forked from xamidev/pepperOS
Fix panic/stack trace
This commit is contained in:
@@ -73,35 +73,17 @@ void panic(struct cpu_status_t* ctx, const char* str)
|
||||
CLEAR_INTERRUPTS;
|
||||
panic_count += 1;
|
||||
if (ctx == NULL) {
|
||||
DEBUG("\x1b[38;5;231m\x1b[48;5;196mKernel panic!!!\x1b[0m Something went horribly wrong! (no cpu ctx)");
|
||||
printf("\x1b[38;5;231m\x1b[48;5;27m");
|
||||
DIE_DEBUG(str);
|
||||
printf("\x1b[0m");
|
||||
skputc('\r');
|
||||
skputc('\n');
|
||||
DEBUG("\x1b[38;5;231m\x1b[48;5;196mend Kernel panic\x1b[0m");
|
||||
|
||||
if (init.terminal) {
|
||||
printf("\r\n\x1b[38;5;231m\x1b[48;5;196mKernel panic!!!\x1b[48;5;232m Something went horribly wrong! (no cpu ctx)");
|
||||
printf("\r\n%s\r\n\x1b[38;5;231mend Kernel panic\x1b[0m", str);
|
||||
}
|
||||
|
||||
printf("\r\n\x1b[38;5;231m\x1b[48;5;196mKernel panic!!!\x1b[48;5;232m Something went horribly wrong! (no cpu ctx)");
|
||||
printf("\r\n%s\r\n\x1b[38;5;231m\x1b[0m", str);
|
||||
debug_stack_trace(100);
|
||||
hcf();
|
||||
}
|
||||
DEBUG("\x1b[38;5;231m\x1b[48;5;196mKernel panic!!!\x1b[0m at rip=%p\r\nSomething went horribly wrong! (%s) vect=0x%.2x errcode=0x%x\n\rrax=%p rbx=%p rcx=%p rdx=%p\n\rrsi=%p rdi=%p r8=%p r9=%p\n\rr10=%p r11=%p r12=%p r13=%p\n\rr14=%p r15=%p\n\n\rflags=%p\n\r\x1b[0m",
|
||||
ctx->iret_rip,
|
||||
str,
|
||||
ctx->vector_number, ctx->error_code, ctx->rax, ctx->rbx, ctx->rcx, ctx->rdx, ctx->rsi, ctx->rdi,
|
||||
ctx->r8, ctx->r9, ctx->r10, ctx->r11, ctx->r12, ctx->r13, ctx->r14, ctx->r15, ctx->iret_flags);
|
||||
|
||||
if (init.terminal) {
|
||||
printf("\r\n\x1b[38;5;231m\x1b[48;5;196mKernel panic!!!\x1b[48;5;232mat rip=%p\r\nSomething went horribly wrong! (%s) vect=0x%.2x errcode=0x%x\n\rrax=%p rbx=%p rcx=%p rdx=%p\n\rrsi=%p rdi=%p r8=%p r9=%p\n\rr10=%p r11=%p r12=%p r13=%p\n\rr14=%p r15=%p\n\n\rflags=%p ",
|
||||
ctx->iret_rip,
|
||||
str,
|
||||
ctx->vector_number, ctx->error_code, ctx->rax, ctx->rbx, ctx->rcx, ctx->rdx, ctx->rsi, ctx->rdi,
|
||||
ctx->r8, ctx->r9, ctx->r10, ctx->r11, ctx->r12, ctx->r13, ctx->r14, ctx->r15, ctx->iret_flags);
|
||||
}
|
||||
|
||||
printf("\r\n\x1b[38;5;231m\x1b[48;5;196mKernel panic!!!\x1b[48;5;232mat rip=%p\r\nSomething went horribly wrong! (%s) vect=0x%.2x errcode=0x%x\n\rrax=%p rbx=%p rcx=%p rdx=%p\n\rrsi=%p rdi=%p r8=%p r9=%p\n\rr10=%p r11=%p r12=%p r13=%p\n\rr14=%p r15=%p\n\n\rflags=%p ",
|
||||
ctx->iret_rip,
|
||||
str,
|
||||
ctx->vector_number, ctx->error_code, ctx->rax, ctx->rbx, ctx->rcx, ctx->rdx, ctx->rsi, ctx->rdi,
|
||||
ctx->r8, ctx->r9, ctx->r10, ctx->r11, ctx->r12, ctx->r13, ctx->r14, ctx->r15, ctx->iret_flags);
|
||||
|
||||
read_rflags(ctx->iret_flags);
|
||||
debug_stack_trace(100);
|
||||
|
||||
Reference in New Issue
Block a user