diff options
24 files changed, 602 insertions, 415 deletions
@@ -1,5 +1,15 @@ 2007-08-03 Jakub Jelinek <jakub@redhat.com> + * intl/dcigettext.c (_nl_find_msg): Free encoding if __gconv_open + failed. + * intl/finddomain.c (_nl_find_domain): Free normalized_codeset + on failure. + + * elf/dl-load.c (decompose_rpath): Free copy if result couldn't be + allocated. + +2007-08-03 Jakub Jelinek <jakub@redhat.com> + * rt/mqueue.h (mq_timedreceive, mq_timedsend): Fix nonnull argument numbers. diff --git a/elf/dl-load.c b/elf/dl-load.c index 1a84e0f..98d25b8 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -578,6 +578,7 @@ decompose_rpath (struct r_search_path_struct *sps, * sizeof (*result)); if (result == NULL) { + free (copy); errstring = N_("cannot create cache for search path"); signal_error: _dl_signal_error (ENOMEM, NULL, NULL, errstring); diff --git a/intl/dcigettext.c b/intl/dcigettext.c index 23e019a..ad2835f 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -949,7 +949,10 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp) nothing to do. Otherwise do not use the translation at all. */ if (__builtin_expect (r != __GCONV_NULCONV, 1)) - return NULL; + { + free ((char *) encoding); + return NULL; + } convd->conv = (__gconv_t) -1; } diff --git a/intl/finddomain.c b/intl/finddomain.c index 54e617c..03583b1 100644 --- a/intl/finddomain.c +++ b/intl/finddomain.c @@ -143,7 +143,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) if (retval == NULL) /* This means we are out of core. */ - return NULL; + goto out; if (retval->decided <= 0) _nl_load_domain (retval, domainbinding); @@ -159,6 +159,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) } } +out: /* The space for normalized_codeset is dynamically allocated. Free it. */ if (mask & XPG_NORM_CODESET) free ((void *) normalized_codeset); diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 8eae5da..d27b6d7 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,7 @@ +2007-08-03 Jakub Jelinek <jakub@redhat.com> + + * locales/translit_combining: Add U0141 and U0142. + 2007-07-30 Jakub Jelinek <jakub@redhat.com> * tst-strptime.c (do_test): Use %tu in fmt string for ptrdiff_t value. diff --git a/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S index be85ab7..feb8211 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/libc-lowlevellock.S @@ -16,32 +16,4 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <kernel-features.h> - -/* 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 --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S index b10903b..e929e28 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S @@ -18,45 +18,112 @@ #include <sysdep.h> #include <pthread-errnos.h> +#include <kernel-features.h> +#include <lowlevellock.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h index be47bd7..88e94b9 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h @@ -19,19 +19,24 @@ #ifndef _LOWLEVELLOCK_H #define _LOWLEVELLOCK_H 1 +#ifndef __ASSEMBLER__ #include <time.h> #include <sys/param.h> #include <bits/pthreadtypes.h> #include <kernel-features.h> +#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_mutex_trylock(futex) \ +#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_trylock(futex) \ ({ unsigned char __result; \ __asm __volatile ("\ .align 2\n\ @@ -94,12 +109,12 @@ extern int __lll_mutex_unlock_wake (int *__futex) attribute_hidden; 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 *__futex) attribute_hidden; : "=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 *__futex) attribute_hidden; 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 *__futex) attribute_hidden; : "=&r" (__result) : "r" (1), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ if (__result) \ - __lll_mutex_lock_wait (__result, __futex); }) - -#define lll_robust_mutex_lock(futex, id) \ - ({ int __result, val, *__futex = &(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_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 *__futex) attribute_hidden; : "=&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 *__futex) attribute_hidden; : "=&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 *__futex) attribute_hidden; : "=&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 *__futex) attribute_hidden; : "=&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 *__futex) attribute_hidden; : "=&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 *__futex) attribute_hidden; : "=&r" (__result) : "r" (__futex) \ : "r0", "r1", "memory"); \ if (__result) \ - __lll_mutex_unlock_wake (__futex); }) - -#define lll_robust_mutex_unlock(futex) \ + { \ + if (__builtin_constant_p (private) \ + && (private) == LLL_PRIVATE) \ + __lll_unlock_wake_private (__futex); \ + else \ + __lll_unlock_wake (__futex, (private)); \ + } \ + }) + +#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 *__futex) attribute_hidden; : "=&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 *__futex) attribute_hidden; 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, const struct timespec *abstime) } \ __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 --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S index c57d3cf..0ebfbfe 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S @@ -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 <sysdep.h> #include <pthread-errnos.h> +#include <lowlevellock.h> #include <lowlevelrobustlock.h> +#include <kernel-features.h> #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 +#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_mutex_lock_wait - .type __lll_robust_mutex_lock_wait,@function - .hidden __lll_robust_mutex_lock_wait + .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 --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S index 35dd607..c7d7d22 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S @@ -17,14 +17,10 @@ 02111-1307 USA. */ #include <sysdep.h> +#include <lowlevellock.h> #include <lowlevelbarrier.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S index 56f0aa9..b173f2d 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S @@ -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 <sysdep.h> #include <shlib-compat.h> +#include <lowlevellock.h> #include <lowlevelcond.h> #include <kernel-features.h> #include <pthread-pi-defines.h> +#include <pthread-errnos.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S index 8b0196f..3ef2d6e 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S @@ -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 <sysdep.h> #include <shlib-compat.h> +#include <lowlevellock.h> #include <lowlevelcond.h> #include <kernel-features.h> +#include <pthread-errnos.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S index 0173cfb..17c1e6f 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S @@ -18,16 +18,11 @@ #include <sysdep.h> #include <shlib-compat.h> +#include <lowlevellock.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 - - .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 --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S index 5eb332e..9ca4c35 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S @@ -18,14 +18,10 @@ #include <sysdep.h> #include <shlib-compat.h> +#include <lowlevellock.h> #include <lowlevelcond.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S index 3d694d8..4399075 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S @@ -19,12 +19,9 @@ #include <unwindbuf.h> #include <sysdep.h> #include <kernel-features.h> +#include <lowlevellock.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S index f179513..9e4ba95 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S @@ -17,17 +17,13 @@ 02111-1307 USA. */ #include <sysdep.h> +#include <lowlevellock.h> #include <lowlevelrwlock.h> #include <pthread-errnos.h> #include <tcb-offsets.h> #include <kernel-features.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S index e87326e..b06fd96 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S @@ -17,18 +17,13 @@ 02111-1307 USA. */ #include <sysdep.h> +#include <lowlevellock.h> #include <lowlevelrwlock.h> #include <pthread-errnos.h> #include <tcb-offsets.h> #include <kernel-features.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S index 18641fe..4591309 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S @@ -17,18 +17,13 @@ 02111-1307 USA. */ #include <sysdep.h> +#include <lowlevellock.h> #include <lowlevelrwlock.h> #include <pthread-errnos.h> #include <tcb-offsets.h> #include <kernel-features.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S index df4df60..1504c1a 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S @@ -17,15 +17,11 @@ 02111-1307 USA. */ #include <sysdep.h> +#include <lowlevellock.h> #include <lowlevelrwlock.h> #include <kernel-features.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S index 13a2fda..25dffe4 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S @@ -17,17 +17,13 @@ 02111-1307 USA. */ #include <sysdep.h> +#include <lowlevellock.h> #include <lowlevelrwlock.h> #include <pthread-errnos.h> #include <tcb-offsets.h> #include <kernel-features.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S index a63233f..a3a7710 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S @@ -20,14 +20,10 @@ #include <shlib-compat.h> #include <pthread-errnos.h> #include <structsem.h> +#include <lowlevellock.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S index e5e064b..7924e87 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S @@ -21,13 +21,10 @@ #include <pthread-errnos.h> #include <tcb-offsets.h> #include <structsem.h> +#include <lowlevellock.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S index ccdf3a0..835e37d 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S @@ -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 <sysdep.h> #include <shlib-compat.h> #include <pthread-errnos.h> +#include <lowlevellock.h> #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 --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S index 85ce909..6ef7fcf 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S @@ -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 <pthread-errnos.h> #include <tcb-offsets.h> #include <structsem.h> +#include <lowlevellock.h> #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 |