summaryrefslogtreecommitdiff
path: root/kernel/src/print/panic.c
diff options
context:
space:
mode:
authorTyler Murphy <=>2023-07-16 02:54:32 -0400
committerTyler Murphy <=>2023-07-16 02:54:32 -0400
commitfbf131b5c043b27e0b1543374bb144e3e426f723 (patch)
tree07f0ab2fc107b36621d5ae95480e6a91e332548b /kernel/src/print/panic.c
downloadfinix-fbf131b5c043b27e0b1543374bb144e3e426f723.tar.gz
finix-fbf131b5c043b27e0b1543374bb144e3e426f723.tar.bz2
finix-fbf131b5c043b27e0b1543374bb144e3e426f723.zip
initial
Diffstat (limited to '')
-rw-r--r--kernel/src/print/panic.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/kernel/src/print/panic.c b/kernel/src/print/panic.c
new file mode 100644
index 0000000..5e686e1
--- /dev/null
+++ b/kernel/src/print/panic.c
@@ -0,0 +1,27 @@
+#include <sys.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <panic.h>
+#include <print.h>
+
+#include "tty/color.h"
+#include "tty/term.h"
+
+__attribute__((noreturn))
+void _panic_impl(char* msg, int line, char* file, ...) {
+ int_disable();
+ 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);
+
+ while(1) {
+ halt();
+ }
+}