summaryrefslogtreecommitdiffhomepage
path: root/src/loader/inc/panic.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/loader/inc/panic.h')
-rw-r--r--src/loader/inc/panic.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/loader/inc/panic.h b/src/loader/inc/panic.h
new file mode 100644
index 0000000..73819c9
--- /dev/null
+++ b/src/loader/inc/panic.h
@@ -0,0 +1,24 @@
+// MIT License, Copyright (c) 2021 Marvin Borner
+
+#ifndef PNC_H
+#define PNC_H
+
+#include <log.h>
+
+#define panic(reason) \
+ { \
+ log("%s:%d: %s: Panic: %s", __FILE__, __LINE__, __func__, (reason)); \
+ while (1) \
+ __asm__ volatile("cli\nhlt"); \
+ }
+
+#define assert(exp) \
+ { \
+ if (!(exp)) \
+ panic("Assertion '" #exp "' failed\n"); \
+ }
+
+// This shouldn't return, therefore this declaration belongs here (kinda)
+void jmp_kernel(void *kernel, int args, ...);
+
+#endif