summaryrefslogtreecommitdiffstats
path: root/lib/kpanic.c
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2024-03-11 21:30:31 -0400
committerJon Santmyer <jon@jonsantmyer.com>2024-03-11 21:30:31 -0400
commitd1ff7bcc91886626dc9060ec5fb67ee102ab7c1d (patch)
tree8f0b5cd8aad31089131785dc6e37b659490f9955 /lib/kpanic.c
downloadjove-kernel-d1ff7bcc91886626dc9060ec5fb67ee102ab7c1d.tar.gz
jove-kernel-d1ff7bcc91886626dc9060ec5fb67ee102ab7c1d.tar.bz2
jove-kernel-d1ff7bcc91886626dc9060ec5fb67ee102ab7c1d.zip
usermode capable kernel with logging syscall
Diffstat (limited to 'lib/kpanic.c')
-rw-r--r--lib/kpanic.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/kpanic.c b/lib/kpanic.c
new file mode 100644
index 0000000..97e42eb
--- /dev/null
+++ b/lib/kpanic.c
@@ -0,0 +1,15 @@
+#include "jove.h"
+#include "io/log.h"
+
+#include <stdarg.h>
+
+__attribute__((noreturn))
+void _kpanic(const char *file, int line, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ klogf("!!! PANIC !!!\n%s:%i\n", file, line);
+ kvlogf(fmt, ap);
+ va_end(ap);
+ for(;;) __asm__ volatile("hlt");
+}