Rev 615 | Rev 799 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 615 | Rev 794 | ||
|---|---|---|---|
| Line 38... | Line 38... | ||
| 38 | #include <print.h> |
38 | #include <print.h> |
| 39 | #include <interrupt.h> |
39 | #include <interrupt.h> |
| 40 | #include <func.h> |
40 | #include <func.h> |
| 41 | #include <console/kconsole.h> |
41 | #include <console/kconsole.h> |
| 42 | #include <arch/debugger.h> |
42 | #include <arch/debugger.h> |
| - | 43 | #include <syscall/syscall.h> |
|
| 43 | 44 | ||
| 44 | static char * exctable[] = { |
45 | static char * exctable[] = { |
| 45 | "Interrupt","TLB Modified","TLB Invalid","TLB Invalid Store", |
46 | "Interrupt","TLB Modified","TLB Invalid","TLB Invalid Store", |
| 46 | "Address Error - load/instr. fetch", |
47 | "Address Error - load/instr. fetch", |
| 47 | "Address Error - store", |
48 | "Address Error - store", |
| Line 132... | Line 133... | ||
| 132 | for (i = 0; i < 8; i++) |
133 | for (i = 0; i < 8; i++) |
| 133 | if (cause & (1 << i)) |
134 | if (cause & (1 << i)) |
| 134 | exc_dispatch(i+INT_OFFSET, pstate); |
135 | exc_dispatch(i+INT_OFFSET, pstate); |
| 135 | } |
136 | } |
| 136 | 137 | ||
| - | 138 | #include <debug.h> |
|
| - | 139 | /** Handle syscall userspace call */ |
|
| - | 140 | static void syscall_exception(int n, void *data) |
|
| - | 141 | { |
|
| - | 142 | struct exception_regdump *pstate = (struct exception_regdump *)data; |
|
| - | 143 | ||
| - | 144 | if (pstate->a3 < SYSCALL_END) |
|
| - | 145 | pstate->v0 = syscall_table[pstate->a3](pstate->a0, |
|
| - | 146 | pstate->a1, |
|
| - | 147 | pstate->a2); |
|
| - | 148 | else |
|
| - | 149 | panic("Undefined syscall %d", pstate->a3); |
|
| - | 150 | pstate->epc += 4; |
|
| - | 151 | } |
|
| - | 152 | ||
| 137 | 153 | ||
| 138 | void exception(struct exception_regdump *pstate) |
154 | void exception(struct exception_regdump *pstate) |
| 139 | { |
155 | { |
| 140 | int cause; |
156 | int cause; |
| 141 | int excno; |
157 | int excno; |
| Line 188... | Line 204... | ||
| 188 | exc_register(EXC_TLBS, "tlbinvl", tlbinv_exception); |
204 | exc_register(EXC_TLBS, "tlbinvl", tlbinv_exception); |
| 189 | exc_register(EXC_Int, "interrupt", interrupt_exception); |
205 | exc_register(EXC_Int, "interrupt", interrupt_exception); |
| 190 | #ifdef CONFIG_FPU_LAZY |
206 | #ifdef CONFIG_FPU_LAZY |
| 191 | exc_register(EXC_CpU, "cpunus", cpuns_exception); |
207 | exc_register(EXC_CpU, "cpunus", cpuns_exception); |
| 192 | #endif |
208 | #endif |
| - | 209 | exc_register(EXC_Sys, "syscall", syscall_exception); |
|
| 193 | } |
210 | } |