From ccd59100139788404a6bcb34e9547137d509b482 Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 29 Nov 2020 16:17:56 +0100 Subject: clang format --- include/syscall.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'include') 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; -- cgit v1.2.3