Skip to content

Commit 3973615

Browse files
mcaylandbonzini
authored andcommitted
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 <[email protected]> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2198 Message-ID: <[email protected]> Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent f1b8613 commit 3973615

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

target/i386/tcg/translate.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,7 @@ static void gen_enter(DisasContext *s, int esp_addend, int level)
21382138
}
21392139

21402140
/* Copy the FrameTemp value to EBP. */
2141-
gen_op_mov_reg_v(s, a_ot, R_EBP, s->T1);
2141+
gen_op_mov_reg_v(s, d_ot, R_EBP, s->T1);
21422142

21432143
/* Compute the final value of ESP. */
21442144
tcg_gen_subi_tl(s->T1, s->T1, esp_addend + size * level);

0 commit comments

Comments
 (0)