Fix spurious IRQ check
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 25 Oct 2013 19:29:04 +0000 (12:29 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 16 Jan 2014 19:16:37 +0000 (11:16 -0800)
kern/arch/x86/trap.c

index 485706e..0761789 100644 (file)
@@ -406,11 +406,11 @@ static bool check_spurious_irq(uint32_t trap_nr)
        /* the PIC may send spurious irqs via one of the chips irq 7.  if the isr
         * doesn't show that irq, then it was spurious, and we don't send an eoi.
         * Check out http://wiki.osdev.org/8259_PIC#Spurious_IRQs */
-       if ((trap_nr == PIC1_SPURIOUS) && !(pic_get_isr() & PIC1_SPURIOUS)) {
+       if ((trap_nr == PIC1_SPURIOUS) && !(pic_get_isr() & (1 << 7))) {
                printk("Spurious PIC1 irq!\n"); /* want to know if this happens */
                return TRUE;
        }
-       if ((trap_nr == PIC2_SPURIOUS) && !(pic_get_isr() & PIC2_SPURIOUS)) {
+       if ((trap_nr == PIC2_SPURIOUS) && !(pic_get_isr() & (1 << 15))) {
                printk("Spurious PIC2 irq!\n"); /* want to know if this happens */
                /* for the cascaded PIC, we *do* need to send an EOI to the master's
                 * cascade irq (2). */