1 #ifndef _BITS_SYSCALLS_H
2 #define _BITS_SYSCALLS_H
4 # error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."
11 #define SYS_ify(syscall_name) (__NR_##syscall_name)
13 #undef _syscall_return
14 #define _syscall_return(type) \
16 if ((unsigned long) (_sc_ret) >= (unsigned long) (-125)) { \
17 __set_errno(-_sc_ret); \
21 return (type) (_sc_ret); \
24 #define _syscall_clobbers \
25 "r1", "r2", "r3", "r4", \
26 "r5", "r6", "r7", "r8", \
32 #define _syscall0(type, name) \
35 register long _sc_0 __asm__("r0") = SYS_ify (name); \
38 __asm__ __volatile__ ( \
41 " movl %%sp, %%ap \n" \
43 " addl2 $4, %%sp \n" \
44 " movl (%%sp)+, %%ap \n" \
47 : _syscall_clobbers); \
50 _syscall_return (type); \
56 #define _syscall1(type, name, type1, arg1) \
57 type name (type1 arg1) \
59 register long _sc_0 __asm__("r0") = SYS_ify (name); \
62 __asm__ __volatile__ ( \
66 " movl %%sp, %%ap \n" \
68 " addl2 $8, %%sp \n" \
69 " movl (%%sp)+, %%ap \n" \
73 : _syscall_clobbers); \
76 _syscall_return (type); \
82 #define _syscall2(type, name, type1, arg1, type2, arg2) \
83 type name (type1 arg1, \
86 register long _sc_0 __asm__("r0") = SYS_ify (name); \
89 __asm__ __volatile__ ( \
94 " movl %%sp, %%ap \n" \
96 " addl2 $12, %%sp \n" \
97 " movl (%%sp)+, %%ap \n" \
102 : _syscall_clobbers); \
105 _syscall_return (type); \
111 #define _syscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \
112 type name (type1 arg1, \
116 register long _sc_0 __asm__("r0") = SYS_ify (name); \
119 __asm__ __volatile__ ( \
125 " movl %%sp, %%ap \n" \
127 " addl2 $16, %%sp \n" \
128 " movl (%%sp)+, %%ap \n" \
134 : _syscall_clobbers); \
137 _syscall_return (type); \
143 #define _syscall4(type, name, type1, arg1, type2, arg2, type3, arg3, \
145 type name (type1 arg1, \
150 register long _sc_0 __asm__("r0") = SYS_ify (name); \
153 __asm__ __volatile__ ( \
160 " movl %%sp, %%ap \n" \
162 " addl2 $20, %%sp \n" \
163 " movl (%%sp)+, %%ap \n" \
170 : _syscall_clobbers); \
173 _syscall_return (type); \
179 #define _syscall5(type, name, type1, arg1, type2, arg2, type3, arg3, \
180 type4, arg4, type5, arg5) \
181 type name (type1 arg1, \
187 register long _sc_0 __asm__("r0") = SYS_ify (name); \
190 __asm__ __volatile__ ( \
198 " movl %%sp, %%ap \n" \
200 " addl2 $24, %%sp \n" \
201 " movl (%%sp)+, %%ap \n" \
209 : _syscall_clobbers); \
212 _syscall_return (type); \
218 #define _syscall6(type, name, type1, arg1, type2, arg2, type3, arg3, \
219 type4, arg4, type5, arg5, type6, arg6) \
220 type name (type1 arg1, \
227 register long _sc_0 __asm__("r0") = SYS_ify (name); \
230 __asm__ __volatile__ ( \
239 " movl %%sp, %%ap \n" \
241 " addl2 $28, %%sp \n" \
242 " movl (%%sp)+, %%ap \n" \
251 : _syscall_clobbers); \
254 _syscall_return (type); \
257 #endif /* __ASSEMBLER__ */
258 #endif /* _BITS_SYSCALLS_H */