aboutsummaryrefslogtreecommitdiff
path: root/include/syscall.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/syscall.h')
-rw-r--r--include/syscall.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/syscall.h b/include/syscall.h
index 0460ede..0508b38 100644
--- a/include/syscall.h
+++ b/include/syscall.h
@@ -3,7 +3,7 @@
#pragma once
#if !defined(__linux__) || !defined(__x86_64__)
-# error "Only supported on linux(x86_64)!"
+# error "Only supported on linux(x86_64)!"
#endif
// Inline ASM
@@ -46,8 +46,15 @@
// Reference:
// syscall(2)
-#define argcast(A) ((long)(A))
-#define syscall3(n,a1,a2,a3) _syscall3(n, argcast(a1), argcast(a2), argcast(a3))
+#define argcast(A) ((long)(A))
+#define syscall1(n, a1) _syscall1(n, argcast(a1))
+#define syscall3(n, a1, a2, a3) _syscall3(n, argcast(a1), argcast(a2), argcast(a3))
+
+static inline long _syscall1(long n, long a1) {
+ long ret;
+ asm volatile("syscall" : "=a"(ret) : "a"(n), "D"(a1) : "memory");
+ return ret;
+}
static inline long _syscall3(long n, long a1, long a2, long a3) {
long ret;