From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4990 invoked by alias); 1 Aug 2007 23:00:51 -0000 Received: (qmail 4971 invoked by uid 22791); 1 Aug 2007 23:00:50 -0000 X-Spam-Check-By: sourceware.org Received: from mo10.iij4u.or.jp (HELO mo10.iij4u.or.jp) (210.138.174.78) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 01 Aug 2007 23:00:41 +0000 Received: by mo.iij4u.or.jp (mo10) id l71N0ahQ032328; Thu, 2 Aug 2007 08:00:36 +0900 Received: from localhost (238.152.138.210.bn.2iij.net [210.138.152.238]) by mbox.iij4u.or.jp (mbox10) id l71N0SZX008169; Thu, 2 Aug 2007 08:00:32 +0900 Date: Wed, 01 Aug 2007 23:00:00 -0000 Message-Id: <20070802.080027.08326116.kkojima@rr.iij4u.or.jp> To: libc-hacker@sources.redhat.com Subject: Re: [PATCH] lowlevellock.h cleanups, LLL_SHARED vs. LLL_PRIVATE on lll locks From: Kaz Kojima In-Reply-To: <20070731111453.GZ4603@sunsite.mff.cuni.cz> References: <20070725201502.GI4603@sunsite.mff.cuni.cz> <20070731111453.GZ4603@sunsite.mff.cuni.cz> X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2007-08/txt/msg00001.txt.bz2 Jakub Jelinek wrote: > Here is an updated patch against CVS trunk plus > http://sources.redhat.com/ml/libc-hacker/2007-07/msg00050.html > which changes all in-tree arches but SH (will leave that to Kaz) and > sparc sem_* stuff (will do when I find time for it). The attached patch is the SH portion for this change and a few other code cleanups. Regards, kaz -- 2007-08-01 Kaz Kojima * sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S: Remove definitions for private futexes. * sysdeps/unix/sysv/linux/sh/lowlevellock.S: Include kernel-features.h and lowlevellock.h. Use private futexes if they are available. (__lll_lock_wait_private, __lll_unlock_wake_private): New. (__lll_mutex_lock_wait): Rename to (__lll_lock_wait): ... this. Don't compile in for libc.so. (__lll_mutex_timedlock_wait): Rename to ... (__lll_timedlock_wait): ... this. Use __NR_gettimeofday. Don't compile in for libc.so. (__lll_mutex_unlock_wake): Rename to ... (__lll_unlock_wake): ... this. Don't compile in for libc.so. (__lll_timedwait_tid): Use __NR_gettimeofday. * sysdeps/unix/sysv/linux/sh/lowlevellock.h: Allow including the header from assembler. Renamed all lll_mutex_* resp. lll_robust_mutex_* macros to lll_* resp. lll_robust_*. Renamed all LLL_MUTEX_LOCK_* macros to LLL_LOCK_*. (FUTEX_CMP_REQUEUE, FUTEX_WAKE_OP, FUTEX_OP_CLEAR_WAKE_IF_GT_ONE): Define. (__lll_lock_wait_private): Add prototype. (__lll_lock_wait, __lll_timedlock_wait, __lll_robust_lock_wait, __lll_robust_timedlock_wait, __lll_unlock_wake_private, __lll_unlock_wake): Likewise. (lll_lock): Add private argument. Call __lll_lock_wait_private if private is constant LLL_PRIVATE. (lll_robust_lock, lll_cond_lock, lll_robust_cond_lock, lll_timedlock, lll_robust_timedlock): Add private argument. (lll_unlock): Add private argument. Call __lll_unlock_wake_private if private is constant LLL_PRIVATE. (lll_robust_unlock, lll_robust_dead): Add private argument. (lll_lock_t): Remove. (__lll_cond_wait, __lll_cond_timedwait, __lll_cond_wake, __lll_cond_broadcast, lll_cond_wait, lll_cond_timedwait, lll_cond_wake, lll_cond_broadcast): Remove. * sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S: Include kernel-features.h and lowlevellock.h. (SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Remove. (LOAD_FUTEX_WAIT): Define. (__lll_robust_mutex_lock_wait): Rename to ... (__lll_robust_lock_wait): ... this. Add private argument. Use LOAD_FUTEX_WAIT macro. (__lll_robust_mutex_timedlock_wait): Rename to ... (__lll_robust_timedlock_wait): ... this. Add private argument. Use __NR_gettimeofday. Use LOAD_FUTEX_WAIT macro. * sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S: Include lowlevellock.h. (SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Remove. (pthread_barrier_wait): Use __lll_{lock,unlock}_* instead of __lll_mutex_{lock,unlock}_*. * sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S: Include lowlevellock.h and pthread-errnos.h. (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE, FUTEX_CMP_REQUEUE, EINVAL): Remove. (__pthread_cond_broadcast): Use __lll_{lock,unlock}_* instead of __lll_mutex_{lock,unlock}_*. * sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S: Include lowlevellock.h and pthread-errnos.h. (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE, EINVAL): Remove. (__pthread_cond_signal): Use __lll_{lock,unlock}_* instead of __lll_mutex_{lock,unlock}_*. * sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Include lowlevellock.h. (SYS_futex, SYS_gettimeofday, FUTEX_WAIT, FUTEX_WAKE): Remove. (__pthread_cond_timedwait): Use __lll_{lock,unlock}_* instead of __lll_mutex_{lock,unlock}_*. Use __NR_gettimeofday. (__condvar_tw_cleanup): Likewise. * sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Include lowlevellock.h. (SYS_futex, FUTEX_WAIT, FUTEX_WAKE): Remove. (__pthread_cond_wait): Use __lll_{lock,unlock}_* instead of __lll_mutex_{lock,unlock}_*. ( __condvar_w_cleanup): Likewise. * sysdeps/unix/sysv/linux/sh/pthread_once.S: Include lowlevellock.h. (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S: Include lowlevellock.h. (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove. (__pthread_rwlock_rdlock): Use __lll_{lock,unlock}_* instead of __lll_mutex_{lock,unlock}_*. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S: Include lowlevellock.h. (SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove. (pthread_rwlock_timedrdlock): Use __lll_{lock,unlock}_* instead of __lll_mutex_{lock,unlock}_*. Use __NR_gettimeofday. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S: Include lowlevellock.h. (SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove. (pthread_rwlock_timedwrlock): Use __lll_{lock,unlock}_* instead of __lll_mutex_{lock,unlock}_*. Use __NR_gettimeofday. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S: Include lowlevellock.h. (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove. (__pthread_rwlock_unlock): Use __lll_{lock,unlock}_* instead of __lll_mutex_{lock,unlock}_*. * sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S: Include lowlevellock.h. (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove. (__pthread_rwlock_wrlock): Use __lll_{lock,unlock}_* instead of __lll_mutex_{lock,unlock}_*. * sysdeps/unix/sysv/linux/sh/sem_post.S: Include lowlevellock.h. (SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove. (__new_sem_post): Use standard initial exec code sequences. * sysdeps/unix/sysv/linux/sh/sem_timedwait.S: Include lowlevellock.h. (SYS_gettimeofday, SYS_futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_PRIVATE_FLAG): Remove. (sem_timedwait): Use __NR_gettimeofday. Use standard initial exec code sequences. * sysdeps/unix/sysv/linux/sh/sem_trywait.S: Include lowlevellock.h. (__new_sem_trywait): Use standard initial exec code sequences. * sysdeps/unix/sysv/linux/sh/sem_wait.S: Include lowlevellock.h. (__new_sem_wait): Use standard initial exec code sequences. diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S 2007-07-31 21:24:55.000000000 +0900 @@ -16,32 +16,4 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include - -/* All locks in libc are private. Use the kernel feature if possible. */ -#define FUTEX_PRIVATE_FLAG 128 -#ifdef __ASSUME_PRIVATE_FUTEX -# define FUTEX_WAIT (0 | FUTEX_PRIVATE_FLAG) -# define FUTEX_WAKE (1 | FUTEX_PRIVATE_FLAG) -#else -# define LOAD_FUTEX_WAIT(reg,tmp) \ - stc gbr, tmp ; \ - mov.w 99f, reg ; \ - add reg, tmp ; \ - bra 98f ; \ - mov.l @tmp, reg ; \ -99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \ -98: - -# define LOAD_FUTEX_WAKE(reg,tmp) \ - stc gbr, tmp ; \ - mov.w 99f, reg ; \ - add reg, tmp ; \ - mov.l @tmp, reg ; \ - bra 98f ; \ - mov #FUTEX_WAKE, tmp ; \ -99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \ -98: or tmp, reg -#endif - #include "lowlevellock.S" diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S 2007-08-01 13:28:04.000000000 +0900 @@ -18,45 +18,112 @@ #include #include +#include +#include #include "lowlevel-atomic.h" .text -#define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 -#ifndef FUTEX_WAIT -# define FUTEX_WAIT 0 -# define FUTEX_WAKE 1 -#endif - -#ifndef LOAD_FUTEX_WAIT +#ifdef __ASSUME_PRIVATE_FUTEX +# define LOAD_PRIVATE_FUTEX_WAIT(reg,tmp,tmp2) \ + mov #(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg; \ + extu.b reg, reg +# define LOAD_PRIVATE_FUTEX_WAKE(reg,tmp,tmp2) \ + mov #(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), reg; \ + extu.b reg, reg +# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \ + mov #(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), tmp; \ + extu.b tmp, tmp; \ + xor tmp, reg +# define LOAD_FUTEX_WAKE(reg,tmp,tmp2) \ + mov #(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), tmp; \ + extu.b tmp, tmp; \ + xor tmp, reg +#else # if FUTEX_WAIT == 0 -# define LOAD_FUTEX_WAIT(reg,tmp) \ - xor reg, reg +# define LOAD_PRIVATE_FUTEX_WAIT(reg,tmp,tmp2) \ + stc gbr, tmp ; \ + mov.w 99f, reg ; \ + add reg, tmp ; \ + bra 98f ; \ + mov.l @tmp, reg ; \ +99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \ +98: # else -# define LOAD_FUTEX_WAIT(reg,tmp) \ - mov #FUTEX_WAIT, reg; \ - extu.b reg, reg +# define LOAD_PRIVATE_FUTEX_WAIT(reg,tmp,tmp2) \ + stc gbr, tmp ; \ + mov.w 99f, reg ; \ + add reg, tmp ; \ + mov.l @tmp, reg ; \ + bra 98f ; \ + mov #FUTEX_WAIT, tmp ; \ +99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \ +98: or tmp, reg +# endif +# define LOAD_PRIVATE_FUTEX_WAKE(reg,tmp,tmp2) \ + stc gbr, tmp ; \ + mov.w 99f, reg ; \ + add reg, tmp ; \ + mov.l @tmp, reg ; \ + bra 98f ; \ + mov #FUTEX_WAKE, tmp ; \ +99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \ +98: or tmp, reg +# if FUTEX_WAIT == 0 +# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \ + stc gbr, tmp ; \ + mov.w 99f, tmp2 ; \ + add tmp2, tmp ; \ + mov.l @tmp, tmp2 ; \ + bra 98f ; \ + mov #FUTEX_PRIVATE_FLAG, tmp +99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \ +98: extu.b tmp, tmp ; \ + xor tmp, reg ; \ + and tmp2, reg +# else +# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \ + stc gbr, tmp ; \ + mov.w 99f, tmp2 ; \ + add tmp2, tmp ; \ + mov.l @tmp, tmp2 ; \ + bra 98f ; \ + mov #FUTEX_PRIVATE_FLAG, tmp +99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \ +98: extu.b tmp, tmp ; \ + xor tmp, reg ; \ + and tmp2, reg ; \ + mov #FUTEX_WAIT, tmp ; \ + or tmp, reg # endif # define LOAD_FUTEX_WAKE(reg,tmp) \ - mov #FUTEX_WAKE, reg; \ - extu.b reg, reg + stc gbr, tmp ; \ + mov.w 99f, tmp2 ; \ + add tmp2, tmp ; \ + mov.l @tmp, tmp2 ; \ + bra 98f ; \ + mov #FUTEX_PRIVATE_FLAG, tmp +99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \ +98: extu.b tmp, tmp ; \ + xor tmp, reg ; \ + and tmp2, reg ; \ + mov #FUTEX_WAKE, tmp ; \ + or tmp, reg #endif - - .globl __lll_mutex_lock_wait - .type __lll_mutex_lock_wait,@function - .hidden __lll_mutex_lock_wait + .globl __lll_lock_wait_private + .type __lll_lock_wait_private,@function + .hidden __lll_lock_wait_private .align 5 cfi_startproc -__lll_mutex_lock_wait: +__lll_lock_wait_private: mov.l r8, @-r15 cfi_adjust_cfa_offset(4) cfi_rel_offset (r8, 0) mov r4, r6 mov r5, r8 mov #0, r7 /* No timeout. */ - LOAD_FUTEX_WAIT (r5, r0) + LOAD_PRIVATE_FUTEX_WAIT (r5, r0, r1) mov #2, r4 cmp/eq r4, r6 @@ -79,22 +146,67 @@ __lll_mutex_lock_wait: ret mov r2, r0 cfi_endproc - .size __lll_mutex_lock_wait,.-__lll_mutex_lock_wait - + .size __lll_lock_wait_private,.-__lll_lock_wait_private #ifdef NOT_IN_libc - .globl __lll_mutex_timedlock_wait - .type __lll_mutex_timedlock_wait,@function - .hidden __lll_mutex_timedlock_wait + .globl __lll_lock_wait + .type __lll_lock_wait,@function + .hidden __lll_lock_wait .align 5 cfi_startproc -__lll_mutex_timedlock_wait: +__lll_lock_wait: + mov.l r9, @-r15 + cfi_adjust_cfa_offset(4) + cfi_rel_offset (r9, 0) + mov.l r8, @-r15 + cfi_adjust_cfa_offset(4) + cfi_rel_offset (r8, 0) + mov r6, r9 + mov r4, r6 + mov r5, r8 + mov #0, r7 /* No timeout. */ + mov r9, r5 + LOAD_FUTEX_WAIT (r5, r0, r1) + + 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, r6 + XCHG (r6, @r8, r2) + tst r2, r2 + bf 1b + + mov.l @r15+, r8 + mov.l @r15+, r9 + ret + mov r2, r0 + cfi_endproc + .size __lll_lock_wait,.-__lll_lock_wait + + .globl __lll_timedlock_wait + .type __lll_timedlock_wait,@function + .hidden __lll_timedlock_wait + .align 5 + cfi_startproc +__lll_timedlock_wait: /* Check for a valid timeout value. */ mov.l @(4,r6), r1 mov.l .L1g, r0 cmp/hs r0, r1 bt 3f + mov.l r11, @-r15 + cfi_adjust_cfa_offset(4) + cfi_rel_offset (r11, 0) mov.l r10, @-r15 cfi_adjust_cfa_offset(4) cfi_rel_offset (r10, 0) @@ -104,6 +216,7 @@ __lll_mutex_timedlock_wait: mov.l r8, @-r15 cfi_adjust_cfa_offset(4) cfi_rel_offset (r8, 0) + mov r7, r11 mov r4, r10 mov r6, r9 mov r5, r8 @@ -116,7 +229,7 @@ __lll_mutex_timedlock_wait: /* Get current time. */ mov r15, r4 mov #0, r5 - mov #SYS_gettimeofday, r3 + mov #__NR_gettimeofday, r3 trapa #0x12 SYSCALL_INST_PAD @@ -149,7 +262,8 @@ __lll_mutex_timedlock_wait: bt 8f mov r8, r4 - LOAD_FUTEX_WAIT (r5, r0) + mov r11, r5 + LOAD_FUTEX_WAIT (r5, r0, r1) mov r10, r6 mov r15, r7 mov #SYS_futex, r3 @@ -169,8 +283,9 @@ __lll_mutex_timedlock_wait: add #8, r15 mov.l @r15+, r8 mov.l @r15+, r9 + mov.l @r15+, r10 rts - mov.l @r15+, r10 + mov.l @r15+, r11 7: /* Check whether the time expired. */ mov #-ETIMEDOUT, r1 @@ -198,17 +313,16 @@ __lll_mutex_timedlock_wait: .L1g: .long 1000000000 - .size __lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait + .size __lll_timedlock_wait,.-__lll_timedlock_wait #endif - - .globl __lll_mutex_unlock_wake - .type __lll_mutex_unlock_wake,@function - .hidden __lll_mutex_unlock_wake + .globl __lll_unlock_wake_private + .type __lll_unlock_wake_private,@function + .hidden __lll_unlock_wake_private .align 5 cfi_startproc -__lll_mutex_unlock_wake: - LOAD_FUTEX_WAKE (r5, r0) +__lll_unlock_wake_private: + LOAD_PRIVATE_FUTEX_WAKE (r5, r0, r1) mov #1, r6 /* Wake one thread. */ mov #0, r7 mov.l r7, @r4 /* Stores 0. */ @@ -219,10 +333,28 @@ __lll_mutex_unlock_wake: rts nop cfi_endproc - .size __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake - + .size __lll_unlock_wake_private,.-__lll_unlock_wake_private #ifdef NOT_IN_libc + .globl __lll_unlock_wake + .type __lll_unlock_wake,@function + .hidden __lll_unlock_wake + .align 5 + cfi_startproc +__lll_unlock_wake: + LOAD_FUTEX_WAKE (r5, r0, r1) + mov #1, r6 /* Wake one thread. */ + mov #0, r7 + mov.l r7, @r4 /* Stores 0. */ + mov #SYS_futex, r3 + extu.b r3, r3 + trapa #0x14 + SYSCALL_INST_PAD + rts + nop + cfi_endproc + .size __lll_unlock_wake,.-__lll_unlock_wake + .globl __lll_timedwait_tid .type __lll_timedwait_tid,@function .hidden __lll_timedwait_tid @@ -246,7 +378,7 @@ __lll_timedwait_tid: /* Get current time. */ mov r15, r4 mov #0, r5 - mov #SYS_gettimeofday, r3 + mov #__NR_gettimeofday, r3 trapa #0x12 SYSCALL_INST_PAD diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h 2007-07-31 20:25:06.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h 2007-08-01 15:41:56.000000000 +0900 @@ -19,19 +19,24 @@ #ifndef _LOWLEVELLOCK_H #define _LOWLEVELLOCK_H 1 +#ifndef __ASSEMBLER__ #include #include #include #include +#endif #define SYS_futex 240 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 +#define FUTEX_CMP_REQUEUE 4 +#define FUTEX_WAKE_OP 5 #define FUTEX_LOCK_PI 6 #define FUTEX_UNLOCK_PI 7 #define FUTEX_TRYLOCK_PI 8 #define FUTEX_PRIVATE_FLAG 128 +#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE ((4 << 24) | 1) /* Values for 'private' parameter of locking macros. Yes, the definition seems to be backwards. But it is not. The bit will be @@ -64,20 +69,30 @@ # endif #endif +#ifndef __ASSEMBLER__ /* Initializer for compatibility lock. */ -#define LLL_MUTEX_LOCK_INITIALIZER (0) -#define LLL_MUTEX_LOCK_INITIALIZER_LOCKED (1) -#define LLL_MUTEX_LOCK_INITIALIZER_WAITERS (2) - -extern int __lll_mutex_lock_wait (int val, int *__futex) attribute_hidden; -extern int __lll_mutex_timedlock_wait (int val, int *__futex, - const struct timespec *abstime) - attribute_hidden; -extern int __lll_mutex_unlock_wake (int *__futex) attribute_hidden; +#define LLL_LOCK_INITIALIZER (0) +#define LLL_LOCK_INITIALIZER_LOCKED (1) +#define LLL_LOCK_INITIALIZER_WAITERS (2) +extern int __lll_lock_wait_private (int val, int *__futex) + attribute_hidden; +extern int __lll_lock_wait (int val, int *__futex, int private) + attribute_hidden; +extern int __lll_timedlock_wait (int val, int *__futex, + const struct timespec *abstime, int private) + attribute_hidden; +extern int __lll_robust_lock_wait (int val, int *__futex, int private) + attribute_hidden; +extern int __lll_robust_timedlock_wait (int val, int *__futex, + const struct timespec *abstime, + int private) + attribute_hidden; +extern int __lll_unlock_wake_private (int *__futex) attribute_hidden; +extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; -#define lll_mutex_trylock(futex) \ +#define lll_trylock(futex) \ ({ unsigned char __result; \ __asm __volatile ("\ .align 2\n\ @@ -94,12 +109,12 @@ extern int __lll_mutex_unlock_wake (int negc %0,%0"\ : "=r" (__result) \ : "r" (&(futex)), \ - "r" (LLL_MUTEX_LOCK_INITIALIZER_LOCKED), \ - "r" (LLL_MUTEX_LOCK_INITIALIZER) \ + "r" (LLL_LOCK_INITIALIZER_LOCKED), \ + "r" (LLL_LOCK_INITIALIZER) \ : "r0", "r1", "r2", "t", "memory"); \ __result; }) -#define lll_robust_mutex_trylock(futex, id) \ +#define lll_robust_trylock(futex, id) \ ({ unsigned char __result; \ __asm __volatile ("\ .align 2\n\ @@ -117,11 +132,11 @@ extern int __lll_mutex_unlock_wake (int : "=r" (__result) \ : "r" (&(futex)), \ "r" (id), \ - "r" (LLL_MUTEX_LOCK_INITIALIZER) \ + "r" (LLL_LOCK_INITIALIZER) \ : "r0", "r1", "r2", "t", "memory"); \ __result; }) -#define lll_mutex_cond_trylock(futex) \ +#define lll_cond_trylock(futex) \ ({ unsigned char __result; \ __asm __volatile ("\ .align 2\n\ @@ -138,13 +153,13 @@ extern int __lll_mutex_unlock_wake (int negc %0,%0"\ : "=r" (__result) \ : "r" (&(futex)), \ - "r" (LLL_MUTEX_LOCK_INITIALIZER_WAITERS), \ - "r" (LLL_MUTEX_LOCK_INITIALIZER) \ + "r" (LLL_LOCK_INITIALIZER_WAITERS), \ + "r" (LLL_LOCK_INITIALIZER) \ : "r0", "r1", "r2", "t", "memory"); \ __result; }) -#define lll_mutex_lock(futex) \ - (void) ({ int __result, val, *__futex = &(futex); \ +#define lll_lock(futex, private) \ + (void) ({ int __result, *__futex = &(futex); \ __asm __volatile ("\ .align 2\n\ mova 1f,r0\n\ @@ -159,10 +174,17 @@ extern int __lll_mutex_unlock_wake (int : "=&r" (__result) : "r" (1), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ if (__result) \ - __lll_mutex_lock_wait (__result, __futex); }) + { \ + if (__builtin_constant_p (private) \ + && (private) == LLL_PRIVATE) \ + __lll_lock_wait_private (__result, __futex); \ + else \ + __lll_lock_wait (__result, __futex, (private)); \ + } \ + }) -#define lll_robust_mutex_lock(futex, id) \ - ({ int __result, val, *__futex = &(futex); \ +#define lll_robust_lock(futex, id, private) \ + ({ int __result, *__futex = &(futex); \ __asm __volatile ("\ .align 2\n\ mova 1f,r0\n\ @@ -177,13 +199,13 @@ extern int __lll_mutex_unlock_wake (int : "=&r" (__result) : "r" (id), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ if (__result) \ - __result = __lll_robust_mutex_lock_wait (__result, __futex); \ + __result = __lll_robust_lock_wait (__result, __futex, private); \ __result; }) /* Special version of lll_mutex_lock which causes the unlock function to always wakeup waiters. */ -#define lll_mutex_cond_lock(futex) \ - (void) ({ int __result, val, *__futex = &(futex); \ +#define lll_cond_lock(futex, private) \ + (void) ({ int __result, *__futex = &(futex); \ __asm __volatile ("\ .align 2\n\ mova 1f,r0\n\ @@ -198,10 +220,10 @@ extern int __lll_mutex_unlock_wake (int : "=&r" (__result) : "r" (2), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ if (__result) \ - __lll_mutex_lock_wait (__result, __futex); }) + __lll_lock_wait (__result, __futex, private); }) -#define lll_robust_mutex_cond_lock(futex, id) \ - ({ int __result, val, *__futex = &(futex); \ +#define lll_robust_cond_lock(futex, id, private) \ + ({ int __result, *__futex = &(futex); \ __asm __volatile ("\ .align 2\n\ mova 1f,r0\n\ @@ -216,11 +238,11 @@ extern int __lll_mutex_unlock_wake (int : "=&r" (__result) : "r" (id | FUTEX_WAITERS), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ if (__result) \ - __result = __lll_robust_mutex_lock_wait (__result, __futex); \ + __result = __lll_robust_lock_wait (__result, __futex, private); \ __result; }) -#define lll_mutex_timedlock(futex, timeout) \ - ({ int __result, val, *__futex = &(futex); \ +#define lll_timedlock(futex, timeout, private) \ + ({ int __result, *__futex = &(futex); \ __asm __volatile ("\ .align 2\n\ mova 1f,r0\n\ @@ -235,11 +257,11 @@ extern int __lll_mutex_unlock_wake (int : "=&r" (__result) : "r" (1), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ if (__result) \ - __result = __lll_mutex_timedlock_wait (__result, __futex, timeout); \ + __result = __lll_timedlock_wait (__result, __futex, timeout, private); \ __result; }) -#define lll_robust_mutex_timedlock(futex, timeout, id) \ - ({ int __result, val, *__futex = &(futex); \ +#define lll_robust_timedlock(futex, timeout, id, private) \ + ({ int __result, *__futex = &(futex); \ __asm __volatile ("\ .align 2\n\ mova 1f,r0\n\ @@ -254,11 +276,11 @@ extern int __lll_mutex_unlock_wake (int : "=&r" (__result) : "r" (id), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ if (__result) \ - __result = __lll_robust_mutex_timedlock_wait (__result, __futex, \ - timeout); \ + __result = __lll_robust_timedlock_wait (__result, __futex, \ + timeout, private); \ __result; }) -#define lll_mutex_unlock(futex) \ +#define lll_unlock(futex, private) \ (void) ({ int __result, *__futex = &(futex); \ __asm __volatile ("\ .align 2\n\ @@ -272,9 +294,16 @@ extern int __lll_mutex_unlock_wake (int : "=&r" (__result) : "r" (__futex) \ : "r0", "r1", "memory"); \ if (__result) \ - __lll_mutex_unlock_wake (__futex); }) + { \ + if (__builtin_constant_p (private) \ + && (private) == LLL_PRIVATE) \ + __lll_unlock_wake_private (__futex); \ + else \ + __lll_unlock_wake (__futex, (private)); \ + } \ + }) -#define lll_robust_mutex_unlock(futex) \ +#define lll_robust_unlock(futex, private) \ (void) ({ int __result, *__futex = &(futex); \ __asm __volatile ("\ .align 2\n\ @@ -288,9 +317,9 @@ extern int __lll_mutex_unlock_wake (int : "=&r" (__result) : "r" (__futex), "r" (FUTEX_WAITERS) \ : "r0", "r1", "memory"); \ if (__result) \ - __lll_mutex_unlock_wake (__futex); }) + __lll_unlock_wake (__futex, private); }) -#define lll_robust_mutex_dead(futex) \ +#define lll_robust_dead(futex, private) \ (void) ({ int __ignore, *__futex = &(futex); \ __asm __volatile ("\ .align 2\n\ @@ -303,22 +332,7 @@ extern int __lll_mutex_unlock_wake (int 1: mov r1,r15"\ : "=&r" (__ignore) : "r" (__futex), "r" (FUTEX_OWNER_DIED) \ : "r0", "r1", "memory"); \ - lll_futex_wake (__futex, 1, LLL_SHARED); }) - -#define lll_mutex_islocked(futex) \ - (futex != 0) - - -/* We have a separate internal lock implementation which is not tied - to binary compatibility. */ - -/* Type for lock object. */ -typedef int lll_lock_t; - -/* Initializers for lock. */ -#define LLL_LOCK_INITIALIZER (0) -#define LLL_LOCK_INITIALIZER_LOCKED (1) - + lll_futex_wake (__futex, 1, private); }) # ifdef NEED_SYSCALL_INST_PAD # define SYSCALL_WITH_INST_PAD "\ @@ -367,25 +381,14 @@ typedef int lll_lock_t; } while (0) -/* The states of a lock are: - 0 - untaken - 1 - taken by one user - 2 - taken by more users */ - -#define lll_trylock(futex) lll_mutex_trylock (futex) -#define lll_lock(futex) lll_mutex_lock (futex) -#define lll_unlock(futex) lll_mutex_unlock (futex) - #define lll_islocked(futex) \ (futex != LLL_LOCK_INITIALIZER) - /* The kernel notifies a process with uses CLONE_CLEARTID via futex wakeup when the clone terminates. The memory location contains the thread ID while the clone is running and is reset to zero afterwards. */ -extern int __lll_wait_tid (int *tid) attribute_hidden; #define lll_wait_tid(tid) \ do { \ __typeof (tid) *__tid = &(tid); \ @@ -407,24 +410,6 @@ extern int __lll_timedwait_tid (int *tid } \ __result; }) - -/* Conditional variable handling. */ - -extern void __lll_cond_wait (pthread_cond_t *cond) attribute_hidden; -extern int __lll_cond_timedwait (pthread_cond_t *cond, - const struct timespec *abstime) - attribute_hidden; -extern void __lll_cond_wake (pthread_cond_t *cond) attribute_hidden; -extern void __lll_cond_broadcast (pthread_cond_t *cond) attribute_hidden; - - -#define lll_cond_wait(cond) \ - __lll_cond_wait (cond) -#define lll_cond_timedwait(cond, abstime) \ - __lll_cond_timedwait (cond, abstime) -#define lll_cond_wake(cond) \ - __lll_cond_wake (cond) -#define lll_cond_broadcast(cond) \ - __lll_cond_broadcast (cond) +#endif /* !__ASSEMBLER__ */ #endif /* lowlevellock.h */ diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S 2006-02-18 00:36:10.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S 2007-08-01 14:29:53.000000000 +0900 @@ -1,4 +1,5 @@ -/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005, 2006, 2007 + 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 @@ -18,31 +19,64 @@ #include #include +#include #include +#include #include "lowlevel-atomic.h" .text -#define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 #define FUTEX_WAITERS 0x80000000 #define FUTEX_OWNER_DIED 0x40000000 - - .globl __lll_robust_mutex_lock_wait - .type __lll_robust_mutex_lock_wait,@function - .hidden __lll_robust_mutex_lock_wait +#ifdef __ASSUME_PRIVATE_FUTEX +# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \ + mov #(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), tmp; \ + extu.b tmp, tmp; \ + xor tmp, reg +#else +# if FUTEX_WAIT == 0 +# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \ + stc gbr, tmp ; \ + mov.w 99f, tmp2 ; \ + add tmp2, tmp ; \ + mov.l @tmp, tmp2 ; \ + bra 98f ; \ + mov #FUTEX_PRIVATE_FLAG, tmp +99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \ +98: extu.b tmp, tmp ; \ + xor tmp, reg ; \ + and tmp2, reg +# else +# define LOAD_FUTEX_WAIT(reg,tmp,tmp2) \ + stc gbr, tmp ; \ + mov.w 99f, tmp2 ; \ + add tmp2, tmp ; \ + mov.l @tmp, tmp2 ; \ + bra 98f ; \ + mov #FUTEX_PRIVATE_FLAG, tmp +99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \ +98: extu.b tmp, tmp ; \ + xor tmp, reg ; \ + and tmp2, reg ; \ + mov #FUTEX_WAIT, tmp ; \ + or tmp, reg +# endif +#endif + + .globl __lll_robust_lock_wait + .type __lll_robust_lock_wait,@function + .hidden __lll_robust_lock_wait .align 5 cfi_startproc -__lll_robust_mutex_lock_wait: +__lll_robust_lock_wait: mov.l r8, @-r15 cfi_adjust_cfa_offset(4) cfi_rel_offset (r8, 0) mov r5, r8 mov #0, r7 /* No timeout. */ - mov #FUTEX_WAIT, r5 + mov r6, r5 + LOAD_FUTEX_WAIT (r5, r0, r1) 4: mov r4, r6 @@ -90,21 +124,24 @@ __lll_robust_mutex_lock_wait: .long FUTEX_WAITERS .Ltidoff: .word TID - TLS_PRE_TCB_SIZE - .size __lll_robust_mutex_lock_wait,.-__lll_robust_mutex_lock_wait + .size __lll_robust_lock_wait,.-__lll_robust_lock_wait - .globl __lll_robust_mutex_timedlock_wait - .type __lll_robust_mutex_timedlock_wait,@function - .hidden __lll_robust_mutex_timedlock_wait + .globl __lll_robust_timedlock_wait + .type __lll_robust_timedlock_wait,@function + .hidden __lll_robust_timedlock_wait .align 5 cfi_startproc -__lll_robust_mutex_timedlock_wait: +__lll_robust_timedlock_wait: /* Check for a valid timeout value. */ mov.l @(4,r6), r1 mov.l .L1g, r0 cmp/hs r0, r1 bt 3f + mov.l r11, @-r15 + cfi_adjust_cfa_offset(4) + cfi_rel_offset (r11, 0) mov.l r10, @-r15 cfi_adjust_cfa_offset(4) cfi_rel_offset (r10, 0) @@ -114,6 +151,7 @@ __lll_robust_mutex_timedlock_wait: mov.l r8, @-r15 cfi_adjust_cfa_offset(4) cfi_rel_offset (r8, 0) + mov r7, r11 mov r4, r10 mov r6, r9 mov r5, r8 @@ -126,7 +164,7 @@ __lll_robust_mutex_timedlock_wait: /* Get current time. */ mov r15, r4 mov #0, r5 - mov #SYS_gettimeofday, r3 + mov #__NR_gettimeofday, r3 trapa #0x12 SYSCALL_INST_PAD @@ -167,7 +205,8 @@ __lll_robust_mutex_timedlock_wait: 2: mov r8, r4 - mov #FUTEX_WAIT, r5 + mov r11, r5 + LOAD_FUTEX_WAIT (r5, r0, r1) mov r10, r6 mov r15, r7 mov #SYS_futex, r3 @@ -196,8 +235,9 @@ __lll_robust_mutex_timedlock_wait: add #8, r15 mov.l @r15+, r8 mov.l @r15+, r9 + mov.l @r15+, r10 rts - mov.l @r15+, r10 + mov.l @r15+, r11 7: /* Check whether the time expired. */ @@ -221,4 +261,4 @@ __lll_robust_mutex_timedlock_wait: .word TID - TLS_PRE_TCB_SIZE .L1k: .word 1000 - .size __lll_robust_mutex_timedlock_wait,.-__lll_robust_mutex_timedlock_wait + .size __lll_robust_timedlock_wait,.-__lll_robust_timedlock_wait diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S 2007-08-01 09:38:20.000000000 +0900 @@ -17,14 +17,10 @@ 02111-1307 USA. */ #include +#include #include #include "lowlevel-atomic.h" -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 - - .text .globl pthread_barrier_wait @@ -152,6 +148,10 @@ pthread_barrier_wait: mov.l @r15+, r9 1: + mov.l @(PRIVATE,r8), r6 + mov #LLL_SHARED, r0 + extu.b r0, r0 + xor r0, r6 mov r2, r4 mov r8, r5 mov.l .Lwait0, r1 @@ -162,6 +162,10 @@ pthread_barrier_wait: nop 4: + mov.l @(PRIVATE,r8), r5 + mov #LLL_SHARED, r0 + extu.b r0, r0 + xor r0, r5 mov r8, r4 mov.l .Lwake0, r1 bsrf r1 @@ -172,6 +176,10 @@ pthread_barrier_wait: 6: mov r6, r9 + mov.l @(PRIVATE,r8), r5 + mov #LLL_SHARED, r0 + extu.b r0, r0 + xor r0, r5 mov r8, r4 mov.l .Lwake1, r1 bsrf r1 @@ -182,6 +190,10 @@ pthread_barrier_wait: 9: mov r6, r9 + mov.l @(PRIVATE,r8), r5 + mov #LLL_SHARED, r0 + extu.b r0, r0 + xor r0, r5 mov r8, r4 mov.l .Lwake2, r1 bsrf r1 @@ -194,11 +206,11 @@ pthread_barrier_wait: .Lall: .long 0x7fffffff .Lwait0: - .long __lll_mutex_lock_wait-.Lwait0b + .long __lll_lock_wait-.Lwait0b .Lwake0: - .long __lll_mutex_unlock_wake-.Lwake0b + .long __lll_unlock_wake-.Lwake0b .Lwake1: - .long __lll_mutex_unlock_wake-.Lwake1b + .long __lll_unlock_wake-.Lwake1b .Lwake2: - .long __lll_mutex_unlock_wake-.Lwake2b + .long __lll_unlock_wake-.Lwake2b .size pthread_barrier_wait,.-pthread_barrier_wait diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S 2006-09-18 06:49:04.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S 2007-08-01 09:49:37.000000000 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2006, 2007 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 @@ -18,19 +18,13 @@ #include #include +#include #include #include #include +#include #include "lowlevel-atomic.h" -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 -#define FUTEX_REQUEUE 3 -#define FUTEX_CMP_REQUEUE 4 - -#define EINVAL 22 - .text /* int pthread_cond_broadcast (pthread_cond_t *cond) */ @@ -162,10 +156,12 @@ __pthread_cond_broadcast: #if cond_lock != 0 add #cond_lock, r5 #endif - mov.l .Lmwait5, r1 + mov #LLL_SHARED, r6 + extu.b r6, r6 + mov.l .Lwait5, r1 bsrf r1 mov r2, r4 -.Lmwait5b: +.Lwait5b: bra 2b nop @@ -175,10 +171,11 @@ __pthread_cond_broadcast: #if cond_lock != 0 add #cond_lock, r4 #endif - mov.l .Lmwake5, r1 + mov #LLL_SHARED, r5 + mov.l .Lwake5, r1 bsrf r1 - nop -.Lmwake5b: + extu.b r5, r5 +.Lwake5b: bra 6b nop @@ -188,10 +185,11 @@ __pthread_cond_broadcast: #if cond_lock != 0 add #cond_lock, r4 #endif - mov.l .Lmwake6, r1 + mov #LLL_SHARED, r5 + mov.l .Lwake6, r1 bsrf r1 - nop -.Lmwake6b: + extu.b r5, r5 +.Lwake6b: bra 8b nop @@ -208,12 +206,12 @@ __pthread_cond_broadcast: nop .align 2 -.Lmwait5: - .long __lll_mutex_lock_wait-.Lmwait5b -.Lmwake5: - .long __lll_mutex_unlock_wake-.Lmwake5b -.Lmwake6: - .long __lll_mutex_unlock_wake-.Lmwake6b +.Lwait5: + .long __lll_lock_wait-.Lwait5b +.Lwake5: + .long __lll_unlock_wake-.Lwake5b +.Lwake6: + .long __lll_unlock_wake-.Lwake6b .size __pthread_cond_broadcast, .-__pthread_cond_broadcast versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast, GLIBC_2_3_2) diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S 2004-06-18 08:55:56.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S 2007-08-01 09:52:30.000000000 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2007 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 @@ -18,17 +18,12 @@ #include #include +#include #include #include +#include #include "lowlevel-atomic.h" -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 -#define FUTEX_REQUEUE 3 - -#define EINVAL 22 - .text /* int pthread_cond_signal (pthread_cond_t *cond) */ @@ -108,10 +103,12 @@ __pthread_cond_signal: #if cond_lock != 0 add #cond_lock, r5 #endif - mov.l .Lmwait4, r1 + mov #LLL_SHARED, r6 + extu.b r6, r6 + mov.l .Lwait4, r1 bsrf r1 mov r2, r4 -.Lmwait4b: +.Lwait4b: bra 2b nop @@ -121,18 +118,19 @@ __pthread_cond_signal: #if cond_lock != 0 add #cond_lock, r4 #endif - mov.l .Lmwake4, r1 + mov #LLL_SHARED, r5 + mov.l .Lwake4, r1 bsrf r1 - nop -.Lmwake4b: + extu.b r5, r5 +.Lwake4b: bra 6b nop .align 2 -.Lmwait4: - .long __lll_mutex_lock_wait-.Lmwait4b -.Lmwake4: - .long __lll_mutex_unlock_wake-.Lmwake4b +.Lwait4: + .long __lll_lock_wait-.Lwait4b +.Lwake4: + .long __lll_unlock_wake-.Lwake4b .size __pthread_cond_signal, .-__pthread_cond_signal versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal, GLIBC_2_3_2) diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S 2007-08-01 10:00:23.000000000 +0900 @@ -18,16 +18,11 @@ #include #include +#include #include #include #include "lowlevel-atomic.h" -#define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 - - .text /* int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, @@ -164,7 +159,7 @@ __pthread_cond_timedwait: mov r15, r4 add #16, r4 mov #0, r5 - mov #SYS_gettimeofday, r3 + mov #__NR_gettimeofday, r3 trapa #0x12 SYSCALL_INST_PAD @@ -182,7 +177,7 @@ __pthread_cond_timedwait: mov r15, r4 add #16, r4 mov #0, r5 - mov #SYS_gettimeofday, r3 + mov #__NR_gettimeofday, r3 trapa #0x12 SYSCALL_INST_PAD @@ -403,10 +398,12 @@ __pthread_cond_timedwait: #if cond_lock != 0 add #cond_lock, r5 #endif - mov.l .Lmwait2, r1 + mov #LLL_SHARED, r6 + extu.b r6, r6 + mov.l .Lwait2, r1 bsrf r1 mov r2, r4 -.Lmwait2b: +.Lwait2b: bra 2b nop @@ -416,10 +413,11 @@ __pthread_cond_timedwait: #if cond_lock != 0 add #cond_lock, r4 #endif - mov.l .Lmwake2, r1 + mov #LLL_SHARED, r5 + mov.l .Lmwait2, r1 bsrf r1 - nop -.Lmwake2b: + extu.b r5, r5 +.Lmwait2b: bra 4b nop @@ -429,10 +427,12 @@ __pthread_cond_timedwait: #if cond_lock != 0 add #cond_lock, r5 #endif - mov.l .Lmwait3, r1 + mov #LLL_SHARED, r6 + extu.b r6, r6 + mov.l .Lwait3, r1 bsrf r1 mov r2, r4 -.Lmwait3b: +.Lwait3b: bra 6b nop @@ -442,10 +442,11 @@ __pthread_cond_timedwait: #if cond_lock != 0 add #cond_lock, r4 #endif - mov.l .Lmwake3, r1 + mov #LLL_SHARED, r5 + mov.l .Lmwait3, r1 bsrf r1 - nop -.Lmwake3b: + extu.b r5, r5 +.Lmwait3b: bra 11b nop @@ -464,25 +465,26 @@ __pthread_cond_timedwait: #if cond_lock != 0 add #cond_lock, r4 #endif - mov.l .Lmwake4, r1 + mov #LLL_SHARED, r5 + mov.l .Lmwait4, r1 bsrf r1 - nop -.Lmwake4b: + extu.b r5, r5 +.Lmwait4b: 17: bra 18b mov.l @(24,r15), r0 .align 2 +.Lwait2: + .long __lll_lock_wait-.Lwait2b .Lmwait2: - .long __lll_mutex_lock_wait-.Lmwait2b -.Lmwake2: - .long __lll_mutex_unlock_wake-.Lmwake2b + .long __lll_unlock_wake-.Lmwait2b +.Lwait3: + .long __lll_lock_wait-.Lwait3b .Lmwait3: - .long __lll_mutex_lock_wait-.Lmwait3b -.Lmwake3: - .long __lll_mutex_unlock_wake-.Lmwake3b -.Lmwake4: - .long __lll_mutex_unlock_wake-.Lmwake4b + .long __lll_unlock_wake-.Lmwait3b +.Lmwait4: + .long __lll_unlock_wake-.Lmwait4b .size __pthread_cond_timedwait, .-__pthread_cond_timedwait versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, GLIBC_2_3_2) @@ -507,10 +509,12 @@ __condvar_tw_cleanup: #if cond_lock != 0 add #cond_lock, r5 #endif - mov.l .Lmwait5, r1 + mov #LLL_SHARED, r6 + extu.b r6, r6 + mov.l .Lwait5, r1 bsrf r1 mov r2, r4 -.Lmwait5b: +.Lwait5b: 1: mov.l @(broadcast_seq,r8), r0 @@ -600,10 +604,11 @@ __condvar_tw_cleanup: #if cond_lock != 0 add #cond_lock, r4 #endif - mov.l .Lmwake5, r1 + mov #LLL_SHARED, r5 + mov.l .Lmwait5, r1 bsrf r1 - nop -.Lmwake5b: + extu.b r5, r5 +.Lmwait5b: 2: /* Wake up all waiters to make sure no signal gets lost. */ @@ -636,10 +641,10 @@ __condvar_tw_cleanup: sleep .align 2 +.Lwait5: + .long __lll_lock_wait-.Lwait5b .Lmwait5: - .long __lll_mutex_lock_wait-.Lmwait5b -.Lmwake5: - .long __lll_mutex_unlock_wake-.Lmwake5b + .long __lll_unlock_wake-.Lmwait5b .Lmlocki5: .long __pthread_mutex_cond_lock-.Lmlocki5b .Lresume: diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S 2007-08-01 10:04:30.000000000 +0900 @@ -18,14 +18,10 @@ #include #include +#include #include #include "lowlevel-atomic.h" -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 - - .text /* int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) */ @@ -267,10 +263,12 @@ __pthread_cond_wait: #if cond_lock != 0 add #cond_lock, r5 #endif - mov.l .Lmwait0, r1 + mov #LLL_SHARED, r6 + extu.b r6, r6 + mov.l .Lwait0, r1 bsrf r1 mov r2, r4 -.Lmwait0b: +.Lwait0b: bra 2b nop 3: @@ -279,10 +277,11 @@ __pthread_cond_wait: #if cond_lock != 0 add #cond_lock, r4 #endif - mov.l .Lmwake0, r1 + mov #LLL_SHARED, r5 + mov.l .Lwake0, r1 bsrf r1 - nop -.Lmwake0b: + extu.b r5, r5 +.Lwake0b: bra 4b nop @@ -292,10 +291,12 @@ __pthread_cond_wait: #if cond_lock != 0 add #cond_lock, r5 #endif - mov.l .Lmwait1, r1 + mov #LLL_SHARED, r6 + extu.b r6, r6 + mov.l .Lwait1, r1 bsrf r1 mov r2, r4 -.Lmwait1b: +.Lwait1b: bra 6b nop @@ -305,10 +306,11 @@ __pthread_cond_wait: #if cond_lock != 0 add #cond_lock, r4 #endif - mov.l .Lmwake1, r1 + mov #LLL_SHARED, r5 + mov.l .Lwake1, r1 bsrf r1 - nop -.Lmwake1b: + extu.b r5, r5 +.Lwake1b: bra 11b nop @@ -327,26 +329,27 @@ __pthread_cond_wait: #if cond_lock != 0 add #cond_lock, r4 #endif - mov.l .Lmwake2, r1 + mov #LLL_SHARED, r5 + mov.l .Lwake2, r1 bsrf r1 - nop -.Lmwake2b: + extu.b r5, r5 +.Lwake2b: 13: bra 14b mov.l @(12,r15), r0 .align 2 -.Lmwait0: - .long __lll_mutex_lock_wait-.Lmwait0b -.Lmwake0: - .long __lll_mutex_unlock_wake-.Lmwake0b -.Lmwait1: - .long __lll_mutex_lock_wait-.Lmwait1b -.Lmwake1: - .long __lll_mutex_unlock_wake-.Lmwake1b -.Lmwake2: - .long __lll_mutex_unlock_wake-.Lmwake2b +.Lwait0: + .long __lll_lock_wait-.Lwait0b +.Lwake0: + .long __lll_unlock_wake-.Lwake0b +.Lwait1: + .long __lll_lock_wait-.Lwait1b +.Lwake1: + .long __lll_unlock_wake-.Lwake1b +.Lwake2: + .long __lll_unlock_wake-.Lwake2b .size __pthread_cond_wait, .-__pthread_cond_wait versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait, GLIBC_2_3_2) @@ -371,10 +374,12 @@ __condvar_w_cleanup: #if cond_lock != 0 add #cond_lock, r5 #endif - mov.l .Lmwait3, r1 + mov #LLL_SHARED, r6 + extu.b r6, r6 + mov.l .Lwait3, r1 bsrf r1 mov r2, r4 -.Lmwait3b: +.Lwait3b: 1: mov.l @(broadcast_seq,r8), r0 @@ -464,10 +469,11 @@ __condvar_w_cleanup: #if cond_lock != 0 add #cond_lock, r4 #endif - mov.l .Lmwake3, r1 + mov #LLL_SHARED, r5 + mov.l .Lwake3, r1 bsrf r1 - nop -.Lmwake3b: + extu.b r5, r5 +.Lwake3b: 2: /* Wake up all waiters to make sure no signal gets lost. */ @@ -500,10 +506,10 @@ __condvar_w_cleanup: sleep .align 2 -.Lmwait3: - .long __lll_mutex_lock_wait-.Lmwait3b -.Lmwake3: - .long __lll_mutex_unlock_wake-.Lmwake3b +.Lwait3: + .long __lll_lock_wait-.Lwait3b +.Lwake3: + .long __lll_unlock_wake-.Lwake3b .Lmlocki3: .long __pthread_mutex_cond_lock-.Lmlocki3b .Lresume: diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S 2007-07-31 20:37:32.000000000 +0900 @@ -19,12 +19,9 @@ #include #include #include +#include #include "lowlevel-atomic.h" -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 -#define FUTEX_PRIVATE_FLAG 128 .comm __fork_generation, 4, 4 diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S 2007-08-01 10:22:01.000000000 +0900 @@ -17,17 +17,13 @@ 02111-1307 USA. */ #include +#include #include #include #include #include #include "lowlevel-atomic.h" -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 -#define FUTEX_PRIVATE_FLAG 128 - .text @@ -156,10 +152,12 @@ __pthread_rwlock_rdlock: #if MUTEX != 0 add #MUTEX, r5 #endif - mov r2, r4 + mov #PSHARED, r0 + mov.b @(r0,r8), r6 + extu.b r6, r6 mov.l .Lwait0, r1 bsrf r1 - nop + mov r2, r4 .Lwait0b: bra 2b nop @@ -182,6 +180,9 @@ __pthread_rwlock_rdlock: #if MUTEX != 0 add #MUTEX, r4 #endif + mov #PSHARED, r0 + mov.b @(r0,r8), r5 + extu.b r5, r5 mov.l .Lwake0, r1 bsrf r1 nop @@ -210,6 +211,9 @@ __pthread_rwlock_rdlock: #if MUTEX != 0 add #MUTEX, r4 #endif + mov #PSHARED, r0 + mov.b @(r0,r8), r5 + extu.b r5, r5 mov.l .Lwake1, r1 bsrf r1 nop @@ -222,23 +226,25 @@ __pthread_rwlock_rdlock: #if MUTEX != 0 add #MUTEX, r5 #endif - mov r2, r4 + mov #PSHARED, r0 + mov.b @(r0,r8), r6 + extu.b r6, r6 mov.l .Lwait1, r1 bsrf r1 - nop + mov r2, r4 .Lwait1b: bra 13b nop .align 2 .Lwait0: - .long __lll_mutex_lock_wait-.Lwait0b + .long __lll_lock_wait-.Lwait0b .Lwake0: - .long __lll_mutex_unlock_wake-.Lwake0b + .long __lll_unlock_wake-.Lwake0b .Lwait1: - .long __lll_mutex_lock_wait-.Lwait1b + .long __lll_lock_wait-.Lwait1b .Lwake1: - .long __lll_mutex_unlock_wake-.Lwake1b + .long __lll_unlock_wake-.Lwake1b .size __pthread_rwlock_rdlock,.-__pthread_rwlock_rdlock .globl pthread_rwlock_rdlock diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S 2007-08-01 14:42:21.000000000 +0900 @@ -17,18 +17,13 @@ 02111-1307 USA. */ #include +#include #include #include #include #include #include "lowlevel-atomic.h" -#define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 -#define FUTEX_PRIVATE_FLAG 128 - .text @@ -92,7 +87,7 @@ pthread_rwlock_timedrdlock: /* Get current time. */ mov r15, r4 mov #0, r5 - mov #SYS_gettimeofday, r3 + mov #__NR_gettimeofday, r3 trapa #0x12 SYSCALL_INST_PAD @@ -213,10 +208,12 @@ pthread_rwlock_timedrdlock: #if MUTEX != 0 add #MUTEX, r5 #endif - mov r2, r4 + mov #PSHARED, r0 + mov.b @(r0,r8), r6 + extu.b r6, r6 mov.l .Lwait2, r1 bsrf r1 - nop + mov r2, r4 .Lwait2b: bra 2b nop @@ -239,6 +236,9 @@ pthread_rwlock_timedrdlock: #if MUTEX != 0 add #MUTEX, r4 #endif + mov #PSHARED, r0 + mov.b @(r0,r8), r5 + extu.b r5, r5 mov.l .Lwake2, r1 bsrf r1 nop @@ -267,6 +267,9 @@ pthread_rwlock_timedrdlock: #if MUTEX != 0 add #MUTEX, r4 #endif + mov #PSHARED, r0 + mov.b @(r0,r8), r5 + extu.b r5, r5 mov.l .Lwake3, r1 bsrf r1 nop @@ -279,10 +282,12 @@ pthread_rwlock_timedrdlock: #if MUTEX != 0 add #MUTEX, r5 #endif - mov r2, r4 + mov #PSHARED, r0 + mov.b @(r0,r8), r6 + extu.b r6, r6 mov.l .Lwait3, r1 bsrf r1 - nop + mov r2, r4 .Lwait3b: bra 13b nop @@ -297,11 +302,11 @@ pthread_rwlock_timedrdlock: .align 2 .Lwait2: - .long __lll_mutex_lock_wait-.Lwait2b + .long __lll_lock_wait-.Lwait2b .Lwake2: - .long __lll_mutex_unlock_wake-.Lwake2b + .long __lll_unlock_wake-.Lwake2b .Lwait3: - .long __lll_mutex_lock_wait-.Lwait3b + .long __lll_lock_wait-.Lwait3b .Lwake3: - .long __lll_mutex_unlock_wake-.Lwake3b + .long __lll_unlock_wake-.Lwake3b .size pthread_rwlock_timedrdlock,.-pthread_rwlock_timedrdlock diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S 2007-08-01 10:28:41.000000000 +0900 @@ -17,18 +17,13 @@ 02111-1307 USA. */ #include +#include #include #include #include #include #include "lowlevel-atomic.h" -#define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 -#define FUTEX_PRIVATE_FLAG 128 - .text @@ -88,7 +83,7 @@ pthread_rwlock_timedwrlock: /* Get current time. */ mov r15, r4 mov #0, r5 - mov #SYS_gettimeofday, r3 + mov #__NR_gettimeofday, r3 trapa #0x12 SYSCALL_INST_PAD @@ -211,10 +206,12 @@ pthread_rwlock_timedwrlock: #if MUTEX != 0 add #MUTEX, r5 #endif - mov r2, r4 + mov #PSHARED, r0 + mov.b @(r0,r8), r6 + extu.b r6, r6 mov.l .Lwait6, r1 bsrf r1 - nop + mov r2, r4 .Lwait6b: bra 2b nop @@ -232,6 +229,9 @@ pthread_rwlock_timedwrlock: #if MUTEX != 0 add #MUTEX, r4 #endif + mov #PSHARED, r0 + mov.b @(r0,r8), r5 + extu.b r5, r5 mov.l .Lwake6, r1 bsrf r1 nop @@ -255,6 +255,9 @@ pthread_rwlock_timedwrlock: #if MUTEX != 0 add #MUTEX, r4 #endif + mov #PSHARED, r0 + mov.b @(r0,r8), r5 + extu.b r5, r5 mov.l .Lwake7, r1 bsrf r1 nop @@ -267,10 +270,12 @@ pthread_rwlock_timedwrlock: #if MUTEX != 0 add #MUTEX, r5 #endif - mov r2, r4 + mov #PSHARED, r0 + mov.b @(r0,r8), r6 + extu.b r6, r6 mov.l .Lwait7, r1 bsrf r1 - nop + mov r2, r4 .Lwait7b: bra 13b nop @@ -281,11 +286,11 @@ pthread_rwlock_timedwrlock: .align 2 .Lwait6: - .long __lll_mutex_lock_wait-.Lwait6b + .long __lll_lock_wait-.Lwait6b .Lwake6: - .long __lll_mutex_unlock_wake-.Lwake6b + .long __lll_unlock_wake-.Lwake6b .Lwait7: - .long __lll_mutex_lock_wait-.Lwait7b + .long __lll_lock_wait-.Lwait7b .Lwake7: - .long __lll_mutex_unlock_wake-.Lwake7b + .long __lll_unlock_wake-.Lwake7b .size pthread_rwlock_timedwrlock,.-pthread_rwlock_timedwrlock diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S 2007-08-01 10:32:50.000000000 +0900 @@ -17,15 +17,11 @@ 02111-1307 USA. */ #include +#include #include #include #include "lowlevel-atomic.h" -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 -#define FUTEX_PRIVATE_FLAG 128 - .text @@ -138,10 +134,12 @@ __pthread_rwlock_unlock: #if MUTEX != 0 add #MUTEX, r5 #endif - mov r2, r4 + mov #PSHARED, r0 + mov.b @(r0,r8), r6 + extu.b r6, r6 mov.l .Lwait8, r1 bsrf r1 - nop + mov r2, r4 .Lwait8b: bra 2b nop @@ -150,6 +148,9 @@ __pthread_rwlock_unlock: #if MUTEX != 0 add #MUTEX, r4 #endif + mov #PSHARED, r0 + mov.b @(r0,r8), r5 + extu.b r5, r5 mov.l .Lwake8, r1 bsrf r1 nop @@ -164,6 +165,9 @@ __pthread_rwlock_unlock: #if MUTEX != 0 add #MUTEX, r4 #endif + mov #PSHARED, r0 + mov.b @(r0,r8), r5 + extu.b r5, r5 mov.l .Lwake9, r1 bsrf r1 nop @@ -179,11 +183,11 @@ __pthread_rwlock_unlock: #endif .align 2 .Lwait8: - .long __lll_mutex_lock_wait-.Lwait8b + .long __lll_lock_wait-.Lwait8b .Lwake8: - .long __lll_mutex_unlock_wake-.Lwake8b + .long __lll_unlock_wake-.Lwake8b .Lwake9: - .long __lll_mutex_unlock_wake-.Lwake9b + .long __lll_unlock_wake-.Lwake9b .size __pthread_rwlock_unlock,.-__pthread_rwlock_unlock .globl pthread_rwlock_unlock diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S 2007-08-01 10:36:18.000000000 +0900 @@ -17,17 +17,13 @@ 02111-1307 USA. */ #include +#include #include #include #include #include #include "lowlevel-atomic.h" -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 -#define FUTEX_PRIVATE_FLAG 128 - .text @@ -145,10 +141,12 @@ __pthread_rwlock_wrlock: #if MUTEX != 0 add #MUTEX, r5 #endif - mov r2, r4 + mov #PSHARED, r0 + mov.b @(r0,r8), r6 + extu.b r6, r6 mov.l .Lwait4, r1 bsrf r1 - nop + mov r2, r4 .Lwait4b: bra 2b nop @@ -166,6 +164,9 @@ __pthread_rwlock_wrlock: #if MUTEX != 0 add #MUTEX, r4 #endif + mov #PSHARED, r0 + mov.b @(r0,r8), r5 + extu.b r5, r5 mov.l .Lwake4, r1 bsrf r1 nop @@ -192,6 +193,9 @@ __pthread_rwlock_wrlock: #if MUTEX != 0 add #MUTEX, r4 #endif + mov #PSHARED, r0 + mov.b @(r0,r8), r5 + extu.b r5, r5 mov.l .Lwake5, r1 bsrf r1 nop @@ -204,23 +208,25 @@ __pthread_rwlock_wrlock: #if MUTEX != 0 add #MUTEX, r5 #endif - mov r2, r4 + mov #PSHARED, r0 + mov.b @(r0,r8), r6 + extu.b r6, r6 mov.l .Lwait5, r1 bsrf r1 - nop + mov r2, r4 .Lwait5b: bra 13b nop .align 2 .Lwait4: - .long __lll_mutex_lock_wait-.Lwait4b + .long __lll_lock_wait-.Lwait4b .Lwake4: - .long __lll_mutex_unlock_wake-.Lwake4b + .long __lll_unlock_wake-.Lwake4b .Lwait5: - .long __lll_mutex_lock_wait-.Lwait5b + .long __lll_lock_wait-.Lwait5b .Lwake5: - .long __lll_mutex_unlock_wake-.Lwake5b + .long __lll_unlock_wake-.Lwake5b .globl pthread_rwlock_wrlock pthread_rwlock_wrlock = __pthread_rwlock_wrlock diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S 2007-08-01 17:23:23.000000000 +0900 @@ -20,14 +20,10 @@ #include #include #include +#include #include "lowlevel-atomic.h" -#define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 -#define FUTEX_WAIT 0 -#define FUTEX_WAKE 1 - .text .globl __new_sem_post @@ -65,7 +61,12 @@ __new_sem_post: mov.l .Lerrno3, r0 stc gbr, r1 mov.l @(r0, r12), r0 - add r1, r0 + bra .Lexit + add r1, r0 + .align 2 +.Lerrno3: + .long errno@GOTTPOFF +.Lexit: #else mov.l .Lerrloc3, r1 bsrf r1 @@ -81,10 +82,7 @@ __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 diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S 2007-08-01 17:24:02.000000000 +0900 @@ -21,13 +21,10 @@ #include #include #include +#include #include "lowlevel-atomic.h" -#define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 -#define FUTEX_WAIT 0 - #if VALUE != 0 # error "code needs to be rewritten for VALUE != 0" #endif @@ -81,7 +78,7 @@ sem_timedwait: /* Compute relative timeout. */ mov r15, r4 mov #0, r5 - mov #SYS_gettimeofday, r3 + mov #__NR_gettimeofday, r3 trapa #0x12 SYSCALL_INST_PAD @@ -180,15 +177,19 @@ sem_timedwait: mov.l .Lerrno2, r0 stc gbr, r1 mov.l @(r0, r12), r0 - add r1, r0 - mov.l r10, @r0 + bra .Lexit + add r1, r0 + .align 2 +.Lerrno2: + .long errno@GOTTPOFF +.Lexit: #else mov.l .Lerrloc2, r1 bsrf r1 nop .Lerrloc2b: - mov.l r10, @r0 #endif + mov.l r10, @r0 DEC (@(NWAITERS,r8), r2) bra 10b mov #-1, r0 @@ -200,10 +201,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 -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S 2004-06-30 00:51:02.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S 2007-08-01 17:22:26.000000000 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2007 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 @@ -19,6 +19,7 @@ #include #include #include +#include #include "lowlevel-atomic.h" @@ -60,15 +61,19 @@ __new_sem_trywait: mov.l .Lerrno1, r0 stc gbr, r1 mov.l @(r0, r12), r0 - add r1, r0 - mov.l r8, @r0 + bra .Lexit + add r1, 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,10 +83,7 @@ __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 diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S 2007-06-18 09:03:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S 2007-08-01 17:21:55.000000000 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2007 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 @@ -21,13 +21,10 @@ #include #include #include +#include #include "lowlevel-atomic.h" -#define SYS_gettimeofday __NR_gettimeofday -#define SYS_futex 240 -#define FUTEX_WAIT 0 - #if VALUE != 0 # error "code needs to be rewritten for VALUE != 0" #endif @@ -138,24 +135,26 @@ __new_sem_wait: mov.l .Lerrno0, r0 stc gbr, r1 mov.l @(r0, r12), r0 - add r1, r0 - mov.l r8, @r0 + bra .Lexit + add r1, 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 bra 9b mov #-1, r0 + .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