/* * This file implements the full kernel panic routine. This routine does not * return, and is essentially a shutdown routine. It will print a message to * the debug port and halt the processor. In an ideal build, this function * won't need to be linked in. */ #include #include /* Kernel panic */ _Noreturn void panic(char *fmt, ...) { outb(0xE9, '\033'); outb(0xE9, '['); outb(0xE9, '3'); outb(0xE9, '1'); outb(0xE9, 'm'); char *p = fmt; while (*p) outb(0xE9, *p++); outb(0xE9, '\n'); asm volatile("cli"); while (1) asm volatile("hlt"); }