diff options
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r-- | libc/sysdeps/linux/common/bits/siginfo.h | 29 | ||||
-rw-r--r-- | libc/sysdeps/linux/mips/Makefile | 23 | ||||
-rw-r--r-- | libc/sysdeps/linux/mips/bits/siginfo.h | 29 | ||||
-rw-r--r-- | libc/sysdeps/linux/mips/sgidefs.h | 45 | ||||
-rw-r--r-- | libc/sysdeps/linux/mips/sys/asm.h | 29 | ||||
-rw-r--r-- | libc/sysdeps/linux/mips/sys/regdef.h | 8 | ||||
-rw-r--r-- | libc/sysdeps/linux/mips/sysdep.h | 640 |
7 files changed, 201 insertions, 602 deletions
diff --git a/libc/sysdeps/linux/common/bits/siginfo.h b/libc/sysdeps/linux/common/bits/siginfo.h index 4ce319dc9..03c1c11fc 100644 --- a/libc/sysdeps/linux/common/bits/siginfo.h +++ b/libc/sysdeps/linux/common/bits/siginfo.h @@ -1,5 +1,5 @@ -/* siginfo_t, sigevent and constants. Linux version. - Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc. +/* siginfo_t, sigevent and constants. Linux/SPARC version. + Copyright (C) 1997, 1998, 1999, 2000, 2001 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 @@ -69,9 +69,8 @@ typedef struct siginfo /* POSIX.1b timers. */ struct { - int si_tid; /* Timer ID. */ - int si_overrun; /* Overrun count. */ - sigval_t si_sigval; /* Signal value. */ + unsigned int _timer1; + unsigned int _timer2; } _timer; /* POSIX.1b signals. */ @@ -111,8 +110,8 @@ typedef struct siginfo /* X/Open requires some more fields with fixed names. */ # define si_pid _sifields._kill.si_pid # define si_uid _sifields._kill.si_uid -# define si_timerid _sifields._timer.si_tid -# define si_overrun _sifields._timer.si_overrun +# define si_timer1 _sifields._timer._timer1 +# define si_timer2 _sifields._timer._timer2 # define si_status _sifields._sigchld.si_status # define si_utime _sifields._sigchld.si_utime # define si_stime _sifields._sigchld.si_stime @@ -270,6 +269,9 @@ enum # define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3) # endif +/* Forward declaration of the `pthread_attr_t' type. */ +struct __pthread_attr_s; + typedef struct sigevent { sigval_t sigev_value; @@ -280,14 +282,10 @@ typedef struct sigevent { int _pad[__SIGEV_PAD_SIZE]; - /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the - thread to receive the signal. */ - __pid_t _tid; - struct { - void (*_function) (sigval_t); /* Function to start. */ - void *_attribute; /* Really pthread_attr_t. */ + void (*_function) (sigval_t); /* Function to start. */ + struct __pthread_attr_s *_attribute; /* Really pthread_attr_t. */ } _sigev_thread; } _sigev_un; } sigevent_t; @@ -303,11 +301,8 @@ enum # define SIGEV_SIGNAL SIGEV_SIGNAL SIGEV_NONE, /* Other notification: meaningless. */ # define SIGEV_NONE SIGEV_NONE - SIGEV_THREAD, /* Deliver via thread creation. */ + SIGEV_THREAD /* Deliver via thread creation. */ # define SIGEV_THREAD SIGEV_THREAD - - SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */ -#define SIGEV_THREAD_ID SIGEV_THREAD_ID }; #endif /* have _SIGNAL_H. */ diff --git a/libc/sysdeps/linux/mips/Makefile b/libc/sysdeps/linux/mips/Makefile index bd905441a..caa332dd6 100644 --- a/libc/sysdeps/linux/mips/Makefile +++ b/libc/sysdeps/linux/mips/Makefile @@ -19,8 +19,9 @@ TOPDIR=../../../../ include $(TOPDIR)Rules.mak -CRT0_SRC = crt0.S -CRT0_OBJ = crt1.o +CRT_SRC = crt1.S +CRT_OBJ = crt1.o +SCRT_OBJ = $(patsubst %,S%, $(CRT_OBJ)) CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o SSRC=bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S syscall.S pipe.S @@ -30,23 +31,25 @@ CSRC=__longjmp.c brk.c setjmp_aux.c mmap.c __syscall_error.c \ cacheflush.c pread_write.c sysmips.c _test_and_set.c #sigaction.c COBJS=$(patsubst %.c,%.o, $(CSRC)) -OBJS=$(SOBJS) $(MOBJ) $(COBJS) +OBJS=$(SOBJS) $(COBJS) OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH) all: $(OBJ_LIST) -$(OBJ_LIST): $(OBJS) $(CRT0_OBJ) $(CTOR_TARGETS) +$(OBJ_LIST): $(OBJS) $(CRT_OBJ) $(SCRT_OBJ) $(CTOR_TARGETS) echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST) $(INSTALL) -d $(TOPDIR)lib/ - cp $(CRT0_OBJ) $(TOPDIR)lib/ - $(LN) -fs $(CRT0_OBJ) $(TOPDIR)/lib/crt0.o - $(LN) -fs $(CRT0_OBJ) $(TOPDIR)/lib/Scrt1.o + cp $(CRT_OBJ) $(SCRT_OBJ) $(TOPDIR)lib/ -$(CRT0_OBJ): $(CRT0_SRC) +$(CRT_OBJ): $(CRT_SRC) $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o $(STRIPTOOL) -x -R .note -R .comment $*.o +$(SCRT_OBJ): $(CRT_SRC) + $(CC) $(ASFLAGS) $(PIEFLAG) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o + $(SOBJS): %.o : %.S $(CC) $(ASFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o @@ -55,7 +58,6 @@ $(COBJS): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o - ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) crti.o: crti.S $(CC) $(ASFLAGS) -c crti.S -o crti.o @@ -81,8 +83,10 @@ endif headers: $(LN) -fs ../libc/sysdeps/linux/mips/sgidefs.h $(TOPDIR)/include/ +# $(LN) -fs ../libc/sysdeps/linux/mips/regdef.h $(TOPDIR)/include/ $(LN) -fs ../libc/sysdeps/linux/mips/fpu_control.h $(TOPDIR)/include/ cp sysdep.h $(TOPDIR)/include/ + cp sysdep-nptl.h $(TOPDIR)/include/ clean: $(RM) *.[oa] *~ core @@ -90,3 +94,4 @@ clean: $(RM) $(TOPDIR)/include/fpu_control.h $(RM) $(TOPDIR)/include/sgidefs.h $(RM) $(TOPDIR)/include/sysdep.h + $(RM) $(TOPDIR)/include/sysdep-nptl.h diff --git a/libc/sysdeps/linux/mips/bits/siginfo.h b/libc/sysdeps/linux/mips/bits/siginfo.h index 787e36513..565fa86b1 100644 --- a/libc/sysdeps/linux/mips/bits/siginfo.h +++ b/libc/sysdeps/linux/mips/bits/siginfo.h @@ -1,6 +1,5 @@ /* siginfo_t, sigevent and constants. Linux/MIPS version. - Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2000, 2001 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 @@ -23,8 +22,6 @@ # error "Never include this file directly. Use <signal.h> instead" #endif -#include <bits/wordsize.h> - #if (!defined __have_sigval_t \ && (defined _SIGNAL_H || defined __need_siginfo_t \ || defined __need_sigevent_t)) @@ -42,13 +39,8 @@ typedef union sigval && (defined _SIGNAL_H || defined __need_siginfo_t)) # define __have_siginfo_t 1 -# define __SI_MAX_SIZE 128 -# if __WORDSIZE == 64 -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) -# else -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) -# endif - +# define __SI_MAX_SIZE 128 +# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) typedef struct siginfo { @@ -56,8 +48,6 @@ typedef struct siginfo int si_code; /* Signal code. */ int si_errno; /* If non-zero, an errno value associated with this signal, as defined in <errno.h>. */ - int __pad0[__SI_MAX_SIZE / sizeof (int) - __SI_PAD_SIZE - 3]; - /* Explicit padding. */ union { @@ -159,7 +149,7 @@ enum # define ILL_ILLOPN ILL_ILLOPN ILL_ILLADR, /* Illegal addressing mode. */ # define ILL_ILLADR ILL_ILLADR - ILL_ILLTRP, /* Illegal trap. */ + ILL_ILLTRP, /* Illegal trap. */ # define ILL_ILLTRP ILL_ILLTRP ILL_PRVOPC, /* Privileged opcode. */ # define ILL_PRVOPC ILL_PRVOPC @@ -283,8 +273,8 @@ typedef struct sigevent struct { - void (*_function) (sigval_t); /* Function to start. */ - void *_attribute; /* Really pthread_attr_t. */ + void (*_function) (sigval_t); /* Function to start. */ + struct __pthread_attr_s *_attribute; /* Really pthread_attr_t. */ } _sigev_thread; } _sigev_un; } sigevent_t; @@ -300,11 +290,10 @@ enum # define SIGEV_SIGNAL SIGEV_SIGNAL SIGEV_NONE, /* Other notification: meaningless. */ # define SIGEV_NONE SIGEV_NONE - SIGEV_THREAD, /* Deliver via thread creation. */ + SIGEV_CALLBACK, /* Deliver via thread creation. */ +# define SIGEV_CALLBACK SIGEV_CALLBACK + SIGEV_THREAD /* Deliver via thread creation. */ # define SIGEV_THREAD SIGEV_THREAD - - SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */ -#define SIGEV_THREAD_ID SIGEV_THREAD_ID }; #endif /* have _SIGNAL_H. */ diff --git a/libc/sysdeps/linux/mips/sgidefs.h b/libc/sysdeps/linux/mips/sgidefs.h index 1d4893501..74509fdbd 100644 --- a/libc/sysdeps/linux/mips/sgidefs.h +++ b/libc/sysdeps/linux/mips/sgidefs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ralf Baechle <ralf@gnu.org>. @@ -21,6 +21,27 @@ #define _SGIDEFS_H 1 /* + * A crude hack to stop <asm/sgidefs.h> + */ +#undef __ASM_SGIDEFS_H +#define __ASM_SGIDEFS_H + +/* + * And remove any damage it might have already done + */ +#undef _MIPS_ISA_MIPS1 +#undef _MIPS_ISA_MIPS2 +#undef _MIPS_ISA_MIPS3 +#undef _MIPS_ISA_MIPS4 +#undef _MIPS_ISA_MIPS5 +#undef _MIPS_ISA_MIPS32 +#undef _MIPS_ISA_MIPS64 + +#undef _MIPS_SIM_ABI32 +#undef _MIPS_SIM_NABI32 +#undef _MIPS_SIM_ABI64 + +/* * Definitions for the ISA level */ #define _MIPS_ISA_MIPS1 1 @@ -33,14 +54,20 @@ /* * Subprogram calling convention - * - * At the moment only _MIPS_SIM_ABI32 is in use. This will change rsn. - * Until GCC 2.8.0 is released don't rely on this definitions because the - * 64bit code is essentially using the 32bit interface model just with - * 64bit registers. */ -#define _MIPS_SIM_ABI32 1 -#define _MIPS_SIM_NABI32 2 -#define _MIPS_SIM_ABI64 3 +#ifndef _ABIO32 +# define _ABIO32 1 +#endif +#define _MIPS_SIM_ABI32 _ABIO32 + +#ifndef _ABIN32 +# define _ABIN32 2 +#endif +#define _MIPS_SIM_NABI32 _ABIN32 + +#ifndef _ABI64 +# define _ABI64 3 +#endif +#define _MIPS_SIM_ABI64 _ABI64 #endif /* sgidefs.h */ diff --git a/libc/sysdeps/linux/mips/sys/asm.h b/libc/sysdeps/linux/mips/sys/asm.h index b590802fd..e961f3694 100644 --- a/libc/sysdeps/linux/mips/sys/asm.h +++ b/libc/sysdeps/linux/mips/sys/asm.h @@ -1,5 +1,4 @@ -/* Copyright (C) 1997, 1998, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ralf Baechle <ralf@gnu.org>. @@ -38,11 +37,11 @@ * 64 bit address space isn't used yet, so we may use the R3000 32 bit * defines for now. */ -#if _MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIN32 +#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32) # define PTR .word # define PTRSIZE 4 # define PTRLOG 2 -#elif _MIPS_SIM == _ABI64 +#elif (_MIPS_SIM == _MIPS_SIM_ABI64) # define PTR .dword # define PTRSIZE 8 # define PTRLOG 3 @@ -51,7 +50,7 @@ /* * PIC specific declarations */ -#if _MIPS_SIM == _ABIO32 +#if (_MIPS_SIM == _MIPS_SIM_ABI32) # ifdef __PIC__ # define CPRESTORE(register) \ .cprestore register @@ -98,7 +97,7 @@ l: \ # define SETUP_GPX64_L(cp_reg, ra_save, l) # define RESTORE_GP64 # define USE_ALT_CP(a) -#else /* _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32 */ +#else /* (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32) */ /* * For callee-saved gp calling convention: */ @@ -132,15 +131,15 @@ l: \ /* Use alternate register for context pointer. */ # define USE_ALT_CP(reg) \ .cplocal reg -#endif /* _MIPS_SIM != _ABIO32 */ +#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */ /* * Stack Frame Definitions */ -#if _MIPS_SIM == _ABIO32 +#if (_MIPS_SIM == _MIPS_SIM_ABI32) # define NARGSAVE 4 /* Space for 4 argument registers must be allocated. */ #endif -#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32 +#if (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32) # define NARGSAVE 0 /* No caller responsibilities. */ #endif @@ -288,7 +287,7 @@ symbol = value /* * Stack alignment */ -#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32 +#if (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32) # define ALSZ 15 # define ALMASK ~15 #else @@ -299,7 +298,7 @@ symbol = value /* * Size of a register */ -#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32 +#if (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32) # define SZREG 8 #else # define SZREG 4 @@ -390,7 +389,7 @@ symbol = value /* * How to add/sub/load/store/shift pointers. */ -#if (_MIPS_SIM == _ABIO32 && _MIPS_SZPTR == 32) +#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 32) # define PTR_ADD add # define PTR_ADDI addi # define PTR_ADDU addu @@ -412,7 +411,7 @@ symbol = value # define PTR_SCALESHIFT 2 #endif -#if _MIPS_SIM == _ABIN32 +#if _MIPS_SIM == _MIPS_SIM_NABI32 # define PTR_ADD add # define PTR_ADDI addi # define PTR_ADDU add /* no u */ @@ -434,8 +433,8 @@ symbol = value # define PTR_SCALESHIFT 2 #endif -#if (_MIPS_SIM == _ABIO32 && _MIPS_SZPTR == 64 /* o64??? */) \ - || _MIPS_SIM == _ABI64 +#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 64 /* o64??? */) \ + || _MIPS_SIM == _MIPS_SIM_ABI64 # define PTR_ADD dadd # define PTR_ADDI daddi # define PTR_ADDU daddu diff --git a/libc/sysdeps/linux/mips/sys/regdef.h b/libc/sysdeps/linux/mips/sys/regdef.h index 8fb898a2d..2d94130af 100644 --- a/libc/sysdeps/linux/mips/sys/regdef.h +++ b/libc/sysdeps/linux/mips/sys/regdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ralf Baechle <ralf@gnu.org>. @@ -33,7 +33,7 @@ #define a1 $5 #define a2 $6 #define a3 $7 -#if _MIPS_SIM != _ABIO32 +#if _MIPS_SIM != _MIPS_SIM_ABI32 #define a4 $8 #define a5 $9 #define a6 $10 @@ -46,7 +46,7 @@ #define ta1 a5 #define ta2 a6 #define ta3 a7 -#else /* if _MIPS_SIM == _ABIO32 */ +#else /* if _MIPS_SIM == _MIPS_SIM_ABI32 */ #define t0 $8 /* caller saved */ #define t1 $9 #define t2 $10 @@ -59,7 +59,7 @@ #define ta1 t5 #define ta2 t6 #define ta3 t7 -#endif /* _MIPS_SIM == _ABIO32 */ +#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ #define s0 $16 /* callee saved */ #define s1 $17 #define s2 $18 diff --git a/libc/sysdeps/linux/mips/sysdep.h b/libc/sysdeps/linux/mips/sysdep.h index 0a92afd71..da8eacded 100644 --- a/libc/sysdeps/linux/mips/sysdep.h +++ b/libc/sysdeps/linux/mips/sysdep.h @@ -1,548 +1,132 @@ -/* Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. +/* Copyright (C) 1991, 1992 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 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. - 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. +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. - 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. */ +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. */ -#ifndef _LINUX_MIPS_MIPS32_SYSDEP_H -#define _LINUX_MIPS_MIPS32_SYSDEP_H 1 - -/* There is some commonality. */ -/* NPTL - start sysdeps/unix/mips32/sysdep.h */ - -/* NPTL - start sysdeps/unix/mips/sysdep.h */ - -#include <sgidefs.h> -/* NPTL - start sysdeps/unix/sysdep.h */ +#include <sys/syscall.h> +#include <features.h> -/* NPTL - start sysdeps/generic/sysdep.h */ -/* Define a macro we can use to construct the asm name for a C symbol. */ -#ifdef NO_UNDERSCORES -#ifdef __STDC__ -#define C_LABEL(name) name##: -#else -#define C_LABEL(name) name/**/: -#endif -#else +/* Not that using a `PASTE' macro loses. */ #ifdef __STDC__ -#define C_LABEL(name) _##name##: -#else -#define C_LABEL(name) _/**/name/**/: -#endif -#endif - -#ifdef __ASSEMBLER__ -/* Mark the end of function named SYM. This is used on some platforms - to generate correct debugging information. */ -#ifndef END -#define END(sym) -#endif - -#ifndef JUMPTARGET -#define JUMPTARGET(sym) sym -#endif -/* Makros to generate eh_frame unwind information. */ -# ifdef HAVE_ASM_CFI_DIRECTIVES -# define cfi_startproc .cfi_startproc -# define cfi_endproc .cfi_endproc -# define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off -# define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg -# define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off -# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off -# define cfi_offset(reg, off) .cfi_offset reg, off -# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off -# define cfi_register(r1, r2) .cfi_register r1, r2 -# define cfi_return_column(reg) .cfi_return_column reg -# define cfi_restore(reg) .cfi_restore reg -# define cfi_undefined(reg) .cfi_undefined reg -# define cfi_remember_state .cfi_remember_state -# define cfi_restore_state .cfi_restore_state -# define cfi_window_save .cfi_window_save -# else -# define cfi_startproc -# define cfi_endproc -# define cfi_def_cfa(reg, off) -# define cfi_def_cfa_register(reg) -# define cfi_def_cfa_offset(off) -# define cfi_adjust_cfa_offset(off) -# define cfi_offset(reg, off) -# define cfi_rel_offset(reg, off) -# define cfi_register(r1, r2) -# define cfi_return_column(reg) -# define cfi_restore(reg) -# define cfi_undefined(reg) -# define cfi_remember_state -# define cfi_restore_state -# define cfi_window_save -# endif - -#else /* ! ASSEMBLER */ -# ifdef HAVE_ASM_CFI_DIRECTIVES -# define CFI_STRINGIFY(Name) CFI_STRINGIFY2 (Name) -# define CFI_STRINGIFY2(Name) #Name -# define CFI_STARTPROC ".cfi_startproc" -# define CFI_ENDPROC ".cfi_endproc" -# define CFI_DEF_CFA(reg, off) \ - ".cfi_def_cfa " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off) -# define CFI_DEF_CFA_REGISTER(reg) \ - ".cfi_def_cfa_register " CFI_STRINGIFY(reg) -# define CFI_DEF_CFA_OFFSET(off) \ - ".cfi_def_cfa_offset " CFI_STRINGIFY(off) -# define CFI_ADJUST_CFA_OFFSET(off) \ - ".cfi_adjust_cfa_offset " CFI_STRINGIFY(off) -# define CFI_OFFSET(reg, off) \ - ".cfi_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off) -# define CFI_REL_OFFSET(reg, off) \ - ".cfi_rel_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off) -# define CFI_REGISTER(r1, r2) \ - ".cfi_register " CFI_STRINGIFY(r1) "," CFI_STRINGIFY(r2) -# define CFI_RETURN_COLUMN(reg) \ - ".cfi_return_column " CFI_STRINGIFY(reg) -# define CFI_RESTORE(reg) \ - ".cfi_restore " CFI_STRINGIFY(reg) -# define CFI_UNDEFINED(reg) \ - ".cfi_undefined " CFI_STRINGIFY(reg) -# define CFI_REMEMBER_STATE \ - ".cfi_remember_state" -# define CFI_RESTORE_STATE \ - ".cfi_restore_state" -# define CFI_WINDOW_SAVE \ - ".cfi_window_save" -# else -# define CFI_STARTPROC -# define CFI_ENDPROC -# define CFI_DEF_CFA(reg, off) -# define CFI_DEF_CFA_REGISTER(reg) -# define CFI_DEF_CFA_OFFSET(off) -# define CFI_ADJUST_CFA_OFFSET(off) -# define CFI_OFFSET(reg, off) -# define CFI_REL_OFFSET(reg, off) -# define CFI_REGISTER(r1, r2) -# define CFI_RETURN_COLUMN(reg) -# define CFI_RESTORE(reg) -# define CFI_UNDEFINED(reg) -# define CFI_REMEMBER_STATE -# define CFI_RESTORE_STATE -# define CFI_WINDOW_SAVE -# endif - -#endif /* __ASSEMBLER__ */ -/* NPTL - end sysdeps/generic/sysdep.h */ +#ifdef __ELF__ -#include <sys/syscall.h> -#define HAVE_SYSCALLS +#define SYSCALL_WEAK_ALIAS(alias,orig) \ + .weak alias; \ + alias=__libc_##orig -/* Note that using a `PASTE' macro loses. */ -#ifdef __STDC__ -#define SYSCALL__(name, args) PSEUDO (__##name, name, args) -#else -#define SYSCALL__(name, args) PSEUDO (__/**/name, name, args) -#endif -#define SYSCALL(name, args) PSEUDO (name, name, args) +/* +#ifdef _POSIX_THREADS +*/ + +#if 1 + +#ifdef PTHREAD_KERNEL + +/* Use the regular ELF conventions about underscores, and provide the + weak symbol, as required */ +#define SYSCALL__(name,args) PSEUDO (__machdep_sys_##name, name, args) \ +.weak machdep_sys_##name; \ + machdep_sys_##name = __machdep_sys_##name; \ +.type __machdep_sys_##name,@function; \ +.type machdep_sys_##name,@function; \ +.L__machdep_sys_##name##end: .size __machdep_sys_##name,.L__machdep_sys_##name##end - __machdep_sys_##name + +#define SYSCALL(name,args) PSEUDO (__machdep_sys_##name, name, args) \ +.weak machdep_sys_##name; \ + machdep_sys_##name = __machdep_sys_##name; \ +.type __machdep_sys_##name,@function; \ +.type machdep_sys_##name,@function; \ +.L__machdep_sys_##name##end: .size __machdep_sys_##name,.L__machdep_sys_##name##end - __machdep_sys_##name + +#else /* PTHREAD_KERNEL */ + +/* 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 + +#endif /* PTHREAD_KERNEL */ + +#else /* _POSIX_THREADS */ + +/* 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; \ + __##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) \ + name = __libc_##name; \ +.type __libc_##name,@function; \ +.type name,@function; \ +.L__libc_##name##end: .size __libc_##name,.L__libc_##name##end - __libc_##name + +#endif /* _POSIX_THREADS */ + +#else /* __ELF__ */ + +#define SYSCALL_WEAK_ALIAS(alias,orig) + +/* Regular a.out definition */ +#define SYSCALL__(name,args) PSEUDO (__##name, name, args) +#define SYSCALL(name,args) PSEUDO (name, name, args) + +#endif /* __ELF__ */ + +#else /* __STDC__ */ + +#define SYSCALL__(name,args) PSEUDO (__/**/name, name, args) +#define SYSCALL(name,args) PSEUDO (name, name, args) + +#endif /* __STDC__ */ /* Machine-dependent sysdep.h files are expected to define the macro PSEUDO (function_name, syscall_name) to emit assembly code to define the C-callable function FUNCTION_NAME to do system call SYSCALL_NAME. - r0 and r1 are the system call outputs. MOVE(x, y) should be defined as - an instruction such that "MOVE(r1, r0)" works. ret should be defined + r0 and r1 are the system call outputs. movl should be defined as + an instruction such that "movl r1, r0" works. ret should be defined as the return instruction. */ -#if 0 -/* - * NPTL - these are defined in 'include/bits/syscalls.h' and - * 'include/bits/sysnum.h'. - */ -#ifdef __STDC__ -#define SYS_ify(syscall_name) SYS_##syscall_name -#else -#define SYS_ify(syscall_name) SYS_/**/syscall_name -#endif -#endif - -/* Terminate a system call named SYM. This is used on some platforms - to generate correct debugging information. */ -#ifndef PSEUDO_END -#define PSEUDO_END(sym) -#endif -#ifndef PSEUDO_END_NOERRNO -#define PSEUDO_END_NOERRNO(sym) PSEUDO_END(sym) -#endif -#ifndef PSEUDO_END_ERRVAL -#define PSEUDO_END_ERRVAL(sym) PSEUDO_END(sym) -#endif - -/* Wrappers around system calls should normally inline the system call code. - But sometimes it is not possible or implemented and we use this code. */ -#define INLINE_SYSCALL(name, nr, args...) __syscall_##name (args) -/* NPTL - end sysdeps/unix/sysdep.h */ - -#ifdef __ASSEMBLER__ - -#include <regdef.h> - -#define ENTRY(name) \ - .globl name; \ - .align 2; \ - .ent name,0; \ - name##: - -#undef END -#define END(function) \ - .end function; \ - .size function,.-function - -#define ret j ra ; nop - -#undef PSEUDO_END -#define PSEUDO_END(sym) .end sym; .size sym,.-sym - -#define PSEUDO_NOERRNO(name, syscall_name, args) \ - .align 2; \ - ENTRY(name) \ - .set noreorder; \ - li v0, SYS_ify(syscall_name); \ - syscall - -#undef PSEUDO_END_NOERRNO -#define PSEUDO_END_NOERRNO(sym) .end sym; .size sym,.-sym -#define ret_NOERRNO ret - -#define PSEUDO_ERRVAL(name, syscall_name, args) \ - .align 2; \ - ENTRY(name) \ - .set noreorder; \ - li v0, SYS_ify(syscall_name); \ - syscall - -#undef PSEUDO_END_ERRVAL -#define PSEUDO_END_ERRVAL(sym) .end sym; .size sym,.-sym - -#define ret_ERRVAL ret - -#define r0 v0 -#define r1 v1 -/* The mips move insn is d,s. */ -#define MOVE(x,y) move y , x - -#if _MIPS_SIM == _ABIO32 -# define L(label) $L ## label -#else -# define L(label) .L ## label +#if !defined(HAVE_GNU_LD) && !defined (__ELF__) +#define ___errno _errno #endif -#endif -/* NPTL - end sysdeps/unix/mips/sysdep.h */ - -/* Note that while it's better structurally, going back to call __syscall_error - can make things confusing if you're debugging---it looks like it's jumping - backwards into the previous fn. */ -#ifdef __PIC__ -#define PSEUDO(name, syscall_name, args) \ - .align 2; \ - 99: la t9,__syscall_error; \ - jr t9; \ - ENTRY(name) \ - .set noreorder; \ - .cpload t9; \ - li v0, SYS_ify(syscall_name); \ - syscall; \ - .set reorder; \ - bne a3, zero, 99b; \ -L(syse1): -#else -#define PSEUDO(name, syscall_name, args) \ - .set noreorder; \ - .align 2; \ - 99: j __syscall_error; \ - nop; \ - ENTRY(name) \ - .set noreorder; \ - li v0, SYS_ify(syscall_name); \ - syscall; \ - .set reorder; \ - bne a3, zero, 99b; \ -L(syse1): -#endif -/* NPTL - end sysdeps/unix/mips32/sysdep.h */ - -/* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h - of the kernel. But these symbols do not follow the SYS_* syntax - so we have to redefine the `SYS_ify' macro here. */ -#undef SYS_ify -#ifdef __STDC__ -# define SYS_ify(syscall_name) __NR_##syscall_name -#else -# define SYS_ify(syscall_name) __NR_/**/syscall_name -#endif - -#ifdef __ASSEMBLER__ +#define HAVE_SYSCALLS -/* We don't want the label for the error handler to be visible in the symbol - table when we define it here. */ -#ifdef __PIC__ -# define SYSCALL_ERROR_LABEL 99b +#ifdef __PTHREADS_NATIVE__ +#include <sysdep-nptl.h> #endif - -#else /* ! __ASSEMBLER__ */ - -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#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 = -1L; \ - } \ - result_var; }) - -#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; \ -}) - -#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; \ -}) - -#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 __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \ - "$14", "$15", "$24", "$25", "memory" - -#endif /* __ASSEMBLER__ */ - -#endif /* linux/mips/mips32/sysdep.h */ |