31 static int errno=1234;
33 #define __sfsyscall_return(type, res) \
35 if ((unsigned long)(res) >= (unsigned long)(-125)) { \
39 return (type) (res); \
44 #define __sfsyscall_return(type, res) \
46 return (type) (res); \
54 #define _sfsyscall0(type, name) \
57 __asm__ volatile("###> " #name " <###\n\t" \
61 : "memory", "rcx", "r11", "cc" \
63 __sfsyscall_return(type,__res); \
66 #define _sfsyscall1(type, name, type1, arg1) \
67 type name(type1 arg1) { \
69 register type1 rdi asm("rdi"); \
71 asm volatile("###> " #name "(%2) <###\n\t" \
74 : "0" (__NR_##name), \
76 : "memory", "rcx", "r11", "cc" \
78 __sfsyscall_return(type,__res); \
81 #define _sfsyscall2(type, name, type1, arg1, type2, arg2) \
82 type name(type1 arg1, type2 arg2) { \
84 register type1 rdi asm("rdi"); \
85 register type2 rsi asm("rsi"); \
88 __asm__ volatile("###> " #name "(%2, %3) <###\n\t" \
91 : "0" (__NR_##name), \
94 : "memory", "rcx", "r11", "cc" \
96 __sfsyscall_return(type, __res); \
99 #define _sfsyscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \
100 type name(type1 arg1, type2 arg2, type3 arg3) { \
102 register type1 rdi asm("rdi"); \
103 register type2 rsi asm("rsi"); \
104 register type3 rdx asm("rdx"); \
108 asm volatile("###> " #name "(%2, %3, %4) <###\n\t" \
111 : "0" (__NR_##name), \
115 : "memory", "rcx", "r11", "cc" \
117 __sfsyscall_return(type, __res); \
120 #define _sfsyscall4(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) \
121 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
123 register type1 rdi asm("rdi"); \
124 register type2 rsi asm("rsi"); \
125 register type3 rdx asm("rdx"); \
126 register type4 r10 asm("r10"); \
131 asm volatile("###> " #name "(%2, %3, %4, %5) <###\n\t" \
134 : "0" (__NR_##name), \
139 : "memory", "rcx", "r11", "cc" \
141 __sfsyscall_return(type, __res); \
144 #define _sfsyscall5(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5) \
145 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
148 register type1 rdi asm("rdi"); \
149 register type2 rsi asm("rsi"); \
150 register type3 rdx asm("rdx"); \
151 register type4 r10 asm("r10"); \
152 register type5 r8 asm("r8"); \
158 asm volatile("###> " #name "(%2, %3, %4, %5, %6) <###\n\t" \
161 : "0" (__NR_##name), \
167 : "memory", "rcx", "r11", "cc" \
169 __sfsyscall_return(type, __res); \
172 #define _sfsyscall6(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5, type6, arg6)\
173 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
174 type5 arg5, type6 arg6) { \
176 register type1 rdi asm("rdi"); \
177 register type2 rsi asm("rsi"); \
178 register type3 rdx asm("rdx"); \
179 register type4 r10 asm("r10"); \
180 register type5 r8 asm("r8"); \
181 register type6 r9 asm("r9"); \
188 asm volatile("###> " #name "(%2, %3, %4, %5, %6, %7) <###\n\t" \
191 : "0" (__NR_##name), \
198 : "memory", "rcx", "r11", "cc" \
200 __sfsyscall_return(type, __res); \