Rev 3906 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3906 | Rev 4311 | ||
---|---|---|---|
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 | 68 | ||
70 | if (irq->preack) { |
69 | if (irq->preack) { |
71 | /* Acknowledge the interrupt before processing */ |
70 | /* Acknowledge the interrupt before processing */ |
72 | pic_ack_interrupt(inum); |
71 | if (irq->cir) |
73 | ack = true; |
72 | irq->cir(irq->cir_arg, irq->inr); |
74 | } |
73 | } |
75 | 74 | ||
76 | irq->handler(irq); |
75 | irq->handler(irq); |
- | 76 | ||
- | 77 | if (!irq->preack) { |
|
- | 78 | if (irq->cir) |
|
- | 79 | irq->cir(irq->cir_arg, irq->inr); |
|
- | 80 | } |
|
- | 81 | ||
77 | spinlock_unlock(&irq->lock); |
82 | spinlock_unlock(&irq->lock); |
78 | } else { |
83 | } else { |
79 | /* |
84 | /* |
80 | * Spurious interrupt. |
85 | * Spurious interrupt. |
81 | */ |
86 | */ |
82 | #ifdef CONFIG_DEBUG |
87 | #ifdef CONFIG_DEBUG |
83 | printf("cpu%u: spurious interrupt (inum=%d)\n", CPU->id, inum); |
88 | printf("cpu%u: spurious interrupt (inum=%d)\n", CPU->id, inum); |
84 | #endif |
89 | #endif |
85 | } |
90 | } |
86 | - | ||
87 | if (!ack) |
- | |
88 | pic_ack_interrupt(inum); |
- | |
89 | } |
91 | } |
90 | } |
92 | } |
91 | 93 | ||
92 | 94 | ||
93 | static void exception_decrementer(int n, istate_t *istate) |
95 | static void exception_decrementer(int n, istate_t *istate) |