1570af302Sopenharmony_ci#define __SYSCALL_LL_E(x) \
2570af302Sopenharmony_ci((union { long long ll; long l[2]; }){ .ll = x }).l[0], \
3570af302Sopenharmony_ci((union { long long ll; long l[2]; }){ .ll = x }).l[1]
4570af302Sopenharmony_ci#define __SYSCALL_LL_O(x) 0, __SYSCALL_LL_E((x))
5570af302Sopenharmony_ci
6570af302Sopenharmony_cistatic inline long __syscall0(long n)
7570af302Sopenharmony_ci{
8570af302Sopenharmony_ci	register long r0 __asm__("r0") = n;
9570af302Sopenharmony_ci	register long r3 __asm__("r3");
10570af302Sopenharmony_ci	__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
11570af302Sopenharmony_ci	: "+r"(r0), "=r"(r3)
12570af302Sopenharmony_ci	:: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
13570af302Sopenharmony_ci	return r3;
14570af302Sopenharmony_ci}
15570af302Sopenharmony_ci
16570af302Sopenharmony_cistatic inline long __syscall1(long n, long a)
17570af302Sopenharmony_ci{
18570af302Sopenharmony_ci	register long r0 __asm__("r0") = n;
19570af302Sopenharmony_ci	register long r3 __asm__("r3") = a;
20570af302Sopenharmony_ci	__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
21570af302Sopenharmony_ci	: "+r"(r0), "+r"(r3)
22570af302Sopenharmony_ci	:: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
23570af302Sopenharmony_ci	return r3;
24570af302Sopenharmony_ci}
25570af302Sopenharmony_ci
26570af302Sopenharmony_cistatic inline long __syscall2(long n, long a, long b)
27570af302Sopenharmony_ci{
28570af302Sopenharmony_ci	register long r0 __asm__("r0") = n;
29570af302Sopenharmony_ci	register long r3 __asm__("r3") = a;
30570af302Sopenharmony_ci	register long r4 __asm__("r4") = b;
31570af302Sopenharmony_ci	__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
32570af302Sopenharmony_ci	: "+r"(r0), "+r"(r3), "+r"(r4)
33570af302Sopenharmony_ci	:: "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
34570af302Sopenharmony_ci	return r3;
35570af302Sopenharmony_ci}
36570af302Sopenharmony_ci
37570af302Sopenharmony_cistatic inline long __syscall3(long n, long a, long b, long c)
38570af302Sopenharmony_ci{
39570af302Sopenharmony_ci	register long r0 __asm__("r0") = n;
40570af302Sopenharmony_ci	register long r3 __asm__("r3") = a;
41570af302Sopenharmony_ci	register long r4 __asm__("r4") = b;
42570af302Sopenharmony_ci	register long r5 __asm__("r5") = c;
43570af302Sopenharmony_ci	__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
44570af302Sopenharmony_ci	: "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5)
45570af302Sopenharmony_ci	:: "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
46570af302Sopenharmony_ci	return r3;
47570af302Sopenharmony_ci}
48570af302Sopenharmony_ci
49570af302Sopenharmony_cistatic inline long __syscall4(long n, long a, long b, long c, long d)
50570af302Sopenharmony_ci{
51570af302Sopenharmony_ci	register long r0 __asm__("r0") = n;
52570af302Sopenharmony_ci	register long r3 __asm__("r3") = a;
53570af302Sopenharmony_ci	register long r4 __asm__("r4") = b;
54570af302Sopenharmony_ci	register long r5 __asm__("r5") = c;
55570af302Sopenharmony_ci	register long r6 __asm__("r6") = d;
56570af302Sopenharmony_ci	__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
57570af302Sopenharmony_ci	: "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6)
58570af302Sopenharmony_ci	:: "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12");
59570af302Sopenharmony_ci	return r3;
60570af302Sopenharmony_ci}
61570af302Sopenharmony_ci
62570af302Sopenharmony_cistatic inline long __syscall5(long n, long a, long b, long c, long d, long e)
63570af302Sopenharmony_ci{
64570af302Sopenharmony_ci	register long r0 __asm__("r0") = n;
65570af302Sopenharmony_ci	register long r3 __asm__("r3") = a;
66570af302Sopenharmony_ci	register long r4 __asm__("r4") = b;
67570af302Sopenharmony_ci	register long r5 __asm__("r5") = c;
68570af302Sopenharmony_ci	register long r6 __asm__("r6") = d;
69570af302Sopenharmony_ci	register long r7 __asm__("r7") = e;
70570af302Sopenharmony_ci	__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
71570af302Sopenharmony_ci	: "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7)
72570af302Sopenharmony_ci	:: "memory", "cr0", "r8", "r9", "r10", "r11", "r12");
73570af302Sopenharmony_ci	return r3;
74570af302Sopenharmony_ci}
75570af302Sopenharmony_ci
76570af302Sopenharmony_cistatic inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
77570af302Sopenharmony_ci{
78570af302Sopenharmony_ci	register long r0 __asm__("r0") = n;
79570af302Sopenharmony_ci	register long r3 __asm__("r3") = a;
80570af302Sopenharmony_ci	register long r4 __asm__("r4") = b;
81570af302Sopenharmony_ci	register long r5 __asm__("r5") = c;
82570af302Sopenharmony_ci	register long r6 __asm__("r6") = d;
83570af302Sopenharmony_ci	register long r7 __asm__("r7") = e;
84570af302Sopenharmony_ci	register long r8 __asm__("r8") = f;
85570af302Sopenharmony_ci	__asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
86570af302Sopenharmony_ci	: "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7), "+r"(r8)
87570af302Sopenharmony_ci	:: "memory", "cr0", "r9", "r10", "r11", "r12");
88570af302Sopenharmony_ci	return r3;
89570af302Sopenharmony_ci}
90570af302Sopenharmony_ci
91570af302Sopenharmony_ci#define SYSCALL_FADVISE_6_ARG
92570af302Sopenharmony_ci
93570af302Sopenharmony_ci#define SO_RCVTIMEO_OLD  18
94570af302Sopenharmony_ci#define SO_SNDTIMEO_OLD  19
95