From c95f8d146849ac1a5a0eb550e08b6010ae7234aa Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Fri, 16 Feb 2024 12:52:09 -0600 Subject: 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 --- kernel/panic.c | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 kernel/panic.c (limited to 'kernel') 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 +#include + +void panic(const char *str) { + kprintf("KERNEL PANIC\n"); + kprintf("ERROR: %s\n", str); + while (1); +} -- cgit v1.2.3