Skip to contentSkip to conversation

PIC spurious interrupts

PATCH New Hampa Hug 1 participant 1 message Sep 23, 2004

lore
Share & tools
lore

Hampa Hug

author
#0 lore raw

PATCH 1/1 PIC spurious interrupts

Hello

This patch fixes two issues:

- Spurious interrupts do not occur in practice.
- If an unexpected spurious interrupt in the slave PIC is not acknowledged by the interrupt handler, no EOI will be sent to the master PIC (for IRQ 2), leaving all interrupts of lower priority disabled (unless SFN mode is used).

This patch fixes the OS/2 boot lock-up problem for me.

cheers
Hampa

cpu-exec.c +2 -0
diff -Nur qemu-cvs/cpu-exec.c qemu-pic/cpu-exec.c
@@ -228,6 +228,7 @@
                         int intno;
                         env->interrupt_request &= ~CPU_INTERRUPT_HARD;
                         intno = cpu_get_pic_interrupt(env);
+                        if (intno >= 0) {
                         if (loglevel & CPU_LOG_TB_IN_ASM) {
                             fprintf(logfile, "Servicing hardware INT=0x%02x\n", intno);
                         }
@@ -239,6 +240,7 @@
 #else
                         T0 = 0;
 #endif
+                        }
                     }
 #elif defined(TARGET_PPC)
 #if 0
hw/i8259.c +8 -5
diff -Nur qemu-cvs/hw/i8259.c qemu-pic/hw/i8259.c
@@ -204,19 +204,22 @@
             irq2 = pic_get_irq(&pics[1]);
             if (irq2 >= 0) {
                 pic_intack(&pics[1], irq2);
+                intno = pics[1].irq_base + irq2;
+                irq = irq2 + 8;
             } else {
                 /* spurious IRQ on slave controller */
-                irq2 = 7;
+                irq = -1;
+                intno = -1;
+                /* EOI for master PIC */
+                pics[0].isr &= ~(1 << 2);
             }
-            intno = pics[1].irq_base + irq2;
-            irq = irq2 + 8;
         } else {
             intno = pics[0].irq_base + irq;
         }
     } else {
         /* spurious IRQ on host controller */
-        irq = 7;
-        intno = pics[0].irq_base + irq;
+        irq = -1;
+        intno = -1;
     }
     pic_update_irq();