Subversion Repositories HelenOS

Rev

Rev 2265 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2265 Rev 2292
Line 58... Line 58...
58
static void exception_external(int n, istate_t *istate)
58
static void exception_external(int n, istate_t *istate)
59
{
59
{
60
    int inum;
60
    int inum;
61
   
61
   
62
    while ((inum = pic_get_pending()) != -1) {
62
    while ((inum = pic_get_pending()) != -1) {
63
        bool ack = false;
-
 
64
        irq_t *irq = irq_dispatch_and_lock(inum);
63
        irq_t *irq = irq_dispatch_and_lock(inum);
65
        if (irq) {
64
        if (irq) {
66
            /*
65
            /*
67
             * The IRQ handler was found.
66
             * The IRQ handler was found.
68
             */
67
             */
69
           
-
 
70
            if (irq->preack) {
-
 
71
                /* Acknowledge the interrupt before processing */
-
 
72
                pic_ack_interrupt(inum);
-
 
73
                ack = true;
-
 
74
            }
-
 
75
           
-
 
76
            irq->handler(irq, irq->arg);
68
            irq->handler(irq, irq->arg);
77
            spinlock_unlock(&irq->lock);
69
            spinlock_unlock(&irq->lock);
78
        } else {
70
        } else {
79
            /*
71
            /*
80
             * Spurious interrupt.
72
             * Spurious interrupt.
81
             */
73
             */
82
#ifdef CONFIG_DEBUG
74
#ifdef CONFIG_DEBUG
83
            printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum);
75
            printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum);
84
#endif
76
#endif
85
        }
77
        }
86
       
-
 
87
        if (!ack)
-
 
88
            pic_ack_interrupt(inum);
78
        pic_ack_interrupt(inum);
89
    }
79
    }
90
}
80
}
91
 
81
 
92
 
82