Rev 3431 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3431 | Rev 4377 | ||
---|---|---|---|
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 */ |
- | 71 | if (irq->cir) |
|
- | 72 | irq->cir(irq->cir_arg, irq->inr); |
|
- | 73 | } |
|
- | 74 | ||
72 | pic_ack_interrupt(inum); |
75 | irq->handler(irq); |
- | 76 | ||
- | 77 | if (!irq->preack) { |
|
73 | ack = true; |
78 | if (irq->cir) |
- | 79 | irq->cir(irq->cir_arg, irq->inr); |
|
74 | } |
80 | } |
75 | 81 | ||
76 | irq->handler(irq, irq->arg); |
- | |
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) |
94 | { |
96 | { |
95 | clock(); |
- | |
96 | start_decrementer(); |
97 | start_decrementer(); |
- | 98 | clock(); |
|
97 | } |
99 | } |
98 | 100 | ||
99 | #ifdef CONFIG_UDEBUG |
101 | #ifdef CONFIG_UDEBUG |
100 | 102 | ||
101 | static void exception_program_trap(istate_t *istate) |
103 | static void exception_program_trap(istate_t *istate) |