diff options
author | guoguangyao <guoguangyao18@mails.ucas.ac.cn> | 2024-01-15 10:08:04 +0800 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2024-01-20 12:24:19 +0300 |
commit | 57078586026b2ff8c052f909a120118058a7fd57 (patch) | |
tree | 77cd9dc7003aac0222c3c1ae223fec159ee356b7 | |
parent | 99e32260ac203040ea1f9c1c2930298ab1dee9cf (diff) |
target/i386: fix incorrect EIP in PC-relative translation blocks
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: qemu-stable@nongnu.org
Fixes: b5e0d5d22fbf ("target/i386: Fix 32-bit wrapping of pc/eip computation")
Fixes: 5b2fd6cf3735 (b5e0d5d22fbf in 8.1.4)
Signed-off-by: guoguangyao <guoguangyao18@mails.ucas.ac.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240115020804.30272-1-guoguangyao18@mails.ucas.ac.cn>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 2926eab8969908bc068629e973062a0fb6ff3759)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r-- | target/i386/tcg/translate.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 1d3c9a8be4..2a9f277adb 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; } |