• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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))
5 
6 #define SYSCALL_MMAP2_UNIT 8192ULL
7 
__syscall0(long n)8 static __inline long __syscall0(long n)
9 {
10 	register unsigned long r11 __asm__("r11") = n;
11 	__asm__ __volatile__ ("l.sys 1"
12 			      : "=r"(r11)
13 			      : "r"(r11)
14 			      : "memory", "r3", "r4", "r5", "r6", "r7", "r8",
15 				"r12", "r13", "r15", "r17", "r19", "r21",
16 				"r23", "r25", "r27", "r29", "r31");
17 	return r11;
18 }
19 
__syscall1(long n,long a)20 static inline long __syscall1(long n, long a)
21 {
22 	register unsigned long r11 __asm__("r11") = n;
23 	register unsigned long r3 __asm__("r3") = a;
24 	__asm__ __volatile__ ("l.sys 1"
25 			      : "=r"(r11)
26 			      : "r"(r11), "r"(r3)
27 			      : "memory", "r4", "r5", "r6", "r7", "r8",
28 				"r12", "r13", "r15", "r17", "r19", "r21",
29 				"r23", "r25", "r27", "r29", "r31");
30 	return r11;
31 }
32 
__syscall2(long n,long a,long b)33 static inline long __syscall2(long n, long a, long b)
34 {
35 	register unsigned long r11 __asm__("r11") = n;
36 	register unsigned long r3 __asm__("r3") = a;
37 	register unsigned long r4 __asm__("r4") = b;
38 	__asm__ __volatile__ ("l.sys 1"
39 			      : "=r"(r11)
40 			      : "r"(r11), "r"(r3), "r"(r4)
41 			      : "memory", "r5", "r6", "r7", "r8",
42 				"r12", "r13", "r15", "r17", "r19", "r21",
43 				"r23", "r25", "r27", "r29", "r31");
44 	return r11;
45 }
46 
__syscall3(long n,long a,long b,long c)47 static inline long __syscall3(long n, long a, long b, long c)
48 {
49 	register unsigned long r11 __asm__("r11") = n;
50 	register unsigned long r3 __asm__("r3") = a;
51 	register unsigned long r4 __asm__("r4") = b;
52 	register unsigned long r5 __asm__("r5") = c;
53 	__asm__ __volatile__ ("l.sys 1"
54 			      : "=r"(r11)
55 			      : "r"(r11), "r"(r3), "r"(r4), "r"(r5)
56 			      : "memory", "r6", "r7", "r8",
57 				"r12", "r13", "r15", "r17", "r19", "r21",
58 				"r23", "r25", "r27", "r29", "r31");
59 	return r11;
60 }
61 
__syscall4(long n,long a,long b,long c,long d)62 static inline long __syscall4(long n, long a, long b, long c, long d)
63 {
64 	register unsigned long r11 __asm__("r11") = n;
65 	register unsigned long r3 __asm__("r3") = a;
66 	register unsigned long r4 __asm__("r4") = b;
67 	register unsigned long r5 __asm__("r5") = c;
68 	register unsigned long r6 __asm__("r6") = d;
69 	__asm__ __volatile__ ("l.sys 1"
70 			      : "=r"(r11)
71 			      : "r"(r11), "r"(r3), "r"(r4), "r"(r5), "r"(r6)
72 			      : "memory", "r7", "r8",
73 				"r12", "r13", "r15", "r17", "r19", "r21",
74 				"r23", "r25", "r27", "r29", "r31");
75 	return r11;
76 }
77 
__syscall5(long n,long a,long b,long c,long d,long e)78 static inline long __syscall5(long n, long a, long b, long c, long d, long e)
79 {
80 	register unsigned long r11 __asm__("r11") = n;
81 	register unsigned long r3 __asm__("r3") = a;
82 	register unsigned long r4 __asm__("r4") = b;
83 	register unsigned long r5 __asm__("r5") = c;
84 	register unsigned long r6 __asm__("r6") = d;
85 	register unsigned long r7 __asm__("r7") = e;
86 	__asm__ __volatile__ ("l.sys 1"
87 			      : "=r"(r11)
88 			      : "r"(r11), "r"(r3), "r"(r4), "r"(r5), "r"(r6),
89 				"r"(r7)
90 			      : "memory", "r8",
91 				"r12", "r13", "r15", "r17", "r19", "r21",
92 				"r23", "r25", "r27", "r29", "r31");
93 	return r11;
94 }
95 
__syscall6(long n,long a,long b,long c,long d,long e,long f)96 static inline long __syscall6(long n, long a, long b, long c, long d, long e, long f)
97 {
98 	register unsigned long r11 __asm__("r11") = n;
99 	register unsigned long r3 __asm__("r3") = a;
100 	register unsigned long r4 __asm__("r4") = b;
101 	register unsigned long r5 __asm__("r5") = c;
102 	register unsigned long r6 __asm__("r6") = d;
103 	register unsigned long r7 __asm__("r7") = e;
104 	register unsigned long r8 __asm__("r8") = f;
105 	__asm__ __volatile__ ("l.sys 1"
106 			      : "=r"(r11)
107 			      : "r"(r11), "r"(r3), "r"(r4), "r"(r5), "r"(r6),
108 				"r"(r7), "r"(r8)
109 			      : "memory",
110 				"r12", "r13", "r15", "r17", "r19", "r21",
111 				"r23", "r25", "r27", "r29", "r31");
112 	return r11;
113 }
114 
115 #define IPC_64 0
116