Subversion Repositories HelenOS

Rev

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

Rev 2071 Rev 2218
Line 154... Line 154...
154
static void irq_interrupt(int n, istate_t *istate)
154
static void irq_interrupt(int n, istate_t *istate)
155
{
155
{
156
    ASSERT(n >= IVT_IRQBASE);
156
    ASSERT(n >= IVT_IRQBASE);
157
   
157
   
158
    int inum = n - IVT_IRQBASE;
158
    int inum = n - IVT_IRQBASE;
-
 
159
    bool ack = false;
159
    ASSERT(inum < IRQ_COUNT);
160
    ASSERT(inum < IRQ_COUNT);
160
    ASSERT((inum != IRQ_PIC_SPUR) && (inum != IRQ_PIC1));
161
    ASSERT((inum != IRQ_PIC_SPUR) && (inum != IRQ_PIC1));
161
 
162
   
162
    irq_t *irq = irq_dispatch_and_lock(inum);
163
    irq_t *irq = irq_dispatch_and_lock(inum);
163
    if (irq) {
164
    if (irq) {
164
        /*
165
        /*
165
         * The IRQ handler was found.
166
         * The IRQ handler was found.
166
         */
167
         */
-
 
168
         
-
 
169
        if (irq->preack) {
-
 
170
            /* Send EOI before processing the interrupt */
-
 
171
            trap_virtual_eoi();
-
 
172
            ack = true;
-
 
173
        }
167
        irq->handler(irq, irq->arg);
174
        irq->handler(irq, irq->arg);
168
        spinlock_unlock(&irq->lock);
175
        spinlock_unlock(&irq->lock);
169
    } else {
176
    } else {
170
        /*
177
        /*
171
         * Spurious interrupt.
178
         * Spurious interrupt.
172
         */
179
         */
173
#ifdef CONFIG_DEBUG
180
#ifdef CONFIG_DEBUG
174
        printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum);
181
        printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum);
175
#endif
182
#endif
176
    }
183
    }
-
 
184
   
-
 
185
    if (!ack)
177
    trap_virtual_eoi();
186
        trap_virtual_eoi();
178
}
187
}
179
 
188
 
180
void interrupt_init(void)
189
void interrupt_init(void)
181
{
190
{