#include "alloc.h" #include "debug.h" #include "keyboard.h" #include "kprintf.h" #include "memory.h" #include "power.h" #include "terminal.h" extern uint32_t page_table1[1024]; __attribute__((noreturn)) void kpanic(const char *format, ...) { va_list va; /* terminal_set_bg_color(VGA_COLOR_BLUE); */ /* terminal_clear(); */ va_start(va, format); kvprintf(format, &va); va_end(va); uint32_t faulting_address; __asm__ __volatile__("mov %%cr2, %0" : "=r"(faulting_address)); kprintf("fault at address: %p\n", faulting_address); /* for (int i = 16; i < 32; i++) */ /* kprintf("%p\n", page_table1[i]); */ /* show_valloc_mem(); */ /* kprintf("\n\n"); */ /* print_stack(); */ /* kprintf("\n\n"); */ /* kprintf("PRESS SPACE TO REBOOT"); */ while (terminal_getkey().scan_code != KEY_SPACE) ; reboot(); }