summaryrefslogtreecommitdiff
path: root/src/kernel/panic.h
diff options
context:
space:
mode:
authordzwdz2021-07-10 16:37:45 +0200
committerdzwdz2021-07-10 16:37:45 +0200
commitd093a8eea6bfb0ff7e621e9ba3307dae698322aa (patch)
tree08a5272e2813cf8db8feda4ff91d919cb9ad7330 /src/kernel/panic.h
parent1faac72e2514c335e2d5721dce8c9fd1da722062 (diff)
separate the source code from object files; more modular Makefile
Diffstat (limited to 'src/kernel/panic.h')
-rw-r--r--src/kernel/panic.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/kernel/panic.h b/src/kernel/panic.h
new file mode 100644
index 0000000..7d2ea5f
--- /dev/null
+++ b/src/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)