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) \
58 __asm__ volatile ("###> " #name "() <###\n\t" \
61 : "0" (__NR_##name)); \
62 __sfsyscall_return(type,__res); \
65 #define _sfsyscall1(type,name,type1,arg1) \
66 type name(type1 arg1) \
69 __asm__ volatile ("###> " #name "(%2) <###\n\t" \
75 : "0" (__NR_##name),"g" ((long)(arg1))); \
76 __sfsyscall_return(type,__res); \
79 #define _sfsyscall2(type,name,type1,arg1,type2,arg2) \
80 type name(type1 arg1,type2 arg2) \
83 __asm__ volatile ("###> " #name "(%2, %3) <###\n\t" \
89 : "0" (__NR_##name),"g" ((long)(arg1)),"c" ((long)(arg2)) ); \
90 __sfsyscall_return(type,__res); \
93 #define _sfsyscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
94 type name(type1 arg1,type2 arg2,type3 arg3) \
97 __asm__ volatile ("###> " #name "(%2, %3, %4) <###\n\t" \
103 : "0" (__NR_##name),"g" ((long)(arg1)),"c" ((long)(arg2)), \
104 "d" ((long)(arg3)) ); \
105 __sfsyscall_return(type,__res); \
108 #define _sfsyscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
109 type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
112 __asm__ volatile ("###> " #name "(%2, %3, %4, %5) <###\n\t" \
118 : "0" (__NR_##name),"g" ((long)(arg1)),"c" ((long)(arg2)), \
119 "d" ((long)(arg3)),"S" ((long)(arg4)) ); \
120 __sfsyscall_return(type,__res); \
123 #define _sfsyscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
125 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
128 __asm__ volatile ("###> " #name "(%2, %3, %4, %5, %6) <###\n\t" \
134 : "0" (__NR_##name),"g" ((long)(arg1)),"c" ((long)(arg2)), \
135 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
136 __sfsyscall_return(type,__res); \
139 #define _sfsyscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
140 type5,arg5,type6,arg6) \
141 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6) \
144 __asm__ volatile ("##> " #name "(%2, %3, %4, %5, %6, %7) <###\n\t" \
147 "movl %2,%%ebx\n\t" \
148 "movl %7,%%ebp\n\t" \
153 : "0" (__NR_##name),"g" ((long)(arg1)),"c" ((long)(arg2)), \
154 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \
155 "g" ((long)(arg6))); \
156 __sfsyscall_return(type,__res); \
160 #define _sfoldsyscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
161 type5,arg5,type6,arg6) \
162 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6) \
165 __asm__ volatile ("pushl %%ebx\n\t" \
172 "movl %%esp, %%ebx\n\t" \
174 "add $0x18,%%esp\n\t" \
177 : "0" (__NR_##name),"g" ((long)(arg1)),"g" ((long)(arg2)), \
178 "g" ((long)(arg3)),"g" ((long)(arg4)),"g" ((long)(arg5)), \
179 "g" ((long)(arg6))); \
180 __sfsyscall_return(type,__res); \