summaryrefslogtreecommitdiff
path: root/kernel/panic.h
diff options
context:
space:
mode:
authordzwdz2021-07-09 18:27:47 +0200
committerdzwdz2021-07-09 18:27:47 +0200
commit9566dac198f685ef947d82facee0be182a77495e (patch)
tree1e09721f226bf3293e11f37777f2964a2c59d529 /kernel/panic.h
parent5cfe5443e678e3354ed3488baea9c91cbb9e7697 (diff)
implement basic kernel panics
Diffstat (limited to 'kernel/panic.h')
-rw-r--r--kernel/panic.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/kernel/panic.h b/kernel/panic.h
new file mode 100644
index 0000000..7d2ea5f
--- /dev/null
+++ b/kernel/panic.h
@@ -0,0 +1,14 @@
+#pragma once
+#include <kernel/tty.h>
+#include <platform/asm.h>
+
+// dumb c shit
+#define panic_tostr2(x) #x
+#define panic_tostr(x) panic_tostr2(x)
+
+#define panic() do { \
+ tty_const(" PANIC! at the "); \
+ tty_const(__func__); \
+ tty_const(" (" __FILE__ ":" panic_tostr(__LINE__) ") "); \
+ halt_cpu(); \
+} while (0)