diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2003-03-17 15:47:13 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2003-03-17 15:47:13 +0000 |
commit | 4947b4b20f49324647a7cbcd2596b1f5b4639748 (patch) | |
tree | 0447ee1cce55994f03a92ba7413268c51be85d11 | |
parent | de4471dd559ab27a8927135fb5a475eaa613c437 (diff) | |
download | glibc-4947b4b20f49324647a7cbcd2596b1f5b4639748.tar.gz glibc-4947b4b20f49324647a7cbcd2596b1f5b4639748.tar.xz glibc-4947b4b20f49324647a7cbcd2596b1f5b4639748.zip |
* sysdeps/mips/bits/wordsize.h: New file, appropriate for all 3 ABIs. * sysdeps/mips/mips64/gmp-mparam.h: New file. Define BITS_PER_LONGINT to __WORDSIZE, to match all 3 ABIs. * sysdeps/mips/setjmp_aux.c (STRINGXP, REGS, PTRS): New macros. (__sigsetjmp_aux): Use them. Adjust for all 3 ABIs. * sysdeps/mips/elf/start.S: Adjust for all 3 ABIs. * sysdeps/unix/mips/brk.S: Likewise. * sysdeps/unix/mips/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/mips/clone.S: Likewise. * sysdeps/mips/bits/setjmp.h (__jmp_buf): Likewise. * sysdeps/mips/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/mips/sys/profcs.h: Likewise. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/mips/kernel_stat.h: Likewise. * sysdeps/mips/mips64/bsd-_setjmp.S: Likewise. * sysdeps/mips/mips64/bsd-setjmp.S: Likewise. * sysdeps/mips/mips64/setjmp.S: Likewise. * sysdeps/mips/mips64/bits/setjmp.h: Deleted, obsolete. * sysdeps/mips/mips64/soft-fp/sfp-machine.h: Use long long for 64-bit types.
2003-03-17 Alexandre Oliva <aoliva@redhat.com> * sysdeps/mips/bits/wordsize.h: New file, appropriate for all 3 ABIs. * sysdeps/mips/mips64/gmp-mparam.h: New file. Define BITS_PER_LONGINT to __WORDSIZE, to match all 3 ABIs. * sysdeps/mips/setjmp_aux.c (STRINGXP, REGS, PTRS): New macros. (__sigsetjmp_aux): Use them. Adjust for all 3 ABIs. * sysdeps/mips/elf/start.S: Adjust for all 3 ABIs. * sysdeps/unix/mips/brk.S: Likewise. * sysdeps/unix/mips/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/mips/clone.S: Likewise. * sysdeps/mips/bits/setjmp.h (__jmp_buf): Likewise. * sysdeps/mips/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/mips/sys/profcs.h: Likewise. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Likewise. * sysdeps/unix/sysv/linux/mips/kernel_stat.h: Likewise. * sysdeps/mips/mips64/bsd-_setjmp.S: Likewise. * sysdeps/mips/mips64/bsd-setjmp.S: Likewise. * sysdeps/mips/mips64/setjmp.S: Likewise. * sysdeps/mips/mips64/bits/setjmp.h: Deleted, obsolete. * sysdeps/mips/mips64/soft-fp/sfp-machine.h: Use long long for 64-bit types.
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | sysdeps/mips/bits/setjmp.h | 19 | ||||
-rw-r--r-- | sysdeps/mips/bits/wordsize.h | 19 | ||||
-rw-r--r-- | sysdeps/mips/elf/start.S | 59 | ||||
-rw-r--r-- | sysdeps/mips/mips64/bits/setjmp.h | 57 | ||||
-rw-r--r-- | sysdeps/mips/mips64/bsd-_setjmp.S | 19 | ||||
-rw-r--r-- | sysdeps/mips/mips64/bsd-setjmp.S | 20 | ||||
-rw-r--r-- | sysdeps/mips/mips64/gmp-mparam.h | 31 | ||||
-rw-r--r-- | sysdeps/mips/mips64/setjmp.S | 12 | ||||
-rw-r--r-- | sysdeps/mips/mips64/soft-fp/sfp-machine.h | 6 | ||||
-rw-r--r-- | sysdeps/mips/setjmp_aux.c | 38 | ||||
-rw-r--r-- | sysdeps/mips/sys/ucontext.h | 20 | ||||
-rw-r--r-- | sysdeps/unix/mips/brk.S | 7 | ||||
-rw-r--r-- | sysdeps/unix/mips/sysdep.S | 52 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/clone.S | 40 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/kernel_stat.h | 25 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/sys/procfs.h | 16 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/sys/ucontext.h | 10 |
18 files changed, 305 insertions, 169 deletions
diff --git a/ChangeLog b/ChangeLog index b0267dfeb4..e5df07e8dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2003-03-17 Alexandre Oliva <aoliva@redhat.com> + + * sysdeps/mips/bits/wordsize.h: New file, appropriate for all + 3 ABIs. + * sysdeps/mips/mips64/gmp-mparam.h: New file. Define + BITS_PER_LONGINT to __WORDSIZE, to match all 3 ABIs. + * sysdeps/mips/setjmp_aux.c (STRINGXP, REGS, PTRS): New macros. + (__sigsetjmp_aux): Use them. Adjust for all 3 ABIs. + * sysdeps/mips/elf/start.S: Adjust for all 3 ABIs. + * sysdeps/unix/mips/brk.S: Likewise. + * sysdeps/unix/mips/sysdep.S: Likewise. + * sysdeps/unix/sysv/linux/mips/clone.S: Likewise. + * sysdeps/mips/bits/setjmp.h (__jmp_buf): Likewise. + * sysdeps/mips/sys/ucontext.h: Likewise. + * sysdeps/unix/sysv/linux/mips/sys/profcs.h: Likewise. + * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Likewise. + * sysdeps/unix/sysv/linux/mips/kernel_stat.h: Likewise. + * sysdeps/mips/mips64/bsd-_setjmp.S: Likewise. + * sysdeps/mips/mips64/bsd-setjmp.S: Likewise. + * sysdeps/mips/mips64/setjmp.S: Likewise. + * sysdeps/mips/mips64/bits/setjmp.h: Deleted, obsolete. + * sysdeps/mips/mips64/soft-fp/sfp-machine.h: Use long long for + 64-bit types. + 2003-03-16 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/clock_settime.c (HANDLE_REALTIME): Define tv here, diff --git a/sysdeps/mips/bits/setjmp.h b/sysdeps/mips/bits/setjmp.h index 8cb53ee291..fa48676445 100644 --- a/sysdeps/mips/bits/setjmp.h +++ b/sysdeps/mips/bits/setjmp.h @@ -1,5 +1,6 @@ /* Define the machine-dependent type `jmp_buf'. MIPS version. - Copyright (C) 1992,93,95,97,2000 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 1995, 1997, 2000, 2002, 2003 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,25 +25,33 @@ typedef struct { /* Program counter. */ - void * __pc; + __ptr_t __pc; /* Stack pointer. */ - void * __sp; + __ptr_t __sp; /* Callee-saved registers s0 through s7. */ +#if _MIPS_SIM == _MIPS_SIM_ABI32 int __regs[8]; +#else + __extension__ long long __regs[8]; +#endif /* The frame pointer. */ - void * __fp; + __ptr_t __fp; /* The global pointer. */ - void * __gp; + __ptr_t __gp; /* Floating point status register. */ int __fpc_csr; /* Callee-saved floating point registers. */ +#if _MIPS_SIM == _MIPS_SIM_ABI32 double __fpregs[6]; +#else + double __fpregs[8]; +#endif } __jmp_buf[1]; #ifdef __USE_MISC diff --git a/sysdeps/mips/bits/wordsize.h b/sysdeps/mips/bits/wordsize.h new file mode 100644 index 0000000000..666c7ad07e --- /dev/null +++ b/sysdeps/mips/bits/wordsize.h @@ -0,0 +1,19 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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. */ + +#define __WORDSIZE _MIPS_SZPTR diff --git a/sysdeps/mips/elf/start.S b/sysdeps/mips/elf/start.S index e85e9f535e..7567423f00 100644 --- a/sysdeps/mips/elf/start.S +++ b/sysdeps/mips/elf/start.S @@ -1,5 +1,6 @@ /* Startup code compliant to the ELF Mips ABI. - Copyright (C) 1995, 1997, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995, 1997, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,6 +20,7 @@ #define __ASSEMBLY__ 1 #include <entry.h> +#include <sys/asm.h> #ifndef ENTRY_POINT #error ENTRY_POINT needs to be defined for start.S on MIPS/ELF. @@ -52,42 +54,41 @@ char **argv, void (*init) (void), void (*fini) (void), void (*rtld_fini) (void), void *stack_end) */ -#ifdef __PIC__ -/* A macro to (re)initialize gp. We can get the run time address of 0f in - ra ($31) by blezal instruction. In this early phase, we can't save gp - in stack and .cprestore doesn't work properly. So we set gp by using - this macro. */ -#define SET_GP \ - .set noreorder; \ - bltzal $0,0f; \ - nop; \ -0: .cpload $31; \ - .set reorder; -#endif - + .text .globl ENTRY_POINT .type ENTRY_POINT,@function ENTRY_POINT: #ifdef __PIC__ - SET_GP + SETUP_GPX($0) + SETUP_GPX64($25,$0) #else - la $28, _gp /* Setup GP correctly if we're non-PIC. */ -#endif + PTR_LA $28, _gp /* Setup GP correctly if we're non-PIC. */ move $31, $0 +#endif - la $4, main /* main */ - lw $5, 0($29) /* argc */ - addu $6, $29, 4 /* argv */ - /* Allocate space on the stack for seven arguments and make sure - the stack is aligned to double words (8 bytes). */ - and $29, 0xfffffff8 - subu $29, 32 - la $7, __libc_csu_init /* init */ - la $8, __libc_csu_fini - sw $8, 16($29) /* fini */ - sw $2, 20($29) /* rtld_fini */ - sw $29, 24($29) /* stack_end */ + PTR_LA $4, main /* main */ + PTR_L $5, 0($29) /* argc */ + PTR_ADDIU $6, $29, PTRSIZE /* argv */ + + /* Allocate space on the stack for seven arguments (o32 only) + and make sure the stack is aligned to double words (8 bytes) + on o32 and quad words (16 bytes) on n32 and n64. */ + + and $29, -2 * SZREG +#if _MIPS_SIM == _MIPS_SIM_ABI32 + PTR_SUBIU $29, 32 +#endif + PTR_LA $7, __libc_csu_init /* init */ + PTR_LA $8, __libc_csu_fini +#if _MIPS_SIM == _MIPS_SIM_ABI32 + PTR_S $8, 16($29) /* fini */ + PTR_S $2, 20($29) /* rtld_fini */ + PTR_S $29, 24($29) /* stack_end */ +#else + move $9, $2 /* rtld_fini */ + move $10, $29 /* stack_end */ +#endif jal __libc_start_main hlt: b hlt /* Crash if somehow it does return. */ diff --git a/sysdeps/mips/mips64/bits/setjmp.h b/sysdeps/mips/mips64/bits/setjmp.h deleted file mode 100644 index e126427dbd..0000000000 --- a/sysdeps/mips/mips64/bits/setjmp.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Define the machine-dependent type `jmp_buf'. MIPS version. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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. */ - -#ifndef _SETJMP_H -# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." -#endif - -typedef struct - { - /* Program counter. */ - __ptr_t __pc; - - /* Stack pointer. */ - __ptr_t __sp; - - /* Callee-saved registers s0 through s7. */ - int __regs[8]; - - /* The frame pointer. */ - __ptr_t __fp; - - /* The global pointer. */ - __ptr_t __gp; - - /* Floating point status register. */ - int __fpc_csr; - - /* Callee-saved floating point registers. */ - double __fpregs[8]; - } __jmp_buf[1]; - -#ifdef __USE_MISC -/* Offset to the program counter in `jmp_buf'. */ -# define JB_PC 0 -#endif - - -/* Test if longjmp to JMPBUF would unwind the frame - containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((__ptr_t) (address) < (jmpbuf)[0].__sp) diff --git a/sysdeps/mips/mips64/bsd-_setjmp.S b/sysdeps/mips/mips64/bsd-_setjmp.S index c0ff0d7621..9d79ab0a2f 100644 --- a/sysdeps/mips/mips64/bsd-_setjmp.S +++ b/sysdeps/mips/mips64/bsd-_setjmp.S @@ -1,5 +1,5 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. MIPS64 version. - Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,10 +28,19 @@ #endif ENTRY (_setjmp) #ifdef __PIC__ - .cpload t9 + SETUP_GP #endif - dla t9, C_SYMBOL_NAME (__sigsetjmp) + SETUP_GP64 (v0, C_SYMBOL_NAME (_setjmp)) + PTR_LA t9, C_SYMBOL_NAME (__sigsetjmp) +#if _MIPS_SIM == _MIPS_SIM_ABI32 nop - jr t9 - dli a1, 0 /* Pass a second argument of zero. */ +#endif + RESTORE_GP64 + move a1, zero /* Pass a second argument of zero. */ +#ifdef __PIC__ + jr t9 +#else + j C_SYMBOL_NAME (__sigsetjmp) +#endif + .end _setjmp libc_hidden_def (_setjmp) diff --git a/sysdeps/mips/mips64/bsd-setjmp.S b/sysdeps/mips/mips64/bsd-setjmp.S index ee8678728c..f542cb565f 100644 --- a/sysdeps/mips/mips64/bsd-setjmp.S +++ b/sysdeps/mips/mips64/bsd-setjmp.S @@ -1,5 +1,5 @@ /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. MIPS64 version. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,15 +22,25 @@ in setjmp doesn't clobber the state restored by longjmp. */ #include <sysdep.h> +#include <sys/asm.h> #ifdef PIC .option pic2 #endif ENTRY (setjmp) -#ifdef PIC - .cpload t9 +#ifdef __PIC__ + SETUP_GP #endif - dla t9, C_SYMBOL_NAME (__sigsetjmp) + SETUP_GP64 (v0, C_SYMBOL_NAME (setjmp)) + PTR_LA t9, C_SYMBOL_NAME (__sigsetjmp) +#if _MIPS_SIM == _MIPS_SIM_ABI32 nop - jr t9 +#endif + RESTORE_GP64 dli a1, 1 /* Pass a second argument of one. */ +#ifdef __PIC__ + jr t9 +#else + j C_SYMBOL_NAME (__sigsetjmp) +#endif + .end setjmp diff --git a/sysdeps/mips/mips64/gmp-mparam.h b/sysdeps/mips/mips64/gmp-mparam.h new file mode 100644 index 0000000000..7666137a21 --- /dev/null +++ b/sysdeps/mips/mips64/gmp-mparam.h @@ -0,0 +1,31 @@ +/* gmp-mparam.h -- Compiler/machine parameter header file. + +Copyright (C) 1991, 1993, 1994, 2002, 2003 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#if defined __GMP_H__ && ! defined _LONG_LONG_LIMB +#error "Included too late for _LONG_LONG_LIMB to take effect" +#endif + +#define _LONG_LONG_LIMB +#define BITS_PER_MP_LIMB 64 +#define BYTES_PER_MP_LIMB 8 +#define BITS_PER_LONGINT __WORDSIZE +#define BITS_PER_INT 32 +#define BITS_PER_SHORTINT 16 +#define BITS_PER_CHAR 8 diff --git a/sysdeps/mips/mips64/setjmp.S b/sysdeps/mips/mips64/setjmp.S index 5e18897d88..3d2bf20e7c 100644 --- a/sysdeps/mips/mips64/setjmp.S +++ b/sysdeps/mips/mips64/setjmp.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,6 +17,7 @@ 02111-1307 USA. */ #include <sysdep.h> +#include <sys/asm.h> /* The function __sigsetjmp_aux saves all the registers, but it can't reliably access the stack or frame pointers, so we pass them in as @@ -26,10 +27,15 @@ #endif ENTRY (__sigsetjmp) #ifdef __PIC__ - .cpload t9 + SETUP_GP #endif + SETUP_GP64 (v0, C_SYMBOL_NAME (__sigsetjmp)) move a2, sp move a3, fp - dla t9, __sigsetjmp_aux + PTR_LA t9, __sigsetjmp_aux +#if _MIPS_SIM == _MIPS_SIM_ABI32 nop +#endif + RESTORE_GP64 jr t9 + .end __sigsetjmp diff --git a/sysdeps/mips/mips64/soft-fp/sfp-machine.h b/sysdeps/mips/mips64/soft-fp/sfp-machine.h index 730deae872..309a14a5f8 100644 --- a/sysdeps/mips/mips64/soft-fp/sfp-machine.h +++ b/sysdeps/mips/mips64/soft-fp/sfp-machine.h @@ -1,7 +1,7 @@ #define _FP_W_TYPE_SIZE 64 -#define _FP_W_TYPE unsigned long -#define _FP_WS_TYPE signed long -#define _FP_I_TYPE long +#define _FP_W_TYPE unsigned long long +#define _FP_WS_TYPE signed long long +#define _FP_I_TYPE long long #define _FP_MUL_MEAT_S(R,X,Y) \ _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) diff --git a/sysdeps/mips/setjmp_aux.c b/sysdeps/mips/setjmp_aux.c index 1cd2b2155e..9e6766f949 100644 --- a/sysdeps/mips/setjmp_aux.c +++ b/sysdeps/mips/setjmp_aux.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Brendan Kehoe (brendan@zen.org). @@ -18,6 +18,11 @@ 02111-1307 USA. */ #include <setjmp.h> +#include <sys/asm.h> + +#define STRINGXP(X) __STRING(X) +#define REGS STRINGXP(REG_S) +#define PTRS STRINGXP(PTR_S) /* This function is only called via the assembly language routine __sigsetjmp, which arranges to pass in the stack pointer and the frame @@ -28,15 +33,26 @@ int __sigsetjmp_aux (jmp_buf env, int savemask, int sp, int fp) { /* Store the floating point callee-saved registers... */ +#if _MIPS_SIM == _MIPS_SIM_ABI32 asm volatile ("s.d $f20, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[0])); asm volatile ("s.d $f22, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[1])); asm volatile ("s.d $f24, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[2])); asm volatile ("s.d $f26, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[3])); asm volatile ("s.d $f28, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[4])); asm volatile ("s.d $f30, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[5])); +#else + asm volatile ("s.d $f24, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[0])); + asm volatile ("s.d $f25, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[1])); + asm volatile ("s.d $f26, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[2])); + asm volatile ("s.d $f27, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[3])); + asm volatile ("s.d $f28, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[4])); + asm volatile ("s.d $f29, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[5])); + asm volatile ("s.d $f30, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[6])); + asm volatile ("s.d $f31, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[7])); +#endif /* .. and the PC; */ - asm volatile ("sw $31, %0" : : "m" (env[0].__jmpbuf[0].__pc)); + asm volatile (PTRS " $31, %0" : : "m" (env[0].__jmpbuf[0].__pc)); /* .. and the stack pointer; */ env[0].__jmpbuf[0].__sp = (void *) sp; @@ -45,17 +61,17 @@ __sigsetjmp_aux (jmp_buf env, int savemask, int sp, int fp) env[0].__jmpbuf[0].__fp = (void *) fp; /* .. and the GP; */ - asm volatile ("sw $gp, %0" : : "m" (env[0].__jmpbuf[0].__gp)); + asm volatile (PTRS " $gp, %0" : : "m" (env[0].__jmpbuf[0].__gp)); /* .. and the callee-saved registers; */ - asm volatile ("sw $16, %0" : : "m" (env[0].__jmpbuf[0].__regs[0])); - asm volatile ("sw $17, %0" : : "m" (env[0].__jmpbuf[0].__regs[1])); - asm volatile ("sw $18, %0" : : "m" (env[0].__jmpbuf[0].__regs[2])); - asm volatile ("sw $19, %0" : : "m" (env[0].__jmpbuf[0].__regs[3])); - asm volatile ("sw $20, %0" : : "m" (env[0].__jmpbuf[0].__regs[4])); - asm volatile ("sw $21, %0" : : "m" (env[0].__jmpbuf[0].__regs[5])); - asm volatile ("sw $22, %0" : : "m" (env[0].__jmpbuf[0].__regs[6])); - asm volatile ("sw $23, %0" : : "m" (env[0].__jmpbuf[0].__regs[7])); + asm volatile (REGS " $16, %0" : : "m" (env[0].__jmpbuf[0].__regs[0])); + asm volatile (REGS " $17, %0" : : "m" (env[0].__jmpbuf[0].__regs[1])); + asm volatile (REGS " $18, %0" : : "m" (env[0].__jmpbuf[0].__regs[2])); + asm volatile (REGS " $19, %0" : : "m" (env[0].__jmpbuf[0].__regs[3])); + asm volatile (REGS " $20, %0" : : "m" (env[0].__jmpbuf[0].__regs[4])); + asm volatile (REGS " $21, %0" : : "m" (env[0].__jmpbuf[0].__regs[5])); + asm volatile (REGS " $22, %0" : : "m" (env[0].__jmpbuf[0].__regs[6])); + asm volatile (REGS " $23, %0" : : "m" (env[0].__jmpbuf[0].__regs[7])); /* .. and finally get and reconstruct the floating point csr. */ asm ("cfc1 %0, $31" : "=r" (env[0].__jmpbuf[0].__fpc_csr)); diff --git a/sysdeps/mips/sys/ucontext.h b/sysdeps/mips/sys/ucontext.h index 90c992dae6..90aa09a80f 100644 --- a/sysdeps/mips/sys/ucontext.h +++ b/sysdeps/mips/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,7 +25,11 @@ #include <signal.h> /* Type for general register. */ -typedef unsigned int greg_t; +#if _MIPS_SIM == _MIPS_SIM_ABI32 +typedef __uint32_t greg_t; +#else +typedef __uint64_t greg_t; +#endif /* Number of general registers. */ #define NGREG 36 @@ -115,9 +119,15 @@ typedef struct fpregset { union { +#if _MIPS_SIM == _MIPS_SIM_ABI32 double fp_dregs[16]; float fp_fregs[32]; unsigned int fp_regs[32]; +#else + double fp_dregs[32]; + /* float fp_fregs[32]; */ + __uint64_t fp_regs[32]; +#endif } fp_r; unsigned int fp_csr; unsigned int fp_pad; @@ -133,12 +143,16 @@ typedef struct /* Userlevel context. */ typedef struct ucontext { +#if _MIPS_SIM == _MIPS_SIM_ABI32 unsigned long int uc_flags; +#else + __uint64_t uc_flags; +#endif struct ucontext *uc_link; __sigset_t uc_sigmask; stack_t uc_stack; mcontext_t uc_mcontext; - long int uc_filler[48]; + int uc_filler[48]; } ucontext_t; #endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/mips/brk.S b/sysdeps/unix/mips/brk.S index f094cda19b..a35b8b9113 100644 --- a/sysdeps/unix/mips/brk.S +++ b/sysdeps/unix/mips/brk.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1997, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Brendan Kehoe (brendan@zen.org). @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include <sysdep.h> +#include <sys/asm.h> #ifndef SYS_brk #define SYS_brk 17 @@ -37,9 +38,9 @@ SYSCALL__(brk, 1) .set reorder /* Handle the query case. */ bnez a0, 1f - move a0,v0 + move a0, v0 1: /* Update __curbrk and exit cleanly. */ - sw a0, __curbrk + PTR_S a0, __curbrk move v0, zero jr ra PSEUDO_END(__brk) diff --git a/sysdeps/unix/mips/sysdep.S b/sysdeps/unix/mips/sysdep.S index a1adf677f9..09e8a0ac7a 100644 --- a/sysdeps/unix/mips/sysdep.S +++ b/sysdeps/unix/mips/sysdep.S @@ -24,24 +24,27 @@ #ifdef _LIBC_REENTRANT +LOCALSZ= 3 +FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK +RAOFF= FRAMESZ-(1*SZREG) +GPOFF= FRAMESZ-(2*SZREG) +V0OFF= FRAMESZ-(3*SZREG) + ENTRY(__syscall_error) #ifdef __PIC__ - .set noreorder - .set noat - move AT, ra - bltzal zero, 0f - nop -0: .cpload ra - move ra, AT - .set at - .set reorder + .set noat + SETUP_GPX (AT) + .set at #endif - subu sp, 32 + PTR_SUBU sp, FRAMESZ + .set noat + SETUP_GPX64(GPOFF,AT) + .set at #ifdef __PIC__ - .cprestore 16 + SAVE_GP(GPOFF) #endif - sw v0, 20(sp) - sw ra, 24(sp) + REG_S v0, V0OFF(sp) + REG_S ra, RAOFF(sp) #if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN /* We translate the system's EWOULDBLOCK error into EAGAIN. @@ -56,12 +59,13 @@ L(skip): jal __errno_location /* Store the error value. */ - lw t0, 20(sp) - sw t0, 0(v0) + REG_L t4, V0OFF(sp) + sw t4, 0(v0) /* And just kick back a -1. */ - lw ra, 24(sp) - addiu sp, 32 + REG_L ra, RAOFF(sp) + RESTORE_GP64 + PTR_ADDU sp, FRAMESZ li v0, -1 j ra END(__syscall_error) @@ -71,16 +75,10 @@ L(skip): ENTRY(__syscall_error) #ifdef __PIC__ - .set noreorder - .set noat - move AT, ra - bltzal zero, 0f - nop -0: .cpload ra - move ra, AT - .set at - .set reorder + SETUP_GPX (AT) #endif + SETUP_GPX64 (t9, AT) + #if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN /* We translate the system's EWOULDBLOCK error into EAGAIN. The GNU C library always defines EWOULDBLOCK==EAGAIN. @@ -94,6 +92,8 @@ L(skip): /* And just kick back a -1. */ li v0, -1 + + RESTORE_GP64 j ra END(__syscall_error) #endif /* _LIBC_REENTRANT */ diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S index 2b02a2ba9b..7af2a1652a 100644 --- a/sysdeps/unix/sysv/linux/mips/clone.S +++ b/sysdeps/unix/sysv/linux/mips/clone.S @@ -29,15 +29,17 @@ /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ .text +LOCALSZ= 1 +FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK +GPOFF= FRAMESZ-(1*SZREG) NESTED(__clone,4*SZREG,sp) #ifdef __PIC__ - .set noreorder - .cpload $25 - .set reorder - subu sp,32 - .cprestore 16 -#else - subu sp,32 + SETUP_GP +#endif + PTR_SUBU sp, FRAMESZ + SETUP_GP64 (GPOFF, __clone) +#ifdef __PIC__ + SAVE_GP (GPOFF) #endif #ifdef PROF .set noat @@ -52,9 +54,9 @@ NESTED(__clone,4*SZREG,sp) beqz a0,L(error) /* No NULL function pointers. */ beqz a1,L(error) /* No NULL stack pointers. */ - subu a1,32 /* Reserve argument save space. */ - sw a0,0(a1) /* Save function pointer. */ - sw a3,4(a1) /* Save argument pointer. */ + PTR_SUBU a1,32 /* Reserve argument save space. */ + PTR_S a0,0(a1) /* Save function pointer. */ + PTR_S a3,PTRSIZE(a1) /* Save argument pointer. */ /* Do the system call */ @@ -66,16 +68,20 @@ NESTED(__clone,4*SZREG,sp) beqz v0,L(thread_start) /* Successful return from the parent */ - addiu sp,32 + RESTORE_GP64 + PTR_ADDU sp, FRAMESZ ret /* Something bad happened -- no child created */ L(error): - addiu sp,32 #ifdef __PIC__ - la t9,__syscall_error + PTR_LA t9,__syscall_error + RESTORE_GP64 + PTR_ADDU sp, FRAMESZ jr t9 #else + RESTORE_GP64 + PTR_ADDU sp, FRAMESZ j __syscall_error #endif END(__clone) @@ -86,11 +92,11 @@ L(error): L(thread_start): /* cp is already loaded. */ - .cprestore 16 + SAVE_GP (GPOFF) /* The stackframe has been created on entry of clone(). */ /* Restore the arg for user's function. */ - lw t9,0(sp) /* Function pointer. */ - lw a0,4(sp) /* Argument pointer. */ + PTR_L t9,0(sp) /* Function pointer. */ + PTR_L a0,PTRSIZE(sp) /* Argument pointer. */ /* Call the user's function. */ jal t9 @@ -98,7 +104,7 @@ L(thread_start): /* Call _exit rather than doing it inline for breakpoint purposes. */ move a0,v0 #ifdef __PIC__ - la t9,_exit + PTR_LA t9,_exit jalr t9 #else jal _exit diff --git a/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/sysdeps/unix/sysv/linux/mips/kernel_stat.h index 41137b4fc7..b5fcd008b0 100644 --- a/sysdeps/unix/sysv/linux/mips/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/mips/kernel_stat.h @@ -1,4 +1,28 @@ /* Definition of `struct stat' used in the kernel.. */ +#if defined _ABI64 && _MIPS_SIM == _ABI64 +struct kernel_stat + { + unsigned int st_dev; + unsigned int __pad1[3]; + unsigned long st_ino; + unsigned int st_mode; + unsigned int st_nlink; + int st_uid; + int st_gid; + unsigned int st_rdev; + unsigned int __pad2[3]; + long st_size; + unsigned int st_atime; + unsigned int __unused1; + unsigned int st_mtime; + unsigned int __unused2; + unsigned int st_ctime; + unsigned int __unused3; + unsigned int st_blksize; + unsigned int __pad3; + unsigned long st_blocks; + }; +#else struct kernel_stat { unsigned long int st_dev; @@ -26,3 +50,4 @@ struct kernel_stat unsigned int st_flags; unsigned int st_gen; }; +#endif diff --git a/sysdeps/unix/sysv/linux/mips/sys/procfs.h b/sysdeps/unix/sysv/linux/mips/sys/procfs.h index a21652e1ce..0beb332487 100644 --- a/sysdeps/unix/sysv/linux/mips/sys/procfs.h +++ b/sysdeps/unix/sysv/linux/mips/sys/procfs.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,7 +33,11 @@ #define ELF_NGREG 45 #define ELF_NFPREG 33 +#if defined _ABIN32 && _MIPS_SIM == _ABIN32 +__extension__ typedef unsigned long long elf_greg_t; +#else typedef unsigned long elf_greg_t; +#endif typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef double elf_fpreg_t; @@ -59,8 +64,13 @@ struct elf_prstatus { struct elf_siginfo pr_info; /* Info associated with signal. */ short int pr_cursig; /* Current signal. */ +#if defined _ABIN32 && _MIPS_SIM == _ABIN32 + __extension__ unsigned long long int pr_sigpend; + __extension__ unsigned long long int pr_sighold; +#else unsigned long int pr_sigpend; /* Set of pending signals. */ unsigned long int pr_sighold; /* Set of held signals. */ +#endif __pid_t pr_pid; __pid_t pr_ppid; __pid_t pr_pgrp; @@ -82,7 +92,11 @@ struct elf_prpsinfo char pr_sname; /* Char for pr_state. */ char pr_zomb; /* Zombie. */ char pr_nice; /* Nice val. */ +#if defined _ABIN32 && _MIPS_SIM == _ABIN32 + __extension__ unsigned long long int pr_flag; +#else unsigned long int pr_flag; /* Flags. */ +#endif long pr_uid; long pr_gid; int pr_pid, pr_ppid, pr_pgrp, pr_sid; diff --git a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h index f57b91e4f2..9d80b4086a 100644 --- a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,7 +30,11 @@ /* Type for general register. */ +#if defined _ABIN32 && _MIPS_SIM == _ABIN32 +__extension__ typedef unsigned long long int greg_t; +#else typedef unsigned long int greg_t; +#endif /* Number of general registers. */ #define NGREG 37 @@ -70,7 +74,11 @@ typedef struct /* Userlevel context. */ typedef struct ucontext { +#if defined _ABIN32 && _MIPS_SIM == _ABIN32 + __extension__ unsigned long long int uc_flags; +#else unsigned long int uc_flags; +#endif struct ucontext *uc_link; stack_t uc_stack; mcontext_t uc_mcontext; |