aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-11-29 16:17:56 +0100
committerjohannst <johannes.stoelp@gmail.com>2020-11-29 16:17:56 +0100
commitccd59100139788404a6bcb34e9547137d509b482 (patch)
tree522e1cf32ab1b2df010c8c2eb38ec7cdc9da1a88
parent6b6c7ca4f4cce33595b4187f23d4003aecef47f6 (diff)
downloaddynld-ccd59100139788404a6bcb34e9547137d509b482.tar.gz
dynld-ccd59100139788404a6bcb34e9547137d509b482.zip
clang format
-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;