From 7a912d1b668ab86ffe088eca3ac7e6f78a04a0c5 Mon Sep 17 00:00:00 2001 From: Tyler Murphy <=> Date: Mon, 17 Jul 2023 19:34:52 -0400 Subject: refactoring --- kernel/src/panic.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 kernel/src/panic.c (limited to 'kernel/src/panic.c') diff --git a/kernel/src/panic.c b/kernel/src/panic.c new file mode 100644 index 0000000..96ad3b9 --- /dev/null +++ b/kernel/src/panic.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include +#include +#include + +__attribute__((noreturn)) +void _panic_impl(char* msg, int line, char* file, ...) { + arch_disable_int(); + va_list args; + va_start(args, file); + term_clear(); + term_setpos(0, 0); + term_setfg(VGA_LIGHT_RED); + puts("!!!PANIC!!!\n"); + term_setfg(VGA_WHITE); + vprintk(msg, args); + if (!term_newline()) putchar('\n'); + printk("\nin %s at line %d\n", file, line); + term_flush(); + while(1) { + arch_halt(); + } +} -- cgit v1.2.3-freya