diff options
Diffstat (limited to 'libpthread/nptl/sysdeps/unix/sysv/linux')
28 files changed, 643 insertions, 107 deletions
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile new file mode 100644 index 000000000..43a6fad84 --- /dev/null +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile @@ -0,0 +1,13 @@ +# Makefile for uClibc NPTL +# +# Copyright (C) 2005 Steven J. Hill <sjhill@uclibc.org> +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +top_srcdir=../../../../../../../ +top_builddir=../../../../../../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.arch +include $(top_srcdir)Makerules diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch new file mode 100644 index 000000000..add1cfc03 --- /dev/null +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch @@ -0,0 +1,80 @@ +# Makefile for uClibc NPTL +# +# Copyright (C) 2006 Steven J. Hill <sjhill@uclibc.org> +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +libpthread_SSRC = pt-vfork.S pthread_once.S pthread_rwlock_wrlock.S \ + pthread_rwlock_rdlock.S pthread_rwlock_unlock.S \ + lowlevellock.S pthread_barrier_wait.S pthread_cond_broadcast.S \ + pthread_cond_signal.S \ + pthread_rwlock_timedwrlock.S pthread_rwlock_timedrdlock.S \ + sem_post.S sem_timedwait.S sem_trywait.S sem_wait.S + +libc_a_CSRC = fork.c +libc_a_SSRC = libc-lowlevellock.S clone.S vfork.S + +ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y) +CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__ +endif + +ASFLAGS-pt-vfork.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-pthread_once.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-pthread_rwlock_wrlock.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-pthread_rwlock_rdlock.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-pthread_rwlock_unlock.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-pthread_rwlock_unlock.S = -D_LIBC_REENTRANT -DUSE___THREAD + +ASFLAGS-pthread_barrier_wait.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-pthread_cond_broadcast.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-pthread_cond_signal.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-pthread_cond_wait.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-pthread_cond_timedwait.S = -D_LIBC_REENTRANT -DUSE___THREAD + +ASFLAGS-pthread_rwlock_timedwrlock.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-pthread_rwlock_timedrdlock.S = -D_LIBC_REENTRANT -DUSE___THREAD + +ASFLAGS-sem_post.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-sem_timedwait.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-sem_trywait.S = -D_LIBC_REENTRANT -DUSE___THREAD +ASFLAGS-sem_wait.S = -D_LIBC_REENTRANT -DUSE___THREAD + +ASFLAGS-libc-lowlevellock.S = -D_LIBC_REENTRANT -DUSE___THREAD + +ASFLAGS-lowlevellock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT -DUSE___THREAD + +ASFLAGS-clone.S = -D_LIBC_REENTRANT +ASFLAGS-vfork.S = -D_LIBC_REENTRANT + +ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) +#Needed to use the correct SYSCALL_ERROR_HANDLER +ASFLAGS-clone.S += -DUSE___THREAD +ASFLAGS-vfork.S += -DUSE___THREAD +endif + +CFLAGS += $(SSP_ALL_CFLAGS) +#CFLAGS:=$(CFLAGS:-O1=-O2) + +LINUX_ARCH_DIR:=$(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux/sh +LINUX_ARCH_OUT:=$(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux/sh + +LINUX_ARCH_OBJ:=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libpthread_SSRC)) + +libpthread-a-y += $(LINUX_ARCH_OBJ) +libpthread-so-y += $(LINUX_ARCH_OBJ:.o=.oS) + +libpthread-nomulti-y+=$(LINUX_ARCH_OBJS) + +LIBC_LINUX_ARCH_OBJ:=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libc_a_CSRC)) +LIBC_LINUX_ARCH_OBJ+=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libc_a_SSRC)) + +libc-static-y+=$(LIBC_LINUX_ARCH_OBJ) +libc-shared-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS) + +libc-nomulti-y+=$(LIBC_LINUX_ARCH_OBJ) + +objclean-y+=pthread_linux_arch_objclean + +pthread_linux_arch_objclean: + $(RM) $(LINUX_ARCH_OUT)/*.{o,os,oS} diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S index 62a11972d..918d57926 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S @@ -1,2 +1,2 @@ #define RESET_PID -#include <sysdeps/unix/sysv/linux/sh/clone.S> +#include <libc/sysdeps/linux/sh/clone.S> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/createthread.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/createthread.c index 8e6821538..e17c0174b 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/createthread.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/createthread.c @@ -21,4 +21,4 @@ /* Get the real implementation. */ -#include <nptl/sysdeps/pthread/createthread.c> +#include <sysdeps/pthread/createthread.c> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/fork.c index 6868b9bcd..dcedd2625 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/fork.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/fork.c @@ -18,6 +18,7 @@ #include <sched.h> #include <signal.h> +#include <stdio.h> #include <sysdep.h> #include <tls.h> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevel-atomic.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevel-atomic.h index 76d22c88f..062ce2871 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevel-atomic.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevel-atomic.h @@ -44,14 +44,16 @@ mov.l reg, mem; \ 99: mov r1, r15 -#define XADD(reg, mem, old) \ +#define XADD(reg, mem, new, old) \ .align 2; \ mova 99f, r0; \ + nop; \ mov r15, r1; \ - mov _IMM6, r15; \ + mov _IMM4, r15; \ 98: mov.l mem, old; \ - add old, reg; \ - mov.l reg, mem; \ + mov old, new; \ + add reg, new; \ + mov.l new, mem; \ 99: mov r1, r15 #define XCHG(reg, mem, old) \ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S index bcb15615e..c19de07fc 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S @@ -23,7 +23,7 @@ .text #define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 + #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 @@ -32,33 +32,29 @@ .type __lll_mutex_lock_wait,@function .hidden __lll_mutex_lock_wait .align 5 + /* void __lll_mutex_lock_wait (int val, int *__futex) */ __lll_mutex_lock_wait: - mov.l r8, @-r15 - mov r4, r6 - mov r5, r8 + mov #2, r6 + cmp/eq r4, r6 + mov r5, r4 mov #0, r7 /* No timeout. */ mov #FUTEX_WAIT, r5 - mov #2, r4 - cmp/eq r4, r6 bf 2f 1: - mov r8, r4 mov #SYS_futex, r3 extu.b r3, r3 trapa #0x14 SYSCALL_INST_PAD 2: - mov #2, r4 - XCHG (r4, @r8, r2) + XCHG (r6, @r4, r2) tst r2, r2 bf 1b - mov.l @r15+, r8 ret - mov r2, r0 + nop .size __lll_mutex_lock_wait,.-__lll_mutex_lock_wait @@ -67,6 +63,8 @@ __lll_mutex_lock_wait: .type __lll_mutex_timedlock_wait,@function .hidden __lll_mutex_timedlock_wait .align 5 + /* int __lll_mutex_timedlock_wait (int val, int *__futex, + const struct timespec *abstime) */ __lll_mutex_timedlock_wait: /* Check for a valid timeout value. */ mov.l @(4,r6), r1 @@ -74,10 +72,8 @@ __lll_mutex_timedlock_wait: cmp/hs r0, r1 bt 3f - mov.l r10, @-r15 mov.l r9, @-r15 mov.l r8, @-r15 - mov r4, r10 mov r6, r9 mov r5, r8 @@ -115,34 +111,31 @@ __lll_mutex_timedlock_wait: mov.l r3, @(4,r15) mov #1, r3 - mov #2, r4 - CMPXCHG (r3, @r8, r4, r2) + mov #2, r6 + CMPXCHG (r3, @r8, r6, r2) tst r2, r2 bt 8f mov r8, r4 mov #FUTEX_WAIT, r5 - mov r10, r6 mov r15, r7 mov #SYS_futex, r3 extu.b r3, r3 trapa #0x14 SYSCALL_INST_PAD - mov r0, r5 + mov r0, r4 8: mov #0, r3 - mov #2, r4 - CMPXCHG (r3, @r8, r4, r2) + CMPXCHG (r3, @r8, r6, r2) bf/s 7f - mov #0, r0 + mov #0, r0 6: add #8, r15 mov.l @r15+, r8 - mov.l @r15+, r9 rts - mov.l @r15+, r10 + mov.l @r15+, r9 7: /* Check whether the time expired. */ mov #-ETIMEDOUT, r1 @@ -153,15 +146,15 @@ __lll_mutex_timedlock_wait: XCHG (r2, @r8, r3) tst r3, r3 bt/s 6b - mov #0, r0 + mov #0, r0 bra 1b - nop + nop 3: rts - mov #EINVAL, r0 + mov #EINVAL, r0 5: bra 6b - mov #ETIMEDOUT, r0 + mov #ETIMEDOUT, r0 .L1k: .word 1000 @@ -194,7 +187,7 @@ lll_unlock_wake_cb: 1: rts - nop + nop .size lll_unlock_wake_cb,.-lll_unlock_wake_cb #endif @@ -203,6 +196,7 @@ lll_unlock_wake_cb: .type __lll_mutex_unlock_wake,@function .hidden __lll_mutex_unlock_wake .align 5 + /* void __lll_mutex_unlock_wake(int *__futex) */ __lll_mutex_unlock_wake: mov #FUTEX_WAKE, r5 mov #1, r6 /* Wake one thread. */ @@ -213,7 +207,7 @@ __lll_mutex_unlock_wake: trapa #0x14 SYSCALL_INST_PAD rts - nop + nop .size __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake @@ -283,7 +277,7 @@ __lll_timedwait_tid: add #8, r15 mov.l @r15+, r8 rts - mov.l @r15+, r9 + mov.l @r15+, r9 1: /* Check whether the time expired. */ mov #-ETIMEDOUT, r1 @@ -291,7 +285,7 @@ __lll_timedwait_tid: bf 2b 6: bra 3b - mov #ETIMEDOUT, r0 + mov #ETIMEDOUT, r0 .L1k2: .word 1000 diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h index d9376d45a..05040808d 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h @@ -19,11 +19,11 @@ #ifndef _LOWLEVELLOCK_H #define _LOWLEVELLOCK_H 1 +#include <syscall.h> #include <time.h> #include <sys/param.h> #include <bits/pthreadtypes.h> -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 @@ -195,6 +195,22 @@ typedef int lll_lock_t; : "memory", "t"); \ } while (0) +#define lll_futex_timed_wait(futex, val, timeout) \ + ({ \ + int __status; \ + register unsigned long __r3 asm ("r3") = SYS_futex; \ + register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \ + register unsigned long __r5 asm ("r5") = FUTEX_WAIT; \ + register unsigned long __r6 asm ("r6") = (unsigned long) (val); \ + register unsigned long __r7 asm ("r7") = (timeout); \ + __asm __volatile (SYSCALL_WITH_INST_PAD \ + : "=z" (__status) \ + : "r" (__r3), "r" (__r4), "r" (__r5), \ + "r" (__r6), "r" (__r7) \ + : "memory", "t"); \ + __status; \ + }) + #define lll_futex_wake(futex, nr) \ do { \ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/not-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/not-cancel.h index acf1a617e..f8a217316 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/not-cancel.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/not-cancel.h @@ -1 +1,83 @@ -#include "../i386/not-cancel.h" +/* Uncancelable versions of cancelable interfaces. Linux/NPTL version. + Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + 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. */ + +#include <sysdep.h> + +#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt +extern int __open_nocancel (const char *, int, ...) attribute_hidden; +extern int __close_nocancel (int) attribute_hidden; +extern int __read_nocancel (int, void *, size_t) attribute_hidden; +extern int __write_nocancel (int, const void *, size_t) attribute_hidden; +extern pid_t __waitpid_nocancel (pid_t, int *, int) attribute_hidden; + +libc_hidden_proto(__open_nocancel) +libc_hidden_proto(__close_nocancel) +libc_hidden_proto(__read_nocancel) +libc_hidden_proto(__write_nocancel) +libc_hidden_proto(__waitpid_nocancel) + +#else +#define __open_nocancel(name, ...) __open (name, __VA_ARGS__) +#define __close_nocancel(fd) __close (fd) +#define __read_nocancel(fd, buf, len) __read (fd, buf, len) +#define __write_nocancel(fd, buf, len) __write (fd, buf, len) +#define __waitpid_nocancel(pid, stat_loc, options) \ + __waitpid (pid, stat_loc, options) +#endif + +/* Uncancelable open. */ +#define open_not_cancel(name, flags, mode) \ + __open_nocancel (name, flags, mode) +#define open_not_cancel_2(name, flags) \ + __open_nocancel (name, flags) + +/* Uncancelable close. */ +#define close_not_cancel(fd) \ + __close_nocancel (fd) +#define close_not_cancel_no_status(fd) \ + (void) ({ INTERNAL_SYSCALL_DECL (err); \ + INTERNAL_SYSCALL (close, err, 1, (fd)); }) + +/* Uncancelable read. */ +#define read_not_cancel(fd, buf, n) \ + __read_nocancel (fd, buf, n) + +/* Uncancelable write. */ +#define write_not_cancel(fd, buf, n) \ + __write_nocancel (fd, buf, n) + +/* Uncancelable writev. */ +#define writev_not_cancel_no_status(fd, iov, n) \ + (void) ({ INTERNAL_SYSCALL_DECL (err); \ + INTERNAL_SYSCALL (writev, err, 3, (fd), (iov), (n)); }) + +/* Uncancelable fcntl. */ +#define fcntl_not_cancel(fd, cmd, val) \ + __fcntl_nocancel (fd, cmd, val) + +/* Uncancelable waitpid. */ +#ifdef __NR_waitpid +# define waitpid_not_cancel(pid, stat_loc, options) \ + __waitpid_nocancel (pid, stat_loc, options) +#else +# define waitpid_not_cancel(pid, stat_loc, options) \ + INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL) +#endif + diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S index 1fbb23a5a..a122d0d22 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S @@ -20,7 +20,6 @@ #include <lowlevelbarrier.h> #include "lowlevel-atomic.h" -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 @@ -82,10 +81,8 @@ pthread_barrier_wait: /* Increment LEFT. If this brings the count back to the initial count unlock the object. */ - mov #1, r3 + INC (@(LEFT,r8), r2) mov.l @(INIT_COUNT,r8), r4 - XADD (r3, @(LEFT,r8), r2) - add #-1, r4 cmp/eq r2, r4 bf 10f @@ -125,10 +122,8 @@ pthread_barrier_wait: /* Increment LEFT. If this brings the count back to the initial count unlock the object. */ - mov #1, r3 + INC (@(LEFT,r8), r2) mov.l @(INIT_COUNT,r8), r4 - XADD (r3, @(LEFT,r8), r2) - add #-1, r4 cmp/eq r2, r4 bf 5f diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S index 6bd6e60ec..99533165b 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S @@ -17,12 +17,10 @@ 02111-1307 USA. */ #include <sysdep.h> -#include <shlib-compat.h> #include <lowlevelcond.h> #include <kernel-features.h> #include "lowlevel-atomic.h" -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 #define FUTEX_REQUEUE 3 @@ -209,5 +207,4 @@ __pthread_cond_broadcast: .Lmwake6: .long __lll_mutex_unlock_wake-.Lmwake6b .size __pthread_cond_broadcast, .-__pthread_cond_broadcast -versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast, - GLIBC_2_3_2) +weak_alias (__pthread_cond_broadcast, pthread_cond_broadcast) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S index 8b0196fdc..7b0c2e2b5 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S @@ -17,12 +17,10 @@ 02111-1307 USA. */ #include <sysdep.h> -#include <shlib-compat.h> #include <lowlevelcond.h> #include <kernel-features.h> #include "lowlevel-atomic.h" -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 #define FUTEX_REQUEUE 3 @@ -134,6 +132,5 @@ __pthread_cond_signal: .Lmwake4: .long __lll_mutex_unlock_wake-.Lmwake4b .size __pthread_cond_signal, .-__pthread_cond_signal -versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal, - GLIBC_2_3_2) +weak_alias (__pthread_cond_signal, pthread_cond_signal) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S index 74206a71e..db3ad1e09 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S @@ -17,13 +17,12 @@ 02111-1307 USA. */ #include <sysdep.h> -#include <shlib-compat.h> #include <lowlevelcond.h> #include <pthread-errnos.h> #include "lowlevel-atomic.h" #define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 + #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 @@ -484,8 +483,7 @@ __pthread_cond_timedwait: .Lmwake4: .long __lll_mutex_unlock_wake-.Lmwake4b .size __pthread_cond_timedwait, .-__pthread_cond_timedwait -versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, - GLIBC_2_3_2) +weak_alias (__pthread_cond_timedwait, pthread_cond_timedwait) .type __condvar_tw_cleanup, @function diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S index 2d6b68566..64adbce60 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S @@ -17,11 +17,9 @@ 02111-1307 USA. */ #include <sysdep.h> -#include <shlib-compat.h> #include <lowlevelcond.h> #include "lowlevel-atomic.h" -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 @@ -348,8 +346,7 @@ __pthread_cond_wait: .Lmwake2: .long __lll_mutex_unlock_wake-.Lmwake2b .size __pthread_cond_wait, .-__pthread_cond_wait -versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait, - GLIBC_2_3_2) +weak_alias (__pthread_cond_wait, pthread_cond_wait) .type __condvar_w_cleanup, @function diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S index 02af56b4c..2e6d0cc5a 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S @@ -20,7 +20,6 @@ #include <sysdep.h> #include "lowlevel-atomic.h" -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S index f64c7217c..ee3f2ad4b 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S @@ -22,7 +22,6 @@ #include <tcb-offsets.h> #include "lowlevel-atomic.h" -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S index 633a14b1a..8a4e7d3bc 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S @@ -23,7 +23,6 @@ #include "lowlevel-atomic.h" #define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S index 29e29b6f6..6284140a6 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S @@ -23,7 +23,6 @@ #include "lowlevel-atomic.h" #define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S index 172689bec..a610708c8 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S @@ -20,7 +20,6 @@ #include <lowlevelrwlock.h> #include "lowlevel-atomic.h" -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S index 995d823e8..d071f7f03 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S @@ -22,7 +22,6 @@ #include <tcb-offsets.h> #include "lowlevel-atomic.h" -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S index 9bc12da7e..9755b7e16 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S @@ -17,13 +17,11 @@ 02111-1307 USA. */ #include <sysdep.h> -#include <shlib-compat.h> #include <pthread-errnos.h> #include "lowlevel-atomic.h" #define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 @@ -33,12 +31,9 @@ .type __new_sem_post,@function .align 5 __new_sem_post: - mov #1, r3 - XADD (r3, @r4, r2) + INC (@r4, r6) mov #FUTEX_WAKE, r5 - mov r2, r6 - add #1, r6 mov #0, r7 mov #SYS_futex, r3 extu.b r3, r3 @@ -60,7 +55,12 @@ __new_sem_post: mov.l .Lerrno3, r0 stc gbr, r1 mov.l @(r0, r12), r0 + bra .Lexit add r1, r0 + .align 2 +.Lerrno3: + .long errno@GOTTPOFF +.Lexit: #else mov.l .Lerrloc3, r1 bsrf r1 @@ -76,12 +76,9 @@ __new_sem_post: .align 2 .Lgot3: .long _GLOBAL_OFFSET_TABLE_ -#if USE___THREAD -.Lerrno3: - .long errno@GOTTPOFF -#else +#if !USE___THREAD .Lerrloc3: .long __errno_location@PLT-(.Lerrloc3b-.) #endif .size __new_sem_post,.-__new_sem_post - versioned_symbol(libpthread, __new_sem_post, sem_post, GLIBC_2_1) + weak_alias(__new_sem_post, sem_post) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S index acb7d0f78..c8bd4af0f 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S @@ -17,14 +17,12 @@ 02111-1307 USA. */ #include <sysdep.h> -#include <shlib-compat.h> #include <pthread-errnos.h> #include <tcb-offsets.h> #include "lowlevel-atomic.h" #define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 @@ -118,7 +116,7 @@ sem_timedwait: 5: cmp/pz r2 bf/s 6f /* Time is already up. */ - mov #ETIMEDOUT, r0 + mov #ETIMEDOUT, r0 /* Store relative timeout. */ mov.l r2, @r15 @@ -179,15 +177,19 @@ sem_timedwait: mov.l .Lerrno2, r0 stc gbr, r1 mov.l @(r0, r12), r0 + bra .Lexit add r1, r0 - mov.l r8, @r0 + .align 2 +.Lerrno2: + .long errno@GOTTPOFF +.Lexit: #else mov.l .Lerrloc2, r1 bsrf r1 nop .Lerrloc2b: - mov.l r8, @r0 #endif + mov.l r8, @r0 add #8, r15 lds.l @r15+, pr mov.l @r15+, r12 @@ -225,10 +227,7 @@ sem_timedwait: .long 1000000000 .Lgot2: .long _GLOBAL_OFFSET_TABLE_ -#if USE___THREAD -.Lerrno2: - .long errno@GOTTPOFF -#else +#if !USE___THREAD .Lerrloc2: .long __errno_location@PLT-(.Lerrloc2b-.) #endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S index ccdf3a0db..00c61f3bb 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S @@ -17,7 +17,6 @@ 02111-1307 USA. */ #include <sysdep.h> -#include <shlib-compat.h> #include <pthread-errnos.h> #include "lowlevel-atomic.h" @@ -60,15 +59,19 @@ __new_sem_trywait: mov.l .Lerrno1, r0 stc gbr, r1 mov.l @(r0, r12), r0 + bra .Lexit add r1, r0 - mov.l r8, @r0 + .align 2 +.Lerrno1: + .long errno@GOTTPOFF +.Lexit: #else mov.l .Lerrloc1, r1 bsrf r1 nop .Lerrloc1b: - mov.l r8, @r0 #endif + mov.l r8, @r0 lds.l @r15+, pr mov.l @r15+, r8 mov.l @r15+, r12 @@ -78,12 +81,9 @@ __new_sem_trywait: .align 2 .Lgot1: .long _GLOBAL_OFFSET_TABLE_ -#if USE___THREAD -.Lerrno1: - .long errno@GOTTPOFF -#else +#if !USE___THREAD .Lerrloc1: .long __errno_location@PLT-(.Lerrloc1b-.) #endif .size __new_sem_trywait,.-__new_sem_trywait - versioned_symbol(libpthread, __new_sem_trywait, sem_trywait, GLIBC_2_1) + weak_alias(__new_sem_trywait, sem_trywait) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S index 9ceb8f1c2..c12e5ab45 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S @@ -17,14 +17,12 @@ 02111-1307 USA. */ #include <sysdep.h> -#include <shlib-compat.h> #include <pthread-errnos.h> #include <tcb-offsets.h> #include "lowlevel-atomic.h" #define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 @@ -109,15 +107,19 @@ __new_sem_wait: mov.l .Lerrno0, r0 stc gbr, r1 mov.l @(r0, r12), r0 + bra .Lexit add r1, r0 - mov.l r8, @r0 + .align 2 +.Lerrno0: + .long errno@GOTTPOFF +.Lexit: #else mov.l .Lerrloc0, r1 bsrf r1 nop .Lerrloc0b: - mov.l r8, @r0 #endif + mov.l r8, @r0 mov #-1, r0 9: lds.l @r15+, pr @@ -150,10 +152,7 @@ __new_sem_wait: .align 2 .Lgot0: .long _GLOBAL_OFFSET_TABLE_ -#if USE___THREAD -.Lerrno0: - .long errno@GOTTPOFF -#else +#if !USE___THREAD .Lerrloc0: .long __errno_location@PLT-(.Lerrloc0b-.) #endif @@ -164,4 +163,4 @@ __new_sem_wait: .Lunwind: .long HIDDEN_JUMPTARGET (__pthread_unwind)-.Lunwindb .size __new_sem_wait,.-__new_sem_wait - versioned_symbol(libpthread, __new_sem_wait, sem_wait, GLIBC_2_1) + weak_alias(__new_sem_wait, sem_wait) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sh4/sysdep.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sh4/sysdep.h new file mode 100644 index 000000000..1aed1a14a --- /dev/null +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sh4/sysdep.h @@ -0,0 +1,4 @@ +/* 4 instruction cycles not accessing cache and TLB are needed after + trapa instruction to avoid an SH-4 silicon bug. */ +#define NEED_SYSCALL_INST_PAD +#include_next <sysdep.h> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h index fc3c2340b..dbaa44385 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h @@ -16,10 +16,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <sysdep.h> #include <tls.h> +#include <sysdep.h> #ifndef __ASSEMBLER__ -# include <nptl/pthreadP.h> +# include <pthreadP.h> #endif #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep.h new file mode 100644 index 000000000..6e0596144 --- /dev/null +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep.h @@ -0,0 +1,371 @@ +/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995. + Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>. + + 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_SH_SYSDEP_H +#define _LINUX_SH_SYSDEP_H 1 + +/* There is some commonality. */ +#include <sysdeps/unix/sh/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 +#define SYS_ify(syscall_name) (__NR_##syscall_name) + + +#ifdef __ASSEMBLER__ + +/* Linux uses a negative return value to indicate syscall errors, + unlike most Unices, which use the condition codes' carry flag. + + Since version 2.1 the return value of a system call might be + negative even if the call succeeded. E.g., the `lseek' system call + might return a large offset. Therefore we must not anymore test + for < 0, but test for a real error by making sure the value in R0 + is a real error number. Linus said he will make sure the no syscall + returns a value in -1 .. -4095 as a valid result so we can savely + test with -4095. */ + +#define _IMM1 #-1 +#define _IMM12 #-12 +#undef PSEUDO +#define PSEUDO(name, syscall_name, args) \ + .text; \ + ENTRY (name); \ + DO_CALL (syscall_name, args); \ + mov r0,r1; \ + mov _IMM12,r2; \ + shad r2,r1; \ + not r1,r1; \ + tst r1,r1; \ + bf .Lpseudo_end; \ + SYSCALL_ERROR_HANDLER; \ + .Lpseudo_end: + +#undef PSEUDO_END +#define PSEUDO_END(name) \ + END (name) + +#undef PSEUDO_NOERRNO +#define PSEUDO_NOERRNO(name, syscall_name, args) \ + .text; \ + ENTRY (name); \ + DO_CALL (syscall_name, args) + +#undef PSEUDO_END_NOERRNO +#define PSEUDO_END_NOERRNO(name) \ + END (name) + +#define ret_NOERRNO ret + +#define PSEUDO_ERRVAL(name, syscall_name, args) \ + .text; \ + ENTRY (name); \ + DO_CALL (syscall_name, args); + +#undef PSEUDO_END_ERRVAL +#define PSEUDO_END_ERRVAL(name) \ + END (name) + +#define ret_ERRVAL ret + +#ifndef PIC +# define SYSCALL_ERROR_HANDLER \ + mov.l 0f,r1; \ + jmp @r1; \ + mov r0,r4; \ + .align 2; \ + 0: .long __syscall_error + +#include <libc/sysdeps/linux/sh/syscall_error.S> +#else +# if RTLD_PRIVATE_ERRNO + +# define SYSCALL_ERROR_HANDLER \ + neg r0,r1; \ + mov.l 0f,r12; \ + mova 0f,r0; \ + add r0,r12; \ + mov.l 1f,r0; \ + mov.l r1,@(r0,r12) + bra .Lpseudo_end; \ + mov _IMM1,r0; \ + .align 2; \ + 0: .long _GLOBAL_OFFSET_TABLE_; \ + 1: .long rtld_errno@GOTOFF + +# elif defined _LIBC_REENTRANT + +# if USE___THREAD + +# ifndef NOT_IN_libc +# define SYSCALL_ERROR_ERRNO __libc_errno +# else +# define SYSCALL_ERROR_ERRNO errno +# endif +# define SYSCALL_ERROR_HANDLER \ + neg r0,r1; \ + mov r12,r2; \ + mov.l 0f,r12; \ + mova 0f,r0; \ + add r0,r12; \ + mov.l 1f,r0; \ + stc gbr, r4; \ + mov.l @(r0,r12),r0; \ + bra .Lskip; \ + add r4,r0; \ + .align 2; \ + 1: .long SYSCALL_ERROR_ERRNO@GOTTPOFF; \ + .Lskip: \ + mov r2,r12; \ + mov.l r1,@r0; \ + bra .Lpseudo_end; \ + mov _IMM1,r0; \ + .align 2; \ + 0: .long _GLOBAL_OFFSET_TABLE_ +# else + +# define SYSCALL_ERROR_HANDLER \ + neg r0,r1; \ + mov.l r14,@-r15; \ + mov.l r12,@-r15; \ + mov.l r1,@-r15; \ + mov.l 0f,r12; \ + mova 0f,r0; \ + add r0,r12; \ + sts.l pr,@-r15; \ + mov r15,r14; \ + mov.l 1f,r1; \ + bsrf r1; \ + nop; \ + 2: mov r14,r15; \ + lds.l @r15+,pr; \ + mov.l @r15+,r1; \ + mov.l r1,@r0; \ + mov.l @r15+,r12; \ + mov.l @r15+,r14; \ + bra .Lpseudo_end; \ + mov _IMM1,r0; \ + .align 2; \ + 0: .long _GLOBAL_OFFSET_TABLE_; \ + 1: .long PLTJMP(C_SYMBOL_NAME(__errno_location))-(2b-.) +/* A quick note: it is assumed that the call to `__errno_location' does + not modify the stack! */ +# endif +# else + +/* Store (-r0) into errno through the GOT. */ +# define SYSCALL_ERROR_HANDLER \ + neg r0,r1; \ + mov r12,r2; \ + mov.l 0f,r12; \ + mova 0f,r0; \ + add r0,r12; \ + mov.l 1f,r0; \ + mov.l @(r0,r12),r0; \ + mov r2,r12; \ + mov.l r1,@r0; \ + bra .Lpseudo_end; \ + mov _IMM1,r0; \ + .align 2; \ + 0: .long _GLOBAL_OFFSET_TABLE_; \ + 1: .long errno@GOT +# endif /* _LIBC_REENTRANT */ +#endif /* PIC */ + +# ifdef NEED_SYSCALL_INST_PAD +# define SYSCALL_INST_PAD \ + or r0,r0; or r0,r0; or r0,r0; or r0,r0; or r0,r0 +# else +# define SYSCALL_INST_PAD +# endif + +#define SYSCALL_INST0 trapa #0x10 +#define SYSCALL_INST1 trapa #0x11 +#define SYSCALL_INST2 trapa #0x12 +#define SYSCALL_INST3 trapa #0x13 +#define SYSCALL_INST4 trapa #0x14 +#define SYSCALL_INST5 mov.l @(0,r15),r0; trapa #0x15 +#define SYSCALL_INST6 mov.l @(0,r15),r0; mov.l @(4,r15),r1; trapa #0x16 + +#undef DO_CALL +#define DO_CALL(syscall_name, args) \ + mov.l 1f,r3; \ + SYSCALL_INST##args; \ + SYSCALL_INST_PAD; \ + bra 2f; \ + nop; \ + .align 2; \ + 1: .long SYS_ify (syscall_name); \ + 2: + +#else /* not __ASSEMBLER__ */ + +#define SYSCALL_INST_STR0 "trapa #0x10\n\t" +#define SYSCALL_INST_STR1 "trapa #0x11\n\t" +#define SYSCALL_INST_STR2 "trapa #0x12\n\t" +#define SYSCALL_INST_STR3 "trapa #0x13\n\t" +#define SYSCALL_INST_STR4 "trapa #0x14\n\t" +#define SYSCALL_INST_STR5 "trapa #0x15\n\t" +#define SYSCALL_INST_STR6 "trapa #0x16\n\t" + +# ifdef NEED_SYSCALL_INST_PAD +# define SYSCALL_INST_PAD "\ + or r0,r0; or r0,r0; or r0,r0; or r0,r0; or r0,r0" +# else +# define SYSCALL_INST_PAD +# endif + +#define ASMFMT_0 +#define ASMFMT_1 \ + , "r" (r4) +#define ASMFMT_2 \ + , "r" (r4), "r" (r5) +#define ASMFMT_3 \ + , "r" (r4), "r" (r5), "r" (r6) +#define ASMFMT_4 \ + , "r" (r4), "r" (r5), "r" (r6), "r" (r7) +#define ASMFMT_5 \ + , "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0) +#define ASMFMT_6 \ + , "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0), "r" (r1) +#define ASMFMT_7 \ + , "r" (r4), "r" (r5), "r" (r6), "r" (r7), "0" (r0), "r" (r1), "r" (r2) + +#define SUBSTITUTE_ARGS_0() +#define SUBSTITUTE_ARGS_1(arg1) \ + long int _arg1 = (long int) (arg1); \ + register long int r4 asm ("%r4") = (long int) (_arg1) +#define SUBSTITUTE_ARGS_2(arg1, arg2) \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + register long int r4 asm ("%r4") = (long int) (_arg1); \ + register long int r5 asm ("%r5") = (long int) (_arg2) +#define SUBSTITUTE_ARGS_3(arg1, arg2, arg3) \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + register long int r4 asm ("%r4") = (long int) (_arg1); \ + register long int r5 asm ("%r5") = (long int) (_arg2); \ + register long int r6 asm ("%r6") = (long int) (_arg3) +#define SUBSTITUTE_ARGS_4(arg1, arg2, arg3, arg4) \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + register long int r4 asm ("%r4") = (long int) (_arg1); \ + register long int r5 asm ("%r5") = (long int) (_arg2); \ + register long int r6 asm ("%r6") = (long int) (_arg3); \ + register long int r7 asm ("%r7") = (long int) (_arg4) +#define SUBSTITUTE_ARGS_5(arg1, arg2, arg3, arg4, arg5) \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + long int _arg5 = (long int) (arg5); \ + register long int r4 asm ("%r4") = (long int) (_arg1); \ + register long int r5 asm ("%r5") = (long int) (_arg2); \ + register long int r6 asm ("%r6") = (long int) (_arg3); \ + register long int r7 asm ("%r7") = (long int) (_arg4); \ + register long int r0 asm ("%r0") = (long int) (_arg5) +#define SUBSTITUTE_ARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + long int _arg5 = (long int) (arg5); \ + long int _arg6 = (long int) (arg6); \ + register long int r4 asm ("%r4") = (long int)(_arg1); \ + register long int r5 asm ("%r5") = (long int) (_arg2); \ + register long int r6 asm ("%r6") = (long int) (_arg3); \ + register long int r7 asm ("%r7") = (long int) (_arg4); \ + register long int r0 asm ("%r0") = (long int) (_arg5); \ + register long int r1 asm ("%r1") = (long int) (_arg6) +#define SUBSTITUTE_ARGS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + long int _arg5 = (long int) (arg5); \ + long int _arg6 = (long int) (arg6); \ + long int _arg7 = (long int) (arg7); \ + register long int r4 asm ("%r4") = (long int) (_arg1); \ + register long int r5 asm ("%r5") = (long int) (_arg2); \ + register long int r6 asm ("%r6") = (long int) (_arg3); \ + register long int r7 asm ("%r7") = (long int) (_arg4); \ + register long int r0 asm ("%r0") = (long int) (_arg5); \ + register long int r1 asm ("%r1") = (long int) (_arg6); \ + register long int r2 asm ("%r2") = (long int) (_arg7) + +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \ + { \ + __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ + resultvar = 0xffffffff; \ + } \ + (int) resultvar; }) + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL(name, err, nr, args...) \ + ({ \ + unsigned long int resultvar; \ + register long int r3 asm ("%r3") = SYS_ify (name); \ + SUBSTITUTE_ARGS_##nr(args); \ + \ + asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \ + : "=z" (resultvar) \ + : "r" (r3) ASMFMT_##nr \ + : "memory"); \ + \ + (int) resultvar; }) + +/* The _NCS variant allows non-constant syscall numbers. */ +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ + ({ \ + unsigned long int resultvar; \ + register long int r3 asm ("%r3") = (name); \ + SUBSTITUTE_ARGS_##nr(args); \ + \ + asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \ + : "=z" (resultvar) \ + : "r" (r3) ASMFMT_##nr \ + : "memory"); \ + \ + (int) resultvar; }) + +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int) (val) >= 0xfffff001u) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) + +#endif /* __ASSEMBLER__ */ + +#endif /* linux/sh/sysdep.h */ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S index b5f5d86dd..a45c09fd6 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S @@ -66,6 +66,6 @@ ENTRY (__vfork) .word PID - TLS_PRE_TCB_SIZE .align 2 PSEUDO_END (__vfork) -hidden_def (__vfork) +hidden_def (vfork) weak_alias (__vfork, vfork) |