diff options
Diffstat (limited to 'libc')
| -rw-r--r-- | libc/string/mips/memcpy.S | 4 | ||||
| -rw-r--r-- | libc/string/mips/memset.S | 4 | ||||
| -rw-r--r-- | libc/string/mips/sysdep.h | 46 | ||||
| -rw-r--r-- | libc/sysdeps/linux/mips/Makefile.arch | 2 | ||||
| -rw-r--r-- | libc/sysdeps/linux/mips/bits/syscalls.h | 16 | ||||
| -rw-r--r-- | libc/sysdeps/linux/mips/clone.S | 5 | ||||
| -rw-r--r-- | libc/sysdeps/linux/mips/syscall_error.S | 6 | ||||
| -rw-r--r-- | libc/sysdeps/linux/mips/sysdep.h | 343 | ||||
| -rw-r--r-- | libc/sysdeps/linux/mips/vfork.S | 1 |
9 files changed, 53 insertions, 374 deletions
diff --git a/libc/string/mips/memcpy.S b/libc/string/mips/memcpy.S index 2e42b1793..991b44eb4 100644 --- a/libc/string/mips/memcpy.S +++ b/libc/string/mips/memcpy.S @@ -17,10 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <features.h> -/*#include <sysdep.h>*/ +#include <sysdep.h> #include <endian.h> -#include "sysdep.h" #ifdef __mips64 #error mips32 code being compiled for mips64! diff --git a/libc/string/mips/memset.S b/libc/string/mips/memset.S index 4269ebc6e..8e814a49b 100644 --- a/libc/string/mips/memset.S +++ b/libc/string/mips/memset.S @@ -17,10 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <features.h> -/*#include <sysdep.h>*/ +#include <sysdep.h> #include <endian.h> -#include "sysdep.h" #ifdef __mips64 #error mips32 code being compiled for mips64! diff --git a/libc/string/mips/sysdep.h b/libc/string/mips/sysdep.h deleted file mode 100644 index 27518ac42..000000000 --- a/libc/string/mips/sysdep.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Adapted from glibc's sysdeps/unix/mips/sysdep.h */ - -/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Brendan Kehoe (brendan@zen.org). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifdef __ASSEMBLER__ - -#include <sgidefs.h> -#include <sys/regdef.h> - -#define ENTRY(name) \ - .globl name; \ - .hidden name; \ - .align 2; \ - .ent name,0; \ - name##: - -#undef END -#define END(function) \ - .end function; \ - .size function,.-function - -#if _MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _MIPS_SIM_ABIO64 -# define L(label) $L ## label -#else -# define L(label) .L ## label -#endif - -#endif diff --git a/libc/sysdeps/linux/mips/Makefile.arch b/libc/sysdeps/linux/mips/Makefile.arch index a53f888b5..1742eaac4 100644 --- a/libc/sysdeps/linux/mips/Makefile.arch +++ b/libc/sysdeps/linux/mips/Makefile.arch @@ -10,7 +10,7 @@ CSRC := __longjmp.c brk.c setjmp_aux.c mmap.c cacheflush.c \ pread_write.c sysmips.c _test_and_set.c sigaction.c SSRC := bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S syscall.S \ - syscall_error.S pipe.S + syscall_error.S pipe.S vfork.S ARCH_HEADERS := sgidefs.h sysdep.h # regdef.h diff --git a/libc/sysdeps/linux/mips/bits/syscalls.h b/libc/sysdeps/linux/mips/bits/syscalls.h index f19bd25e7..c89114401 100644 --- a/libc/sysdeps/linux/mips/bits/syscalls.h +++ b/libc/sysdeps/linux/mips/bits/syscalls.h @@ -1,5 +1,6 @@ #ifndef _BITS_SYSCALLS_H #define _BITS_SYSCALLS_H + #ifndef _SYSCALL_H # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif @@ -9,15 +10,16 @@ * programs. */ #include <bits/sysnum.h> +#ifndef __set_errno +# define __set_errno(val) (errno = (val)) +#endif + #ifndef SYS_ify -# define SYS_ify(syscall_name) (__NR_##syscall_name) +# define SYS_ify(syscall_name) __NR_##syscall_name #endif #ifndef __ASSEMBLER__ -#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \ - "$14", "$15", "$24", "$25", "memory" - #define _syscall0(type,name) \ type name(void) \ { \ @@ -263,5 +265,9 @@ type name (atype a,btype b,ctype c,dtype d,etype e,ftype f,gtype g) \ return (type)-1; \ } -#endif /* __ASSEMBLER__ */ +#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \ + "$14", "$15", "$24", "$25", "memory" + +#endif /* ! __ASSEMBLER__ */ + #endif /* _BITS_SYSCALLS_H */ diff --git a/libc/sysdeps/linux/mips/clone.S b/libc/sysdeps/linux/mips/clone.S index 65ac8b16a..59df022c5 100644 --- a/libc/sysdeps/linux/mips/clone.S +++ b/libc/sysdeps/linux/mips/clone.S @@ -22,8 +22,7 @@ #include <sys/asm.h> #include <sysdep.h> -#define _ERRNO_H 1 -#include <bits/errno.h> +#include <bits/errno_values.h> #ifdef RESET_PID #include <tls.h> #endif @@ -102,9 +101,7 @@ NESTED(__clone,4*SZREG,sp) /* Something bad happened -- no child created */ L(error): -#ifdef __UCLIBC__ move a0,v0 -#endif #ifdef __PIC__ PTR_LA t9,__syscall_error RESTORE_GP64 diff --git a/libc/sysdeps/linux/mips/syscall_error.S b/libc/sysdeps/linux/mips/syscall_error.S index 1eeca9b7e..ca4a47800 100644 --- a/libc/sysdeps/linux/mips/syscall_error.S +++ b/libc/sysdeps/linux/mips/syscall_error.S @@ -18,11 +18,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <features.h> -#include <sysdep.h> -#define _ERRNO_H -#include <bits/errno.h> #include <sys/asm.h> +#include <sysdep.h> +#include <bits/errno_values.h> #ifdef __UCLIBC_HAS_THREADS__ diff --git a/libc/sysdeps/linux/mips/sysdep.h b/libc/sysdeps/linux/mips/sysdep.h index b21ddfbe1..38d4ce903 100644 --- a/libc/sysdeps/linux/mips/sysdep.h +++ b/libc/sysdeps/linux/mips/sysdep.h @@ -1,325 +1,54 @@ -/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Adapted from glibc's sysdeps/unix/mips/sysdep.h */ -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. +/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. -#include <sys/syscall.h> -#ifdef __ASSEMBLER__ -#include <sys/regdef.h> -#endif -#include <features.h> - -/* Not that using a `PASTE' macro loses. */ -#ifdef __STDC__ - -#define SYSCALL_WEAK_ALIAS(alias,orig) \ - .weak alias; \ - alias=__libc_##orig - -/* Use the regular ELF conventions about underscores, and provide the - weak symbol, as required */ -#define SYSCALL__(name,args) PSEUDO (__libc_##name, name, args) \ -.weak __##name; \ -.weak name; \ - __##name = __libc_##name; \ - name = __libc_##name; \ -.type __libc_##name,@function; \ -.type name,@function; \ -.type __##name,@function; \ -.L__libc_##name##end: .size __libc_##name,.L__libc_##name##end - __libc_##name - -#define SYSCALL(name,args) PSEUDO (__libc_##name, name, args) \ -.weak name; \ - name = __libc_##name; \ -.type __libc_##name,@function; \ -.type name,@function; \ -.L__libc_##name##end: .size __libc_##name,.L__libc_##name##end - __libc_##name + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ -#else /* __STDC__ */ - -#define SYSCALL__(name,args) PSEUDO (__/**/name, name, args) -#define SYSCALL(name,args) PSEUDO (name, name, args) +#include <features.h> -#endif /* __STDC__ */ +#if __UCLIBC_HAS_THREADS_NATIVE__ +#include_next <sysdep.h> -#ifndef __ASSEMBLER__ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#if 0 -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL(err); \ - long result_var = INTERNAL_SYSCALL (name, err, nr, args); \ - if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \ - result_var = -1L; \ - } \ - result_var; }) #else -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL(err); \ - long result_var = INTERNAL_SYSCALL (name, err, nr, args); \ - if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \ - { \ - result_var = __syscall_error((int) result_var); \ - } \ - result_var; }) -#endif - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long err - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((long) (err)) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (val) - -#undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - internal_syscall##nr (, "li\t$2, %2\t\t\t# " #name "\n\t", \ - "i" (SYS_ify (name)), err, args) -#undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - internal_syscall##nr (= number, , "r" (__v0), err, args) - -#define internal_syscall0(ncs_init, cs_init, input, err, dummy...) \ -({ \ - long _sys_result; \ - \ - { \ - register long __v0 asm("$2") ncs_init; \ - register long __a3 asm("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - cs_init \ - "syscall\n\t" \ - ".set reorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall1(ncs_init, cs_init, input, err, arg1) \ -({ \ - long _sys_result; \ - \ - { \ - register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a3 asm("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - cs_init \ - "syscall\n\t" \ - ".set reorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input, "r" (__a0) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2) \ -({ \ - long _sys_result; \ - \ - { \ - register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a3 asm("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - cs_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input, "r" (__a0), "r" (__a1) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3)\ -({ \ - long _sys_result; \ - \ - { \ - register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - cs_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4)\ -({ \ - long _sys_result; \ - \ - { \ - register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7") = (long) arg4; \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - cs_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "+r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -/* We need to use a frame pointer for the functions in which we - adjust $sp around the syscall, or debug information and unwind - information will be $sp relative and thus wrong during the syscall. As - of GCC 3.4.3, this is sufficient. */ -#define FORCE_FRAME_POINTER alloca (4) - -#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5)\ -({ \ - long _sys_result; \ - \ - FORCE_FRAME_POINTER; \ - { \ - register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7") = (long) arg4; \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - "subu\t$29, 32\n\t" \ - "sw\t%6, 16($29)\n\t" \ - cs_init \ - "syscall\n\t" \ - "addiu\t$29, 32\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "+r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2), \ - "r" ((long)arg5) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) +#ifdef __ASSEMBLER__ -#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6)\ -({ \ - long _sys_result; \ - \ - FORCE_FRAME_POINTER; \ - { \ - register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7") = (long) arg4; \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - "subu\t$29, 32\n\t" \ - "sw\t%6, 16($29)\n\t" \ - "sw\t%7, 20($29)\n\t" \ - cs_init \ - "syscall\n\t" \ - "addiu\t$29, 32\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "+r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2), \ - "r" ((long)arg5), "r" ((long)arg6) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) +#include <sgidefs.h> +#include <sys/regdef.h> -#define internal_syscall7(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\ -({ \ - long _sys_result; \ - \ - FORCE_FRAME_POINTER; \ - { \ - register long __v0 asm("$2") ncs_init; \ - register long __a0 asm("$4") = (long) arg1; \ - register long __a1 asm("$5") = (long) arg2; \ - register long __a2 asm("$6") = (long) arg3; \ - register long __a3 asm("$7") = (long) arg4; \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - "subu\t$29, 32\n\t" \ - "sw\t%6, 16($29)\n\t" \ - "sw\t%7, 20($29)\n\t" \ - "sw\t%8, 24($29)\n\t" \ - cs_init \ - "syscall\n\t" \ - "addiu\t$29, 32\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "+r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2), \ - "r" ((long)arg5), "r" ((long)arg6), "r" ((long)arg7) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) +#define ENTRY(name) \ + .globl name; \ + .align 2; \ + .ent name,0; \ + name##: -#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \ - "$14", "$15", "$24", "$25", "memory" -#else -#define ENTRY(name) \ - .globl name; \ - .align 2; \ - .ent name,0; \ - name##: -#endif +#undef END +#define END(function) \ + .end function; \ + .size function,.-function #if _MIPS_SIM == _ABIO32 # define L(label) $L ## label #else # define L(label) .L ## label #endif + +#endif + +#endif /* __UCLIBC_HAS_THREADS_NATIVE__ */ diff --git a/libc/sysdeps/linux/mips/vfork.S b/libc/sysdeps/linux/mips/vfork.S index 3d839f588..8400df052 100644 --- a/libc/sysdeps/linux/mips/vfork.S +++ b/libc/sysdeps/linux/mips/vfork.S @@ -20,7 +20,6 @@ #include <sys/asm.h> #include <sysdep.h> -#include <sgidefs.h> #ifndef SAVE_PID #define SAVE_PID |
