Skip to content

Commit 827be9d

Browse files
bonziniMichael Tokarev
authored andcommitted
target/i386: do not block singlestep for STI
STI will trigger a singlestep exception even if it has inhibit-IRQ behavior. Do not suppress single-step for all IRQ-inhibiting instructions, instead special case MOV SS and POP SS. Cc: [email protected] Fixes: f0f0136 ("target/i386: no single-step exception after MOV or POP SS", 2024-05-25) Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit 1e94ddc) Signed-off-by: Michael Tokarev <[email protected]>
1 parent f60033d commit 827be9d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

target/i386/tcg/translate.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2013,11 +2013,15 @@ static void gen_movl_seg(DisasContext *s, X86Seg seg_reg, TCGv src, bool inhibit
20132013
* stop as a special handling must be done to disable hardware
20142014
* interrupts for the next instruction.
20152015
*
2016+
* This is the last instruction, so it's okay to overwrite
2017+
* HF_TF_MASK; the next TB will start with the flag set.
2018+
*
20162019
* DISAS_EOB_INHIBIT_IRQ is a superset of DISAS_EOB_NEXT which
20172020
* might have been set above.
20182021
*/
20192022
if (inhibit_irq) {
20202023
s->base.is_jmp = DISAS_EOB_INHIBIT_IRQ;
2024+
s->flags &= ~HF_TF_MASK;
20212025
}
20222026
}
20232027

@@ -2265,7 +2269,7 @@ gen_eob(DisasContext *s, int mode)
22652269
if (mode == DISAS_EOB_RECHECK_TF) {
22662270
gen_helper_rechecking_single_step(tcg_env);
22672271
tcg_gen_exit_tb(NULL, 0);
2268-
} else if ((s->flags & HF_TF_MASK) && mode != DISAS_EOB_INHIBIT_IRQ) {
2272+
} else if (s->flags & HF_TF_MASK) {
22692273
gen_helper_single_step(tcg_env);
22702274
} else if (mode == DISAS_JUMP &&
22712275
/* give irqs a chance to happen */

0 commit comments

Comments
 (0)