diff mbox series

Signed-off-by: guoguangyao <guoguangyao18@mails.ucas.ac.cn>

Message ID 20231221093805.309502-1-guoguangyao18@mails.ucas.ac.cn (mailing list archive)
State New, archived
Headers show
Series Signed-off-by: guoguangyao <guoguangyao18@mails.ucas.ac.cn> | expand

Commit Message

guoguangyao Dec. 21, 2023, 9:38 a.m. UTC
target/i386: Eip error in x86_64-softmmu

When closing PCREL, qemu-system-x86_64 run into error.
Eip modification here leads to the result.

Fixes: b5e0d5d22fbf("target/i386: Fix 32-bit wrapping of pc/eip computation")

 Changes to be committed:
	modified:   target/i386/tcg/translate.c
---
 target/i386/tcg/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 037bc47e7c..3dc7781a41 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;
 }