Rev 2107 | Rev 2439 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2107 | Rev 2218 | ||
---|---|---|---|
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; |
|
179 | ASSERT(inum < IRQ_COUNT); |
180 | ASSERT(inum < IRQ_COUNT); |
180 | ASSERT((inum != IRQ_PIC_SPUR) && (inum != IRQ_PIC1)); |
181 | ASSERT((inum != IRQ_PIC_SPUR) && (inum != IRQ_PIC1)); |
181 | 182 | ||
182 | irq_t *irq = irq_dispatch_and_lock(inum); |
183 | irq_t *irq = irq_dispatch_and_lock(inum); |
183 | if (irq) { |
184 | if (irq) { |
184 | /* |
185 | /* |
185 | * The IRQ handler was found. |
186 | * The IRQ handler was found. |
186 | */ |
187 | */ |
- | 188 | ||
- | 189 | if (irq->preack) { |
|
- | 190 | /* Send EOI before processing the interrupt */ |
|
- | 191 | trap_virtual_eoi(); |
|
- | 192 | ack = true; |
|
- | 193 | } |
|
187 | irq->handler(irq, irq->arg); |
194 | irq->handler(irq, irq->arg); |
188 | spinlock_unlock(&irq->lock); |
195 | spinlock_unlock(&irq->lock); |
189 | } else { |
196 | } else { |
190 | /* |
197 | /* |
191 | * Spurious interrupt. |
198 | * Spurious interrupt. |
192 | */ |
199 | */ |
193 | #ifdef CONFIG_DEBUG |
200 | #ifdef CONFIG_DEBUG |
194 | printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum); |
201 | printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum); |
195 | #endif |
202 | #endif |
196 | } |
203 | } |
- | 204 | ||
- | 205 | if (!ack) |
|
197 | trap_virtual_eoi(); |
206 | trap_virtual_eoi(); |
198 | } |
207 | } |
199 | 208 | ||
200 | void interrupt_init(void) |
209 | void interrupt_init(void) |
201 | { |
210 | { |
202 | int i; |
211 | int i; |