* 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>
This commit is contained in:
Ulrich Drepper 2007-08-03 15:50:30 +00:00
parent 96c502084a
commit ce31a3b1c5
24 changed files with 599 additions and 412 deletions

View File

@ -1,3 +1,13 @@
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> 2007-08-03 Jakub Jelinek <jakub@redhat.com>
* rt/mqueue.h (mq_timedreceive, mq_timedsend): Fix nonnull argument * rt/mqueue.h (mq_timedreceive, mq_timedsend): Fix nonnull argument

View File

@ -578,6 +578,7 @@ decompose_rpath (struct r_search_path_struct *sps,
* sizeof (*result)); * sizeof (*result));
if (result == NULL) if (result == NULL)
{ {
free (copy);
errstring = N_("cannot create cache for search path"); errstring = N_("cannot create cache for search path");
signal_error: signal_error:
_dl_signal_error (ENOMEM, NULL, NULL, errstring); _dl_signal_error (ENOMEM, NULL, NULL, errstring);

View File

@ -949,7 +949,10 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
nothing to do. Otherwise do not use the nothing to do. Otherwise do not use the
translation at all. */ translation at all. */
if (__builtin_expect (r != __GCONV_NULCONV, 1)) if (__builtin_expect (r != __GCONV_NULCONV, 1))
return NULL; {
free ((char *) encoding);
return NULL;
}
convd->conv = (__gconv_t) -1; convd->conv = (__gconv_t) -1;
} }

View File

@ -143,7 +143,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding)
if (retval == NULL) if (retval == NULL)
/* This means we are out of core. */ /* This means we are out of core. */
return NULL; goto out;
if (retval->decided <= 0) if (retval->decided <= 0)
_nl_load_domain (retval, domainbinding); _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. */ /* The space for normalized_codeset is dynamically allocated. Free it. */
if (mask & XPG_NORM_CODESET) if (mask & XPG_NORM_CODESET)
free ((void *) normalized_codeset); free ((void *) normalized_codeset);

View File

@ -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> 2007-07-30 Jakub Jelinek <jakub@redhat.com>
* tst-strptime.c (do_test): Use %tu in fmt string for ptrdiff_t value. * tst-strptime.c (do_test): Use %tu in fmt string for ptrdiff_t value.

View File

@ -16,32 +16,4 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */ 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" #include "lowlevellock.S"

View File

@ -18,45 +18,112 @@
#include <sysdep.h> #include <sysdep.h>
#include <pthread-errnos.h> #include <pthread-errnos.h>
#include <kernel-features.h>
#include <lowlevellock.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
.text .text
#define SYS_gettimeofday __NR_gettimeofday #ifdef __ASSUME_PRIVATE_FUTEX
#define SYS_futex 240 # define LOAD_PRIVATE_FUTEX_WAIT(reg,tmp,tmp2) \
#ifndef FUTEX_WAIT mov #(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg; \
# define FUTEX_WAIT 0
# define FUTEX_WAKE 1
#endif
#ifndef LOAD_FUTEX_WAIT
# if FUTEX_WAIT == 0
# define LOAD_FUTEX_WAIT(reg,tmp) \
xor reg, reg
# else
# define LOAD_FUTEX_WAIT(reg,tmp) \
mov #FUTEX_WAIT, reg; \
extu.b reg, 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_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_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 # endif
# define LOAD_FUTEX_WAKE(reg,tmp) \ # define LOAD_FUTEX_WAKE(reg,tmp) \
mov #FUTEX_WAKE, reg; \ stc gbr, tmp ; \
extu.b reg, reg 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 #endif
.globl __lll_lock_wait_private
.globl __lll_mutex_lock_wait .type __lll_lock_wait_private,@function
.type __lll_mutex_lock_wait,@function .hidden __lll_lock_wait_private
.hidden __lll_mutex_lock_wait
.align 5 .align 5
cfi_startproc cfi_startproc
__lll_mutex_lock_wait: __lll_lock_wait_private:
mov.l r8, @-r15 mov.l r8, @-r15
cfi_adjust_cfa_offset(4) cfi_adjust_cfa_offset(4)
cfi_rel_offset (r8, 0) cfi_rel_offset (r8, 0)
mov r4, r6 mov r4, r6
mov r5, r8 mov r5, r8
mov #0, r7 /* No timeout. */ mov #0, r7 /* No timeout. */
LOAD_FUTEX_WAIT (r5, r0) LOAD_PRIVATE_FUTEX_WAIT (r5, r0, r1)
mov #2, r4 mov #2, r4
cmp/eq r4, r6 cmp/eq r4, r6
@ -79,22 +146,67 @@ __lll_mutex_lock_wait:
ret ret
mov r2, r0 mov r2, r0
cfi_endproc cfi_endproc
.size __lll_mutex_lock_wait,.-__lll_mutex_lock_wait .size __lll_lock_wait_private,.-__lll_lock_wait_private
#ifdef NOT_IN_libc #ifdef NOT_IN_libc
.globl __lll_mutex_timedlock_wait .globl __lll_lock_wait
.type __lll_mutex_timedlock_wait,@function .type __lll_lock_wait,@function
.hidden __lll_mutex_timedlock_wait .hidden __lll_lock_wait
.align 5 .align 5
cfi_startproc 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. */ /* Check for a valid timeout value. */
mov.l @(4,r6), r1 mov.l @(4,r6), r1
mov.l .L1g, r0 mov.l .L1g, r0
cmp/hs r0, r1 cmp/hs r0, r1
bt 3f bt 3f
mov.l r11, @-r15
cfi_adjust_cfa_offset(4)
cfi_rel_offset (r11, 0)
mov.l r10, @-r15 mov.l r10, @-r15
cfi_adjust_cfa_offset(4) cfi_adjust_cfa_offset(4)
cfi_rel_offset (r10, 0) cfi_rel_offset (r10, 0)
@ -104,6 +216,7 @@ __lll_mutex_timedlock_wait:
mov.l r8, @-r15 mov.l r8, @-r15
cfi_adjust_cfa_offset(4) cfi_adjust_cfa_offset(4)
cfi_rel_offset (r8, 0) cfi_rel_offset (r8, 0)
mov r7, r11
mov r4, r10 mov r4, r10
mov r6, r9 mov r6, r9
mov r5, r8 mov r5, r8
@ -116,7 +229,7 @@ __lll_mutex_timedlock_wait:
/* Get current time. */ /* Get current time. */
mov r15, r4 mov r15, r4
mov #0, r5 mov #0, r5
mov #SYS_gettimeofday, r3 mov #__NR_gettimeofday, r3
trapa #0x12 trapa #0x12
SYSCALL_INST_PAD SYSCALL_INST_PAD
@ -149,7 +262,8 @@ __lll_mutex_timedlock_wait:
bt 8f bt 8f
mov r8, r4 mov r8, r4
LOAD_FUTEX_WAIT (r5, r0) mov r11, r5
LOAD_FUTEX_WAIT (r5, r0, r1)
mov r10, r6 mov r10, r6
mov r15, r7 mov r15, r7
mov #SYS_futex, r3 mov #SYS_futex, r3
@ -169,8 +283,9 @@ __lll_mutex_timedlock_wait:
add #8, r15 add #8, r15
mov.l @r15+, r8 mov.l @r15+, r8
mov.l @r15+, r9 mov.l @r15+, r9
mov.l @r15+, r10
rts rts
mov.l @r15+, r10 mov.l @r15+, r11
7: 7:
/* Check whether the time expired. */ /* Check whether the time expired. */
mov #-ETIMEDOUT, r1 mov #-ETIMEDOUT, r1
@ -198,17 +313,16 @@ __lll_mutex_timedlock_wait:
.L1g: .L1g:
.long 1000000000 .long 1000000000
.size __lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait .size __lll_timedlock_wait,.-__lll_timedlock_wait
#endif #endif
.globl __lll_unlock_wake_private
.globl __lll_mutex_unlock_wake .type __lll_unlock_wake_private,@function
.type __lll_mutex_unlock_wake,@function .hidden __lll_unlock_wake_private
.hidden __lll_mutex_unlock_wake
.align 5 .align 5
cfi_startproc cfi_startproc
__lll_mutex_unlock_wake: __lll_unlock_wake_private:
LOAD_FUTEX_WAKE (r5, r0) LOAD_PRIVATE_FUTEX_WAKE (r5, r0, r1)
mov #1, r6 /* Wake one thread. */ mov #1, r6 /* Wake one thread. */
mov #0, r7 mov #0, r7
mov.l r7, @r4 /* Stores 0. */ mov.l r7, @r4 /* Stores 0. */
@ -219,10 +333,28 @@ __lll_mutex_unlock_wake:
rts rts
nop nop
cfi_endproc cfi_endproc
.size __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake .size __lll_unlock_wake_private,.-__lll_unlock_wake_private
#ifdef NOT_IN_libc #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 .globl __lll_timedwait_tid
.type __lll_timedwait_tid,@function .type __lll_timedwait_tid,@function
.hidden __lll_timedwait_tid .hidden __lll_timedwait_tid
@ -246,7 +378,7 @@ __lll_timedwait_tid:
/* Get current time. */ /* Get current time. */
mov r15, r4 mov r15, r4
mov #0, r5 mov #0, r5
mov #SYS_gettimeofday, r3 mov #__NR_gettimeofday, r3
trapa #0x12 trapa #0x12
SYSCALL_INST_PAD SYSCALL_INST_PAD

View File

@ -19,19 +19,24 @@
#ifndef _LOWLEVELLOCK_H #ifndef _LOWLEVELLOCK_H
#define _LOWLEVELLOCK_H 1 #define _LOWLEVELLOCK_H 1
#ifndef __ASSEMBLER__
#include <time.h> #include <time.h>
#include <sys/param.h> #include <sys/param.h>
#include <bits/pthreadtypes.h> #include <bits/pthreadtypes.h>
#include <kernel-features.h> #include <kernel-features.h>
#endif
#define SYS_futex 240 #define SYS_futex 240
#define FUTEX_WAIT 0 #define FUTEX_WAIT 0
#define FUTEX_WAKE 1 #define FUTEX_WAKE 1
#define FUTEX_CMP_REQUEUE 4
#define FUTEX_WAKE_OP 5
#define FUTEX_LOCK_PI 6 #define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7 #define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8 #define FUTEX_TRYLOCK_PI 8
#define FUTEX_PRIVATE_FLAG 128 #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 /* Values for 'private' parameter of locking macros. Yes, the
definition seems to be backwards. But it is not. The bit will be definition seems to be backwards. But it is not. The bit will be
@ -64,20 +69,30 @@
# endif # endif
#endif #endif
#ifndef __ASSEMBLER__
/* Initializer for compatibility lock. */ /* Initializer for compatibility lock. */
#define LLL_MUTEX_LOCK_INITIALIZER (0) #define LLL_LOCK_INITIALIZER (0)
#define LLL_MUTEX_LOCK_INITIALIZER_LOCKED (1) #define LLL_LOCK_INITIALIZER_LOCKED (1)
#define LLL_MUTEX_LOCK_INITIALIZER_WAITERS (2) #define LLL_LOCK_INITIALIZER_WAITERS (2)
extern int __lll_mutex_lock_wait (int val, int *__futex) attribute_hidden; extern int __lll_lock_wait_private (int val, int *__futex)
extern int __lll_mutex_timedlock_wait (int val, int *__futex, attribute_hidden;
const struct timespec *abstime) extern int __lll_lock_wait (int val, int *__futex, int private)
attribute_hidden; attribute_hidden;
extern int __lll_mutex_unlock_wake (int *__futex) 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) \
#define lll_mutex_trylock(futex) \
({ unsigned char __result; \ ({ unsigned char __result; \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
@ -94,12 +109,12 @@ extern int __lll_mutex_unlock_wake (int *__futex) attribute_hidden;
negc %0,%0"\ negc %0,%0"\
: "=r" (__result) \ : "=r" (__result) \
: "r" (&(futex)), \ : "r" (&(futex)), \
"r" (LLL_MUTEX_LOCK_INITIALIZER_LOCKED), \ "r" (LLL_LOCK_INITIALIZER_LOCKED), \
"r" (LLL_MUTEX_LOCK_INITIALIZER) \ "r" (LLL_LOCK_INITIALIZER) \
: "r0", "r1", "r2", "t", "memory"); \ : "r0", "r1", "r2", "t", "memory"); \
__result; }) __result; })
#define lll_robust_mutex_trylock(futex, id) \ #define lll_robust_trylock(futex, id) \
({ unsigned char __result; \ ({ unsigned char __result; \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
@ -117,11 +132,11 @@ extern int __lll_mutex_unlock_wake (int *__futex) attribute_hidden;
: "=r" (__result) \ : "=r" (__result) \
: "r" (&(futex)), \ : "r" (&(futex)), \
"r" (id), \ "r" (id), \
"r" (LLL_MUTEX_LOCK_INITIALIZER) \ "r" (LLL_LOCK_INITIALIZER) \
: "r0", "r1", "r2", "t", "memory"); \ : "r0", "r1", "r2", "t", "memory"); \
__result; }) __result; })
#define lll_mutex_cond_trylock(futex) \ #define lll_cond_trylock(futex) \
({ unsigned char __result; \ ({ unsigned char __result; \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
@ -138,13 +153,13 @@ extern int __lll_mutex_unlock_wake (int *__futex) attribute_hidden;
negc %0,%0"\ negc %0,%0"\
: "=r" (__result) \ : "=r" (__result) \
: "r" (&(futex)), \ : "r" (&(futex)), \
"r" (LLL_MUTEX_LOCK_INITIALIZER_WAITERS), \ "r" (LLL_LOCK_INITIALIZER_WAITERS), \
"r" (LLL_MUTEX_LOCK_INITIALIZER) \ "r" (LLL_LOCK_INITIALIZER) \
: "r0", "r1", "r2", "t", "memory"); \ : "r0", "r1", "r2", "t", "memory"); \
__result; }) __result; })
#define lll_mutex_lock(futex) \ #define lll_lock(futex, private) \
(void) ({ int __result, val, *__futex = &(futex); \ (void) ({ int __result, *__futex = &(futex); \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
mova 1f,r0\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) \ : "=&r" (__result) : "r" (1), "r" (__futex) \
: "r0", "r1", "t", "memory"); \ : "r0", "r1", "t", "memory"); \
if (__result) \ 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) \ #define lll_robust_lock(futex, id, private) \
({ int __result, val, *__futex = &(futex); \ ({ int __result, *__futex = &(futex); \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
mova 1f,r0\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) \ : "=&r" (__result) : "r" (id), "r" (__futex) \
: "r0", "r1", "t", "memory"); \ : "r0", "r1", "t", "memory"); \
if (__result) \ if (__result) \
__result = __lll_robust_mutex_lock_wait (__result, __futex); \ __result = __lll_robust_lock_wait (__result, __futex, private); \
__result; }) __result; })
/* Special version of lll_mutex_lock which causes the unlock function to /* Special version of lll_mutex_lock which causes the unlock function to
always wakeup waiters. */ always wakeup waiters. */
#define lll_mutex_cond_lock(futex) \ #define lll_cond_lock(futex, private) \
(void) ({ int __result, val, *__futex = &(futex); \ (void) ({ int __result, *__futex = &(futex); \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
mova 1f,r0\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) \ : "=&r" (__result) : "r" (2), "r" (__futex) \
: "r0", "r1", "t", "memory"); \ : "r0", "r1", "t", "memory"); \
if (__result) \ if (__result) \
__lll_mutex_lock_wait (__result, __futex); }) __lll_lock_wait (__result, __futex, private); })
#define lll_robust_mutex_cond_lock(futex, id) \ #define lll_robust_cond_lock(futex, id, private) \
({ int __result, val, *__futex = &(futex); \ ({ int __result, *__futex = &(futex); \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
mova 1f,r0\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) \ : "=&r" (__result) : "r" (id | FUTEX_WAITERS), "r" (__futex) \
: "r0", "r1", "t", "memory"); \ : "r0", "r1", "t", "memory"); \
if (__result) \ if (__result) \
__result = __lll_robust_mutex_lock_wait (__result, __futex); \ __result = __lll_robust_lock_wait (__result, __futex, private); \
__result; }) __result; })
#define lll_mutex_timedlock(futex, timeout) \ #define lll_timedlock(futex, timeout, private) \
({ int __result, val, *__futex = &(futex); \ ({ int __result, *__futex = &(futex); \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
mova 1f,r0\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) \ : "=&r" (__result) : "r" (1), "r" (__futex) \
: "r0", "r1", "t", "memory"); \ : "r0", "r1", "t", "memory"); \
if (__result) \ if (__result) \
__result = __lll_mutex_timedlock_wait (__result, __futex, timeout); \ __result = __lll_timedlock_wait (__result, __futex, timeout, private); \
__result; }) __result; })
#define lll_robust_mutex_timedlock(futex, timeout, id) \ #define lll_robust_timedlock(futex, timeout, id, private) \
({ int __result, val, *__futex = &(futex); \ ({ int __result, *__futex = &(futex); \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
mova 1f,r0\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) \ : "=&r" (__result) : "r" (id), "r" (__futex) \
: "r0", "r1", "t", "memory"); \ : "r0", "r1", "t", "memory"); \
if (__result) \ if (__result) \
__result = __lll_robust_mutex_timedlock_wait (__result, __futex, \ __result = __lll_robust_timedlock_wait (__result, __futex, \
timeout); \ timeout, private); \
__result; }) __result; })
#define lll_mutex_unlock(futex) \ #define lll_unlock(futex, private) \
(void) ({ int __result, *__futex = &(futex); \ (void) ({ int __result, *__futex = &(futex); \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
@ -272,9 +294,16 @@ extern int __lll_mutex_unlock_wake (int *__futex) attribute_hidden;
: "=&r" (__result) : "r" (__futex) \ : "=&r" (__result) : "r" (__futex) \
: "r0", "r1", "memory"); \ : "r0", "r1", "memory"); \
if (__result) \ 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); \ (void) ({ int __result, *__futex = &(futex); \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
@ -288,9 +317,9 @@ extern int __lll_mutex_unlock_wake (int *__futex) attribute_hidden;
: "=&r" (__result) : "r" (__futex), "r" (FUTEX_WAITERS) \ : "=&r" (__result) : "r" (__futex), "r" (FUTEX_WAITERS) \
: "r0", "r1", "memory"); \ : "r0", "r1", "memory"); \
if (__result) \ 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); \ (void) ({ int __ignore, *__futex = &(futex); \
__asm __volatile ("\ __asm __volatile ("\
.align 2\n\ .align 2\n\
@ -303,22 +332,7 @@ extern int __lll_mutex_unlock_wake (int *__futex) attribute_hidden;
1: mov r1,r15"\ 1: mov r1,r15"\
: "=&r" (__ignore) : "r" (__futex), "r" (FUTEX_OWNER_DIED) \ : "=&r" (__ignore) : "r" (__futex), "r" (FUTEX_OWNER_DIED) \
: "r0", "r1", "memory"); \ : "r0", "r1", "memory"); \
lll_futex_wake (__futex, 1, LLL_SHARED); }) lll_futex_wake (__futex, 1, private); })
#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)
# ifdef NEED_SYSCALL_INST_PAD # ifdef NEED_SYSCALL_INST_PAD
# define SYSCALL_WITH_INST_PAD "\ # define SYSCALL_WITH_INST_PAD "\
@ -367,25 +381,14 @@ typedef int lll_lock_t;
} while (0) } 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) \ #define lll_islocked(futex) \
(futex != LLL_LOCK_INITIALIZER) (futex != LLL_LOCK_INITIALIZER)
/* The kernel notifies a process with uses CLONE_CLEARTID via futex /* The kernel notifies a process with uses CLONE_CLEARTID via futex
wakeup when the clone terminates. The memory location contains the wakeup when the clone terminates. The memory location contains the
thread ID while the clone is running and is reset to zero thread ID while the clone is running and is reset to zero
afterwards. */ afterwards. */
extern int __lll_wait_tid (int *tid) attribute_hidden;
#define lll_wait_tid(tid) \ #define lll_wait_tid(tid) \
do { \ do { \
__typeof (tid) *__tid = &(tid); \ __typeof (tid) *__tid = &(tid); \
@ -407,24 +410,6 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
} \ } \
__result; }) __result; })
#endif /* !__ASSEMBLER__ */
/* 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 /* lowlevellock.h */ #endif /* lowlevellock.h */

View File

@ -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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -18,31 +19,64 @@
#include <sysdep.h> #include <sysdep.h>
#include <pthread-errnos.h> #include <pthread-errnos.h>
#include <lowlevellock.h>
#include <lowlevelrobustlock.h> #include <lowlevelrobustlock.h>
#include <kernel-features.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
.text .text
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_WAITERS 0x80000000 #define FUTEX_WAITERS 0x80000000
#define FUTEX_OWNER_DIED 0x40000000 #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 .globl __lll_robust_lock_wait
.type __lll_robust_mutex_lock_wait,@function .type __lll_robust_lock_wait,@function
.hidden __lll_robust_mutex_lock_wait .hidden __lll_robust_lock_wait
.align 5 .align 5
cfi_startproc cfi_startproc
__lll_robust_mutex_lock_wait: __lll_robust_lock_wait:
mov.l r8, @-r15 mov.l r8, @-r15
cfi_adjust_cfa_offset(4) cfi_adjust_cfa_offset(4)
cfi_rel_offset (r8, 0) cfi_rel_offset (r8, 0)
mov r5, r8 mov r5, r8
mov #0, r7 /* No timeout. */ mov #0, r7 /* No timeout. */
mov #FUTEX_WAIT, r5 mov r6, r5
LOAD_FUTEX_WAIT (r5, r0, r1)
4: 4:
mov r4, r6 mov r4, r6
@ -90,21 +124,24 @@ __lll_robust_mutex_lock_wait:
.long FUTEX_WAITERS .long FUTEX_WAITERS
.Ltidoff: .Ltidoff:
.word TID - TLS_PRE_TCB_SIZE .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 .globl __lll_robust_timedlock_wait
.type __lll_robust_mutex_timedlock_wait,@function .type __lll_robust_timedlock_wait,@function
.hidden __lll_robust_mutex_timedlock_wait .hidden __lll_robust_timedlock_wait
.align 5 .align 5
cfi_startproc cfi_startproc
__lll_robust_mutex_timedlock_wait: __lll_robust_timedlock_wait:
/* Check for a valid timeout value. */ /* Check for a valid timeout value. */
mov.l @(4,r6), r1 mov.l @(4,r6), r1
mov.l .L1g, r0 mov.l .L1g, r0
cmp/hs r0, r1 cmp/hs r0, r1
bt 3f bt 3f
mov.l r11, @-r15
cfi_adjust_cfa_offset(4)
cfi_rel_offset (r11, 0)
mov.l r10, @-r15 mov.l r10, @-r15
cfi_adjust_cfa_offset(4) cfi_adjust_cfa_offset(4)
cfi_rel_offset (r10, 0) cfi_rel_offset (r10, 0)
@ -114,6 +151,7 @@ __lll_robust_mutex_timedlock_wait:
mov.l r8, @-r15 mov.l r8, @-r15
cfi_adjust_cfa_offset(4) cfi_adjust_cfa_offset(4)
cfi_rel_offset (r8, 0) cfi_rel_offset (r8, 0)
mov r7, r11
mov r4, r10 mov r4, r10
mov r6, r9 mov r6, r9
mov r5, r8 mov r5, r8
@ -126,7 +164,7 @@ __lll_robust_mutex_timedlock_wait:
/* Get current time. */ /* Get current time. */
mov r15, r4 mov r15, r4
mov #0, r5 mov #0, r5
mov #SYS_gettimeofday, r3 mov #__NR_gettimeofday, r3
trapa #0x12 trapa #0x12
SYSCALL_INST_PAD SYSCALL_INST_PAD
@ -167,7 +205,8 @@ __lll_robust_mutex_timedlock_wait:
2: 2:
mov r8, r4 mov r8, r4
mov #FUTEX_WAIT, r5 mov r11, r5
LOAD_FUTEX_WAIT (r5, r0, r1)
mov r10, r6 mov r10, r6
mov r15, r7 mov r15, r7
mov #SYS_futex, r3 mov #SYS_futex, r3
@ -196,8 +235,9 @@ __lll_robust_mutex_timedlock_wait:
add #8, r15 add #8, r15
mov.l @r15+, r8 mov.l @r15+, r8
mov.l @r15+, r9 mov.l @r15+, r9
mov.l @r15+, r10
rts rts
mov.l @r15+, r10 mov.l @r15+, r11
7: 7:
/* Check whether the time expired. */ /* Check whether the time expired. */
@ -221,4 +261,4 @@ __lll_robust_mutex_timedlock_wait:
.word TID - TLS_PRE_TCB_SIZE .word TID - TLS_PRE_TCB_SIZE
.L1k: .L1k:
.word 1000 .word 1000
.size __lll_robust_mutex_timedlock_wait,.-__lll_robust_mutex_timedlock_wait .size __lll_robust_timedlock_wait,.-__lll_robust_timedlock_wait

View File

@ -17,14 +17,10 @@
02111-1307 USA. */ 02111-1307 USA. */
#include <sysdep.h> #include <sysdep.h>
#include <lowlevellock.h>
#include <lowlevelbarrier.h> #include <lowlevelbarrier.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
.text .text
.globl pthread_barrier_wait .globl pthread_barrier_wait
@ -152,6 +148,10 @@ pthread_barrier_wait:
mov.l @r15+, r9 mov.l @r15+, r9
1: 1:
mov.l @(PRIVATE,r8), r6
mov #LLL_SHARED, r0
extu.b r0, r0
xor r0, r6
mov r2, r4 mov r2, r4
mov r8, r5 mov r8, r5
mov.l .Lwait0, r1 mov.l .Lwait0, r1
@ -162,6 +162,10 @@ pthread_barrier_wait:
nop nop
4: 4:
mov.l @(PRIVATE,r8), r5
mov #LLL_SHARED, r0
extu.b r0, r0
xor r0, r5
mov r8, r4 mov r8, r4
mov.l .Lwake0, r1 mov.l .Lwake0, r1
bsrf r1 bsrf r1
@ -172,6 +176,10 @@ pthread_barrier_wait:
6: 6:
mov r6, r9 mov r6, r9
mov.l @(PRIVATE,r8), r5
mov #LLL_SHARED, r0
extu.b r0, r0
xor r0, r5
mov r8, r4 mov r8, r4
mov.l .Lwake1, r1 mov.l .Lwake1, r1
bsrf r1 bsrf r1
@ -182,6 +190,10 @@ pthread_barrier_wait:
9: 9:
mov r6, r9 mov r6, r9
mov.l @(PRIVATE,r8), r5
mov #LLL_SHARED, r0
extu.b r0, r0
xor r0, r5
mov r8, r4 mov r8, r4
mov.l .Lwake2, r1 mov.l .Lwake2, r1
bsrf r1 bsrf r1
@ -194,11 +206,11 @@ pthread_barrier_wait:
.Lall: .Lall:
.long 0x7fffffff .long 0x7fffffff
.Lwait0: .Lwait0:
.long __lll_mutex_lock_wait-.Lwait0b .long __lll_lock_wait-.Lwait0b
.Lwake0: .Lwake0:
.long __lll_mutex_unlock_wake-.Lwake0b .long __lll_unlock_wake-.Lwake0b
.Lwake1: .Lwake1:
.long __lll_mutex_unlock_wake-.Lwake1b .long __lll_unlock_wake-.Lwake1b
.Lwake2: .Lwake2:
.long __lll_mutex_unlock_wake-.Lwake2b .long __lll_unlock_wake-.Lwake2b
.size pthread_barrier_wait,.-pthread_barrier_wait .size pthread_barrier_wait,.-pthread_barrier_wait

View File

@ -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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -18,19 +18,13 @@
#include <sysdep.h> #include <sysdep.h>
#include <shlib-compat.h> #include <shlib-compat.h>
#include <lowlevellock.h>
#include <lowlevelcond.h> #include <lowlevelcond.h>
#include <kernel-features.h> #include <kernel-features.h>
#include <pthread-pi-defines.h> #include <pthread-pi-defines.h>
#include <pthread-errnos.h>
#include "lowlevel-atomic.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 .text
/* int pthread_cond_broadcast (pthread_cond_t *cond) */ /* int pthread_cond_broadcast (pthread_cond_t *cond) */
@ -162,10 +156,12 @@ __pthread_cond_broadcast:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r5 add #cond_lock, r5
#endif #endif
mov.l .Lmwait5, r1 mov #LLL_SHARED, r6
extu.b r6, r6
mov.l .Lwait5, r1
bsrf r1 bsrf r1
mov r2, r4 mov r2, r4
.Lmwait5b: .Lwait5b:
bra 2b bra 2b
nop nop
@ -175,10 +171,11 @@ __pthread_cond_broadcast:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r4 add #cond_lock, r4
#endif #endif
mov.l .Lmwake5, r1 mov #LLL_SHARED, r5
mov.l .Lwake5, r1
bsrf r1 bsrf r1
nop extu.b r5, r5
.Lmwake5b: .Lwake5b:
bra 6b bra 6b
nop nop
@ -188,10 +185,11 @@ __pthread_cond_broadcast:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r4 add #cond_lock, r4
#endif #endif
mov.l .Lmwake6, r1 mov #LLL_SHARED, r5
mov.l .Lwake6, r1
bsrf r1 bsrf r1
nop extu.b r5, r5
.Lmwake6b: .Lwake6b:
bra 8b bra 8b
nop nop
@ -208,12 +206,12 @@ __pthread_cond_broadcast:
nop nop
.align 2 .align 2
.Lmwait5: .Lwait5:
.long __lll_mutex_lock_wait-.Lmwait5b .long __lll_lock_wait-.Lwait5b
.Lmwake5: .Lwake5:
.long __lll_mutex_unlock_wake-.Lmwake5b .long __lll_unlock_wake-.Lwake5b
.Lmwake6: .Lwake6:
.long __lll_mutex_unlock_wake-.Lmwake6b .long __lll_unlock_wake-.Lwake6b
.size __pthread_cond_broadcast, .-__pthread_cond_broadcast .size __pthread_cond_broadcast, .-__pthread_cond_broadcast
versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast, versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
GLIBC_2_3_2) GLIBC_2_3_2)

View File

@ -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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -18,17 +18,12 @@
#include <sysdep.h> #include <sysdep.h>
#include <shlib-compat.h> #include <shlib-compat.h>
#include <lowlevellock.h>
#include <lowlevelcond.h> #include <lowlevelcond.h>
#include <kernel-features.h> #include <kernel-features.h>
#include <pthread-errnos.h>
#include "lowlevel-atomic.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 .text
/* int pthread_cond_signal (pthread_cond_t *cond) */ /* int pthread_cond_signal (pthread_cond_t *cond) */
@ -108,10 +103,12 @@ __pthread_cond_signal:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r5 add #cond_lock, r5
#endif #endif
mov.l .Lmwait4, r1 mov #LLL_SHARED, r6
extu.b r6, r6
mov.l .Lwait4, r1
bsrf r1 bsrf r1
mov r2, r4 mov r2, r4
.Lmwait4b: .Lwait4b:
bra 2b bra 2b
nop nop
@ -121,18 +118,19 @@ __pthread_cond_signal:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r4 add #cond_lock, r4
#endif #endif
mov.l .Lmwake4, r1 mov #LLL_SHARED, r5
mov.l .Lwake4, r1
bsrf r1 bsrf r1
nop extu.b r5, r5
.Lmwake4b: .Lwake4b:
bra 6b bra 6b
nop nop
.align 2 .align 2
.Lmwait4: .Lwait4:
.long __lll_mutex_lock_wait-.Lmwait4b .long __lll_lock_wait-.Lwait4b
.Lmwake4: .Lwake4:
.long __lll_mutex_unlock_wake-.Lmwake4b .long __lll_unlock_wake-.Lwake4b
.size __pthread_cond_signal, .-__pthread_cond_signal .size __pthread_cond_signal, .-__pthread_cond_signal
versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal, versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
GLIBC_2_3_2) GLIBC_2_3_2)

View File

@ -18,16 +18,11 @@
#include <sysdep.h> #include <sysdep.h>
#include <shlib-compat.h> #include <shlib-compat.h>
#include <lowlevellock.h>
#include <lowlevelcond.h> #include <lowlevelcond.h>
#include <pthread-errnos.h> #include <pthread-errnos.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
.text .text
/* int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, /* int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
@ -164,7 +159,7 @@ __pthread_cond_timedwait:
mov r15, r4 mov r15, r4
add #16, r4 add #16, r4
mov #0, r5 mov #0, r5
mov #SYS_gettimeofday, r3 mov #__NR_gettimeofday, r3
trapa #0x12 trapa #0x12
SYSCALL_INST_PAD SYSCALL_INST_PAD
@ -182,7 +177,7 @@ __pthread_cond_timedwait:
mov r15, r4 mov r15, r4
add #16, r4 add #16, r4
mov #0, r5 mov #0, r5
mov #SYS_gettimeofday, r3 mov #__NR_gettimeofday, r3
trapa #0x12 trapa #0x12
SYSCALL_INST_PAD SYSCALL_INST_PAD
@ -403,10 +398,12 @@ __pthread_cond_timedwait:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r5 add #cond_lock, r5
#endif #endif
mov.l .Lmwait2, r1 mov #LLL_SHARED, r6
extu.b r6, r6
mov.l .Lwait2, r1
bsrf r1 bsrf r1
mov r2, r4 mov r2, r4
.Lmwait2b: .Lwait2b:
bra 2b bra 2b
nop nop
@ -416,10 +413,11 @@ __pthread_cond_timedwait:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r4 add #cond_lock, r4
#endif #endif
mov.l .Lmwake2, r1 mov #LLL_SHARED, r5
mov.l .Lmwait2, r1
bsrf r1 bsrf r1
nop extu.b r5, r5
.Lmwake2b: .Lmwait2b:
bra 4b bra 4b
nop nop
@ -429,10 +427,12 @@ __pthread_cond_timedwait:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r5 add #cond_lock, r5
#endif #endif
mov.l .Lmwait3, r1 mov #LLL_SHARED, r6
extu.b r6, r6
mov.l .Lwait3, r1
bsrf r1 bsrf r1
mov r2, r4 mov r2, r4
.Lmwait3b: .Lwait3b:
bra 6b bra 6b
nop nop
@ -442,10 +442,11 @@ __pthread_cond_timedwait:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r4 add #cond_lock, r4
#endif #endif
mov.l .Lmwake3, r1 mov #LLL_SHARED, r5
mov.l .Lmwait3, r1
bsrf r1 bsrf r1
nop extu.b r5, r5
.Lmwake3b: .Lmwait3b:
bra 11b bra 11b
nop nop
@ -464,25 +465,26 @@ __pthread_cond_timedwait:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r4 add #cond_lock, r4
#endif #endif
mov.l .Lmwake4, r1 mov #LLL_SHARED, r5
mov.l .Lmwait4, r1
bsrf r1 bsrf r1
nop extu.b r5, r5
.Lmwake4b: .Lmwait4b:
17: 17:
bra 18b bra 18b
mov.l @(24,r15), r0 mov.l @(24,r15), r0
.align 2 .align 2
.Lwait2:
.long __lll_lock_wait-.Lwait2b
.Lmwait2: .Lmwait2:
.long __lll_mutex_lock_wait-.Lmwait2b .long __lll_unlock_wake-.Lmwait2b
.Lmwake2: .Lwait3:
.long __lll_mutex_unlock_wake-.Lmwake2b .long __lll_lock_wait-.Lwait3b
.Lmwait3: .Lmwait3:
.long __lll_mutex_lock_wait-.Lmwait3b .long __lll_unlock_wake-.Lmwait3b
.Lmwake3: .Lmwait4:
.long __lll_mutex_unlock_wake-.Lmwake3b .long __lll_unlock_wake-.Lmwait4b
.Lmwake4:
.long __lll_mutex_unlock_wake-.Lmwake4b
.size __pthread_cond_timedwait, .-__pthread_cond_timedwait .size __pthread_cond_timedwait, .-__pthread_cond_timedwait
versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
GLIBC_2_3_2) GLIBC_2_3_2)
@ -507,10 +509,12 @@ __condvar_tw_cleanup:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r5 add #cond_lock, r5
#endif #endif
mov.l .Lmwait5, r1 mov #LLL_SHARED, r6
extu.b r6, r6
mov.l .Lwait5, r1
bsrf r1 bsrf r1
mov r2, r4 mov r2, r4
.Lmwait5b: .Lwait5b:
1: 1:
mov.l @(broadcast_seq,r8), r0 mov.l @(broadcast_seq,r8), r0
@ -600,10 +604,11 @@ __condvar_tw_cleanup:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r4 add #cond_lock, r4
#endif #endif
mov.l .Lmwake5, r1 mov #LLL_SHARED, r5
mov.l .Lmwait5, r1
bsrf r1 bsrf r1
nop extu.b r5, r5
.Lmwake5b: .Lmwait5b:
2: 2:
/* Wake up all waiters to make sure no signal gets lost. */ /* Wake up all waiters to make sure no signal gets lost. */
@ -636,10 +641,10 @@ __condvar_tw_cleanup:
sleep sleep
.align 2 .align 2
.Lwait5:
.long __lll_lock_wait-.Lwait5b
.Lmwait5: .Lmwait5:
.long __lll_mutex_lock_wait-.Lmwait5b .long __lll_unlock_wake-.Lmwait5b
.Lmwake5:
.long __lll_mutex_unlock_wake-.Lmwake5b
.Lmlocki5: .Lmlocki5:
.long __pthread_mutex_cond_lock-.Lmlocki5b .long __pthread_mutex_cond_lock-.Lmlocki5b
.Lresume: .Lresume:

View File

@ -18,14 +18,10 @@
#include <sysdep.h> #include <sysdep.h>
#include <shlib-compat.h> #include <shlib-compat.h>
#include <lowlevellock.h>
#include <lowlevelcond.h> #include <lowlevelcond.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
.text .text
/* int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) */ /* int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) */
@ -267,10 +263,12 @@ __pthread_cond_wait:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r5 add #cond_lock, r5
#endif #endif
mov.l .Lmwait0, r1 mov #LLL_SHARED, r6
extu.b r6, r6
mov.l .Lwait0, r1
bsrf r1 bsrf r1
mov r2, r4 mov r2, r4
.Lmwait0b: .Lwait0b:
bra 2b bra 2b
nop nop
3: 3:
@ -279,10 +277,11 @@ __pthread_cond_wait:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r4 add #cond_lock, r4
#endif #endif
mov.l .Lmwake0, r1 mov #LLL_SHARED, r5
mov.l .Lwake0, r1
bsrf r1 bsrf r1
nop extu.b r5, r5
.Lmwake0b: .Lwake0b:
bra 4b bra 4b
nop nop
@ -292,10 +291,12 @@ __pthread_cond_wait:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r5 add #cond_lock, r5
#endif #endif
mov.l .Lmwait1, r1 mov #LLL_SHARED, r6
extu.b r6, r6
mov.l .Lwait1, r1
bsrf r1 bsrf r1
mov r2, r4 mov r2, r4
.Lmwait1b: .Lwait1b:
bra 6b bra 6b
nop nop
@ -305,10 +306,11 @@ __pthread_cond_wait:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r4 add #cond_lock, r4
#endif #endif
mov.l .Lmwake1, r1 mov #LLL_SHARED, r5
mov.l .Lwake1, r1
bsrf r1 bsrf r1
nop extu.b r5, r5
.Lmwake1b: .Lwake1b:
bra 11b bra 11b
nop nop
@ -327,26 +329,27 @@ __pthread_cond_wait:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r4 add #cond_lock, r4
#endif #endif
mov.l .Lmwake2, r1 mov #LLL_SHARED, r5
mov.l .Lwake2, r1
bsrf r1 bsrf r1
nop extu.b r5, r5
.Lmwake2b: .Lwake2b:
13: 13:
bra 14b bra 14b
mov.l @(12,r15), r0 mov.l @(12,r15), r0
.align 2 .align 2
.Lmwait0: .Lwait0:
.long __lll_mutex_lock_wait-.Lmwait0b .long __lll_lock_wait-.Lwait0b
.Lmwake0: .Lwake0:
.long __lll_mutex_unlock_wake-.Lmwake0b .long __lll_unlock_wake-.Lwake0b
.Lmwait1: .Lwait1:
.long __lll_mutex_lock_wait-.Lmwait1b .long __lll_lock_wait-.Lwait1b
.Lmwake1: .Lwake1:
.long __lll_mutex_unlock_wake-.Lmwake1b .long __lll_unlock_wake-.Lwake1b
.Lmwake2: .Lwake2:
.long __lll_mutex_unlock_wake-.Lmwake2b .long __lll_unlock_wake-.Lwake2b
.size __pthread_cond_wait, .-__pthread_cond_wait .size __pthread_cond_wait, .-__pthread_cond_wait
versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait, versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
GLIBC_2_3_2) GLIBC_2_3_2)
@ -371,10 +374,12 @@ __condvar_w_cleanup:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r5 add #cond_lock, r5
#endif #endif
mov.l .Lmwait3, r1 mov #LLL_SHARED, r6
extu.b r6, r6
mov.l .Lwait3, r1
bsrf r1 bsrf r1
mov r2, r4 mov r2, r4
.Lmwait3b: .Lwait3b:
1: 1:
mov.l @(broadcast_seq,r8), r0 mov.l @(broadcast_seq,r8), r0
@ -464,10 +469,11 @@ __condvar_w_cleanup:
#if cond_lock != 0 #if cond_lock != 0
add #cond_lock, r4 add #cond_lock, r4
#endif #endif
mov.l .Lmwake3, r1 mov #LLL_SHARED, r5
mov.l .Lwake3, r1
bsrf r1 bsrf r1
nop extu.b r5, r5
.Lmwake3b: .Lwake3b:
2: 2:
/* Wake up all waiters to make sure no signal gets lost. */ /* Wake up all waiters to make sure no signal gets lost. */
@ -500,10 +506,10 @@ __condvar_w_cleanup:
sleep sleep
.align 2 .align 2
.Lmwait3: .Lwait3:
.long __lll_mutex_lock_wait-.Lmwait3b .long __lll_lock_wait-.Lwait3b
.Lmwake3: .Lwake3:
.long __lll_mutex_unlock_wake-.Lmwake3b .long __lll_unlock_wake-.Lwake3b
.Lmlocki3: .Lmlocki3:
.long __pthread_mutex_cond_lock-.Lmlocki3b .long __pthread_mutex_cond_lock-.Lmlocki3b
.Lresume: .Lresume:

View File

@ -19,12 +19,9 @@
#include <unwindbuf.h> #include <unwindbuf.h>
#include <sysdep.h> #include <sysdep.h>
#include <kernel-features.h> #include <kernel-features.h>
#include <lowlevellock.h>
#include "lowlevel-atomic.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 .comm __fork_generation, 4, 4

View File

@ -17,17 +17,13 @@
02111-1307 USA. */ 02111-1307 USA. */
#include <sysdep.h> #include <sysdep.h>
#include <lowlevellock.h>
#include <lowlevelrwlock.h> #include <lowlevelrwlock.h>
#include <pthread-errnos.h> #include <pthread-errnos.h>
#include <tcb-offsets.h> #include <tcb-offsets.h>
#include <kernel-features.h> #include <kernel-features.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_PRIVATE_FLAG 128
.text .text
@ -156,10 +152,12 @@ __pthread_rwlock_rdlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r5 add #MUTEX, r5
#endif #endif
mov r2, r4 mov #PSHARED, r0
mov.b @(r0,r8), r6
extu.b r6, r6
mov.l .Lwait0, r1 mov.l .Lwait0, r1
bsrf r1 bsrf r1
nop mov r2, r4
.Lwait0b: .Lwait0b:
bra 2b bra 2b
nop nop
@ -182,6 +180,9 @@ __pthread_rwlock_rdlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r4 add #MUTEX, r4
#endif #endif
mov #PSHARED, r0
mov.b @(r0,r8), r5
extu.b r5, r5
mov.l .Lwake0, r1 mov.l .Lwake0, r1
bsrf r1 bsrf r1
nop nop
@ -210,6 +211,9 @@ __pthread_rwlock_rdlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r4 add #MUTEX, r4
#endif #endif
mov #PSHARED, r0
mov.b @(r0,r8), r5
extu.b r5, r5
mov.l .Lwake1, r1 mov.l .Lwake1, r1
bsrf r1 bsrf r1
nop nop
@ -222,23 +226,25 @@ __pthread_rwlock_rdlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r5 add #MUTEX, r5
#endif #endif
mov r2, r4 mov #PSHARED, r0
mov.b @(r0,r8), r6
extu.b r6, r6
mov.l .Lwait1, r1 mov.l .Lwait1, r1
bsrf r1 bsrf r1
nop mov r2, r4
.Lwait1b: .Lwait1b:
bra 13b bra 13b
nop nop
.align 2 .align 2
.Lwait0: .Lwait0:
.long __lll_mutex_lock_wait-.Lwait0b .long __lll_lock_wait-.Lwait0b
.Lwake0: .Lwake0:
.long __lll_mutex_unlock_wake-.Lwake0b .long __lll_unlock_wake-.Lwake0b
.Lwait1: .Lwait1:
.long __lll_mutex_lock_wait-.Lwait1b .long __lll_lock_wait-.Lwait1b
.Lwake1: .Lwake1:
.long __lll_mutex_unlock_wake-.Lwake1b .long __lll_unlock_wake-.Lwake1b
.size __pthread_rwlock_rdlock,.-__pthread_rwlock_rdlock .size __pthread_rwlock_rdlock,.-__pthread_rwlock_rdlock
.globl pthread_rwlock_rdlock .globl pthread_rwlock_rdlock

View File

@ -17,18 +17,13 @@
02111-1307 USA. */ 02111-1307 USA. */
#include <sysdep.h> #include <sysdep.h>
#include <lowlevellock.h>
#include <lowlevelrwlock.h> #include <lowlevelrwlock.h>
#include <pthread-errnos.h> #include <pthread-errnos.h>
#include <tcb-offsets.h> #include <tcb-offsets.h>
#include <kernel-features.h> #include <kernel-features.h>
#include "lowlevel-atomic.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 .text
@ -92,7 +87,7 @@ pthread_rwlock_timedrdlock:
/* Get current time. */ /* Get current time. */
mov r15, r4 mov r15, r4
mov #0, r5 mov #0, r5
mov #SYS_gettimeofday, r3 mov #__NR_gettimeofday, r3
trapa #0x12 trapa #0x12
SYSCALL_INST_PAD SYSCALL_INST_PAD
@ -213,10 +208,12 @@ pthread_rwlock_timedrdlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r5 add #MUTEX, r5
#endif #endif
mov r2, r4 mov #PSHARED, r0
mov.b @(r0,r8), r6
extu.b r6, r6
mov.l .Lwait2, r1 mov.l .Lwait2, r1
bsrf r1 bsrf r1
nop mov r2, r4
.Lwait2b: .Lwait2b:
bra 2b bra 2b
nop nop
@ -239,6 +236,9 @@ pthread_rwlock_timedrdlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r4 add #MUTEX, r4
#endif #endif
mov #PSHARED, r0
mov.b @(r0,r8), r5
extu.b r5, r5
mov.l .Lwake2, r1 mov.l .Lwake2, r1
bsrf r1 bsrf r1
nop nop
@ -267,6 +267,9 @@ pthread_rwlock_timedrdlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r4 add #MUTEX, r4
#endif #endif
mov #PSHARED, r0
mov.b @(r0,r8), r5
extu.b r5, r5
mov.l .Lwake3, r1 mov.l .Lwake3, r1
bsrf r1 bsrf r1
nop nop
@ -279,10 +282,12 @@ pthread_rwlock_timedrdlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r5 add #MUTEX, r5
#endif #endif
mov r2, r4 mov #PSHARED, r0
mov.b @(r0,r8), r6
extu.b r6, r6
mov.l .Lwait3, r1 mov.l .Lwait3, r1
bsrf r1 bsrf r1
nop mov r2, r4
.Lwait3b: .Lwait3b:
bra 13b bra 13b
nop nop
@ -297,11 +302,11 @@ pthread_rwlock_timedrdlock:
.align 2 .align 2
.Lwait2: .Lwait2:
.long __lll_mutex_lock_wait-.Lwait2b .long __lll_lock_wait-.Lwait2b
.Lwake2: .Lwake2:
.long __lll_mutex_unlock_wake-.Lwake2b .long __lll_unlock_wake-.Lwake2b
.Lwait3: .Lwait3:
.long __lll_mutex_lock_wait-.Lwait3b .long __lll_lock_wait-.Lwait3b
.Lwake3: .Lwake3:
.long __lll_mutex_unlock_wake-.Lwake3b .long __lll_unlock_wake-.Lwake3b
.size pthread_rwlock_timedrdlock,.-pthread_rwlock_timedrdlock .size pthread_rwlock_timedrdlock,.-pthread_rwlock_timedrdlock

View File

@ -17,18 +17,13 @@
02111-1307 USA. */ 02111-1307 USA. */
#include <sysdep.h> #include <sysdep.h>
#include <lowlevellock.h>
#include <lowlevelrwlock.h> #include <lowlevelrwlock.h>
#include <pthread-errnos.h> #include <pthread-errnos.h>
#include <tcb-offsets.h> #include <tcb-offsets.h>
#include <kernel-features.h> #include <kernel-features.h>
#include "lowlevel-atomic.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 .text
@ -88,7 +83,7 @@ pthread_rwlock_timedwrlock:
/* Get current time. */ /* Get current time. */
mov r15, r4 mov r15, r4
mov #0, r5 mov #0, r5
mov #SYS_gettimeofday, r3 mov #__NR_gettimeofday, r3
trapa #0x12 trapa #0x12
SYSCALL_INST_PAD SYSCALL_INST_PAD
@ -211,10 +206,12 @@ pthread_rwlock_timedwrlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r5 add #MUTEX, r5
#endif #endif
mov r2, r4 mov #PSHARED, r0
mov.b @(r0,r8), r6
extu.b r6, r6
mov.l .Lwait6, r1 mov.l .Lwait6, r1
bsrf r1 bsrf r1
nop mov r2, r4
.Lwait6b: .Lwait6b:
bra 2b bra 2b
nop nop
@ -232,6 +229,9 @@ pthread_rwlock_timedwrlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r4 add #MUTEX, r4
#endif #endif
mov #PSHARED, r0
mov.b @(r0,r8), r5
extu.b r5, r5
mov.l .Lwake6, r1 mov.l .Lwake6, r1
bsrf r1 bsrf r1
nop nop
@ -255,6 +255,9 @@ pthread_rwlock_timedwrlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r4 add #MUTEX, r4
#endif #endif
mov #PSHARED, r0
mov.b @(r0,r8), r5
extu.b r5, r5
mov.l .Lwake7, r1 mov.l .Lwake7, r1
bsrf r1 bsrf r1
nop nop
@ -267,10 +270,12 @@ pthread_rwlock_timedwrlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r5 add #MUTEX, r5
#endif #endif
mov r2, r4 mov #PSHARED, r0
mov.b @(r0,r8), r6
extu.b r6, r6
mov.l .Lwait7, r1 mov.l .Lwait7, r1
bsrf r1 bsrf r1
nop mov r2, r4
.Lwait7b: .Lwait7b:
bra 13b bra 13b
nop nop
@ -281,11 +286,11 @@ pthread_rwlock_timedwrlock:
.align 2 .align 2
.Lwait6: .Lwait6:
.long __lll_mutex_lock_wait-.Lwait6b .long __lll_lock_wait-.Lwait6b
.Lwake6: .Lwake6:
.long __lll_mutex_unlock_wake-.Lwake6b .long __lll_unlock_wake-.Lwake6b
.Lwait7: .Lwait7:
.long __lll_mutex_lock_wait-.Lwait7b .long __lll_lock_wait-.Lwait7b
.Lwake7: .Lwake7:
.long __lll_mutex_unlock_wake-.Lwake7b .long __lll_unlock_wake-.Lwake7b
.size pthread_rwlock_timedwrlock,.-pthread_rwlock_timedwrlock .size pthread_rwlock_timedwrlock,.-pthread_rwlock_timedwrlock

View File

@ -17,15 +17,11 @@
02111-1307 USA. */ 02111-1307 USA. */
#include <sysdep.h> #include <sysdep.h>
#include <lowlevellock.h>
#include <lowlevelrwlock.h> #include <lowlevelrwlock.h>
#include <kernel-features.h> #include <kernel-features.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_PRIVATE_FLAG 128
.text .text
@ -138,10 +134,12 @@ __pthread_rwlock_unlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r5 add #MUTEX, r5
#endif #endif
mov r2, r4 mov #PSHARED, r0
mov.b @(r0,r8), r6
extu.b r6, r6
mov.l .Lwait8, r1 mov.l .Lwait8, r1
bsrf r1 bsrf r1
nop mov r2, r4
.Lwait8b: .Lwait8b:
bra 2b bra 2b
nop nop
@ -150,6 +148,9 @@ __pthread_rwlock_unlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r4 add #MUTEX, r4
#endif #endif
mov #PSHARED, r0
mov.b @(r0,r8), r5
extu.b r5, r5
mov.l .Lwake8, r1 mov.l .Lwake8, r1
bsrf r1 bsrf r1
nop nop
@ -164,6 +165,9 @@ __pthread_rwlock_unlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r4 add #MUTEX, r4
#endif #endif
mov #PSHARED, r0
mov.b @(r0,r8), r5
extu.b r5, r5
mov.l .Lwake9, r1 mov.l .Lwake9, r1
bsrf r1 bsrf r1
nop nop
@ -179,11 +183,11 @@ __pthread_rwlock_unlock:
#endif #endif
.align 2 .align 2
.Lwait8: .Lwait8:
.long __lll_mutex_lock_wait-.Lwait8b .long __lll_lock_wait-.Lwait8b
.Lwake8: .Lwake8:
.long __lll_mutex_unlock_wake-.Lwake8b .long __lll_unlock_wake-.Lwake8b
.Lwake9: .Lwake9:
.long __lll_mutex_unlock_wake-.Lwake9b .long __lll_unlock_wake-.Lwake9b
.size __pthread_rwlock_unlock,.-__pthread_rwlock_unlock .size __pthread_rwlock_unlock,.-__pthread_rwlock_unlock
.globl pthread_rwlock_unlock .globl pthread_rwlock_unlock

View File

@ -17,17 +17,13 @@
02111-1307 USA. */ 02111-1307 USA. */
#include <sysdep.h> #include <sysdep.h>
#include <lowlevellock.h>
#include <lowlevelrwlock.h> #include <lowlevelrwlock.h>
#include <pthread-errnos.h> #include <pthread-errnos.h>
#include <tcb-offsets.h> #include <tcb-offsets.h>
#include <kernel-features.h> #include <kernel-features.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_PRIVATE_FLAG 128
.text .text
@ -145,10 +141,12 @@ __pthread_rwlock_wrlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r5 add #MUTEX, r5
#endif #endif
mov r2, r4 mov #PSHARED, r0
mov.b @(r0,r8), r6
extu.b r6, r6
mov.l .Lwait4, r1 mov.l .Lwait4, r1
bsrf r1 bsrf r1
nop mov r2, r4
.Lwait4b: .Lwait4b:
bra 2b bra 2b
nop nop
@ -166,6 +164,9 @@ __pthread_rwlock_wrlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r4 add #MUTEX, r4
#endif #endif
mov #PSHARED, r0
mov.b @(r0,r8), r5
extu.b r5, r5
mov.l .Lwake4, r1 mov.l .Lwake4, r1
bsrf r1 bsrf r1
nop nop
@ -192,6 +193,9 @@ __pthread_rwlock_wrlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r4 add #MUTEX, r4
#endif #endif
mov #PSHARED, r0
mov.b @(r0,r8), r5
extu.b r5, r5
mov.l .Lwake5, r1 mov.l .Lwake5, r1
bsrf r1 bsrf r1
nop nop
@ -204,23 +208,25 @@ __pthread_rwlock_wrlock:
#if MUTEX != 0 #if MUTEX != 0
add #MUTEX, r5 add #MUTEX, r5
#endif #endif
mov r2, r4 mov #PSHARED, r0
mov.b @(r0,r8), r6
extu.b r6, r6
mov.l .Lwait5, r1 mov.l .Lwait5, r1
bsrf r1 bsrf r1
nop mov r2, r4
.Lwait5b: .Lwait5b:
bra 13b bra 13b
nop nop
.align 2 .align 2
.Lwait4: .Lwait4:
.long __lll_mutex_lock_wait-.Lwait4b .long __lll_lock_wait-.Lwait4b
.Lwake4: .Lwake4:
.long __lll_mutex_unlock_wake-.Lwake4b .long __lll_unlock_wake-.Lwake4b
.Lwait5: .Lwait5:
.long __lll_mutex_lock_wait-.Lwait5b .long __lll_lock_wait-.Lwait5b
.Lwake5: .Lwake5:
.long __lll_mutex_unlock_wake-.Lwake5b .long __lll_unlock_wake-.Lwake5b
.globl pthread_rwlock_wrlock .globl pthread_rwlock_wrlock
pthread_rwlock_wrlock = __pthread_rwlock_wrlock pthread_rwlock_wrlock = __pthread_rwlock_wrlock

View File

@ -20,14 +20,10 @@
#include <shlib-compat.h> #include <shlib-compat.h>
#include <pthread-errnos.h> #include <pthread-errnos.h>
#include <structsem.h> #include <structsem.h>
#include <lowlevellock.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
.text .text
.globl __new_sem_post .globl __new_sem_post
@ -65,7 +61,12 @@ __new_sem_post:
mov.l .Lerrno3, r0 mov.l .Lerrno3, r0
stc gbr, r1 stc gbr, r1
mov.l @(r0, r12), r0 mov.l @(r0, r12), r0
add r1, r0 bra .Lexit
add r1, r0
.align 2
.Lerrno3:
.long errno@GOTTPOFF
.Lexit:
#else #else
mov.l .Lerrloc3, r1 mov.l .Lerrloc3, r1
bsrf r1 bsrf r1
@ -81,10 +82,7 @@ __new_sem_post:
.align 2 .align 2
.Lgot3: .Lgot3:
.long _GLOBAL_OFFSET_TABLE_ .long _GLOBAL_OFFSET_TABLE_
#if USE___THREAD #if !USE___THREAD
.Lerrno3:
.long errno@GOTTPOFF
#else
.Lerrloc3: .Lerrloc3:
.long __errno_location@PLT-(.Lerrloc3b-.) .long __errno_location@PLT-(.Lerrloc3b-.)
#endif #endif

View File

@ -21,13 +21,10 @@
#include <pthread-errnos.h> #include <pthread-errnos.h>
#include <tcb-offsets.h> #include <tcb-offsets.h>
#include <structsem.h> #include <structsem.h>
#include <lowlevellock.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
#define FUTEX_WAIT 0
#if VALUE != 0 #if VALUE != 0
# error "code needs to be rewritten for VALUE != 0" # error "code needs to be rewritten for VALUE != 0"
#endif #endif
@ -81,7 +78,7 @@ sem_timedwait:
/* Compute relative timeout. */ /* Compute relative timeout. */
mov r15, r4 mov r15, r4
mov #0, r5 mov #0, r5
mov #SYS_gettimeofday, r3 mov #__NR_gettimeofday, r3
trapa #0x12 trapa #0x12
SYSCALL_INST_PAD SYSCALL_INST_PAD
@ -180,15 +177,19 @@ sem_timedwait:
mov.l .Lerrno2, r0 mov.l .Lerrno2, r0
stc gbr, r1 stc gbr, r1
mov.l @(r0, r12), r0 mov.l @(r0, r12), r0
add r1, r0 bra .Lexit
mov.l r10, @r0 add r1, r0
.align 2
.Lerrno2:
.long errno@GOTTPOFF
.Lexit:
#else #else
mov.l .Lerrloc2, r1 mov.l .Lerrloc2, r1
bsrf r1 bsrf r1
nop nop
.Lerrloc2b: .Lerrloc2b:
mov.l r10, @r0
#endif #endif
mov.l r10, @r0
DEC (@(NWAITERS,r8), r2) DEC (@(NWAITERS,r8), r2)
bra 10b bra 10b
mov #-1, r0 mov #-1, r0
@ -200,10 +201,7 @@ sem_timedwait:
.long 1000000000 .long 1000000000
.Lgot2: .Lgot2:
.long _GLOBAL_OFFSET_TABLE_ .long _GLOBAL_OFFSET_TABLE_
#if USE___THREAD #if !USE___THREAD
.Lerrno2:
.long errno@GOTTPOFF
#else
.Lerrloc2: .Lerrloc2:
.long __errno_location@PLT-(.Lerrloc2b-.) .long __errno_location@PLT-(.Lerrloc2b-.)
#endif #endif

View File

@ -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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -19,6 +19,7 @@
#include <sysdep.h> #include <sysdep.h>
#include <shlib-compat.h> #include <shlib-compat.h>
#include <pthread-errnos.h> #include <pthread-errnos.h>
#include <lowlevellock.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
@ -60,15 +61,19 @@ __new_sem_trywait:
mov.l .Lerrno1, r0 mov.l .Lerrno1, r0
stc gbr, r1 stc gbr, r1
mov.l @(r0, r12), r0 mov.l @(r0, r12), r0
add r1, r0 bra .Lexit
mov.l r8, @r0 add r1, r0
.align 2
.Lerrno1:
.long errno@GOTTPOFF
.Lexit:
#else #else
mov.l .Lerrloc1, r1 mov.l .Lerrloc1, r1
bsrf r1 bsrf r1
nop nop
.Lerrloc1b: .Lerrloc1b:
mov.l r8, @r0
#endif #endif
mov.l r8, @r0
lds.l @r15+, pr lds.l @r15+, pr
mov.l @r15+, r8 mov.l @r15+, r8
mov.l @r15+, r12 mov.l @r15+, r12
@ -78,10 +83,7 @@ __new_sem_trywait:
.align 2 .align 2
.Lgot1: .Lgot1:
.long _GLOBAL_OFFSET_TABLE_ .long _GLOBAL_OFFSET_TABLE_
#if USE___THREAD #if !USE___THREAD
.Lerrno1:
.long errno@GOTTPOFF
#else
.Lerrloc1: .Lerrloc1:
.long __errno_location@PLT-(.Lerrloc1b-.) .long __errno_location@PLT-(.Lerrloc1b-.)
#endif #endif

View File

@ -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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -21,13 +21,10 @@
#include <pthread-errnos.h> #include <pthread-errnos.h>
#include <tcb-offsets.h> #include <tcb-offsets.h>
#include <structsem.h> #include <structsem.h>
#include <lowlevellock.h>
#include "lowlevel-atomic.h" #include "lowlevel-atomic.h"
#define SYS_gettimeofday __NR_gettimeofday
#define SYS_futex 240
#define FUTEX_WAIT 0
#if VALUE != 0 #if VALUE != 0
# error "code needs to be rewritten for VALUE != 0" # error "code needs to be rewritten for VALUE != 0"
#endif #endif
@ -138,24 +135,26 @@ __new_sem_wait:
mov.l .Lerrno0, r0 mov.l .Lerrno0, r0
stc gbr, r1 stc gbr, r1
mov.l @(r0, r12), r0 mov.l @(r0, r12), r0
add r1, r0 bra .Lexit
mov.l r8, @r0 add r1, r0
.align 2
.Lerrno0:
.long errno@GOTTPOFF
.Lexit:
#else #else
mov.l .Lerrloc0, r1 mov.l .Lerrloc0, r1
bsrf r1 bsrf r1
nop nop
.Lerrloc0b: .Lerrloc0b:
mov.l r8, @r0
#endif #endif
mov.l r8, @r0
bra 9b bra 9b
mov #-1, r0 mov #-1, r0
.align 2
.Lgot0: .Lgot0:
.long _GLOBAL_OFFSET_TABLE_ .long _GLOBAL_OFFSET_TABLE_
#if USE___THREAD #if !USE___THREAD
.Lerrno0:
.long errno@GOTTPOFF
#else
.Lerrloc0: .Lerrloc0:
.long __errno_location@PLT-(.Lerrloc0b-.) .long __errno_location@PLT-(.Lerrloc0b-.)
#endif #endif