summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2024-02-16 12:52:09 -0600
committerDanny Holman <dholman@gymli.org>2024-02-16 12:52:09 -0600
commitc95f8d146849ac1a5a0eb550e08b6010ae7234aa (patch)
treeb5dc539314e6afd143012005c319ec191e9a256c /kernel
parentd0b2495636d042a1f301fd2d0d68d7f782275cd4 (diff)
kernel: add a panic function
Add a panic function that stops the current CPU and prints an error message into the ring buffer. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/panic.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/panic.c b/kernel/panic.c
new file mode 100644
index 0000000..c75fafb
--- /dev/null
+++ b/kernel/panic.c
@@ -0,0 +1,8 @@
+#include <kernel/panic.h>
+#include <kernel/io.h>
+
+void panic(const char *str) {
+ kprintf("KERNEL PANIC\n");
+ kprintf("ERROR: %s\n", str);
+ while (1);
+}