github.com/afumu/libc@v0.0.6/musl/arch/aarch64/syscall_arch.h (about) 1 #define __SYSCALL_LL_E(x) (x) 2 #define __SYSCALL_LL_O(x) (x) 3 4 #define __asm_syscall(...) do { \ 5 __asm__ __volatile__ ( "svc 0" \ 6 : "=r"(x0) : __VA_ARGS__ : "memory", "cc"); \ 7 return x0; \ 8 } while (0) 9 10 inline long __syscall0(long n) 11 { 12 register long x8 __asm__("x8") = n; 13 register long x0 __asm__("x0"); 14 __asm_syscall("r"(x8)); 15 } 16 17 inline long __syscall1(long n, long a) 18 { 19 register long x8 __asm__("x8") = n; 20 register long x0 __asm__("x0") = a; 21 __asm_syscall("r"(x8), "0"(x0)); 22 } 23 24 inline long __syscall2(long n, long a, long b) 25 { 26 register long x8 __asm__("x8") = n; 27 register long x0 __asm__("x0") = a; 28 register long x1 __asm__("x1") = b; 29 __asm_syscall("r"(x8), "0"(x0), "r"(x1)); 30 } 31 32 inline long __syscall3(long n, long a, long b, long c) 33 { 34 register long x8 __asm__("x8") = n; 35 register long x0 __asm__("x0") = a; 36 register long x1 __asm__("x1") = b; 37 register long x2 __asm__("x2") = c; 38 __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2)); 39 } 40 41 inline long __syscall4(long n, long a, long b, long c, long d) 42 { 43 register long x8 __asm__("x8") = n; 44 register long x0 __asm__("x0") = a; 45 register long x1 __asm__("x1") = b; 46 register long x2 __asm__("x2") = c; 47 register long x3 __asm__("x3") = d; 48 __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3)); 49 } 50 51 inline long __syscall5(long n, long a, long b, long c, long d, long e) 52 { 53 register long x8 __asm__("x8") = n; 54 register long x0 __asm__("x0") = a; 55 register long x1 __asm__("x1") = b; 56 register long x2 __asm__("x2") = c; 57 register long x3 __asm__("x3") = d; 58 register long x4 __asm__("x4") = e; 59 __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4)); 60 } 61 62 inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) 63 { 64 register long x8 __asm__("x8") = n; 65 register long x0 __asm__("x0") = a; 66 register long x1 __asm__("x1") = b; 67 register long x2 __asm__("x2") = c; 68 register long x3 __asm__("x3") = d; 69 register long x4 __asm__("x4") = e; 70 register long x5 __asm__("x5") = f; 71 __asm_syscall("r"(x8), "0"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5)); 72 } 73 74 #define VDSO_USEFUL 75 #define VDSO_CGT_SYM "__kernel_clock_gettime" 76 #define VDSO_CGT_VER "LINUX_2.6.39" 77 78 #define IPC_64 0