qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/i386: Eip error in x86_64-softmmu
@ 2024-01-15  2:08 guoguangyao
  2024-01-15  2:52 ` Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: guoguangyao @ 2024-01-15  2:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson, pbonzini, eduardo, guoguangyao

When closing PCREL, qemu-system-x86_64 run into error.
Eip modification here leads to the result. Using s->pc
in func gen_update_eip_next() solves the problem.

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

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

	modified:   target/i386/tcg/translate.c
---
 target/i386/tcg/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index e1eb82a5c6..6f57d5a8a5 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -567,9 +567,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.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-17  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-15  2:08 [PATCH] target/i386: Eip error in x86_64-softmmu guoguangyao
2024-01-15  2:52 ` Richard Henderson
2024-01-15  6:31 ` Michael Tokarev
2024-02-17  9:21 ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).