#include "panic.h" #include "printf.h" char* panic_msg[] = { "#DE - Divide error.", "#DB", "#2", "#BP", "#OF", "#BR", "#UD - Invalid opcode.", "#NM", "#DF - Double fault.", "#9", "#TS", "#NP", "#SS", "#GP - General protection fault.", "#PF - Page fault.", "#15", "#MF", "#AC", "#MC", "#XM", [20 ... 31] = "Undefined exception." }; void panic(panic_stack_t stack) { printf("Kernel panic: %s\n", panic_msg[stack.num]); printf("INT: %8u EC: %08x\n", stack.num, stack.error_code); printf(" CS: %04x DS: %04x SS: %04x\n", stack.cs, stack.ds, stack.ss); printf("EIP: %08x EFLAGS: %08x\n", stack.eip, stack.eflags); printf("EAX: %08x EBX: %08x ECX: %08x EDX: %08x\n", stack.eax, stack.ebx, stack.ecx, stack.edx); printf("ESP: %08x EBP: %08x ESI: %08x EDI: %08x\n", stack.esp, stack.ebp, stack.esi, stack.edi); asm volatile( "cli\n" "hlt\n" ); while(1); }