rewrite core of the glob implementation for correctness & optimization
[musl.git] / arch / s390x / syscall_arch.h
blobafb99852ebbe009514aab2e08c9f235d46241a55
1 #define __SYSCALL_LL_E(x) (x)
2 #define __SYSCALL_LL_O(x) (x)
4 #define __asm_syscall(ret, ...) do { \
5 __asm__ __volatile__ ("svc 0\n" \
6 : ret : __VA_ARGS__ : "memory"); \
7 return r2; \
8 } while (0)
10 static inline long __syscall0(long n)
12 register long r1 __asm__("r1") = n;
13 register long r2 __asm__("r2");
14 __asm_syscall("=r"(r2), "r"(r1));
17 static inline long __syscall1(long n, long a)
19 register long r1 __asm__("r1") = n;
20 register long r2 __asm__("r2") = a;
21 __asm_syscall("+r"(r2), "r"(r1));
24 static inline long __syscall2(long n, long a, long b)
26 register long r1 __asm__("r1") = n;
27 register long r2 __asm__("r2") = a;
28 register long r3 __asm__("r3") = b;
29 __asm_syscall("+r"(r2), "r"(r1), "r"(r3));
32 static inline long __syscall3(long n, long a, long b, long c)
34 register long r1 __asm__("r1") = n;
35 register long r2 __asm__("r2") = a;
36 register long r3 __asm__("r3") = b;
37 register long r4 __asm__("r4") = c;
38 __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4));
41 static inline long __syscall4(long n, long a, long b, long c, long d)
43 register long r1 __asm__("r1") = n;
44 register long r2 __asm__("r2") = a;
45 register long r3 __asm__("r3") = b;
46 register long r4 __asm__("r4") = c;
47 register long r5 __asm__("r5") = d;
48 __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4), "r"(r5));
51 static inline long __syscall5(long n, long a, long b, long c, long d, long e)
53 register long r1 __asm__("r1") = n;
54 register long r2 __asm__("r2") = a;
55 register long r3 __asm__("r3") = b;
56 register long r4 __asm__("r4") = c;
57 register long r5 __asm__("r5") = d;
58 register long r6 __asm__("r6") = e;
59 __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4), "r"(r5), "r"(r6));
62 static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
64 if (n == SYS_mmap) return __syscall1(n, (long)(long[]){a,b,c,d,e,f});
66 register long r1 __asm__("r1") = n;
67 register long r2 __asm__("r2") = a;
68 register long r3 __asm__("r3") = b;
69 register long r4 __asm__("r4") = c;
70 register long r5 __asm__("r5") = d;
71 register long r6 __asm__("r6") = e;
72 register long r7 __asm__("r7") = f;
73 __asm_syscall("+r"(r2), "r"(r1), "r"(r3), "r"(r4), "r"(r5), "r"(r6), "r"(r7));
76 #define SYSCALL_USE_SOCKETCALL