aboutsummaryrefslogtreecommitdiff
path: root/libc/inc/sys.h
diff options
context:
space:
mode:
Diffstat (limited to 'libc/inc/sys.h')
-rw-r--r--libc/inc/sys.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/libc/inc/sys.h b/libc/inc/sys.h
new file mode 100644
index 0000000..16d3c4f
--- /dev/null
+++ b/libc/inc/sys.h
@@ -0,0 +1,27 @@
+// MIT License, Copyright (c) 2020 Marvin Borner
+// Syscall implementation
+
+#ifndef SYS_H
+#define SYS_H
+
+enum sys { SYS_LOOP, SYS_MALLOC, SYS_FREE, SYS_EXEC, SYS_EXIT };
+
+int sys0(enum sys num);
+int sys1(enum sys num, int d1);
+int sys2(enum sys num, int d1, int d2);
+int sys3(enum sys num, int d1, int d2, int d3);
+int sys4(enum sys num, int d1, int d2, int d3, int d4);
+int sys5(enum sys num, int d1, int d2, int d3, int d4, int d5);
+
+/**
+ * Wrappers
+ */
+
+#define loop() sys0(SYS_LOOP)
+#define exec(path) sys1(SYS_EXEC, (int)path)
+#define exit() \
+ sys0(SYS_EXIT); \
+ while (1) { \
+ }
+
+#endif