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