From: guoguangyao <[email protected]> The PCREL patches introduced a bug when updating EIP in the !CF_PCREL case. Using s->pc in func gen_update_eip_next() solves the problem.
Cc: [email protected] Fixes: b5e0d5d22fbf ("target/i386: Fix 32-bit wrapping of pc/eip computation") Signed-off-by: guoguangyao <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-ID: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit 2926eab8969908bc068629e973062a0fb6ff3759) Signed-off-by: Michael Tokarev <[email protected]> diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index e68375b19d..312ca0d594 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -566,9 +566,9 @@ static void gen_update_eip_next(DisasContext *s) if (tb_cflags(s->base.tb) & CF_PCREL) { tcg_gen_addi_tl(cpu_eip, cpu_eip, s->pc - s->pc_save); } else if (CODE64(s)) { - tcg_gen_movi_tl(cpu_eip, s->base.pc_next); + tcg_gen_movi_tl(cpu_eip, s->pc); } else { - tcg_gen_movi_tl(cpu_eip, (uint32_t)(s->base.pc_next - s->cs_base)); + tcg_gen_movi_tl(cpu_eip, (uint32_t)(s->pc - s->cs_base)); } s->pc_save = s->pc; } -- 2.39.2
