Commit e1638bd8588d780079e231b109ac94f0c281efda

Authored by malc
1 parent 6d946cda

Fix interrupt exclusion via SSTEP_NOIRQ

Commit #5620 revealed an issue of the SSTEP_NOIRQ masking that was
applied on all interrupt sources (including internal ones) when single
stepping through the guest. Due to that commit, we now ended up in an
infinite loop when CPU_INTERRUPT_EXIT was pending on SSTEP resume. That
was due to #5620 eating all TBs while CPU_INTERRUPT_EXIT is pending, but
SSTEP_NOIRQ preventing CPU_INTERRUPT_EXIT to be processed.

What SSTEP_NOIRQ should actually do is to block the delivery of all
external, guest visible interrupts. With the fix below applied, single
stepping now works again.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5643 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 8 additions and 2 deletions
cpu-exec.c
... ... @@ -384,8 +384,14 @@ int cpu_exec(CPUState *env1)
384 384 next_tb = 0; /* force lookup of first TB */
385 385 for(;;) {
386 386 interrupt_request = env->interrupt_request;
387   - if (unlikely(interrupt_request) &&
388   - likely(!(env->singlestep_enabled & SSTEP_NOIRQ))) {
  387 + if (unlikely(interrupt_request)) {
  388 + if (unlikely(env->singlestep_enabled & SSTEP_NOIRQ)) {
  389 + /* Mask out external interrupts for this step. */
  390 + interrupt_request &= ~(CPU_INTERRUPT_HARD |
  391 + CPU_INTERRUPT_FIQ |
  392 + CPU_INTERRUPT_SMI |
  393 + CPU_INTERRUPT_NMI);
  394 + }
389 395 if (interrupt_request & CPU_INTERRUPT_DEBUG) {
390 396 env->interrupt_request &= ~CPU_INTERRUPT_DEBUG;
391 397 env->exception_index = EXCP_DEBUG;
... ...