Changes in / [e3038b4:05e3cb8] in mainline
- Location:
- kernel
- Files:
-
- 5 added
- 1 deleted
- 37 edited
-
Makefile (modified) (1 diff)
-
arch/abs32le/src/abs32le.c (modified) (1 diff)
-
arch/amd64/include/interrupt.h (modified) (1 diff)
-
arch/amd64/include/types.h (modified) (1 diff)
-
arch/amd64/src/asm_utils.S (modified) (3 diffs)
-
arch/amd64/src/interrupt.c (modified) (5 diffs)
-
arch/amd64/src/mm/page.c (modified) (1 diff)
-
arch/arm32/Makefile.inc (modified) (1 diff)
-
arch/arm32/include/exception.h (modified) (2 diffs)
-
arch/arm32/src/exc_handler.S (modified) (2 diffs)
-
arch/arm32/src/exception.c (modified) (1 diff)
-
arch/arm32/src/mm/page.c (modified) (1 diff)
-
arch/arm32/src/mm/page_fault.c (modified) (2 diffs)
-
arch/arm32/src/panic.S (added)
-
arch/ia32/Makefile.inc (modified) (1 diff)
-
arch/ia32/include/interrupt.h (modified) (1 diff)
-
arch/ia32/src/asm.S (modified) (5 diffs)
-
arch/ia32/src/debug/panic.s (added)
-
arch/ia32/src/interrupt.c (modified) (7 diffs)
-
arch/ia32/src/mm/page.c (modified) (1 diff)
-
arch/ia64/src/asm.S (modified) (1 diff)
-
arch/ia64/src/interrupt.c (modified) (4 diffs)
-
arch/ia64/src/mm/tlb.c (modified) (7 diffs)
-
arch/mips32/Makefile.inc (modified) (1 diff)
-
arch/mips32/src/exception.c (modified) (4 diffs)
-
arch/mips32/src/mm/tlb.c (modified) (2 diffs)
-
arch/mips32/src/panic.S (added)
-
arch/ppc32/Makefile.inc (modified) (1 diff)
-
arch/ppc32/include/types.h (modified) (1 diff)
-
arch/ppc32/src/debug/panic.s (added)
-
arch/ppc32/src/interrupt.c (modified) (1 diff)
-
arch/ppc32/src/mm/tlb.c (modified) (1 diff)
-
arch/sparc64/Makefile.inc (modified) (1 diff)
-
arch/sparc64/include/types.h (modified) (1 diff)
-
arch/sparc64/src/mm/sun4u/tlb.c (modified) (7 diffs)
-
arch/sparc64/src/mm/sun4v/tlb.c (modified) (6 diffs)
-
arch/sparc64/src/panic.S (added)
-
arch/sparc64/src/trap/exception.c (modified) (20 diffs)
-
generic/include/debug.h (modified) (2 diffs)
-
generic/include/interrupt.h (modified) (1 diff)
-
generic/include/panic.h (modified) (2 diffs)
-
generic/src/debug/panic.c (deleted)
-
generic/src/debug/stacktrace.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
kernel/Makefile
re3038b4 r05e3cb8 201 201 generic/src/debug/symtab.c \ 202 202 generic/src/debug/stacktrace.c \ 203 generic/src/debug/panic.c \204 203 generic/src/interrupt/interrupt.c \ 205 204 generic/src/main/main.c \ -
kernel/arch/abs32le/src/abs32le.c
re3038b4 r05e3cb8 114 114 } 115 115 116 void istate_decode(istate_t *istate)116 void panic_printf(const char *fmt, ...) 117 117 { 118 (void) istate; 118 va_list args; 119 120 va_start(args, fmt); 121 vprintf(fmt, args); 122 va_end(args); 123 124 halt(); 119 125 } 120 126 -
kernel/arch/amd64/include/interrupt.h
re3038b4 r05e3cb8 112 112 extern void (* eoi_function)(void); 113 113 114 extern void decode_istate(int n, istate_t *istate); 114 115 extern void interrupt_init(void); 115 116 extern void trap_virtual_enable_irqs(uint16_t irqmask); -
kernel/arch/amd64/include/types.h
re3038b4 r05e3cb8 50 50 } fncptr_t; 51 51 52 /* Formats for uintptr_t, size_t */52 /**< Formats for uintptr_t, size_t */ 53 53 #define PRIp "llx" 54 54 #define PRIs "llu" 55 55 56 /* Formats for (u)int8_t, (u)int16_t, (u)int32_t, (u)int64_t and (u)native_t */56 /**< Formats for (u)int8_t, (u)int16_t, (u)int32_t, (u)int64_t and (u)native_t */ 57 57 #define PRId8 "d" 58 58 #define PRId16 "d" -
kernel/arch/amd64/src/asm_utils.S
re3038b4 r05e3cb8 51 51 .global interrupt_handlers 52 52 .global syscall_entry 53 .global panic_printf 54 55 panic_printf: 56 movabsq $halt, %rax 57 movq %rax, (%rsp) 58 jmp printf 59 53 60 .global cpuid 54 61 .global has_cpuid … … 227 234 save_all_gpr 228 235 cld 229 230 # 231 # Stop stack traces here if we came from userspace. 232 # 233 movq %cs, %rax 234 xorq %rdx, %rdx 235 cmpq %rax, IREGISTER_SPACE+16(%rsp) 236 cmovneq %rdx, %rbp 237 238 movq $(\i), %rdi # %rdi - first parameter 239 movq %rsp, %rsi # %rsi - pointer to istate 240 call exc_dispatch # exc_dispatch(i, istate) 236 237 # Stop stack traces here 238 xorq %rbp, %rbp 239 240 movq $(\i), %rdi # %rdi - first parameter 241 movq %rsp, %rsi # %rsi - pointer to istate 242 call exc_dispatch # exc_dispatch(i, istate) 241 243 242 244 restore_all_gpr … … 288 290 pushq %rcx 289 291 pushq %r11 290 pushq %rbp 291 292 xorq %rbp, %rbp # stop the stack traces here 293 294 movq %r10, %rcx # Copy the 4th argument where it is expected 292 293 movq %r10, %rcx # Copy the 4th argument where it is expected 295 294 pushq %rax 296 295 call syscall_handler 297 296 addq $8, %rsp 298 299 popq %rbp 297 300 298 popq %r11 301 299 popq %rcx -
kernel/arch/amd64/src/interrupt.c
re3038b4 r05e3cb8 63 63 void (* eoi_function)(void) = NULL; 64 64 65 void istate_decode(istate_t *istate) 66 { 67 printf("error_word=%#llx\n", istate->error_word); 68 printf("cs =%#0.16llx\trflags=%#0.16llx\n", istate->cs, 69 istate->rflags); 70 printf("rax=%#0.16llx\trbx=%#0.16llx\trcx=%#0.16llx\n", istate->rax, 65 void decode_istate(int n, istate_t *istate) 66 { 67 const char *symbol = symtab_fmt_name_lookup(istate->rip); 68 69 printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n", n, __func__); 70 printf("%%rip: %#llx (%s)\n", istate->rip, symbol); 71 printf("ERROR_WORD=%#llx\n", istate->error_word); 72 printf("%%cs=%#llx, rflags=%#llx, %%cr0=%#llx\n", istate->cs, 73 istate->rflags, read_cr0()); 74 printf("%%rax=%#llx, %%rcx=%#llx, %%rdx=%#llx\n", istate->rax, 71 75 istate->rcx, istate->rdx); 72 printf(" rsi=%#0.16llx\trdi=%#0.16llx\tr8 =%#0.16llx\n", istate->rsi,76 printf("%%rsi=%#llx, %%rdi=%#llx, %%r8=%#llx\n", istate->rsi, 73 77 istate->rdi, istate->r8); 74 printf(" r9 =%#0.16llx\tr10=%#0.16llx\tr11=%#0.16llx\n", istate->r9,78 printf("%%r9=%#llx, %%r10=%#llx, %%r11=%#llx\n", istate->r9, 75 79 istate->r10, istate->r11); 80 printf("%%rsp=%#llx\n", &istate->stack[0]); 81 82 stack_trace_istate(istate); 76 83 } 77 84 … … 88 95 { 89 96 fault_if_from_uspace(istate, "Unserviced interrupt: %u.", n); 90 panic_badtrap(istate, n, "Unserviced interrupt."); 97 decode_istate(n, istate); 98 panic("Unserviced interrupt."); 91 99 } 92 100 … … 94 102 { 95 103 fault_if_from_uspace(istate, "Divide error."); 96 panic_badtrap(istate, n, "Divide error."); 104 decode_istate(n, istate); 105 panic("Divide error."); 97 106 } 98 107 … … 120 129 fault_if_from_uspace(istate, "General protection fault."); 121 130 } 122 panic_badtrap(istate, n, "General protection fault."); 131 132 decode_istate(n, istate); 133 panic("General protection fault."); 123 134 } 124 135 … … 126 137 { 127 138 fault_if_from_uspace(istate, "Stack fault."); 128 panic_badtrap(istate, n, "Stack fault."); 139 decode_istate(n, istate); 140 panic("Stack fault."); 129 141 } 130 142 -
kernel/arch/amd64/src/mm/page.c
re3038b4 r05e3cb8 89 89 90 90 if (as_page_fault(page, access, istate) == AS_PF_FAULT) { 91 fault_if_from_uspace(istate, "Page fault: %#x.", page); 92 panic_memtrap(istate, access, page, "Page fault."); 91 fault_if_from_uspace(istate, "Page fault: %p.", page); 92 decode_istate(n, istate); 93 panic("Page fault: %p", page); 93 94 } 94 95 } -
kernel/arch/arm32/Makefile.inc
re3038b4 r05e3cb8 46 46 arch/$(KARCH)/src/context.S \ 47 47 arch/$(KARCH)/src/dummy.S \ 48 arch/$(KARCH)/src/panic.S \ 48 49 arch/$(KARCH)/src/cpu/cpu.c \ 49 50 arch/$(KARCH)/src/ddi/ddi.c \ -
kernel/arch/arm32/include/exception.h
re3038b4 r05e3cb8 28 28 */ 29 29 30 /** @addtogroup arm32 30 /** @addtogroup arm32 31 31 * @{ 32 32 */ … … 141 141 extern void install_exception_handlers(void); 142 142 extern void exception_init(void); 143 extern void print_istate(istate_t *istate); 143 144 extern void reset_exception_entry(void); 144 145 extern void irq_exception_entry(void); -
kernel/arch/arm32/src/exc_handler.S
re3038b4 r05e3cb8 98 98 stmfd r13!, {r13, lr}^ 99 99 stmfd r13!, {r2} 100 101 # Stop stack traces here102 mov fp, #0103 104 100 b 2f 105 101 … … 127 123 stmfd r13!, {r2} 128 124 2: 125 # Stop stack traces here 126 mov fp, #0 129 127 .endm 130 128 -
kernel/arch/arm32/src/exception.c
re3038b4 r05e3cb8 173 173 * @param istate Structure to be printed. 174 174 */ 175 void istate_decode(istate_t *istate)175 void print_istate(istate_t *istate) 176 176 { 177 printf("r0 =%#0.8lx\tr1 =%#0.8lx\tr2 =%#0.8lx\tr3 =%#0.8lx\n", 177 printf("istate dump:\n"); 178 179 printf(" r0: %x r1: %x r2: %x r3: %x\n", 178 180 istate->r0, istate->r1, istate->r2, istate->r3); 179 printf(" r4 =%#0.8lx\tr5 =%#0.8lx\tr6 =%#0.8lx\tr7 =%#0.8lx\n",181 printf(" r4: %x r5: %x r6: %x r7: %x\n", 180 182 istate->r4, istate->r5, istate->r6, istate->r7); 181 printf(" r8 =%#0.8lx\tr9 =%#0.8lx\tr10=%#0.8lx\tfp =%#0.8lx\n",183 printf(" r8: %x r8: %x r10: %x fp: %x\n", 182 184 istate->r8, istate->r9, istate->r10, istate->fp); 183 printf(" r12=%#0.8lx\tsp =%#0.8lx\tlr =%#0.8lx\tspsr=%#0.8lx\n",185 printf(" r12: %x sp: %x lr: %x spsr: %x\n", 184 186 istate->r12, istate->sp, istate->lr, istate->spsr); 187 188 printf(" pc: %x\n", istate->pc); 189 190 stack_trace_istate(istate); 185 191 } 186 192 -
kernel/arch/arm32/src/mm/page.c
re3038b4 r05e3cb8 27 27 */ 28 28 29 /** @addtogroup arm32mm 29 /** @addtogroup arm32mm 30 30 * @{ 31 31 */ -
kernel/arch/arm32/src/mm/page_fault.c
re3038b4 r05e3cb8 183 183 if (ret == AS_PF_FAULT) { 184 184 fault_if_from_uspace(istate, "Page fault: %#x.", badvaddr); 185 panic_memtrap(istate, access, badvaddr, "Page fault."); 185 print_istate(istate); 186 printf("page fault - pc: %x, va: %x, status: %x(%x), " 187 "access:%d\n", istate->pc, badvaddr, fsr.status, fsr, 188 access); 189 190 panic("Page fault."); 186 191 } 187 192 } … … 198 203 199 204 if (ret == AS_PF_FAULT) { 200 panic_memtrap(istate, PF_ACCESS_EXEC, istate->pc, 201 "Page fault - prefetch_abort."); 205 printf("prefetch_abort\n"); 206 print_istate(istate); 207 panic("page fault - prefetch_abort at address: %x.", 208 istate->pc); 202 209 } 203 210 } -
kernel/arch/ia32/Makefile.inc
re3038b4 r05e3cb8 76 76 ARCH_SOURCES = \ 77 77 arch/$(KARCH)/src/context.S \ 78 arch/$(KARCH)/src/debug/panic.s \ 78 79 arch/$(KARCH)/src/debug/stacktrace.c \ 79 80 arch/$(KARCH)/src/debug/stacktrace_asm.S \ -
kernel/arch/ia32/include/interrupt.h
re3038b4 r05e3cb8 113 113 extern void (* eoi_function)(void); 114 114 115 extern void decode_istate(istate_t *istate); 115 116 extern void interrupt_init(void); 116 117 extern void trap_virtual_enable_irqs(uint16_t irqmask); -
kernel/arch/ia32/src/asm.S
re3038b4 r05e3cb8 163 163 pushl %edi # remember return user address 164 164 165 xorl %ebp, %ebp # stop stack traces here166 167 165 pushl %gs # remember TLS 168 166 … … 198 196 # and call exc_dispatch(). 199 197 # 200 #define INTERRUPT_ALIGN 128198 #define INTERRUPT_ALIGN 64 201 199 .macro handler i n 202 200 … … 226 224 movw %ax, %ds 227 225 movw %ax, %es 228 229 xorl %ebp, %ebp 230 226 231 227 cld 232 228 sti … … 234 230 call syscall_handler 235 231 cli 236 237 movl 20(%esp), %ebp # restore EBP 238 addl $28, %esp # clean-up of parameters 232 addl $28, %esp # clean-up of parameters 239 233 240 234 popl %gs … … 286 280 movw %ax, %es 287 281 288 # stop stack traces here if we came from userspace 289 cmpl $8, 40(%esp) 290 jz 0f 282 # stop stack traces here 291 283 xorl %ebp, %ebp 292 293 0: 284 294 285 pushl %esp # *istate 295 286 pushl $(\i) # intnum -
kernel/arch/ia32/src/interrupt.c
re3038b4 r05e3cb8 63 63 void (* eoi_function)(void) = NULL; 64 64 65 void istate_decode(istate_t *istate) 66 { 67 printf("error_word=%#lx\n", istate->error_word); 68 printf("cs =%#0.8lx\teflags=%#0.8lx\n", istate->cs, istate->eflags); 69 printf("eax=%#0.8lx\tecx=%#0.8lx\tedx=%#0.8lx\n", 70 istate->eax, istate->ecx, istate->edx); 65 void decode_istate(istate_t *istate) 66 { 67 const char *symbol = symtab_fmt_name_lookup(istate->eip); 68 69 if (CPU) 70 printf("----------------EXCEPTION OCCURED (cpu%u)----------------\n", CPU->id); 71 else 72 printf("----------------EXCEPTION OCCURED----------------\n"); 73 74 printf("%%eip: %#lx (%s)\n", istate->eip, symbol); 75 printf("ERROR_WORD=%#lx\n", istate->error_word); 76 printf("%%cs=%#lx,flags=%#lx\n", istate->cs, istate->eflags); 77 printf("%%eax=%#lx, %%ecx=%#lx, %%edx=%#lx, %%esp=%p\n", istate->eax, istate->ecx, istate->edx, &istate->stack[0]); 78 printf("stack: %#lx, %#lx, %#lx, %#lx\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]); 79 printf(" %#lx, %#lx, %#lx, %#lx\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]); 80 81 stack_trace_istate(istate); 71 82 } 72 83 … … 83 94 { 84 95 fault_if_from_uspace(istate, "Unserviced interrupt: %u.", n); 85 panic_badtrap(istate, n, "Unserviced interrupt: %u.", n); 96 97 decode_istate(istate); 98 panic("Unserviced interrupt: %u.", n); 86 99 } 87 100 … … 89 102 { 90 103 fault_if_from_uspace(istate, "Divide error."); 91 panic_badtrap(istate, n, "Divide error."); 104 105 decode_istate(istate); 106 panic("Divide error."); 92 107 } 93 108 … … 113 128 fault_if_from_uspace(istate, "General protection fault."); 114 129 } 115 panic_badtrap(istate, n, "General protection fault."); 130 131 decode_istate(istate); 132 panic("General protection fault."); 116 133 } 117 134 … … 119 136 { 120 137 fault_if_from_uspace(istate, "Stack fault."); 121 panic_badtrap(istate, n, "Stack fault."); 138 139 decode_istate(istate); 140 panic("Stack fault."); 122 141 } 123 142 … … 130 149 ); 131 150 132 fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR =%#0.8x.",151 fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR: %#zx.", 133 152 (unative_t) mxcsr); 134 panic_badtrap(istate, n, "SIMD FP exception, MXCSR=%#0.8x"); 153 154 decode_istate(istate); 155 printf("MXCSR: %#lx\n", mxcsr); 156 panic("SIMD FP exception(19)."); 135 157 } 136 158 … … 142 164 #else 143 165 fault_if_from_uspace(istate, "FPU fault."); 144 panic _badtrap(istate, n,"FPU fault.");166 panic("FPU fault."); 145 167 #endif 146 168 } -
kernel/arch/ia32/src/mm/page.c
re3038b4 r05e3cb8 115 115 if (as_page_fault(page, access, istate) == AS_PF_FAULT) { 116 116 fault_if_from_uspace(istate, "Page fault: %#x.", page); 117 panic_memtrap(istate, access, page, "Page fault."); 117 118 decode_istate(istate); 119 printf("page fault address: %#lx\n", page); 120 panic("Page fault."); 118 121 } 119 122 } -
kernel/arch/ia64/src/asm.S
re3038b4 r05e3cb8 137 137 br cpu_halt 138 138 139 .global panic_printf 140 panic_printf: 141 { 142 br.call.sptk.many b0=printf 143 } 144 br halt 145 139 146 /** Switch to userspace - low level code. 140 147 * -
kernel/arch/ia64/src/interrupt.c
re3038b4 r05e3cb8 133 133 } 134 134 135 void istate_decode(istate_t *istate) 136 { 135 static void dump_interrupted_context(istate_t *istate) 136 { 137 putchar('\n'); 138 printf("Interrupted context dump:\n"); 137 139 printf("ar.bsp=%p\tar.bspstore=%p\n", istate->ar_bsp, 138 140 istate->ar_bspstore); … … 181 183 182 184 fault_if_from_uspace(istate, "General Exception (%s).", desc); 183 panic_badtrap(istate, vector, "General Exception (%s).", desc); 185 186 dump_interrupted_context(istate); 187 panic("General Exception (%s).", desc); 184 188 } 185 189 … … 191 195 fault_if_from_uspace(istate, "Interruption: %#hx (%s).", 192 196 (uint16_t) vector, vector_to_string(vector)); 193 panic_badtrap(istate, vector, "Interruption: %#hx (%s).", 194 (uint16_t) vector, vector_to_string(vector)); 197 dump_interrupted_context(istate); 198 panic("Interruption: %#hx (%s).", (uint16_t) vector, 199 vector_to_string(vector)); 195 200 #endif 196 201 } … … 221 226 fault_if_from_uspace(istate, "Interruption: %#hx (%s).", 222 227 (uint16_t) vector, vector_to_string(vector)); 223 panic_badtrap(istate, vector, "Interruption: %#hx (%s).", 224 (uint16_t) vector, vector_to_string(vector)); 228 dump_interrupted_context(istate); 229 panic("Interruption: %#hx (%s).", (uint16_t) vector, 230 vector_to_string(vector)); 225 231 } 226 232 -
kernel/arch/ia64/src/mm/tlb.c
re3038b4 r05e3cb8 500 500 if (as_page_fault(va, PF_ACCESS_EXEC, istate) == AS_PF_FAULT) { 501 501 fault_if_from_uspace(istate, "Page fault at %p.", va); 502 panic _memtrap(istate, PF_ACCESS_EXEC, va,503 "Page fault.");502 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid, 503 istate->cr_iip); 504 504 } 505 505 } … … 622 622 if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) { 623 623 fault_if_from_uspace(istate, "Page fault at %p.", va); 624 panic _memtrap(istate, PF_ACCESS_READ, va,625 "Page fault.");624 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid, 625 istate->cr_iip); 626 626 } 627 627 } … … 671 671 if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) { 672 672 fault_if_from_uspace(istate, "Page fault at %p.", va); 673 panic _memtrap(istate, PF_ACCESS_WRITE, va,674 "Page fault.");673 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid, 674 istate->cr_iip); 675 675 } 676 676 } … … 708 708 if (as_page_fault(va, PF_ACCESS_EXEC, istate) == AS_PF_FAULT) { 709 709 fault_if_from_uspace(istate, "Page fault at %p.", va); 710 panic _memtrap(istate, PF_ACCESS_EXEC, va,711 "Page fault.");710 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid, 711 istate->cr_iip); 712 712 } 713 713 } … … 745 745 if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) { 746 746 fault_if_from_uspace(istate, "Page fault at %p.", va); 747 panic _memtrap(istate, PF_ACCESS_READ, va,748 "Page fault.");747 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid, 748 istate->cr_iip); 749 749 } 750 750 } … … 778 778 if (as_page_fault(va, PF_ACCESS_WRITE, istate) == AS_PF_FAULT) { 779 779 fault_if_from_uspace(istate, "Page fault at %p.", va); 780 panic_memtrap(istate, PF_ACCESS_WRITE, va, "Page fault."); 780 panic("%s: va=%p, rid=%d, iip=%p.", __func__, va, rid, 781 istate->cr_iip); 781 782 } 782 783 page_table_unlock(AS, true); … … 818 819 if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) { 819 820 fault_if_from_uspace(istate, "Page fault at %p.", va); 820 panic_memtrap(istate, PF_ACCESS_READ, va, 821 "Page fault."); 821 panic("%s: va=%p, rid=%d.", __func__, va, rid); 822 822 } 823 823 } -
kernel/arch/mips32/Makefile.inc
re3038b4 r05e3cb8 54 54 arch/$(KARCH)/src/start.S \ 55 55 arch/$(KARCH)/src/context.S \ 56 arch/$(KARCH)/src/panic.S \ 56 57 arch/$(KARCH)/src/mips32.c \ 57 58 arch/$(KARCH)/src/asm.S \ -
kernel/arch/mips32/src/exception.c
re3038b4 r05e3cb8 72 72 }; 73 73 74 void istate_decode(istate_t *istate)74 static void print_regdump(istate_t *istate) 75 75 { 76 printf("at=%p\tv0=%p\tv1=%p\n", istate->at, istate->v0, istate->v1); 77 printf("a0=%p\ta1=%p\ta2=%p\n", istate->a0, istate->a1, istate->a2); 78 printf("a3=%p\tt0=%p\tt1=%p\n", istate->a3, istate->t0, istate->t1); 79 printf("t2=%p\tt3=%p\tt4=%p\n", istate->t2, istate->t3, istate->t4); 80 printf("t5=%p\tt6=%p\tt7=%p\n", istate->t5, istate->t6, istate->t7); 81 printf("t8=%p\tt9=%p\tgp=%p\n", istate->t8, istate->t9, istate->gp); 82 printf("sp=%p\tra=%p\t\n", istate->sp, istate->ra); 83 printf("lo=%p\thi=%p\t\n", istate->lo, istate->hi); 84 printf("cp0_status=%p\tcp0_epc=%p\tk1=%p\n", 85 istate->status, istate->epc, istate->k1); 76 printf("PC: %#x(%s) RA: %#x(%s), SP(%p)\n", istate->epc, 77 symtab_fmt_name_lookup(istate->epc), istate->ra, 78 symtab_fmt_name_lookup(istate->ra), istate->sp); 86 79 } 87 80 … … 89 82 { 90 83 fault_if_from_uspace(istate, "Unhandled exception %s.", exctable[n]); 91 panic_badtrap(istate, n, "Unhandled exception %s.", exctable[n]); 84 85 print_regdump(istate); 86 panic("Unhandled exception %s.", exctable[n]); 92 87 } 93 88 … … 130 125 scheduler_fpu_lazy_request(); 131 126 else { 132 fault_if_from_uspace(istate, 133 "Unhandled Coprocessor Unusable Exception."); 134 panic_badtrap(istate, n, 135 "Unhandled Coprocessor Unusable Exception."); 127 fault_if_from_uspace(istate, "Unhandled Coprocessor Unusable Exception."); 128 panic("Unhandled Coprocessor Unusable Exception."); 136 129 } 137 130 } … … 169 162 static void syscall_exception(unsigned int n, istate_t *istate) 170 163 { 171 fault_if_from_uspace(istate,"Syscall is handled through shortcut.");164 panic("Syscall is handled through shortcut."); 172 165 } 173 166 -
kernel/arch/mips32/src/mm/tlb.c
re3038b4 r05e3cb8 321 321 void tlb_refill_fail(istate_t *istate) 322 322 { 323 uintptr_t va = cp0_badvaddr_read(); 324 325 fault_if_from_uspace(istate, "TLB Refill Exception on %p.", va); 326 panic_memtrap(istate, PF_ACCESS_READ, va, "TLB Refill Exception."); 323 const char *symbol = symtab_fmt_name_lookup(istate->epc); 324 const char *sym2 = symtab_fmt_name_lookup(istate->ra); 325 326 fault_if_from_uspace(istate, "TLB Refill Exception on %p.", 327 cp0_badvaddr_read()); 328 panic("%x: TLB Refill Exception at %x (%s<-%s).", cp0_badvaddr_read(), 329 istate->epc, symbol, sym2); 327 330 } 328 331 … … 330 333 void tlb_invalid_fail(istate_t *istate) 331 334 { 332 uintptr_t va = cp0_badvaddr_read(); 333 334 fault_if_from_uspace(istate, "TLB Invalid Exception on %p.", va); 335 panic_memtrap(istate, PF_ACCESS_READ, va, "TLB Invalid Exception."); 335 const char *symbol = symtab_fmt_name_lookup(istate->epc); 336 337 fault_if_from_uspace(istate, "TLB Invalid Exception on %p.", 338 cp0_badvaddr_read()); 339 panic("%x: TLB Invalid Exception at %x (%s).", cp0_badvaddr_read(), 340 istate->epc, symbol); 336 341 } 337 342 338 343 void tlb_modified_fail(istate_t *istate) 339 344 { 340 uintptr_t va = cp0_badvaddr_read(); 341 342 fault_if_from_uspace(istate, "TLB Modified Exception on %p.", va); 343 panic_memtrap(istate, PF_ACCESS_WRITE, va, "TLB Modified Exception."); 345 const char *symbol = symtab_fmt_name_lookup(istate->epc); 346 347 fault_if_from_uspace(istate, "TLB Modified Exception on %p.", 348 cp0_badvaddr_read()); 349 panic("%x: TLB Modified Exception at %x (%s).", cp0_badvaddr_read(), 350 istate->epc, symbol); 344 351 } 345 352 -
kernel/arch/ppc32/Makefile.inc
re3038b4 r05e3cb8 40 40 ARCH_SOURCES = \ 41 41 arch/$(KARCH)/src/context.S \ 42 arch/$(KARCH)/src/debug/panic.s \ 42 43 arch/$(KARCH)/src/debug/stacktrace.c \ 43 44 arch/$(KARCH)/src/debug/stacktrace_asm.S \ -
kernel/arch/ppc32/include/types.h
re3038b4 r05e3cb8 50 50 } fncptr_t; 51 51 52 /** Formats for uintptr_t, size_t */52 /**< Formats for uintptr_t, size_t */ 53 53 #define PRIp "x" 54 54 #define PRIs "u" 55 55 56 /** Formats for (u)int8_t, (u)int16_t, (u)int32_t, (u)int64_t and (u)native_t */56 /**< Formats for (u)int8_t, (u)int16_t, (u)int32_t, (u)int64_t and (u)native_t */ 57 57 #define PRId8 "d" 58 58 #define PRId16 "d" -
kernel/arch/ppc32/src/interrupt.c
re3038b4 r05e3cb8 50 50 :: [dec] "r" (1000) 51 51 ); 52 }53 54 void istate_decode(istate_t *istate)55 {56 printf("r0 =%p\tr1 =%p\tr2 =%p\n", istate->r0, istate->sp, istate->r2);57 printf("r3 =%p\tr4 =%p\tr5 =%p\n", istate->r3, istate->r4, istate->r5);58 printf("r6 =%p\tr7 =%p\tr8 =%p\n", istate->r6, istate->r7, istate->r8);59 printf("r9 =%p\tr10=%p\tr11=%p\n",60 istate->r9, istate->r10, istate->r11);61 printf("r12=%p\tr13=%p\tr14=%p\n",62 istate->r12, istate->r13, istate->r14);63 printf("r15=%p\tr16=%p\tr17=%p\n",64 istate->r15, istate->r16, istate->r17);65 printf("r18=%p\tr19=%p\tr20=%p\n",66 istate->r18, istate->r19, istate->r20);67 printf("r21=%p\tr22=%p\tr23=%p\n",68 istate->r21, istate->r22, istate->r23);69 printf("r24=%p\tr25=%p\tr26=%p\n",70 istate->r24, istate->r25, istate->r26);71 printf("r27=%p\tr28=%p\tr29=%p\n",72 istate->r27, istate->r28, istate->r29);73 printf("r30=%p\tr31=%p\n", istate->r30, istate->r31);74 printf("cr =%p\tpc =%p\tlr =%p\n", istate->cr, istate->pc, istate->lr);75 printf("ctr=%p\txer=%p\tdar=%p\n",76 istate->ctr, istate->xer, istate->dar);77 printf("srr1=%p\n", istate->srr1);78 52 } 79 53 -
kernel/arch/ppc32/src/mm/tlb.c
re3038b4 r05e3cb8 111 111 static void pht_refill_fail(uintptr_t badvaddr, istate_t *istate) 112 112 { 113 fault_if_from_uspace(istate, "PHT Refill Exception on %p.", badvaddr); 114 panic_memtrap(istate, PF_ACCESS_READ, badvaddr, 115 "PHT Refill Exception."); 113 const char *symbol = symtab_fmt_name_lookup(istate->pc); 114 const char *sym2 = symtab_fmt_name_lookup(istate->lr); 115 116 fault_if_from_uspace(istate, 117 "PHT Refill Exception on %p.", badvaddr); 118 panic("%p: PHT Refill Exception at %p (%s<-%s).", badvaddr, 119 istate->pc, symbol, sym2); 116 120 } 117 121 -
kernel/arch/sparc64/Makefile.inc
re3038b4 r05e3cb8 64 64 arch/$(KARCH)/src/asm.S \ 65 65 arch/$(KARCH)/src/$(USARCH)/asm.S \ 66 arch/$(KARCH)/src/panic.S \ 66 67 arch/$(KARCH)/src/console.c \ 67 68 arch/$(KARCH)/src/context.S \ -
kernel/arch/sparc64/include/types.h
re3038b4 r05e3cb8 52 52 typedef uint8_t asi_t; 53 53 54 /** Formats for uintptr_t, size_t */54 /**< Formats for uintptr_t, size_t */ 55 55 #define PRIp "llx" 56 56 #define PRIs "llu" 57 57 58 /** Formats for (u)int8_t, (u)int16_t, (u)int32_t, (u)int64_t and (u)native_t */58 /**< Formats for (u)int8_t, (u)int16_t, (u)int32_t, (u)int64_t and (u)native_t */ 59 59 #define PRId8 "d" 60 60 #define PRId16 "d" -
kernel/arch/sparc64/src/mm/sun4u/tlb.c
re3038b4 r05e3cb8 27 27 */ 28 28 29 /** @addtogroup sparc64mm 29 /** @addtogroup sparc64mm 30 30 * @{ 31 31 */ … … 58 58 static void dtlb_pte_copy(pte_t *, size_t, bool); 59 59 static void itlb_pte_copy(pte_t *, size_t); 60 static void do_fast_instruction_access_mmu_miss_fault(istate_t *, uintptr_t, 61 const char *); 60 static void do_fast_instruction_access_mmu_miss_fault(istate_t *, const char *); 62 61 static void do_fast_data_access_mmu_miss_fault(istate_t *, tlb_tag_access_reg_t, 63 62 const char *); … … 223 222 * Forward the page fault to the address space page fault 224 223 * handler. 225 */ 224 */ 226 225 page_table_unlock(AS, true); 227 226 if (as_page_fault(page_16k, PF_ACCESS_EXEC, istate) == 228 227 AS_PF_FAULT) { 229 228 do_fast_instruction_access_mmu_miss_fault(istate, 230 istate->tpc,__func__);229 __func__); 231 230 } 232 231 } … … 259 258 /* NULL access in kernel */ 260 259 do_fast_data_access_mmu_miss_fault(istate, tag, 261 "Dereferencing NULL pointer");260 __func__); 262 261 } else if (page_8k >= end_of_identity) { 263 262 /* … … 439 438 440 439 void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, 441 uintptr_t va, const char *str) 442 { 443 fault_if_from_uspace(istate, "%s, Address=%p.", str, va); 444 panic_memtrap(istate, PF_ACCESS_EXEC, va, "%s.", str); 440 const char *str) 441 { 442 fault_if_from_uspace(istate, "%s.", str); 443 dump_istate(istate); 444 panic("%s.", str); 445 445 } 446 446 … … 451 451 452 452 va = tag.vpn << MMU_PAGE_WIDTH; 453 fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str, va, 454 tag.context); 455 panic_memtrap(istate, PF_ACCESS_READ, va, "%s.", str); 453 if (tag.context) { 454 fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str, va, 455 tag.context); 456 } 457 dump_istate(istate); 458 printf("Faulting page: %p, ASID=%d.\n", va, tag.context); 459 panic("%s.", str); 456 460 } 457 461 … … 462 466 463 467 va = tag.vpn << MMU_PAGE_WIDTH; 464 fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str, va, 465 tag.context); 466 panic_memtrap(istate, PF_ACCESS_WRITE, va, "%s.", str); 468 469 if (tag.context) { 470 fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str, va, 471 tag.context); 472 } 473 printf("Faulting page: %p, ASID=%d\n", va, tag.context); 474 dump_istate(istate); 475 panic("%s.", str); 467 476 } 468 477 -
kernel/arch/sparc64/src/mm/sun4v/tlb.c
re3038b4 r05e3cb8 28 28 */ 29 29 30 /** @addtogroup sparc64mm 30 /** @addtogroup sparc64mm 31 31 * @{ 32 32 */ … … 62 62 static void itlb_pte_copy(pte_t *); 63 63 static void dtlb_pte_copy(pte_t *, bool); 64 static void do_fast_instruction_access_mmu_miss_fault(istate_t *, uintptr_t, 65 const char *); 64 static void do_fast_instruction_access_mmu_miss_fault(istate_t *, const char *); 66 65 static void do_fast_data_access_mmu_miss_fault(istate_t *, uint64_t, 67 66 const char *); … … 236 235 * Forward the page fault to the address space page fault 237 236 * handler. 238 */ 237 */ 239 238 page_table_unlock(AS, true); 240 239 if (as_page_fault(va, PF_ACCESS_EXEC, istate) == AS_PF_FAULT) { 241 240 do_fast_instruction_access_mmu_miss_fault(istate, 242 istate->tpc,__func__);241 __func__); 243 242 } 244 243 } … … 355 354 } 356 355 357 void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, uintptr_t va,356 void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, 358 357 const char *str) 359 358 { 360 fault_if_from_uspace(istate, "%s, Address=%p.", str, va); 361 panic_memtrap(istate, PF_ACCESS_EXEC, va, "%s.", str); 359 fault_if_from_uspace(istate, "%s.", str); 360 dump_istate(istate); 361 panic("%s.", str); 362 362 } 363 363 … … 365 365 uint64_t page_and_ctx, const char *str) 366 366 { 367 fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str, 368 DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx)); 369 panic_memtrap(istate, PF_ACCESS_READ, DMISS_ADDRESS(page_and_ctx), 370 "%s."); 367 if (DMISS_CONTEXT(page_and_ctx)) { 368 fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d)\n", str, DMISS_ADDRESS(page_and_ctx), 369 DMISS_CONTEXT(page_and_ctx)); 370 } 371 dump_istate(istate); 372 printf("Faulting page: %p, ASID=%d\n", DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx)); 373 panic("%s\n", str); 371 374 } 372 375 … … 374 377 uint64_t page_and_ctx, const char *str) 375 378 { 376 fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str, 377 DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx)); 378 panic_memtrap(istate, PF_ACCESS_WRITE, DMISS_ADDRESS(page_and_ctx), 379 "%s."); 379 if (DMISS_CONTEXT(page_and_ctx)) { 380 fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d)\n", str, DMISS_ADDRESS(page_and_ctx), 381 DMISS_CONTEXT(page_and_ctx)); 382 } 383 printf("Faulting page: %p, ASID=%d\n", DMISS_ADDRESS(page_and_ctx), DMISS_CONTEXT(page_and_ctx)); 384 dump_istate(istate); 385 panic("%s\n", str); 380 386 } 381 387 -
kernel/arch/sparc64/src/trap/exception.c
re3038b4 r05e3cb8 44 44 #include <symtab.h> 45 45 46 void istate_decode(istate_t *istate)46 void dump_istate(istate_t *istate) 47 47 { 48 48 const char *tpcs = symtab_fmt_name_lookup(istate->tpc); … … 58 58 { 59 59 fault_if_from_uspace(istate, "%s.", __func__); 60 panic_badtrap(istate, n, "%s.", __func__); 60 dump_istate(istate); 61 panic("%s.", __func__); 61 62 } 62 63 … … 65 66 { 66 67 fault_if_from_uspace(istate, "%s.", __func__); 67 panic_badtrap(istate, n, "%s.", __func__); 68 dump_istate(istate); 69 panic("%s.", __func__); 68 70 } 69 71 … … 72 74 { 73 75 fault_if_from_uspace(istate, "%s.", __func__); 74 panic_badtrap(istate, n, "%s.", __func__); 76 dump_istate(istate); 77 panic("%s.", __func__); 75 78 } 76 79 … … 79 82 { 80 83 fault_if_from_uspace(istate, "%s.", __func__); 81 panic_badtrap(istate, n, "%s.", __func__); 84 dump_istate(istate); 85 panic("%s.", __func__); 82 86 } 83 87 … … 86 90 { 87 91 fault_if_from_uspace(istate, "%s.", __func__); 88 panic_badtrap(istate, n, "%s.", __func__); 92 dump_istate(istate); 93 panic("%s.", __func__); 89 94 } 90 95 … … 93 98 { 94 99 fault_if_from_uspace(istate, "%s.", __func__); 95 panic_badtrap(istate, n, "%s.", __func__); 100 dump_istate(istate); 101 panic("%s.", __func__); 96 102 } 97 103 … … 112 118 #else 113 119 fault_if_from_uspace(istate, "%s.", __func__); 114 panic_badtrap(istate, n, "%s.", __func__); 120 dump_istate(istate); 121 panic("%s.", __func__); 115 122 #endif 116 123 } … … 120 127 { 121 128 fault_if_from_uspace(istate, "%s.", __func__); 122 panic_badtrap(istate, n, "%s.", __func__); 129 dump_istate(istate); 130 panic("%s.", __func__); 123 131 } 124 132 … … 127 135 { 128 136 fault_if_from_uspace(istate, "%s.", __func__); 129 panic_badtrap(istate, n, "%s.", __func__); 137 dump_istate(istate); 138 panic("%s.", __func__); 130 139 } 131 140 … … 134 143 { 135 144 fault_if_from_uspace(istate, "%s.", __func__); 136 panic_badtrap(istate, n, "%s.", __func__); 145 dump_istate(istate); 146 panic("%s.", __func__); 137 147 } 138 148 … … 141 151 { 142 152 fault_if_from_uspace(istate, "%s.", __func__); 143 panic_badtrap(istate, n, "%s.", __func__); 153 dump_istate(istate); 154 panic("%s.", __func__); 144 155 } 145 156 … … 148 159 { 149 160 fault_if_from_uspace(istate, "%s.", __func__); 150 panic_badtrap(istate, n, "%s.", __func__); 161 dump_istate(istate); 162 describe_dmmu_fault(); 163 panic("%s.", __func__); 151 164 } 152 165 … … 155 168 { 156 169 fault_if_from_uspace(istate, "%s.", __func__); 157 panic_badtrap(istate, n, "%s.", __func__); 170 dump_istate(istate); 171 panic("%s.", __func__); 158 172 } 159 173 … … 162 176 { 163 177 fault_if_from_uspace(istate, "%s.", __func__); 164 panic_badtrap(istate, n, "%s.", __func__); 178 dump_istate(istate); 179 panic("%s.", __func__); 165 180 } 166 181 … … 169 184 { 170 185 fault_if_from_uspace(istate, "%s.", __func__); 171 panic_badtrap(istate, n, "%s.", __func__); 186 dump_istate(istate); 187 panic("%s.", __func__); 172 188 } 173 189 … … 176 192 { 177 193 fault_if_from_uspace(istate, "%s.", __func__); 178 panic_badtrap(istate, n, "%s.", __func__); 194 dump_istate(istate); 195 panic("%s.", __func__); 179 196 } 180 197 … … 183 200 { 184 201 fault_if_from_uspace(istate, "%s.", __func__); 185 panic_badtrap(istate, n, "%s.", __func__); 202 dump_istate(istate); 203 panic("%s.", __func__); 186 204 } 187 205 … … 190 208 { 191 209 fault_if_from_uspace(istate, "%s.", __func__); 192 panic_badtrap(istate, n, "%s.", __func__); 210 dump_istate(istate); 211 panic("%s.", __func__); 193 212 } 194 213 … … 197 216 { 198 217 fault_if_from_uspace(istate, "%s.", __func__); 199 panic_badtrap(istate, n, "%s.", __func__); 218 dump_istate(istate); 219 panic("%s.", __func__); 200 220 } 201 221 -
kernel/generic/include/debug.h
re3038b4 r05e3cb8 55 55 do { \ 56 56 if (!(expr)) \ 57 panic _assert("%s", #expr); \57 panic("Assertion failed (%s)", #expr); \ 58 58 } while (0) 59 59 … … 72 72 do { \ 73 73 if (!(expr)) \ 74 panic _assert("%s, %s", #expr, msg); \74 panic("Assertion failed (%s, %s)", #expr, msg); \ 75 75 } while (0) 76 76 -
kernel/generic/include/interrupt.h
re3038b4 r05e3cb8 64 64 extern void irq_initialize_arch(irq_t *); 65 65 66 extern void istate_decode(istate_t *);67 68 66 #endif 69 67 -
kernel/generic/include/panic.h
re3038b4 r05e3cb8 1 1 /* 2 * Copyright (c) 20 10Jakub Jermar2 * Copyright (c) 2001-2004 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 37 37 38 38 #include <typedefs.h> 39 #include <stacktrace.h> 40 #include <print.h> 39 41 40 #define panic(fmt, ...) \ 41 panic_common(PANIC_OTHER, NULL, 0, 0, fmt, ##__VA_ARGS__) 42 #ifdef CONFIG_DEBUG 42 43 43 #define panic_assert(fmt, ...) \ 44 panic_common(PANIC_ASSERT, NULL, 0, 0, fmt, ##__VA_ARGS__) 44 #define panic(format, ...) \ 45 do { \ 46 silent = false; \ 47 printf("Kernel panic in %s() at %s:%u\n", \ 48 __func__, __FILE__, __LINE__); \ 49 stack_trace(); \ 50 panic_printf("Panic message: " format "\n", \ 51 ##__VA_ARGS__);\ 52 } while (0) 45 53 46 #define panic_badtrap(istate, n, fmt, ...) \ 47 panic_common(PANIC_BADTRAP, istate, 0, n, fmt, ##__VA_ARGS__) 54 #else /* CONFIG_DEBUG */ 48 55 49 #define panic_memtrap(istate, access, addr, fmt, ...) \ 50 panic_common(PANIC_MEMTRAP, istate, access, addr, fmt, ##__VA_ARGS__) 56 #define panic(format, ...) \ 57 do { \ 58 silent = false; \ 59 panic_printf("Kernel panic: " format "\n", ##__VA_ARGS__); \ 60 stack_trace(); \ 61 } while (0) 51 62 52 typedef enum { 53 PANIC_OTHER, 54 PANIC_ASSERT, 55 PANIC_BADTRAP, 56 PANIC_MEMTRAP 57 } panic_category_t; 58 59 struct istate; 63 #endif /* CONFIG_DEBUG */ 60 64 61 65 extern bool silent; 62 66 63 extern void panic_common(panic_category_t, struct istate *, int, 64 uintptr_t, const char *, ...) __attribute__ ((noreturn)); 67 extern void panic_printf(const char *fmt, ...) __attribute__((noreturn)); 65 68 66 69 #endif -
kernel/generic/src/debug/stacktrace.c
re3038b4 r05e3cb8 37 37 #include <typedefs.h> 38 38 #include <symtab.h> 39 #include <print.h>40 39 41 40 #define STACK_FRAMES_MAX 20
Note:
See TracChangeset
for help on using the changeset viewer.
