45 lines
1.7 KiB
Diff
45 lines
1.7 KiB
Diff
|
|
From 8179e1d2e08c703a3adcd972091e5611656b727a Mon Sep 17 00:00:00 2001
|
||
|
|
From: jipengfei <jipengfei_yewu@cmss.chinamobile.com>
|
||
|
|
Date: Mon, 9 Sep 2024 20:41:20 +0800
|
||
|
|
Subject: [PATCH] target/i386: fix size of EBP writeback in gen_enter()
|
||
|
|
|
||
|
|
The calculation of FrameTemp is done using the size indicated by mo_pushpop()
|
||
|
|
before being written back to EBP, but the final writeback to EBP is done using
|
||
|
|
the size indicated by mo_stacksize().
|
||
|
|
|
||
|
|
In the case where mo_pushpop() is MO_32 and mo_stacksize() is MO_16 then the
|
||
|
|
final writeback to EBP is done using MO_16 which can leave junk in the top
|
||
|
|
16-bits of EBP after executing ENTER.
|
||
|
|
|
||
|
|
Change the writeback of EBP to use the same size indicated by mo_pushpop() to
|
||
|
|
ensure that the full value is written back.
|
||
|
|
|
||
|
|
cheery-pick from 3973615e7fbaeef1deeaa067577e373781ced70a
|
||
|
|
|
||
|
|
Signed-off-by:jipengfei <jipengfei_yewu@cmss.chinamobile.com>
|
||
|
|
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
|
||
|
|
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2198
|
||
|
|
Message-ID: <20240606095319.229650-5-mark.cave-ayland@ilande.co.uk>
|
||
|
|
Cc: qemu-stable@nongnu.org
|
||
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||
|
|
---
|
||
|
|
target/i386/tcg/translate.c | 2 +-
|
||
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
|
||
|
|
index 82f77b52fb..7c0613fa98 100644
|
||
|
|
--- a/target/i386/tcg/translate.c
|
||
|
|
+++ b/target/i386/tcg/translate.c
|
||
|
|
@@ -2551,7 +2551,7 @@ static void gen_enter(DisasContext *s, int esp_addend, int level)
|
||
|
|
}
|
||
|
|
|
||
|
|
/* Copy the FrameTemp value to EBP. */
|
||
|
|
- gen_op_mov_reg_v(s, a_ot, R_EBP, s->T1);
|
||
|
|
+ gen_op_mov_reg_v(s, d_ot, R_EBP, s->T1);
|
||
|
|
|
||
|
|
/* Compute the final value of ESP. */
|
||
|
|
tcg_gen_subi_tl(s->T1, s->T1, esp_addend + size * level);
|
||
|
|
--
|
||
|
|
2.41.0.windows.1
|
||
|
|
|