* [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
* Re: [PATCH] target/i386: Eip error in x86_64-softmmu
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
2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2024-01-15 2:52 UTC (permalink / raw)
To: guoguangyao, qemu-devel; +Cc: pbonzini, eduardo
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;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] target/i386: Eip error in x86_64-softmmu
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
2 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2024-01-15 6:31 UTC (permalink / raw)
To: guoguangyao, qemu-devel; +Cc: richard.henderson, pbonzini, eduardo, qemu-stable
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] target/i386: Eip error in x86_64-softmmu
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
2 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2024-02-17 9:21 UTC (permalink / raw)
To: guoguangyao, qemu-devel; +Cc: richard.henderson, pbonzini, eduardo
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;
> }
^ permalink raw reply [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).