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) __SYSCALL_LL_E((x))
6 /* The extra OR instructions are to work around a hardware bug:
7 * http://documentation.renesas.com/doc/products/mpumcu/tu/tnsh7456ae.pdf
9 #define __asm_syscall(trapno, ...) do { \
10 __asm__ __volatile__ ( \
17 : "=r"(r0) : __VA_ARGS__ : "memory"); \
21 static inline long __syscall0(long n
)
23 register long r3
__asm__("r3") = n
;
24 register long r0
__asm__("r0");
25 __asm_syscall(16, "r"(r3
));
28 static inline long __syscall1(long n
, long a
)
30 register long r3
__asm__("r3") = n
;
31 register long r4
__asm__("r4") = a
;
32 register long r0
__asm__("r0");
33 __asm_syscall(17, "r"(r3
), "r"(r4
));
36 static inline long __syscall2(long n
, long a
, long b
)
38 register long r3
__asm__("r3") = n
;
39 register long r4
__asm__("r4") = a
;
40 register long r5
__asm__("r5") = b
;
41 register long r0
__asm__("r0");
42 __asm_syscall(18, "r"(r3
), "r"(r4
), "r"(r5
));
45 static inline long __syscall3(long n
, long a
, long b
, long c
)
47 register long r3
__asm__("r3") = n
;
48 register long r4
__asm__("r4") = a
;
49 register long r5
__asm__("r5") = b
;
50 register long r6
__asm__("r6") = c
;
51 register long r0
__asm__("r0");
52 __asm_syscall(19, "r"(r3
), "r"(r4
), "r"(r5
), "r"(r6
));
55 static inline long __syscall4(long n
, long a
, long b
, long c
, long d
)
57 register long r3
__asm__("r3") = n
;
58 register long r4
__asm__("r4") = a
;
59 register long r5
__asm__("r5") = b
;
60 register long r6
__asm__("r6") = c
;
61 register long r7
__asm__("r7") = d
;
62 register long r0
__asm__("r0");
63 __asm_syscall(20, "r"(r3
), "r"(r4
), "r"(r5
), "r"(r6
), "r"(r7
));
66 static inline long __syscall5(long n
, long a
, long b
, long c
, long d
, long e
)
68 register long r3
__asm__("r3") = n
;
69 register long r4
__asm__("r4") = a
;
70 register long r5
__asm__("r5") = b
;
71 register long r6
__asm__("r6") = c
;
72 register long r7
__asm__("r7") = d
;
73 register long r0
__asm__("r0") = e
;
74 __asm_syscall(21, "r"(r3
), "r"(r4
), "r"(r5
), "r"(r6
), "r"(r7
), "0"(r0
));
77 static inline long __syscall6(long n
, long a
, long b
, long c
, long d
, long e
, long f
)
79 register long r3
__asm__("r3") = n
;
80 register long r4
__asm__("r4") = a
;
81 register long r5
__asm__("r5") = b
;
82 register long r6
__asm__("r6") = c
;
83 register long r7
__asm__("r7") = d
;
84 register long r0
__asm__("r0") = e
;
85 register long r1
__asm__("r1") = f
;
86 __asm_syscall(22, "r"(r3
), "r"(r4
), "r"(r5
), "r"(r6
), "r"(r7
), "0"(r0
), "r"(r1
));