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 174... | Line 174... | ||
174 | static void irq_interrupt(int n, istate_t *istate) |
174 | static void irq_interrupt(int n, istate_t *istate) |
175 | { |
175 | { |
176 | ASSERT(n >= IVT_IRQBASE); |
176 | ASSERT(n >= IVT_IRQBASE); |
177 | 177 | ||
178 | int inum = n - IVT_IRQBASE; |
178 | int inum = n - IVT_IRQBASE; |
179 | bool ack = false; |
- | |
180 | ASSERT(inum < IRQ_COUNT); |
179 | ASSERT(inum < IRQ_COUNT); |
181 | ASSERT((inum != IRQ_PIC_SPUR) && (inum != IRQ_PIC1)); |
180 | ASSERT((inum != IRQ_PIC_SPUR) && (inum != IRQ_PIC1)); |
182 | 181 | ||
183 | irq_t *irq = irq_dispatch_and_lock(inum); |
182 | irq_t *irq = irq_dispatch_and_lock(inum); |
184 | if (irq) { |
183 | if (irq) { |
185 | /* |
184 | /* |
186 | * The IRQ handler was found. |
185 | * The IRQ handler was found. |
187 | */ |
186 | */ |
188 | - | ||
189 | if (irq->preack) { |
- | |
190 | /* Send EOI before processing the interrupt */ |
- | |
191 | trap_virtual_eoi(); |
- | |
192 | ack = true; |
- | |
193 | } |
- | |
194 | irq->handler(irq, irq->arg); |
187 | irq->handler(irq, irq->arg); |
195 | spinlock_unlock(&irq->lock); |
188 | spinlock_unlock(&irq->lock); |
196 | } else { |
189 | } else { |
197 | /* |
190 | /* |
198 | * Spurious interrupt. |
191 | * Spurious interrupt. |
199 | */ |
192 | */ |
200 | #ifdef CONFIG_DEBUG |
193 | #ifdef CONFIG_DEBUG |
201 | printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum); |
194 | printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum); |
202 | #endif |
195 | #endif |
203 | } |
196 | } |
204 | - | ||
205 | if (!ack) |
- | |
206 | trap_virtual_eoi(); |
197 | trap_virtual_eoi(); |
207 | } |
198 | } |
208 | 199 | ||
209 | void interrupt_init(void) |
200 | void interrupt_init(void) |
210 | { |
201 | { |