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