10 static int errno = 1234;
12 #define __sfsyscall_return(type, res) \
14 if ((unsigned long)(res) >= (unsigned long)(-125)) { \
23 #define __sfsyscall_return(type, res) \
32 #define _sfsyscall0(type, name) \
35 __asm__ volatile("###> " #name " <###\n\t" \
40 __sfsyscall_return(type, __res); \
43 #define _sfsyscall1(type, name, type1, arg1) \
44 type name(type1 arg1) { \
46 register type1 r1 asm("r0"); \
48 asm volatile("###> " #name "(%2) <###\n\t" \
52 : "0"(__NR_##name), "r"(r1)); \
53 __sfsyscall_return(type, __res); \
56 #define _sfsyscall2(type, name, type1, arg1, type2, arg2) \
57 type name(type1 arg1, type2 arg2) { \
59 register type1 r1 asm("r1"); \
60 register type2 r2 asm("r2"); \
63 __asm__ volatile("###> " #name "(%2, %3) <###\n\t" \
69 __sfsyscall_return(type, __res); \
72 #define _sfsyscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \
73 type name(type1 arg1, type2 arg2, type3 arg3) { \
75 register type1 r0 asm("r0"); \
76 register type2 r1 asm("r1"); \
77 register type3 r2 asm("r2"); \
81 __asm__ __volatile__("###> " #name "(%2, %3, %4) <###\n\t" \
90 __sfsyscall_return(type, __res); \
93 #define _sfsyscall4(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
94 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
96 register type1 r1 asm("r1"); \
98 register type2 r2 asm("r2"); \
99 register type3 r3 asm("r3"); \
100 register type4 r4 asm("r4"); \
105 asm volatile("###> " #name "(%2, %3, %4, %5) <###\n\t" \
108 : "0"(__NR_##name), \
114 __sfsyscall_return(type, __res); \
117 #define _sfsyscall5(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5) \
118 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
121 register type1 r1 asm("r1"); \
122 register type2 r2 asm("r2"); \
123 register type3 r3 asm("r3"); \
124 register type4 r4 asm("r4"); \
125 register type5 r5 asm("r5"); \
131 asm volatile("###> " #name "(%2, %3, %4, %5, %6) <###\n\t" \
134 : "0"(__NR_##name), \
141 __sfsyscall_return(type, __res); \
144 #define _sfsyscall6(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5, type6, arg6) \
145 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
146 type5 arg5, type6 arg6) { \
148 register type1 r1 asm("r1"); \
149 register type2 r2 asm("r2"); \
150 register type3 r3 asm("r3"); \
151 register type4 r4 asm("r4"); \
152 register type5 r5 asm("r5"); \
153 register type6 r6 asm("r6"); \
160 asm volatile("###> " #name "(%2, %3, %4, %5, %6, %7) <###\n\t" \
163 : "0"(__NR_##name), \
171 __sfsyscall_return(type, __res); \