mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 13:38:36 -07:00
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.
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>
(cherry picked from commit 3973615e7f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
60b4f3aff4
commit
db0a21257e
1 changed files with 1 additions and 1 deletions
|
|
@ -2684,7 +2684,7 @@ static void gen_enter(DisasContext *s, int esp_addend, int level)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the FrameTemp value to EBP. */
|
/* 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. */
|
/* Compute the final value of ESP. */
|
||||||
tcg_gen_subi_tl(s->T1, s->T1, esp_addend + size * level);
|
tcg_gen_subi_tl(s->T1, s->T1, esp_addend + size * level);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue