Changes in kernel/arch/mips32/src/exception.c [d99c1d2:0c61955] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/mips32/src/exception.c
rd99c1d2 r0c61955 27 27 */ 28 28 29 /** @addtogroup mips32 29 /** @addtogroup mips32 30 30 * @{ 31 31 */ … … 67 67 "Floating Point", 68 68 NULL, NULL, NULL, NULL, NULL, NULL, NULL, 69 "WatchHi/WatchLo", /* 23 */69 "WatchHi/WatchLo", /* 23 */ 70 70 NULL, NULL, NULL, NULL, NULL, NULL, NULL, 71 71 "Virtual Coherency - data", 72 72 }; 73 73 74 static void print_regdump(istate_t *istate) 75 { 76 const char *pcsymbol = symtab_fmt_name_lookup(istate->epc); 77 const char *rasymbol = symtab_fmt_name_lookup(istate->ra); 78 79 printf("PC: %#x(%s) RA: %#x(%s), SP(%p)\n", istate->epc, pcsymbol, 80 istate->ra, rasymbol, istate->sp); 81 } 82 83 static void unhandled_exception(int n, istate_t *istate) 74 void istate_decode(istate_t *istate) 75 { 76 printf("epc=%p\tsta=%p\tlo =%p\thi =%p\n", 77 istate->epc, istate->status, istate->lo, istate->hi); 78 printf("a0 =%p\ta1 =%p\ta2 =%p\ta3 =%p\n", 79 istate->a0, istate->a1, istate->a2, istate->a3); 80 printf("t0 =%p\tt1 =%p\tt2 =%p\tt3 =%p\n", 81 istate->t0, istate->t1, istate->t2, istate->t3); 82 printf("t4 =%p\tt5 =%p\tt6 =%p\tt7 =%p\n", 83 istate->t4, istate->t5, istate->t6, istate->t7); 84 printf("t8 =%p\tt9 =%p\tv0 =%p\tv1 =%p\n", 85 istate->t8, istate->t9, istate->v0, istate->v1); 86 printf("s0 =%p\ts1 =%p\ts2 =%p\ts3 =%p\n", 87 istate->s0, istate->s1, istate->s2, istate->s3); 88 printf("s4 =%p\ts5 =%p\ts6 =%p\ts7 =%p\n", 89 istate->s4, istate->s5, istate->s6, istate->s7); 90 printf("s8 =%p\tat =%p\tkt0=%p\tkt1=%p\n", 91 istate->s8, istate->at, istate->kt0, istate->kt1); 92 printf("sp =%p\tra =%p\tgp =%p\n", 93 istate->sp, istate->ra, istate->gp); 94 } 95 96 static void unhandled_exception(unsigned int n, istate_t *istate) 84 97 { 85 98 fault_if_from_uspace(istate, "Unhandled exception %s.", exctable[n]); 86 87 print_regdump(istate); 88 panic("Unhandled exception %s.", exctable[n]); 89 } 90 91 static void reserved_instr_exception(int n, istate_t *istate) 99 panic_badtrap(istate, n, "Unhandled exception %s.", exctable[n]); 100 } 101 102 static void reserved_instr_exception(unsigned int n, istate_t *istate) 92 103 { 93 104 if (*((uint32_t *) istate->epc) == 0x7c03e83b) { 94 105 ASSERT(THREAD); 95 106 istate->epc += 4; 96 istate->v1 = istate->k 1;107 istate->v1 = istate->kt1; 97 108 } else 98 109 unhandled_exception(n, istate); 99 110 } 100 111 101 static void breakpoint_exception( int n, istate_t *istate)112 static void breakpoint_exception(unsigned int n, istate_t *istate) 102 113 { 103 114 #ifdef CONFIG_DEBUG … … 111 122 } 112 123 113 static void tlbmod_exception( int n, istate_t *istate)124 static void tlbmod_exception(unsigned int n, istate_t *istate) 114 125 { 115 126 tlb_modified(istate); 116 127 } 117 128 118 static void tlbinv_exception( int n, istate_t *istate)129 static void tlbinv_exception(unsigned int n, istate_t *istate) 119 130 { 120 131 tlb_invalid(istate); … … 122 133 123 134 #ifdef CONFIG_FPU_LAZY 124 static void cpuns_exception( int n, istate_t *istate)135 static void cpuns_exception(unsigned int n, istate_t *istate) 125 136 { 126 137 if (cp0_cause_coperr(cp0_cause_read()) == fpu_cop_id) 127 138 scheduler_fpu_lazy_request(); 128 139 else { 129 fault_if_from_uspace(istate, "Unhandled Coprocessor Unusable Exception."); 130 panic("Unhandled Coprocessor Unusable Exception."); 140 fault_if_from_uspace(istate, 141 "Unhandled Coprocessor Unusable Exception."); 142 panic_badtrap(istate, n, 143 "Unhandled Coprocessor Unusable Exception."); 131 144 } 132 145 } 133 146 #endif 134 147 135 static void interrupt_exception(int n, istate_t *istate) 136 { 137 uint32_t cause; 138 int i; 139 140 /* decode interrupt number and process the interrupt */ 141 cause = (cp0_cause_read() >> 8) & 0xff; 142 148 static void interrupt_exception(unsigned int n, istate_t *istate) 149 { 150 /* Decode interrupt number and process the interrupt */ 151 uint32_t cause = (cp0_cause_read() >> 8) & 0xff; 152 153 unsigned int i; 143 154 for (i = 0; i < 8; i++) { 144 155 if (cause & (1 << i)) { … … 149 160 */ 150 161 irq->handler(irq); 151 spinlock_unlock(&irq->lock);162 irq_spinlock_unlock(&irq->lock, false); 152 163 } else { 153 164 /* … … 155 166 */ 156 167 #ifdef CONFIG_DEBUG 157 printf("cpu%u: spurious interrupt (inum=% d)\n",168 printf("cpu%u: spurious interrupt (inum=%u)\n", 158 169 CPU->id, i); 159 170 #endif … … 164 175 165 176 /** Handle syscall userspace call */ 166 static void syscall_exception( int n, istate_t *istate)167 { 168 panic("Syscall is handled through shortcut.");177 static void syscall_exception(unsigned int n, istate_t *istate) 178 { 179 fault_if_from_uspace(istate, "Syscall is handled through shortcut."); 169 180 } 170 181 171 182 void exception_init(void) 172 183 { 173 int i;174 184 unsigned int i; 185 175 186 /* Clear exception table */ 176 187 for (i = 0; i < IVT_ITEMS; i++) 177 exc_register(i, "undef", (iroutine) unhandled_exception); 178 179 exc_register(EXC_Bp, "bkpoint", (iroutine) breakpoint_exception); 180 exc_register(EXC_RI, "resinstr", (iroutine) reserved_instr_exception); 181 exc_register(EXC_Mod, "tlb_mod", (iroutine) tlbmod_exception); 182 exc_register(EXC_TLBL, "tlbinvl", (iroutine) tlbinv_exception); 183 exc_register(EXC_TLBS, "tlbinvl", (iroutine) tlbinv_exception); 184 exc_register(EXC_Int, "interrupt", (iroutine) interrupt_exception); 188 exc_register(i, "undef", false, 189 (iroutine_t) unhandled_exception); 190 191 exc_register(EXC_Bp, "bkpoint", true, 192 (iroutine_t) breakpoint_exception); 193 exc_register(EXC_RI, "resinstr", true, 194 (iroutine_t) reserved_instr_exception); 195 exc_register(EXC_Mod, "tlb_mod", true, 196 (iroutine_t) tlbmod_exception); 197 exc_register(EXC_TLBL, "tlbinvl", true, 198 (iroutine_t) tlbinv_exception); 199 exc_register(EXC_TLBS, "tlbinvl", true, 200 (iroutine_t) tlbinv_exception); 201 exc_register(EXC_Int, "interrupt", true, 202 (iroutine_t) interrupt_exception); 203 185 204 #ifdef CONFIG_FPU_LAZY 186 exc_register(EXC_CpU, "cpunus", (iroutine) cpuns_exception); 187 #endif 188 exc_register(EXC_Sys, "syscall", (iroutine) syscall_exception); 205 exc_register(EXC_CpU, "cpunus", true, 206 (iroutine_t) cpuns_exception); 207 #endif 208 209 exc_register(EXC_Sys, "syscall", true, 210 (iroutine_t) syscall_exception); 189 211 } 190 212
Note:
See TracChangeset
for help on using the changeset viewer.