Rev 1787 | Rev 2071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1787 | Rev 1936 | ||
---|---|---|---|
Line 43... | Line 43... | ||
43 | #include <symtab.h> |
43 | #include <symtab.h> |
44 | #include <print.h> |
44 | #include <print.h> |
45 | #include <interrupt.h> |
45 | #include <interrupt.h> |
46 | #include <func.h> |
46 | #include <func.h> |
47 | #include <console/kconsole.h> |
47 | #include <console/kconsole.h> |
- | 48 | #include <ddi/irq.h> |
|
48 | #include <arch/debugger.h> |
49 | #include <arch/debugger.h> |
49 | 50 | ||
50 | static char * exctable[] = { |
51 | static char * exctable[] = { |
51 | "Interrupt", |
52 | "Interrupt", |
52 | "TLB Modified", |
53 | "TLB Modified", |
Line 143... | Line 144... | ||
143 | int i; |
144 | int i; |
144 | 145 | ||
145 | /* decode interrupt number and process the interrupt */ |
146 | /* decode interrupt number and process the interrupt */ |
146 | cause = (cp0_cause_read() >> 8) &0xff; |
147 | cause = (cp0_cause_read() >> 8) &0xff; |
147 | 148 | ||
148 | for (i = 0; i < 8; i++) |
149 | for (i = 0; i < 8; i++) { |
149 | if (cause & (1 << i)) |
150 | if (cause & (1 << i)) { |
- | 151 | irq_t *irq = irq_dispatch_and_lock(i); |
|
- | 152 | if (irq) { |
|
- | 153 | /* |
|
- | 154 | * The IRQ handler was found. |
|
- | 155 | */ |
|
150 | exc_dispatch(i+INT_OFFSET, istate); |
156 | irq->handler(irq, irq->arg); |
- | 157 | spinlock_unlock(&irq->lock); |
|
- | 158 | } else { |
|
- | 159 | /* |
|
- | 160 | * Spurious interrupt. |
|
- | 161 | */ |
|
- | 162 | #ifdef CONFIG_DEBUG |
|
- | 163 | printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, i); |
|
- | 164 | #endif |
|
- | 165 | } |
|
- | 166 | } |
|
- | 167 | } |
|
151 | } |
168 | } |
152 | 169 | ||
153 | /** Handle syscall userspace call */ |
170 | /** Handle syscall userspace call */ |
154 | static void syscall_exception(int n, istate_t *istate) |
171 | static void syscall_exception(int n, istate_t *istate) |
155 | { |
172 | { |
Line 159... | Line 176... | ||
159 | void exception_init(void) |
176 | void exception_init(void) |
160 | { |
177 | { |
161 | int i; |
178 | int i; |
162 | 179 | ||
163 | /* Clear exception table */ |
180 | /* Clear exception table */ |
164 | for (i=0;i < IVT_ITEMS; i++) |
181 | for (i = 0; i < IVT_ITEMS; i++) |
165 | exc_register(i, "undef", (iroutine) unhandled_exception); |
182 | exc_register(i, "undef", (iroutine) unhandled_exception); |
- | 183 | ||
166 | exc_register(EXC_Bp, "bkpoint", (iroutine) breakpoint_exception); |
184 | exc_register(EXC_Bp, "bkpoint", (iroutine) breakpoint_exception); |
167 | exc_register(EXC_RI, "resinstr", (iroutine) reserved_instr_exception); |
185 | exc_register(EXC_RI, "resinstr", (iroutine) reserved_instr_exception); |
168 | exc_register(EXC_Mod, "tlb_mod", (iroutine) tlbmod_exception); |
186 | exc_register(EXC_Mod, "tlb_mod", (iroutine) tlbmod_exception); |
169 | exc_register(EXC_TLBL, "tlbinvl", (iroutine) tlbinv_exception); |
187 | exc_register(EXC_TLBL, "tlbinvl", (iroutine) tlbinv_exception); |
170 | exc_register(EXC_TLBS, "tlbinvl", (iroutine) tlbinv_exception); |
188 | exc_register(EXC_TLBS, "tlbinvl", (iroutine) tlbinv_exception); |