syscall_arch.h (1448B)
1 /* tcc-build riscv64 syscall_arch.h replacement. 2 * 3 * Stock musl uses GCC register-asm-variable inline asm 4 * (`register long a7 __asm__("a7") = n; ... ecall`); tcc 0.9.26 lacks 5 * that GCC extension, and its riscv64 inline-asm operand path 6 * ("RISCV64 asm not implemented") can't process the constraint list 7 * either. Route every __syscallN through one variadic-style trampoline 8 * implemented in pure asm (src/internal/riscv64/syscall.s); the 9 * trampoline shuffles C-ABI a0..a6 into kernel-ABI a7 + a0..a5 and 10 * issues `ecall`. 11 * 12 * Mirrors the aarch64 / x86_64 trampoline strategy. 13 */ 14 15 #define __SYSCALL_LL_E(x) (x) 16 #define __SYSCALL_LL_O(x) (x) 17 18 extern long __syscall(long, ...); 19 20 static __inline long __syscall0(long n) 21 { 22 return __syscall(n); 23 } 24 static __inline long __syscall1(long n, long a) 25 { 26 return __syscall(n, a); 27 } 28 static __inline long __syscall2(long n, long a, long b) 29 { 30 return __syscall(n, a, b); 31 } 32 static __inline long __syscall3(long n, long a, long b, long c) 33 { 34 return __syscall(n, a, b, c); 35 } 36 static __inline long __syscall4(long n, long a, long b, long c, long d) 37 { 38 return __syscall(n, a, b, c, d); 39 } 40 static __inline long __syscall5(long n, long a, long b, long c, long d, long e) 41 { 42 return __syscall(n, a, b, c, d, e); 43 } 44 static __inline long __syscall6(long n, long a, long b, long c, long d, long e, long f) 45 { 46 return __syscall(n, a, b, c, d, e, f); 47 } 48 49 #define SYSCALL_FADVISE_6_ARG 50 #define SYSCALL_IPC_BROKEN_MODE