better panic

This commit is contained in:
2026-02-07 02:18:15 +01:00
parent b920c87bab
commit 458ba375f3
8 changed files with 36 additions and 16 deletions

View File

@@ -37,8 +37,17 @@ void hcf()
// Doing nothing (can be interrupted)
void idle() {for(;;)asm("hlt");}
void panic(struct cpu_status_t* ctx)
void panic(struct cpu_status_t* ctx, const char* str)
{
CLEAR_INTERRUPTS;
if (ctx == NULL)
{
DEBUG("\x1b[38;5;231m\x1b[48;5;196mKernel panic!!!\x1b[0m Something went horribly wrong! (no cpu ctx)");
DIE_DEBUG(str);
skputc('\n');
DEBUG("\x1b[38;5;231m\x1b[48;5;196mend Kernel panic - halting...\x1b[0m");
hcf();
}
DEBUG("\x1b[38;5;231m\x1b[48;5;196mKernel panic!!!\x1b[0m at rip=%p\nSomething went horribly wrong! 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\rstack at rbp=%p\n\rHalting...",
ctx->iret_rip,
ctx->vector_number, ctx->error_code, ctx->rax, ctx->rbx, ctx->rcx, ctx->rdx, ctx->rsi, ctx->rdi,
@@ -59,7 +68,7 @@ extern struct process_t* current_process;
void pedicel_main(void* arg)
{
panic(NULL, "we did it!");
}
void two_main(void* arg)
@@ -104,8 +113,8 @@ void kmain()
vmm_init();
struct process_t* pedicel = process_create("pedicel", (void*)pedicel_main, 0);
struct process_t* two = process_create("two", (void*)two_main, 0);
struct process_t* three = process_create("three", (void*)three_main, 0);
//struct process_t* two = process_create("two", (void*)two_main, 0);
//struct process_t* three = process_create("three", (void*)three_main, 0);
process_display_list(processes_list);
scheduler_init();