| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #include <linux/types.h>
- #include <asm/unistd.h>
- /* Here are the macros which define how this platform makes
- * system calls. This particular variant does _not_ set
- * errno (note how it is disabled in __syscall_return) since
- * these will get called before the errno symbol is dynamicly
- * linked.
- by the dynamic linker. The idea is that we want to be able
- to call these before the errno symbol is dynamicly linked, so
- we use our own version here. Note that we cannot assume any
- dynamic linking at all, so we cannot return any error codes.
- We just punt if there is an error. */
- #undef __syscall_return
- #define __syscall_return(type, res) \
- do { \
- if ((unsigned long)(res) >= (unsigned long)(-125)) { \
- /*errno = -(res); */ \
- res = -1; \
- } \
- return (type) (res); \
- } while (0)
- #if defined(__PIC__)
- /*
- * PIC uses %ebx, so we need to save it during system calls
- */
- #undef _syscall1
- #define _syscall1(type,name,type1,arg1) \
- type name(type1 arg1) \
- { \
- long __res; \
- __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
- : "=a" (__res) \
- : "0" (__NR_##name),"r" ((long)(arg1))); \
- __syscall_return(type,__res); \
- }
- #undef _syscall2
- #define _syscall2(type,name,type1,arg1,type2,arg2) \
- type name(type1 arg1,type2 arg2) \
- { \
- long __res; \
- __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
- : "=a" (__res) \
- : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2))); \
- __syscall_return(type,__res); \
- }
- #undef _syscall3
- #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
- type name(type1 arg1,type2 arg2,type3 arg3) \
- { \
- long __res; \
- __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
- : "=a" (__res) \
- : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \
- "d" ((long)(arg3))); \
- __syscall_return(type,__res); \
- }
- #undef _syscall4
- #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
- type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
- { \
- long __res; \
- __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
- : "=a" (__res) \
- : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \
- "d" ((long)(arg3)),"S" ((long)(arg4))); \
- __syscall_return(type,__res); \
- }
- #undef _syscall5
- #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
- type5,arg5) \
- type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
- { \
- long __res; \
- __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
- : "=a" (__res) \
- : "0" (__NR_##name),"m" ((long)(arg1)),"c" ((long)(arg2)), \
- "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
- __syscall_return(type,__res); \
- }
- #endif /* __PIC__ */
|