target/i386/tcg/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
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
15.01.2024 05:08, guoguangyao wrote: > 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") It looks like the situation with PCREL is a bit more complex, see https://gitlab.com/qemu-project/qemu/-/issues/2092 I'm assuming this particular change does not actually fix the problem (which is still unfixed on master). Thanks, /mjt > 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; > }
15.01.2024 05:08, 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> It looks like a -stable material. Marked as "to-apply", please let me know if I shouldn't. /mjt
On 1/15/24 13:08, guoguangyao wrote: > 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(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~ > > 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; > }
© 2016 - 2024 Red Hat, Inc.