diff options
Diffstat (limited to 'libc/sysdeps')
-rw-r--r-- | libc/sysdeps/linux/cris/bits/syscalls.h | 72 | ||||
-rw-r--r-- | libc/sysdeps/linux/hppa/bits/syscalls.h | 85 | ||||
-rw-r--r-- | libc/sysdeps/linux/hppa/brk.c | 2 |
3 files changed, 19 insertions, 140 deletions
diff --git a/libc/sysdeps/linux/cris/bits/syscalls.h b/libc/sysdeps/linux/cris/bits/syscalls.h index 93e7cf2d9..9db08407c 100644 --- a/libc/sysdeps/linux/cris/bits/syscalls.h +++ b/libc/sysdeps/linux/cris/bits/syscalls.h @@ -7,83 +7,19 @@ #ifndef __ASSEMBLER__ -#include <errno.h> - -#define SYS_ify(syscall_name) (__NR_##syscall_name) - -#undef _syscall0 -#define _syscall0(type,name) \ -type name(void) \ -{ \ -return (type) (INLINE_SYSCALL(name, 0)); \ -} - -#undef _syscall1 -#define _syscall1(type,name,type1,arg1) \ -type name(type1 arg1) \ -{ \ -return (type) (INLINE_SYSCALL(name, 1, arg1)); \ -} - -#undef _syscall2 -#define _syscall2(type,name,type1,arg1,type2,arg2) \ -type name(type1 arg1,type2 arg2) \ -{ \ -return (type) (INLINE_SYSCALL(name, 2, arg1, arg2)); \ -} - -#undef _syscall3 -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ -type name(type1 arg1,type2 arg2,type3 arg3) \ -{ \ -return (type) (INLINE_SYSCALL(name, 3, arg1, arg2, arg3)); \ -} - -#undef _syscall4 -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ -return (type) (INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4)); \ -} - -#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) \ -{ \ -return (type) (INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5)); \ -} - -#undef _syscall6 -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ -{ \ -return (type) (INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6)); \ -} - -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ \ - unsigned long __sys_res; \ register unsigned long __res __asm__ ("r10"); \ - LOAD_ARGS_c_##nr (args) \ + LOAD_ARGS_c_##nr(args) \ register unsigned long __callno __asm__ ("r9") \ - = SYS_ify (name); \ + = name; \ __asm__ __volatile__ (LOAD_ARGS_asm_##nr (args) \ CHECK_ARGS_asm_##nr \ "break 13" \ : "=r" (__res) \ : ASM_ARGS_##nr (args) \ : ASM_CLOBBER_##nr); \ - __sys_res = __res; \ - \ - if (__sys_res >= (unsigned long) -4096) \ - { \ - __set_errno (- __sys_res); \ - __sys_res = (unsigned long) -1; \ - } \ - __sys_res; \ + __res; \ }) #define LOAD_ARGS_c_0() diff --git a/libc/sysdeps/linux/hppa/bits/syscalls.h b/libc/sysdeps/linux/hppa/bits/syscalls.h index 9035cd5aa..783ed3246 100644 --- a/libc/sysdeps/linux/hppa/bits/syscalls.h +++ b/libc/sysdeps/linux/hppa/bits/syscalls.h @@ -6,10 +6,6 @@ #ifndef __ASSEMBLER__ -#include <errno.h> - -#define SYS_ify(syscall_name) __NR_##syscall_name - /* Assume all syscalls are done from PIC code just to be * safe. The worst case scenario is that you lose a register * and save/restore r19 across the syscall. */ @@ -44,29 +40,20 @@ #define K_CALL_CLOB_REGS "%r1", "%r2", K_USING_GR4 \ "%r20", "%r29", "%r31" -#undef K_INLINE_SYSCALL -#define K_INLINE_SYSCALL(name, nr, args...) ({ \ - long __sys_res; \ - { \ - register unsigned long __res __asm__("r28"); \ - K_LOAD_ARGS_##nr(args) \ - /* FIXME: HACK stw/ldw r19 around syscall */ \ - __asm__ __volatile__( \ - K_STW_ASM_PIC \ - " ble 0x100(%%sr2, %%r0)\n" \ - " ldi %1, %%r20\n" \ - K_LDW_ASM_PIC \ - : "=r" (__res) \ - : "i" (SYS_ify(name)) K_ASM_ARGS_##nr \ - : "memory", K_CALL_CLOB_REGS K_CLOB_ARGS_##nr \ - ); \ - __sys_res = (long)__res; \ - } \ - if ( (unsigned long)__sys_res >= (unsigned long)-4095 ){ \ - errno = -__sys_res; \ - __sys_res = -1; \ - } \ - __sys_res; \ +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) ({ \ + register unsigned long __res __asm__("r28"); \ + K_LOAD_ARGS_##nr(args) \ + /* FIXME: HACK stw/ldw r19 around syscall */ \ + __asm__ __volatile__( \ + K_STW_ASM_PIC \ + " ble 0x100(%%sr2, %%r0)\n" \ + " ldi %1, %%r20\n" \ + K_LDW_ASM_PIC \ + : "=r" (__res) \ + : "i" (name) K_ASM_ARGS_##nr \ + : "memory", K_CALL_CLOB_REGS K_CLOB_ARGS_##nr \ + ); \ + __res; \ }) #define K_LOAD_ARGS_0() @@ -107,49 +94,5 @@ #define K_CLOB_ARGS_1 K_CLOB_ARGS_2, "%r25" #define K_CLOB_ARGS_0 K_CLOB_ARGS_1, "%r26" -#define _syscall0(type,name) \ -type name(void) \ -{ \ - return (type) K_INLINE_SYSCALL(name, 0); \ -} - -#define _syscall1(type,name,type1,arg1) \ -type name(type1 arg1) \ -{ \ - return (type) K_INLINE_SYSCALL(name, 1, arg1); \ -} - -#define _syscall2(type,name,type1,arg1,type2,arg2) \ -type name(type1 arg1, type2 arg2) \ -{ \ - return (type) K_INLINE_SYSCALL(name, 2, arg1, arg2); \ -} - -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ -type name(type1 arg1, type2 arg2, type3 arg3) \ -{ \ - return (type) K_INLINE_SYSCALL(name, 3, arg1, arg2, arg3); \ -} - -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ - return (type) K_INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4); \ -} - -/* select takes 5 arguments */ -#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) \ -{ \ - return (type) K_INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5); \ -} - -/* mmap & mmap2 take 6 arguments */ -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \ -{ \ - return (type) K_INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6); \ -} - #endif /* __ASSEMBLER__ */ #endif /* _BITS_SYSCALLS_H */ diff --git a/libc/sysdeps/linux/hppa/brk.c b/libc/sysdeps/linux/hppa/brk.c index 6b9604856..5dd407bf7 100644 --- a/libc/sysdeps/linux/hppa/brk.c +++ b/libc/sysdeps/linux/hppa/brk.c @@ -30,7 +30,7 @@ brk (void *addr) { void *newbrk; - __curbrk = newbrk = (void *) K_INLINE_SYSCALL (brk, 1, addr); + __curbrk = newbrk = (void *) INLINE_SYSCALL (brk, 1, addr); if (newbrk < addr) { |