On Fri Apr 7, 2023 at 7:02 PM AEST, Nicholas Piggin wrote: > I get a crash running a powerpc64 TCG machine on x86. > > It can be triggered by booting a custom vmlinux patched to use powerpc > prefix instructions and pcrel addressing, I don't know if that's related > or coincidence. I can give Linux patches or a vmlinux file to reproduce > if needed, or I can test patches quickly. > > The first bad commit is 7058ff5231a0 ("target/ppc: Avoid tcg_const_* in > translate.c")
This seems to do the trick: diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 9d05357d03..23869fe6cb 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1807,8 +1807,8 @@ static inline void gen_op_arith_modw(DisasContext *ctx, TCGv ret, TCGv arg1, TCGv_i32 t2 = tcg_constant_i32(1); TCGv_i32 t3 = tcg_constant_i32(0); tcg_gen_movcond_i32(TCG_COND_EQ, t1, t1, t3, t2, t1); - tcg_gen_remu_i32(t3, t0, t1); - tcg_gen_extu_i32_tl(ret, t3); + tcg_gen_remu_i32(t1, t0, t1); + tcg_gen_extu_i32_tl(ret, t1); } }