diff options
Diffstat (limited to 'sysdeps/unix')
-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 |
6 files changed, 102 insertions, 48 deletions
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; |