commit e50c1e28650f983df0cb19b58918b4973f2edaa0
parent 549af230590c98b3d5f925a76a45db8d81b4eeba
Author: sin <sin@2f30.org>
Date: Tue, 16 Jul 2013 22:31:15 +0100
Add panic()
Diffstat:
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/include/kernel.h b/include/kernel.h
@@ -12,6 +12,7 @@
#include <alloc.h>
#include <debug.h>
#include <atomic.h>
+#include <panic.h>
#define __unused __attribute__((__unused__))
diff --git a/include/panic.h b/include/panic.h
@@ -0,0 +1,6 @@
+#ifndef __PANIC_H
+#define __PANIC_H
+
+void panic(const char *fmt, ...);
+
+#endif /* __PANIC_H */
diff --git a/kernel/panic.c b/kernel/panic.c
@@ -0,0 +1,14 @@
+#include <kernel.h>
+
+void
+panic(const char *fmt, ...)
+{
+ va_list ap;
+
+ /* TODO: Shut down interrupts */
+ kprintf("~~~ kernel panic ~~~\n");
+ va_start(ap, fmt);
+ kvprintf(fmt, ap);
+ va_end(ap);
+ for (;;);
+}