summaryrefslogtreecommitdiffhomepage
path: root/src/loader/inc/pnc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/loader/inc/pnc.h')
-rw-r--r--src/loader/inc/pnc.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/loader/inc/pnc.h b/src/loader/inc/pnc.h
new file mode 100644
index 0000000..3de3364
--- /dev/null
+++ b/src/loader/inc/pnc.h
@@ -0,0 +1,21 @@
+// 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\n", __FILE__, __LINE__, __func__, (reason)); \
+ while (1) \
+ __asm__ volatile("cli\nhlt"); \
+ }
+
+#define assert(exp) \
+ { \
+ if (!(exp)) \
+ panic("Assertion '" #exp "' failed"); \
+ }
+
+#endif