summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libc/sysdeps/linux/mips/Makefile2
-rw-r--r--libc/sysdeps/linux/mips/sysdep-nptl.h550
-rw-r--r--libc/sysdeps/linux/mips/sysdep.h334
-rw-r--r--libpthread/nptl/pthread_create.c1
-rw-r--r--libpthread/nptl/sysdeps/mips/pthread_spin_lock.S5
-rw-r--r--libpthread/nptl/sysdeps/mips/pthread_spin_trylock.S8
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c4
7 files changed, 267 insertions, 637 deletions
diff --git a/libc/sysdeps/linux/mips/Makefile b/libc/sysdeps/linux/mips/Makefile
index cec19a378..91da020dd 100644
--- a/libc/sysdeps/linux/mips/Makefile
+++ b/libc/sysdeps/linux/mips/Makefile
@@ -83,10 +83,8 @@ 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
diff --git a/libc/sysdeps/linux/mips/sysdep-nptl.h b/libc/sysdeps/linux/mips/sysdep-nptl.h
deleted file mode 100644
index e364d774a..000000000
--- a/libc/sysdeps/linux/mips/sysdep-nptl.h
+++ /dev/null
@@ -1,550 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004, 2005 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 _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 */
-
-/* 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
-#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 */
-
-#include <sys/syscall.h>
-#define HAVE_SYSCALLS
-
-#if 0
-/* 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)
-#endif
-
-/* 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
- 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 <sys/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
-#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__
-
-/* 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
-#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 */
diff --git a/libc/sysdeps/linux/mips/sysdep.h b/libc/sysdeps/linux/mips/sysdep.h
index f9778b2d1..8f4262196 100644
--- a/libc/sysdeps/linux/mips/sysdep.h
+++ b/libc/sysdeps/linux/mips/sysdep.h
@@ -23,38 +23,10 @@ Cambridge, MA 02139, USA. */
/* Not that using a `PASTE' macro loses. */
#ifdef __STDC__
-#ifdef __ELF__
-
#define SYSCALL_WEAK_ALIAS(alias,orig) \
.weak alias; \
alias=__libc_##orig
-/*
-#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) \
@@ -74,39 +46,6 @@ Cambridge, MA 02139, USA. */
.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)
@@ -114,22 +53,267 @@ Cambridge, MA 02139, USA. */
#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. movl should be defined as
- an instruction such that "movl r1, r0" works. ret should be defined
- as the return instruction. */
-
-
-#if !defined(HAVE_GNU_LD) && !defined (__ELF__)
-#define ___errno _errno
+#ifndef __ASSEMBLER__
+/* Define a macro which expands into the inline wrapper code for a system
+ call. */
+#undef INLINE_SYSCALL
+#if 0
+#define INLINE_SYSCALL(name, nr, args...) \
+ ({ INTERNAL_SYSCALL_DECL(err); \
+ long result_var = INTERNAL_SYSCALL (name, err, nr, args); \
+ if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
+ { \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \
+ result_var = -1L; \
+ } \
+ result_var; })
+#else
+#define INLINE_SYSCALL(name, nr, args...) \
+ ({ INTERNAL_SYSCALL_DECL(err); \
+ long result_var = INTERNAL_SYSCALL (name, err, nr, args); \
+ if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
+ { \
+ result_var = __syscall_error((int) result_var); \
+ } \
+ result_var; })
#endif
-#define HAVE_SYSCALLS
-
-#ifdef __PTHREADS_NATIVE__
-#include <sysdep-nptl.h>
+#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"
+#else
+#define ENTRY(name) \
+ .globl name; \
+ .align 2; \
+ .ent name,0; \
+ name##:
#endif
#if _MIPS_SIM == _ABIO32
diff --git a/libpthread/nptl/pthread_create.c b/libpthread/nptl/pthread_create.c
index 18f1c034c..c83160c80 100644
--- a/libpthread/nptl/pthread_create.c
+++ b/libpthread/nptl/pthread_create.c
@@ -26,7 +26,6 @@
#include <ldsodefs.h>
#include <atomic.h>
#include <libc-internal.h>
-#include <resolv.h>
#include <shlib-compat.h>
diff --git a/libpthread/nptl/sysdeps/mips/pthread_spin_lock.S b/libpthread/nptl/sysdeps/mips/pthread_spin_lock.S
index d5f2a7234..e35c381ed 100644
--- a/libpthread/nptl/sysdeps/mips/pthread_spin_lock.S
+++ b/libpthread/nptl/sysdeps/mips/pthread_spin_lock.S
@@ -33,5 +33,6 @@ ENTRY (pthread_spin_lock)
MIPS_SYNC
.set pop
li v0, 0
- ret
-PSEUDO_END (pthread_spin_lock)
+ j ra
+ nop
+END (pthread_spin_lock)
diff --git a/libpthread/nptl/sysdeps/mips/pthread_spin_trylock.S b/libpthread/nptl/sysdeps/mips/pthread_spin_trylock.S
index 9c6e740f0..b54732869 100644
--- a/libpthread/nptl/sysdeps/mips/pthread_spin_trylock.S
+++ b/libpthread/nptl/sysdeps/mips/pthread_spin_trylock.S
@@ -35,7 +35,9 @@ ENTRY (pthread_spin_trylock)
MIPS_SYNC
.set pop
li v0, 0
- ret
+ j ra
+ nop
1: li v0, EBUSY
- ret
-PSEUDO_END (pthread_spin_trylock)
+ j ra
+ nop
+END (pthread_spin_trylock)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c
index 6c39eb772..5315b0564 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c
@@ -22,10 +22,6 @@
pid_t
__fork (void)
{
-#ifdef __UCLIBC__
return __libc_fork_nptl ();
-#else
- return __libc_fork ();
-#endif
}
strong_alias (__fork, fork)