aboutsummaryrefslogtreecommitdiff
path: root/lib/include/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/include/common.h')
-rw-r--r--lib/include/common.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/include/common.h b/lib/include/common.h
new file mode 100644
index 0000000..5ea6050
--- /dev/null
+++ b/lib/include/common.h
@@ -0,0 +1,16 @@
+// Copyright (c) 2020 Johannes Stoelp
+
+#pragma once
+
+#include "io.h"
+#include "syscall.h"
+
+#include <asm/unistd.h>
+
+#define ERROR_ON(cond, ...) \
+ do { \
+ if ((cond)) { \
+ efmt(__VA_ARGS__); \
+ syscall1(__NR_exit, 1); \
+ } \
+ } while (0)