diff options
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r-- | libc/sysdeps/linux/alpha/bits/syscalls.h | 8 | ||||
-rw-r--r-- | libc/sysdeps/linux/arm/bits/syscalls.h | 16 | ||||
-rw-r--r-- | libc/sysdeps/linux/avr32/bits/syscalls.h | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bits/syscalls.h | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/bits/syscalls-common.h | 18 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/bits/syscalls.h | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/i386/bits/syscalls.h | 6 | ||||
-rw-r--r-- | libc/sysdeps/linux/ia64/bits/syscalls.h | 9 | ||||
-rw-r--r-- | libc/sysdeps/linux/mips/bits/syscalls.h | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/powerpc/bits/syscalls.h | 14 | ||||
-rw-r--r-- | libc/sysdeps/linux/sh/bits/syscalls.h | 23 | ||||
-rw-r--r-- | libc/sysdeps/linux/sparc/bits/syscalls.h | 5 | ||||
-rw-r--r-- | libc/sysdeps/linux/x86_64/bits/syscalls.h | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/xtensa/bits/syscalls.h | 3 |
14 files changed, 40 insertions, 78 deletions
diff --git a/libc/sysdeps/linux/alpha/bits/syscalls.h b/libc/sysdeps/linux/alpha/bits/syscalls.h index 6be26971f..ee56788a6 100644 --- a/libc/sysdeps/linux/alpha/bits/syscalls.h +++ b/libc/sysdeps/linux/alpha/bits/syscalls.h @@ -26,10 +26,10 @@ #ifndef __ASSEMBLER__ -#define INLINE_SYSCALL(name, nr, args...) \ +#define INLINE_SYSCALL_NCS(name, nr, args...) \ ({ \ long _sc_ret, _sc_err; \ - inline_syscall##nr(__NR_##name, args); \ + inline_syscall##nr(name, args); \ if (__builtin_expect (_sc_err, 0)) \ { \ __set_errno (_sc_ret); \ @@ -38,10 +38,10 @@ _sc_ret; \ }) -#define INTERNAL_SYSCALL(name, err_out, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \ ({ \ long _sc_ret, _sc_err; \ - inline_syscall##nr(__NR_##name, args); \ + inline_syscall##nr(name, args); \ err_out = _sc_err; \ _sc_ret; \ }) diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h index 2ad725544..1a854ffab 100644 --- a/libc/sysdeps/linux/arm/bits/syscalls.h +++ b/libc/sysdeps/linux/arm/bits/syscalls.h @@ -30,8 +30,8 @@ #include <errno.h> -#define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \ +#define INLINE_SYSCALL_NCS(name, nr, args...) \ + ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL_NCS (name, , nr, args); \ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_inline_sys_result, ), 0)) \ { \ __set_errno (INTERNAL_SYSCALL_ERRNO (_inline_sys_result, )); \ @@ -41,12 +41,12 @@ #if !defined(__thumb__) #if defined(__ARM_EABI__) -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({unsigned int __sys_result; \ { \ register int _a1 __asm__ ("r0"), _nr __asm__ ("r7"); \ LOAD_ARGS_##nr (args) \ - _nr = SYS_ify(name); \ + _nr = (name); \ __asm__ __volatile__ ("swi 0x0 @ syscall " #name \ : "=r" (_a1) \ : "r" (_nr) ASM_ARGS_##nr \ @@ -56,14 +56,14 @@ (int) __sys_result; }) #else /* defined(__ARM_EABI__) */ -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ unsigned int __sys_result; \ { \ register int _a1 __asm__ ("a1"); \ LOAD_ARGS_##nr (args) \ __asm__ __volatile__ ("swi %1 @ syscall " #name \ : "=r" (_a1) \ - : "i" (SYS_ify(name)) ASM_ARGS_##nr \ + : "i" (name) ASM_ARGS_##nr \ : "memory"); \ __sys_result = _a1; \ } \ @@ -73,13 +73,13 @@ /* We can't use push/pop inside the asm because that breaks unwinding (ie. thread cancellation). */ -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ unsigned int __sys_result; \ { \ int _sys_buf[2]; \ register int _a1 __asm__ ("a1"); \ register int *_v3 __asm__ ("v3") = _sys_buf; \ - *_v3 = (int) (SYS_ify(name)); \ + *_v3 = (int) (name); \ LOAD_ARGS_##nr (args) \ __asm__ __volatile__ ("str r7, [v3, #4]\n" \ "\tldr r7, [v3]\n" \ diff --git a/libc/sysdeps/linux/avr32/bits/syscalls.h b/libc/sysdeps/linux/avr32/bits/syscalls.h index e473b10ba..48f15d473 100644 --- a/libc/sysdeps/linux/avr32/bits/syscalls.h +++ b/libc/sysdeps/linux/avr32/bits/syscalls.h @@ -8,10 +8,10 @@ #include <errno.h> -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ \ register int _a1 __asm__("r12"); \ - register int _scno __asm__("r8") = SYS_ify(name); \ + register int _scno __asm__("r8") = name; \ LOAD_ARGS_##nr (args); \ __asm__ __volatile__("scall /* syscall " #name " */" \ : "=r" (_a1) \ diff --git a/libc/sysdeps/linux/bfin/bits/syscalls.h b/libc/sysdeps/linux/bfin/bits/syscalls.h index 478ea2dfd..6230b03d8 100644 --- a/libc/sysdeps/linux/bfin/bits/syscalls.h +++ b/libc/sysdeps/linux/bfin/bits/syscalls.h @@ -6,13 +6,13 @@ #ifndef __ASSEMBLER__ -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ \ long __res; \ __asm__ __volatile__ ( \ "excpt 0;\n\t" \ : "=q0" (__res) \ - : "qA" (__NR_##name) ASMFMT_##nr(args) \ + : "qA" (name) ASMFMT_##nr(args) \ : "memory","CC"); \ __res; \ }) diff --git a/libc/sysdeps/linux/common/bits/syscalls-common.h b/libc/sysdeps/linux/common/bits/syscalls-common.h index 81c82c801..2aef89c6e 100644 --- a/libc/sysdeps/linux/common/bits/syscalls-common.h +++ b/libc/sysdeps/linux/common/bits/syscalls-common.h @@ -31,10 +31,15 @@ /* Define a macro which expands into the inline wrapper code for a system call */ #ifndef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ +# define INLINE_SYSCALL(name, nr, args...) INLINE_SYSCALL_NCS(__NR_##name, nr, args) +#endif + +/* Just like INLINE_SYSCALL(), but take a non-constant syscall (NCS) argument */ +#ifndef INLINE_SYSCALL_NCS +# define INLINE_SYSCALL_NCS(name, nr, args...) \ ({ \ INTERNAL_SYSCALL_DECL(err); \ - long res = INTERNAL_SYSCALL(name, err, nr, args); \ + long res = INTERNAL_SYSCALL_NCS(name, err, nr, args); \ if (unlikely(INTERNAL_SYSCALL_ERROR_P(res, err))) { \ __set_errno(INTERNAL_SYSCALL_ERRNO(res, err)); \ res = -1L; \ @@ -43,6 +48,15 @@ }) #endif +/* No point in forcing people to implement both when they only need one */ +#ifndef INTERNAL_SYSCALL +# define INTERNAL_SYSCALL(name, err, nr, args...) INTERNAL_SYSCALL_NCS(__NR_##name, err, nr, args) +#endif + +#ifndef INTERNAL_SYSCALL_NCS +# error your port needs to define INTERNAL_SYSCALL_NCS in bits/syscalls.h +#endif + #ifndef _syscall0 #define C_DECL_ARGS_0() void diff --git a/libc/sysdeps/linux/common/bits/syscalls.h b/libc/sysdeps/linux/common/bits/syscalls.h index e7c6b035d..03d08d1d3 100644 --- a/libc/sysdeps/linux/common/bits/syscalls.h +++ b/libc/sysdeps/linux/common/bits/syscalls.h @@ -6,4 +6,4 @@ */ #error You have not provided architecture specific bits/syscalls.h -#error You should need to define only INTERNAL_SYSCALL +#error You should need to define only INTERNAL_SYSCALL_NCS diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h index 343b096f1..8a98a0e08 100644 --- a/libc/sysdeps/linux/i386/bits/syscalls.h +++ b/libc/sysdeps/linux/i386/bits/syscalls.h @@ -96,16 +96,16 @@ __asm__ (".L__X'%ebx = 1\n\t" ".endm\n\t"); #endif -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ \ register unsigned int resultvar; \ - __asm__ __volatile__ ( \ + __asm__ __volatile__ ( \ LOADARGS_##nr \ "movl %1, %%eax\n\t" \ "int $0x80\n\t" \ RESTOREARGS_##nr \ : "=a" (resultvar) \ - : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \ + : "i" (name) ASMFMT_##nr(args) : "memory", "cc"); \ (int) resultvar; }) #define LOADARGS_0 diff --git a/libc/sysdeps/linux/ia64/bits/syscalls.h b/libc/sysdeps/linux/ia64/bits/syscalls.h index 81b2cf402..9fda3d07a 100644 --- a/libc/sysdeps/linux/ia64/bits/syscalls.h +++ b/libc/sysdeps/linux/ia64/bits/syscalls.h @@ -61,12 +61,9 @@ : "memory" ASM_CLOBBERS_##nr); \ _retval = _r8; -#define DO_INLINE_SYSCALL(name, nr, args...) \ - DO_INLINE_SYSCALL_NCS (__NR_##name, nr, ##args) - -#define INLINE_SYSCALL(name, nr, args...) \ +#define INLINE_SYSCALL_NCS(name, nr, args...) \ ({ \ - DO_INLINE_SYSCALL_NCS (__NR_##name, nr, args) \ + DO_INLINE_SYSCALL_NCS (name, nr, args) \ if (_r10 == -1) \ { \ __set_errno (_retval); \ @@ -81,8 +78,6 @@ DO_INLINE_SYSCALL_NCS (name, nr, args) \ err = _r10; \ _retval; }) -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) #define INTERNAL_SYSCALL_ERROR_P(val, err) (err == -1) diff --git a/libc/sysdeps/linux/mips/bits/syscalls.h b/libc/sysdeps/linux/mips/bits/syscalls.h index 07e0fe439..363991368 100644 --- a/libc/sysdeps/linux/mips/bits/syscalls.h +++ b/libc/sysdeps/linux/mips/bits/syscalls.h @@ -19,9 +19,9 @@ /* Define a macro which expands into the inline wrapper code for a system call. */ -#define INLINE_SYSCALL(name, nr, args...) \ +#define INLINE_SYSCALL_NCS(name, nr, args...) \ ({ INTERNAL_SYSCALL_DECL(err); \ - long result_var = INTERNAL_SYSCALL (name, err, nr, args); \ + long result_var = INTERNAL_SYSCALL_NCS (name, err, nr, args); \ if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \ { \ __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \ diff --git a/libc/sysdeps/linux/powerpc/bits/syscalls.h b/libc/sysdeps/linux/powerpc/bits/syscalls.h index e11c362c8..f689c60ae 100644 --- a/libc/sysdeps/linux/powerpc/bits/syscalls.h +++ b/libc/sysdeps/linux/powerpc/bits/syscalls.h @@ -130,18 +130,6 @@ (int) r3; \ }) -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - INTERNAL_SYSCALL_DECL (sc_err); \ - long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ - sc_ret = -1L; \ - } \ - sc_ret; \ - }) - /* Define a macro which expands inline into the wrapper code for a system call. This use is for internal calls that do not need to handle errors normally. It will never touch errno. @@ -177,8 +165,6 @@ err = r0; \ (int) r3; \ }) -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) # define INTERNAL_SYSCALL_ERROR_P(val, err) \ ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) diff --git a/libc/sysdeps/linux/sh/bits/syscalls.h b/libc/sysdeps/linux/sh/bits/syscalls.h index 6e7ddbb3c..c69dce537 100644 --- a/libc/sysdeps/linux/sh/bits/syscalls.h +++ b/libc/sysdeps/linux/sh/bits/syscalls.h @@ -112,29 +112,6 @@ register long int r1 __asm__ ("%r1") = (long int) (_arg6); \ register long int r2 __asm__ ("%r2") = (long int) (_arg7) -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int __resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (__resultvar, ), 0)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (__resultvar, )); \ - __resultvar = 0xffffffff; \ - } \ - (int) __resultvar; }) - -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - ({ \ - unsigned long int resultvar; \ - register long int r3 __asm__ ("%r3") = SYS_ify (name); \ - SUBSTITUTE_ARGS_##nr(args); \ - \ - __asm__ volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \ - : "=z" (resultvar) \ - : "r" (r3) ASMFMT_##nr \ - : "memory"); \ - \ - (int) resultvar; }) - /* The _NCS variant allows non-constant syscall numbers. */ #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ \ diff --git a/libc/sysdeps/linux/sparc/bits/syscalls.h b/libc/sysdeps/linux/sparc/bits/syscalls.h index 55420104b..78f143911 100644 --- a/libc/sysdeps/linux/sparc/bits/syscalls.h +++ b/libc/sysdeps/linux/sparc/bits/syscalls.h @@ -35,11 +35,6 @@ #define DEBUG_SYSCALL(name) do{} while(0) #endif - -#define INTERNAL_SYSCALL( name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS( __NR_##name, err, nr, args ) - - #define INTERNAL_SYSCALL_NCS(sys_num, err, nr, args...) \ ({ \ unsigned int __res; \ diff --git a/libc/sysdeps/linux/x86_64/bits/syscalls.h b/libc/sysdeps/linux/x86_64/bits/syscalls.h index 3aabe67c6..d16addb4a 100644 --- a/libc/sysdeps/linux/x86_64/bits/syscalls.h +++ b/libc/sysdeps/linux/x86_64/bits/syscalls.h @@ -76,8 +76,6 @@ : "=a" (resultvar) \ : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx"); \ (long) resultvar; }) -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) #define LOAD_ARGS_0() #define LOAD_REGS_0 diff --git a/libc/sysdeps/linux/xtensa/bits/syscalls.h b/libc/sysdeps/linux/xtensa/bits/syscalls.h index 6b87acea4..cc6c41e10 100644 --- a/libc/sysdeps/linux/xtensa/bits/syscalls.h +++ b/libc/sysdeps/linux/xtensa/bits/syscalls.h @@ -81,8 +81,5 @@ : "memory"); \ (long) _a2; }) -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) - #endif /* not __ASSEMBLER__ */ #endif /* _BITS_SYSCALLS_H */ |