This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
make existing mips files multi-ABI
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: 14 Mar 2003 06:42:48 -0300
- Subject: make existing mips files multi-ABI
- Organization: GCC Team, Red Hat
This patch adjusts most of the existing mips-specific files that need
changes to become multi-ABI.
Index: ChangeLog
2003-03-14 Alexandre Oliva <aoliva at redhat dot 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/bits/fcntl.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/stat.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.
Index: sysdeps/mips/setjmp_aux.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/setjmp_aux.c,v
retrieving revision 1.8
diff -u -p -r1.8 setjmp_aux.c
--- sysdeps/mips/setjmp_aux.c 6 Jul 2001 04:56:00 -0000 1.8
+++ sysdeps/mips/setjmp_aux.c 14 Mar 2003 09:30:26 -0000
@@ -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 at zen dot 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 savema
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));
Index: sysdeps/mips/bits/setjmp.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/bits/setjmp.h,v
retrieving revision 1.4
diff -u -p -r1.4 setjmp.h
--- sysdeps/mips/bits/setjmp.h 6 Jul 2001 04:56:00 -0000 1.4
+++ sysdeps/mips/bits/setjmp.h 14 Mar 2003 09:30:26 -0000
@@ -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
+ 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
Index: sysdeps/mips/bits/wordsize.h
===================================================================
RCS file: sysdeps/mips/bits/wordsize.h
diff -N sysdeps/mips/bits/wordsize.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sysdeps/mips/bits/wordsize.h 14 Mar 2003 09:30:26 -0000
@@ -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
Index: sysdeps/mips/elf/start.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/elf/start.S,v
retrieving revision 1.13
diff -u -p -r1.13 start.S
--- sysdeps/mips/elf/start.S 9 Dec 2002 20:37:22 -0000 1.13
+++ sysdeps/mips/elf/start.S 14 Mar 2003 09:30:26 -0000
@@ -19,6 +19,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 +53,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. */
Index: sysdeps/mips/mips64/bsd-_setjmp.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/mips64/bsd-_setjmp.S,v
retrieving revision 1.5
diff -u -p -r1.5 bsd-_setjmp.S
--- sysdeps/mips/mips64/bsd-_setjmp.S 31 Dec 2002 20:37:23 -0000 1.5
+++ sysdeps/mips/mips64/bsd-_setjmp.S 14 Mar 2003 09:30:26 -0000
@@ -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)
Index: sysdeps/mips/mips64/bsd-setjmp.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/mips64/bsd-setjmp.S,v
retrieving revision 1.2
diff -u -p -r1.2 bsd-setjmp.S
--- sysdeps/mips/mips64/bsd-setjmp.S 6 Jul 2001 04:56:01 -0000 1.2
+++ sysdeps/mips/mips64/bsd-setjmp.S 14 Mar 2003 09:30:26 -0000
@@ -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
Index: sysdeps/mips/mips64/gmp-mparam.h
===================================================================
RCS file: sysdeps/mips/mips64/gmp-mparam.h
diff -N sysdeps/mips/mips64/gmp-mparam.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sysdeps/mips/mips64/gmp-mparam.h 14 Mar 2003 09:30:26 -0000
@@ -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
Index: sysdeps/mips/mips64/setjmp.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/mips64/setjmp.S,v
retrieving revision 1.3
diff -u -p -r1.3 setjmp.S
--- sysdeps/mips/mips64/setjmp.S 6 Jul 2001 04:56:01 -0000 1.3
+++ sysdeps/mips/mips64/setjmp.S 14 Mar 2003 09:30:26 -0000
@@ -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
Index: sysdeps/mips/mips64/soft-fp/sfp-machine.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/mips64/soft-fp/sfp-machine.h,v
retrieving revision 1.1
diff -u -p -r1.1 sfp-machine.h
--- sysdeps/mips/mips64/soft-fp/sfp-machine.h 5 Sep 2000 08:37:09 -0000 1.1
+++ sysdeps/mips/mips64/soft-fp/sfp-machine.h 14 Mar 2003 09:30:26 -0000
@@ -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)
Index: sysdeps/mips/sys/ucontext.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/sys/ucontext.h,v
retrieving revision 1.3
diff -u -p -r1.3 ucontext.h
--- sysdeps/mips/sys/ucontext.h 6 Jul 2001 04:56:01 -0000 1.3
+++ sysdeps/mips/sys/ucontext.h 14 Mar 2003 09:30:27 -0000
@@ -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 */
Index: sysdeps/unix/mips/brk.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/mips/brk.S,v
retrieving revision 1.7
diff -u -p -r1.7 brk.S
--- sysdeps/unix/mips/brk.S 11 Jan 2003 15:26:35 -0000 1.7
+++ sysdeps/unix/mips/brk.S 14 Mar 2003 09:30:28 -0000
@@ -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 at zen dot 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)
Index: sysdeps/unix/mips/sysdep.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/mips/sysdep.S,v
retrieving revision 1.14
diff -u -p -r1.14 sysdep.S
--- sysdeps/unix/mips/sysdep.S 14 Mar 2003 03:59:37 -0000 1.14
+++ sysdeps/unix/mips/sysdep.S 14 Mar 2003 09:30:28 -0000
@@ -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 */
Index: sysdeps/unix/sysv/linux/mips/clone.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/clone.S,v
retrieving revision 1.12
diff -u -p -r1.12 clone.S
--- sysdeps/unix/sysv/linux/mips/clone.S 14 Mar 2003 03:59:37 -0000 1.12
+++ sysdeps/unix/sysv/linux/mips/clone.S 14 Mar 2003 09:30:28 -0000
@@ -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
Index: sysdeps/unix/sysv/linux/mips/kernel_stat.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/kernel_stat.h,v
retrieving revision 1.2
diff -u -p -r1.2 kernel_stat.h
--- sysdeps/unix/sysv/linux/mips/kernel_stat.h 20 Nov 2000 07:55:06 -0000 1.2
+++ sysdeps/unix/sysv/linux/mips/kernel_stat.h 14 Mar 2003 09:30:28 -0000
@@ -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
Index: sysdeps/unix/sysv/linux/mips/bits/fcntl.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/bits/fcntl.h,v
retrieving revision 1.16
diff -u -p -r1.16 fcntl.h
--- sysdeps/unix/sysv/linux/mips/bits/fcntl.h 6 Jul 2001 04:56:18 -0000 1.16
+++ sysdeps/unix/sysv/linux/mips/bits/fcntl.h 14 Mar 2003 09:30:28 -0000
@@ -1,5 +1,6 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 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
@@ -142,13 +143,15 @@ typedef struct flock
#ifndef __USE_FILE_OFFSET64
__off_t l_start; /* Offset where the lock begins. */
__off_t l_len; /* Size of the locked area; zero means until EOF. */
- long int l_sysid; /* XXX */
#else
__off64_t l_start; /* Offset where the lock begins. */
__off64_t l_len; /* Size of the locked area; zero means until EOF. */
#endif
+#if ! defined __USE_FILE_OFFSET64 || _MIPS_SIM != _MIPS_SIM_ABI32
+ long int l_sysid;
+#endif
__pid_t l_pid; /* Process holding the lock. */
-#ifndef __USE_FILE_OFFSET64
+#if ! defined __USE_FILE_OFFSET64 || _MIPS_SIM != _MIPS_SIM_ABI32
long int pad[4]; /* XXX */
#endif
} flock_t;
@@ -160,7 +163,13 @@ struct flock64
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
__off64_t l_start; /* Offset where the lock begins. */
__off64_t l_len; /* Size of the locked area; zero means until EOF. */
+#if _MIPS_SIM != _MIPS_SIM_ABI32
+ long int l_sysid;
+#endif
__pid_t l_pid; /* Process holding the lock. */
+#if _MIPS_SIM != _MIPS_SIM_ABI32
+ long int pad[4]; /* XXX */
+#endif
};
#endif
Index: sysdeps/unix/sysv/linux/mips/bits/stat.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/bits/stat.h,v
retrieving revision 1.12
diff -u -p -r1.12 stat.h
--- sysdeps/unix/sysv/linux/mips/bits/stat.h 6 Jul 2001 04:56:18 -0000 1.12
+++ sysdeps/unix/sysv/linux/mips/bits/stat.h 14 Mar 2003 09:30:28 -0000
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 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
@@ -80,15 +81,15 @@ struct stat
#ifdef __USE_LARGEFILE64
struct stat64
{
- unsigned long int st_dev;
- long int st_pad1[3];
+ unsigned int st_dev;
+ int st_pad1[3];
__ino64_t st_ino; /* File serial number. */
__mode_t st_mode; /* File mode. */
__nlink_t st_nlink; /* Link count. */
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group.*/
- unsigned long int st_rdev; /* Device number, if device. */
- long int st_pad2[3];
+ unsigned int st_rdev; /* Device number, if device. */
+ int st_pad2[3];
__off64_t st_size; /* Size of file, in bytes. */
/*
* Actually this should be timestruc_t st_atime, st_mtime and
Index: sysdeps/unix/sysv/linux/mips/sys/procfs.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/sys/procfs.h,v
retrieving revision 1.8
diff -u -p -r1.8 procfs.h
--- sysdeps/unix/sysv/linux/mips/sys/procfs.h 8 Feb 2002 16:21:00 -0000 1.8
+++ sysdeps/unix/sysv/linux/mips/sys/procfs.h 14 Mar 2003 09:30:28 -0000
@@ -32,7 +32,11 @@
#define ELF_NGREG 45
#define ELF_NFPREG 33
+#if defined _ABIN32 && _MIPS_SIM == _ABIN32
+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 +63,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
+ unsigned long long int pr_sigpend; /* Set of pending signals. */
+ unsigned long long int pr_sighold; /* Set of held signals. */
+#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 +91,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
+ unsigned long long int pr_flag; /* Flags. */
+#else
unsigned long int pr_flag; /* Flags. */
+#endif
long pr_uid;
long pr_gid;
int pr_pid, pr_ppid, pr_pgrp, pr_sid;
Index: sysdeps/unix/sysv/linux/mips/sys/ucontext.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/sys/ucontext.h,v
retrieving revision 1.5
diff -u -p -r1.5 ucontext.h
--- sysdeps/unix/sysv/linux/mips/sys/ucontext.h 6 Jul 2001 04:56:18 -0000 1.5
+++ sysdeps/unix/sysv/linux/mips/sys/ucontext.h 14 Mar 2003 09:30:28 -0000
@@ -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
+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
+ 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;
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist Professional serial bug killer