]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Mon, 22 Sep 2003 04:41:12 +0000 (04:41 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 22 Sep 2003 04:41:12 +0000 (04:41 +0000)
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S: Removed.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Adjust
for new mutex implementation.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Likewise
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S:
Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S:
Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise.
Don't use requeue.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.

27 files changed:
nptl/ChangeLog
nptl/Makefile
nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S
nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S
nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S
nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S [deleted file]
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S

index 0562ae947a5fd4cd16a18880f7a8f825214f101a..8bb48ddbc8ebe719f5b94eec41106f0690a7f7b0 100644 (file)
@@ -3,21 +3,40 @@
        * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Completely revamp the
        locking macros.  No distinction between normal and mutex locking
        anymore.
+       * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
        * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Rewrite mutex
        locking.  Merge bits from lowlevelmutex.S we still need.
+       * sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
        * sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S: Removed.
+       * sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S: Removed.
        * Makefile (routines): Remove libc-lowlevelmutex.
        (libpthread-rountines): Remove lowlevelmutex.
-       * pthread_barrier_wait.S: Adjust for new mutex implementation.
-       * pthread_cond_broadcast.S: Likewise.
-       * pthread_cond_timedwait.S: Likewise.
-       * pthread_cond_wait.S: Likewise.
-       * pthread_rwlock_rdlock.S: Likewise.
-       * pthread_rwlock_timedrdlock.S: Likewise.
-       * pthread_rwlock_timedwrlock.S: Likewise.
-       * pthread_rwlock_unlock.S: Likewise.
-       * pthread_rwlock_wrlock.S: Likewise.
-       * pthread_cond_signal.S: Likewise.  Don't use requeue.
+       * sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Adjust
+       for new mutex implementation.
+       * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise.
+       * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
+       * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
+       * sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S: Likewise.
+       * sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
+       Likewise.
+       * sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
+       Likewise.
+       * sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S: Likewise.
+       * sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Likewise
+       * sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S:
+       Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S:
+       Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_unlock.S: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S: Likewise.
+       * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise.
+       Don't use requeue.
+       * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.
 
 2003-09-20  Ulrich Drepper  <drepper@redhat.com>
 
index ba568dffbacfafeb7b3cb3733f15bd650e3766a0..d592137caf94cb775126ccf05a410fa777bdb031 100644 (file)
@@ -29,8 +29,7 @@ extra-libs := libpthread
 extra-libs-others := $(extra-libs)
 install-lib-ldscripts := libpthread.so
 
-routines = alloca_cutoff forward libc-lowlevellock libc-lowlevelmutex \
-          libc-cancellation
+routines = alloca_cutoff forward libc-lowlevellock libc-cancellation
 shared-only-routines = forward
 
 libpthread-routines = init events version \
@@ -102,7 +101,7 @@ libpthread-routines = init events version \
                      cleanup_defer_compat unwind \
                      pt-longjmp \
                      cancellation \
-                     lowlevellock lowlevelmutex \
+                     lowlevellock \
                      pt-vfork \
                      ptw-write ptw-read ptw-close ptw-fcntl ptw-accept \
                      ptw-connect ptw-recv ptw-recvfrom ptw-recvmsg ptw-send \
index 6e4b07729575a381c1917af253c75e1159d95de9..c73970d45f2937e8f973bdb38b25da44788e5ba1 100644 (file)
@@ -65,8 +65,7 @@ __lll_mutex_lock_wait:
 2:     LOCK
        cmpxchgl %edx, (%ebx)
 
-       testl   %eax, %eax
-       jne,pn  1b
+       jnz,pn  1b
 
        popl    %edx
        popl    %ebx
@@ -144,8 +143,7 @@ __lll_mutex_timedlock_wait:
        LOCK
        cmpxchgl %edx, (%ebx)
 
-       testl   %eax, %eax
-       jne     7f
+       jnz     7f
 
 6:     addl    $8, %esp
        popl    %ebp
index 08c6e915b9a91cc4c14c26dc2cb0f69978a51981..d4b61a10c15573bc7351e62d75269c550832351f 100644 (file)
@@ -46,8 +46,7 @@ pthread_barrier_wait:
        xorl    %eax, %eax
        LOCK
        cmpxchgl %edx, MUTEX(%ebx)
-       testl   %eax, %eax
-       jne     1f
+       jnz     1f
 
        /* One less waiter.  If this was the last one needed wake
           everybody.  */
index 1049e0f4dd920b727a83c8cc9dcbc1456a29679b..cdcf6d29145fc93457c36bdd1d7eb5cb7316ff2f 100644 (file)
@@ -59,8 +59,7 @@ __pthread_cond_broadcast:
 #else
        cmpxchgl %edx, cond_lock(%ebx)
 #endif
-       testl   %eax, %eax
-       jne     1f
+       jnz     1f
 
 2:     addl    $wakeup_seq, %ebx
        movl    total_seq+4-wakeup_seq(%ebx), %eax
index d86ee054a960016e77c1428f8308e5afcdad9503..3a24adf911a94bc7cbe9cf39d92dc193cda42235 100644 (file)
@@ -58,8 +58,7 @@ __pthread_cond_signal:
 #else
        cmpxchgl %edx, cond_lock(%edi)
 #endif
-       testl   %eax, %eax
-       jne     1f
+       jnz     1f
 
 2:     leal    wakeup_seq(%edi), %ebx
        movl    total_seq+4(%edi), %eax
index 5799d8f862f225fe995ece1c96bf5438d770df60..ca5c1423c09331377ed92ef3f02930c20e372583 100644 (file)
@@ -64,8 +64,7 @@ __pthread_cond_timedwait:
 #else
        cmpxchgl %edx, cond_lock(%ebx)
 #endif
-       testl   %eax, %eax
-       jne     1f
+       jnz     1f
 
        /* Store the reference to the mutex.  If there is already a
           different value in there this is a bad user bug.  */
@@ -179,8 +178,7 @@ __pthread_cond_timedwait:
 #else
        cmpxchgl %edx, cond_lock(%ebx)
 #endif
-       testl   %eax, %eax
-       jne     5f
+       jnz     5f
 
 6:     movl    woken_seq(%ebx), %eax
        movl    woken_seq+4(%ebx), %ecx
@@ -363,8 +361,7 @@ __condvar_tw_cleanup:
 #else
        cmpxchgl %edx, cond_lock(%ebx)
 #endif
-       testl   %eax, %eax
-       je      1f
+       jz      1f
 
 #if cond_lock == 0
        movl    %ebx, %ecx
index db0428f527386b522e88b6fdd30c7876f35bc8ff..ff3a1ccef3809cb8115cb8f94b4ad0ae26a727c2 100644 (file)
@@ -61,8 +61,7 @@ __pthread_cond_wait:
 #else
        cmpxchgl %edx, cond_lock(%ebx)
 #endif
-       testl   %eax, %eax
-       jne     1f
+       jnz     1f
 
        /* Store the reference to the mutex.  If there is already a
           different value in there this is a bad user bug.  */
@@ -123,8 +122,7 @@ __pthread_cond_wait:
 #else
        cmpxchgl %edx, cond_lock(%ebx)
 #endif
-       testl   %eax, %eax
-       jne     5f
+       jnz     5f
 
 6:     movl    woken_seq(%ebx), %eax
        movl    woken_seq+4(%ebx), %ecx
@@ -256,8 +254,7 @@ __condvar_w_cleanup:
 #else
        cmpxchgl %edx, cond_lock(%ebx)
 #endif
-       testl   %eax, %eax
-       je      1f
+       jz      1f
 
 #if cond_lock == 0
        movl    %ebx, %ecx
index 1c149433f0dcda8121c6506aab389b3f88dc63c3..db0639d21c5f4682b60ce0b975e643cea5b708be 100644 (file)
@@ -54,8 +54,7 @@ __pthread_rwlock_rdlock:
 #else
        cmpxchgl %edx, MUTEX(%ebx)
 #endif
-       testl   %eax, %eax
-       jne     1f
+       jnz     1f
 
 2:     movl    WRITER(%ebx), %eax
        testl   %eax, %eax
@@ -94,8 +93,7 @@ __pthread_rwlock_rdlock:
 #else
        cmpxchgl %edx, MUTEX(%ebx)
 #endif
-       testl   %eax, %eax
-       jne     12f
+       jnz     12f
 
 13:    subl    $1, READERS_QUEUED(%ebx)
        jmp     2b
index 409c046b7ba5f53bd5a34b152d9dbbbeb6a98efd..eb5665b43254748421264d9eb1661c4fe33b8f42 100644 (file)
@@ -58,8 +58,7 @@ pthread_rwlock_timedrdlock:
 #else
        cmpxchgl %edx, MUTEX(%ebp)
 #endif
-       testl   %eax, %eax
-       jne     1f
+       jnz     1f
 
 2:     movl    WRITER(%ebp), %eax
        testl   %eax, %eax
@@ -127,8 +126,7 @@ pthread_rwlock_timedrdlock:
 #else
        cmpxchgl %edx, MUTEX(%ebp)
 #endif
-       testl   %eax, %eax
-       jne     12f
+       jnz     12f
 
 13:    subl    $1, READERS_QUEUED(%ebp)
        cmpl    $-ETIMEDOUT, %ecx
index 00d9906e597d910f95a6757266a45fd4044c9b59..d9db77ba053a1f7730500dc0dd1a2ac7eb4e367c 100644 (file)
@@ -58,8 +58,7 @@ pthread_rwlock_timedwrlock:
 #else
        cmpxchgl %edx, MUTEX(%ebp)
 #endif
-       testl   %eax, %eax
-       jne     1f
+       jnz     1f
 
 2:     movl    WRITER(%ebp), %eax
        testl   %eax, %eax
@@ -125,8 +124,7 @@ pthread_rwlock_timedwrlock:
 #else
        cmpxchgl %edx, MUTEX(%ebp)
 #endif
-       testl   %eax, %eax
-       jne     12f
+       jnz     12f
 
 13:    subl    $1, WRITERS_QUEUED(%ebp)
        cmpl    $-ETIMEDOUT, %ecx
index 839a5eb3369c02ba8afa6aef096c95ca2b13ebda..64aac3255adce579d86e5fe934a135ec8e3f75d8 100644 (file)
@@ -52,8 +52,7 @@ __pthread_rwlock_unlock:
 #else
        cmpxchgl %edx, MUTEX(%edi)
 #endif
-       testl   %eax, %eax
-       jne     1f
+       jnz     1f
 
 2:     cmpl    $0, WRITER(%edi)
        jne     5f
index 89ad6a377423068c96da6e82979ebbe06e93402e..ea9cc170dbccc826759465a224dfdf5913455c26 100644 (file)
@@ -54,8 +54,7 @@ __pthread_rwlock_wrlock:
 #else
        cmpxchgl %edx, MUTEX(%ebx)
 #endif
-       testl   %eax, %eax
-       jne     1f
+       jnz     1f
 
 2:     movl    WRITER(%ebx), %eax
        testl   %eax, %eax
@@ -92,8 +91,7 @@ __pthread_rwlock_wrlock:
 #else
        cmpxchgl %edx, MUTEX(%ebx)
 #endif
-       testl   %eax, %eax
-       jne     12f
+       jnz     12f
 
 13:    subl    $1, WRITERS_QUEUED(%ebx)
        jmp     2b
index ba3259162398e1a19b62e8b4ec988a00d39f36be..be00e8963821e45e2c3a1ee6bad259de051fe736 100644 (file)
@@ -115,8 +115,7 @@ extern int __lll_mutex_unlock_wake (int *__futex)
 #define lll_mutex_lock(futex) \
   (void) ({ int ignore1, ignore2;                                            \
            __asm __volatile (LOCK_INSTR "cmpxchgl %1, %2\n\t"                \
-                             "testl %0, %0\n\t"                              \
-                             "jne _L_mutex_lock_%=\n\t"                      \
+                             "jnz _L_mutex_lock_%=\n\t"                      \
                              ".subsection 1\n\t"                             \
                              ".type _L_mutex_lock_%=,@function\n"            \
                              "_L_mutex_lock_%=:\n\t"                         \
@@ -136,8 +135,7 @@ extern int __lll_mutex_unlock_wake (int *__futex)
 #define lll_mutex_cond_lock(futex) \
   (void) ({ int ignore1, ignore2;                                            \
            __asm __volatile (LOCK_INSTR "cmpxchgl %1, %2\n\t"                \
-                             "testl %0, %0\n\t"                              \
-                             "jne _L_mutex_cond_lock_%=\n\t"                 \
+                             "jnz _L_mutex_cond_lock_%=\n\t"                 \
                              ".subsection 1\n\t"                             \
                              ".type _L_mutex_cond_lock_%=,@function\n"       \
                              "_L_mutex_cond_lock_%=:\n\t"                    \
@@ -155,8 +153,7 @@ extern int __lll_mutex_unlock_wake (int *__futex)
 #define lll_mutex_timedlock(futex, timeout) \
   ({ int result, ignore1, ignore2;                                           \
      __asm __volatile (LOCK_INSTR "cmpxchgl %1, %3\n\t"                              \
-                      "testl %0, %0\n\t"                                     \
-                      "jne _L_mutex_timedlock_%=\n\t"                        \
+                      "jnz _L_mutex_timedlock_%=\n\t"                        \
                       ".subsection 1\n\t"                                    \
                       ".type _L_mutex_timedlock_%=,@function\n"              \
                       "_L_mutex_timedlock_%=:\n\t"                           \
@@ -251,8 +248,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
                              "je,pt 0f\n\t"                                  \
                              "lock\n"                                        \
                              "0:\tcmpxchgl %1, %2\n\t"                       \
-                             "testl %0, %0\n\t"                              \
-                             "jne _L_mutex_lock_%=\n\t"                      \
+                             "jnz _L_mutex_lock_%=\n\t"                      \
                              ".subsection 1\n\t"                             \
                              ".type _L_mutex_lock_%=,@function\n"            \
                              "_L_mutex_lock_%=:\n\t"                         \
index aff449b13a05954da901487a17859b12167bc34a..a56c714aeb6d1a9d2d33d03bedc037d2f176694d 100644 (file)
 #define VSYSCALL_ADDR_vgettimeofday    0xffffffffff600000
 
 
-       /* Modified: %rax, %rsi.  */
-       .globl  __lll_lock_wait
-       .type   __lll_lock_wait,@function
-       .hidden __lll_lock_wait
+       .globl  __lll_mutex_lock_wait
+       .type   __lll_mutex_lock_wait,@function
+       .hidden __lll_mutex_lock_wait
        .align  16
-__lll_lock_wait:
+__lll_mutex_lock_wait:
        pushq   %r10
        pushq   %rdx
 
        xorq    %r10, %r10      /* No timeout.  */
+       movl    $2, %edx
+       movq    %r10, %rsi      /* movq $FUTEX_WAIT, %rsi */
 
 1:
-       leaq    -1(%rsi), %rdx  /* account for the preceeded xadd.  */
-       movq    %r10, %rsi      /* movq $FUTEX_WAIT, %rsi */
+       movl    $1, %eax
+       LOCK
+       cmpxchgl %edx, (%rdi)
+
+       testl   %eax, %eax
+       je      2f
+
        movq    $SYS_futex, %rax
        syscall
 
-       orl     $-1, %esi       /* Load -1.  */
-       LOCK
-       xaddl   %esi, (%rdi)
-       jne     1b
+       xorl    %eax, %eax
+2:     LOCK
+       cmpxchgl %edx, (%rdi)
 
-       movl    $-1, (%rdi)
+       jnz     1b
 
        popq    %rdx
        popq    %r10
        retq
-       .size   __lll_lock_wait,.-__lll_lock_wait
+       .size   __lll_mutex_lock_wait,.-__lll_mutex_lock_wait
+
+
+#ifdef NOT_IN_libc
+       .globl  __lll_mutex_timedlock_wait
+       .type   __lll_mutex_timedlock_wait,@function
+       .hidden __lll_mutex_timedlock_wait
+       .align  16
+__lll_mutex_timedlock_wait:
+       /* Check for a valid timeout value.  */
+       cmpq    $1000000000, 8(%rdx)
+       jae     3f
+
+       pushq   %r12
+       pushq   %r13
+       pushq   %r14
+
+       /* Stack frame for the timespec and timeval structs.  */
+       subq    $16, %rsp
+
+       movq    %rdi, %r12
+       movq    %rdx, %r13
+
+1:
+       /* Get current time.  */
+       movq    %rsp, %rdi
+       xorq    %rsi, %rsi
+       movq    $VSYSCALL_ADDR_vgettimeofday, %rax
+       /* This is a regular function call, all calleer-save registers
+          might be clobbered.  */
+       callq   *%rax
+
+       /* Compute relative timeout.  */
+       movq    8(%rsp), %rax
+       movq    $1000, %rdi
+       mul     %rdi            /* Milli seconds to nano seconds.  */
+       movq    (%r13), %rdi
+       movq    8(%r13), %rsi
+       subq    (%rsp), %rdi
+       subq    %rax, %rsi
+       jns     4f
+       addq    $1000000000, %rsi
+       decq    %rdi
+4:     testq   %rdi, %rdi
+       js      5f              /* Time is already up.  */
+
+       /* Futex call.  */
+       movq    %rdi, (%rsp)    /* Store relative timeout.  */
+       movq    %rsi, 8(%rsp)
+
+       movl    $1, %eax
+       movl    $2, %edx
+       LOCK
+       cmpxchgl %edx, (%r12)
+
+       testl   %eax, %eax
+       je      8f
+
+       movq    %rsp, %r10
+       xorq    %rsi, %rsi      /* movq $FUTEX_WAIT, %rsi */
+       movq    %r12, %rdi
+       movq    $SYS_futex, %rax
+       syscall
+       movq    %rax, %rcx
+
+       movl    $1, %eax
+       LOCK
+       cmpxchgl %edx, (%rdi)
+       jnz     7f
+
+       movl    $2, (%rdi)
+       xorl    %eax, %eax
+
+8:     addq    $16, %rsp
+       popq    %r14
+       popq    %r13
+       popq    %r12
+       retq
+
+       /* Check whether the time expired.  */
+7:     cmpq    $-ETIMEDOUT, %rcx
+       je      5f
+       jmp     1b
+
+3:     movl    $EINVAL, %eax
+       retq
+
+5:     movl    $ETIMEDOUT, %eax
+       jmp     8b
+       .size   __lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait
+#endif
 
 
 #ifdef NOT_IN_libc
@@ -88,24 +183,24 @@ lll_unlock_wake_cb:
 #endif
 
 
-       .globl  __lll_unlock_wake
-       .type   __lll_unlock_wake,@function
-       .hidden __lll_unlock_wake
+       .globl  __lll_mutex_unlock_wake
+       .type   __lll_mutex_unlock_wake,@function
+       .hidden __lll_mutex_unlock_wake
        .align  16
-__lll_unlock_wake:
+__lll_mutex_unlock_wake:
        pushq   %rsi
        pushq   %rdx
 
-1:     movq    $FUTEX_WAKE, %rsi
+       movl    $0, (%rdi)
+       movq    $FUTEX_WAKE, %rsi
        movl    $1, %edx        /* Wake one thread.  */
        movq    $SYS_futex, %rax
-       movl    %edx, (%rdi)    /* Stores '$1'.  */
        syscall
 
        popq    %rdx
        popq    %rsi
        retq
-       .size   __lll_unlock_wake,.-__lll_unlock_wake
+       .size   __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake
 
 
 #ifdef NOT_IN_libc
index 1f1e7dd1a993eb47e41a68f7445c37d60918eb7f..35d132113dffe1002f3715eb0b4f7689a9118c90 100644 (file)
@@ -38,7 +38,8 @@
 
 
 /* Initializer for compatibility lock.  */
-#define LLL_MUTEX_LOCK_INITIALIZER (0)
+#define LLL_MUTEX_LOCK_INITIALIZER             (0)
+#define LLL_MUTEX_LOCK_INITIALIZER_LOCKED      (1)
 
 
 #define lll_futex_wait(futex, val) \
@@ -80,16 +81,16 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden;
   ({ unsigned char ret;                                                              \
      __asm __volatile (LOCK_INSTR "cmpxchgl %2, %1; setne %0"                \
                       : "=a" (ret), "=m" (futex)                             \
-                      : "r" (1), "1" (futex), "0" (0)                        \
+                      : "r" (LLL_MUTEX_LOCK_INITIALIZER_LOCKED), "m" (futex),\
+                        "0" (LLL_MUTEX_LOCK_INITIALIZER)                     \
                       : "memory");                                           \
      ret; })
 
 
 #define lll_mutex_lock(futex) \
-  (void) ({ int ignore1, ignore2;                                            \
-           __asm __volatile (LOCK_INSTR "xaddl %0, %2\n\t"                   \
-                             "testl %0, %0\n\t"                              \
-                             "jne 1f\n\t"                                    \
+  (void) ({ int ignore1, ignore2, ignore3;                                   \
+           __asm __volatile (LOCK_INSTR "cmpxchgl %0, %2\n\t"                \
+                             "jnz 1f\n\t"                                    \
                              ".subsection 1\n"                               \
                              "1:\tleaq %2, %%rdi\n\t"                        \
                              "subq $128, %%rsp\n\t"                          \
@@ -98,16 +99,16 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden;
                              "jmp 2f\n\t"                                    \
                              ".previous\n"                                   \
                              "2:"                                            \
-                             : "=S" (ignore1), "=&D" (ignore2), "=m" (futex) \
-                             : "0" (1), "2" (futex)                          \
-                             : "ax", "cx", "r11", "cc", "memory"); })
+                             : "=S" (ignore1), "=&D" (ignore2), "=m" (futex),\
+                               "=a" (ignore3)                                \
+                             : "0" (1), "m" (futex), "3" (0)                 \
+                             : "cx", "r11", "cc", "memory"); })
 
 
 #define lll_mutex_cond_lock(futex) \
-  (void) ({ int ignore1, ignore2;                                            \
-           __asm __volatile (LOCK_INSTR "xaddl %0, %2\n\t"                   \
-                             "testl %0, %0\n\t"                              \
-                             "jne 1f\n\t"                                    \
+  (void) ({ int ignore1, ignore2, ignore3;                                   \
+           __asm __volatile (LOCK_INSTR "cmpxchgl %0, %2\n\t"                \
+                             "jnz 1f\n\t"                                    \
                              ".subsection 1\n"                               \
                              "1:\tleaq %2, %%rdi\n\t"                        \
                              "subq $128, %%rsp\n\t"                          \
@@ -116,28 +117,28 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden;
                              "jmp 2f\n\t"                                    \
                              ".previous\n"                                   \
                              "2:"                                            \
-                             : "=S" (ignore1), "=&D" (ignore2), "=m" (futex) \
-                             : "0" (2), "2" (futex)                          \
-                             : "ax", "cx", "r11", "cc", "memory"); })
+                             : "=S" (ignore1), "=&D" (ignore2), "=m" (futex),\
+                               "=a" (ignore3)                                \
+                             : "0" (2), "m" (futex), "3" (0)                 \
+                             : "cx", "r11", "cc", "memory"); })
 
 
 #define lll_mutex_timedlock(futex, timeout) \
   ({ int result, ignore1, ignore2, ignore3;                                  \
-     __asm __volatile (LOCK_INSTR "xaddl %0, %4\n\t"                         \
-                      "testl %0, %0\n\t"                                     \
-                      "jne 1f\n\t"                                           \
+     __asm __volatile (LOCK_INSTR "cmpxchgl %2, %4\n\t"                              \
+                      "jnz 1f\n\t"                                           \
                       ".subsection 1\n"                                      \
                       "1:\tleaq %4, %%rdi\n\t"                               \
-                      "movq %7, %%rdx\n\t"                                   \
+                      "movq %8, %%rdx\n\t"                                   \
                       "subq $128, %%rsp\n\t"                                 \
                       "callq __lll_mutex_timedlock_wait\n\t"                 \
                       "addq $128, %%rsp\n\t"                                 \
                       "jmp 2f\n\t"                                           \
                       ".previous\n"                                          \
                       "2:"                                                   \
-                      : "=a" (result), "=&D" (ignore1), "=&S" (ignore2),     \
+                      : "=a" (result), "=&D" (ignore1), "=S" (ignore2),      \
                         "=&d" (ignore3), "=m" (futex)                        \
-                      : "0" (1), "4" (futex), "m" (timeout)                  \
+                      : "0" (0), "2" (1), "m" (futex), "m" (timeout)         \
                       : "memory", "cx", "cc", "r10", "r11");                 \
      result; })
 
@@ -155,12 +156,12 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden;
                              ".previous\n"                                   \
                              "2:"                                            \
                              : "=m" (futex), "=&D" (ignore)                  \
-                             : "0" (futex)                                   \
+                             : "m" (futex)                                   \
                              : "ax", "cx", "r11", "cc", "memory"); })
 
 
 #define lll_mutex_islocked(futex) \
-  (futex != 0)
+  (futex != LLL_MUTEX_LOCK_INITIALIZER)
 
 
 /* We have a separate internal lock implementation which is not tied
@@ -170,63 +171,23 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden;
 typedef int lll_lock_t;
 
 /* Initializers for lock.  */
-#define LLL_LOCK_INITIALIZER           (1)
-#define LLL_LOCK_INITIALIZER_LOCKED    (0)
+#define LLL_LOCK_INITIALIZER           (0)
+#define LLL_LOCK_INITIALIZER_LOCKED    (1)
 
 
-extern int __lll_lock_wait (int *__futex, int val) attribute_hidden;
-extern int __lll_unlock_wake (int *__futex) attribute_hidden;
 extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 
 
 /* The states of a lock are:
-    1  -  untaken
-    0  -  taken by one user
-   <0  -  taken by more users */
+    0  -  untaken
+    1  -  taken by one user
+    2  -  taken by more users */
 
 
 #if defined NOT_IN_libc || defined UP
-# define lll_trylock(futex) \
-  ({ unsigned char ret;                                                              \
-     __asm __volatile (LOCK_INSTR "cmpxchgl %2, %1; setne %0"                \
-                      : "=a" (ret), "=m" (futex)                             \
-                      : "r" (0), "1" (futex), "0" (1)                        \
-                      : "memory");                                           \
-     ret; })
-
-
-# define lll_lock(futex) \
-  (void) ({ int ignore1, ignore2;                                            \
-           __asm __volatile (LOCK_INSTR "xaddl %0, %2\n\t"                   \
-                             "jne 1f\n\t"                                    \
-                             ".subsection 1\n"                               \
-                             "1:\tleaq %2, %%rdi\n\t"                        \
-                             "subq $128, %%rsp\n\t"                          \
-                             "callq __lll_lock_wait\n\t"                     \
-                             "addq $128, %%rsp\n\t"                          \
-                             "jmp 2f\n\t"                                    \
-                             ".previous\n"                                   \
-                             "2:"                                            \
-                             : "=S" (ignore1), "=&D" (ignore2), "=m" (futex) \
-                             : "0" (-1), "2" (futex)                         \
-                             : "ax", "cx", "r11", "cc", "memory"); })
-
-
-# define lll_unlock(futex) \
-  (void) ({ int ignore;                                                              \
-            __asm __volatile (LOCK_INSTR "incl %0\n\t"                       \
-                             "jng 1f\n\t"                                    \
-                             ".subsection 1\n"                               \
-                             "1:\tleaq %0, %%rdi\n\t"                        \
-                             "subq $128, %%rsp\n\t"                          \
-                             "callq __lll_unlock_wake\n\t"                   \
-                             "addq $128, %%rsp\n\t"                          \
-                             "jmp 2f\n\t"                                    \
-                             ".previous\n"                                   \
-                             "2:"                                            \
-                             : "=m" (futex), "=&D" (ignore)                  \
-                             : "0" (futex)                                   \
-                             : "ax", "cx", "r11", "cc", "memory"); })
+# define lll_trylock(futex) lll_mutex_trylock (futex)
+# define lll_lock(futex) lll_mutex_lock (futex)
+# define lll_unlock(futex) lll_mutex_unlock (futex)
 #else
 /* Special versions of the macros for use in libc itself.  They avoid
    the lock prefix when the thread library is not used.
@@ -240,29 +201,31 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
                       "lock\n"                                               \
                       "0:\tcmpxchgl %2, %1; setne %0"                        \
                       : "=a" (ret), "=m" (futex)                             \
-                      : "r" (0), "1" (futex), "0" (1)                        \
+                      : "r" (LLL_MUTEX_LOCK_INITIALIZER_LOCKED), "m" (futex),\
+                        "0" (LLL_MUTEX_LOCK_INITIALIZER)                     \
                       : "memory");                                           \
      ret; })
 
 
 # define lll_lock(futex) \
-  (void) ({ int ignore1, ignore2;                                            \
+  (void) ({ int ignore1, ignore2, ignore3;                                   \
            __asm __volatile ("cmpl $0, __libc_multiple_threads(%%rip)\n\t"   \
                              "je 0f\n\t"                                     \
                              "lock\n"                                        \
-                             "0:\txaddl %0, %2\n\t"                          \
-                             "jne 1f\n\t"                                    \
+                             "0:\tcmpxchgl %0, %2\n\t"                       \
+                             "jnz 1f\n\t"                                    \
                              ".subsection 1\n"                               \
                              "1:\tleaq %2, %%rdi\n\t"                        \
                              "subq $128, %%rsp\n\t"                          \
-                             "callq __lll_lock_wait\n\t"                     \
+                             "callq __lll_mutex_lock_wait\n\t"               \
                              "addq $128, %%rsp\n\t"                          \
                              "jmp 2f\n\t"                                    \
                              ".previous\n"                                   \
                              "2:"                                            \
-                             : "=S" (ignore1), "=&D" (ignore2), "=m" (futex) \
-                             : "0" (-1), "2" (futex)                         \
-                             : "ax", "cx", "r11", "cc", "memory"); })
+                             : "=S" (ignore1), "=&D" (ignore2), "=m" (futex),\
+                               "=a" (ignore3)                                \
+                             : "0" (1), "m" (futex), "3" (0)                 \
+                             : "cx", "r11", "cc", "memory"); })
 
 
 # define lll_unlock(futex) \
@@ -270,12 +233,12 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
             __asm __volatile ("cmpl $0, __libc_multiple_threads(%%rip)\n\t"   \
                              "je 0f\n\t"                                     \
                              "lock\n"                                        \
-                             "0:\tincl %0\n\t"                       \
-                             "jng 1f\n\t"                                    \
+                             "0:\tdecl %0\n\t"                               \
+                             "jne 1f\n\t"                                    \
                              ".subsection 1\n"                               \
                              "1:\tleaq %0, %%rdi\n\t"                        \
                              "subq $128, %%rsp\n\t"                          \
-                             "callq __lll_unlock_wake\n\t"                   \
+                             "callq __lll_mutex_unlock_wake\n\t"             \
                              "addq $128, %%rsp\n\t"                          \
                              "jmp 2f\n\t"                                    \
                              ".previous\n"                                   \
@@ -287,7 +250,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 
 
 #define lll_islocked(futex) \
-  (futex != 0)
+  (futex != LLL_MUTEX_LOCK_INITIALIZER)
 
 
 /* The kernel notifies a process with uses CLONE_CLEARTID via futex
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelmutex.S
deleted file mode 100644 (file)
index 2a2f847..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <pthread-errnos.h>
-
-       .text
-
-#ifndef LOCK
-# ifdef UP
-#  define LOCK
-# else
-#  define LOCK lock
-# endif
-#endif
-
-#define SYS_futex              202
-#define FUTEX_WAIT             0
-#define FUTEX_WAKE             1
-
-/* For the calculation see asm/vsyscall.h.  */
-#define VSYSCALL_ADDR_vgettimeofday    0xffffffffff600000
-
-
-       .globl  __lll_mutex_lock_wait
-       .type   __lll_mutex_lock_wait,@function
-       .hidden __lll_mutex_lock_wait
-       .align  16
-__lll_mutex_lock_wait:
-       pushq   %r10
-       pushq   %rdx
-
-       /* In the loop we are going to add 2 instead of 1 which is what
-          the caller did.  Account for that.  */
-       decq    %rsi
-
-       xorq    %r10, %r10      /* No timeout.  */
-
-1:
-       leaq    2(%rsi), %rdx   /* account for the preceeded xadd.  */
-       movq    %r10, %rsi      /* movq $FUTEX_WAIT, %rsi */
-       movq    $SYS_futex, %rax
-       syscall
-
-       movl    $2, %esi
-       LOCK
-       xaddl   %esi, (%rdi)
-       testl   %esi, %esi
-       jne     1b
-
-       popq    %rdx
-       popq    %r10
-       retq
-       .size   __lll_mutex_lock_wait,.-__lll_mutex_lock_wait
-
-
-#ifdef NOT_IN_libc
-       .globl  __lll_mutex_timedlock_wait
-       .type   __lll_mutex_timedlock_wait,@function
-       .hidden __lll_mutex_timedlock_wait
-       .align  16
-__lll_mutex_timedlock_wait:
-       /* Check for a valid timeout value.  */
-       cmpq    $1000000000, 8(%rdx)
-       jae     3f
-
-       pushq   %r12
-       pushq   %r13
-       pushq   %r14
-
-       /* Stack frame for the timespec and timeval structs.  */
-       subq    $16, %rsp
-
-       movq    %rdi, %r12
-       movq    %rdx, %r13
-
-1:     leaq    1(%rax), %r14
-
-       /* Get current time.  */
-       movq    %rsp, %rdi
-       xorq    %rsi, %rsi
-       movq    $VSYSCALL_ADDR_vgettimeofday, %rax
-       /* This is a regular function call, all calleer-save registers
-          might be clobbered.  */
-       callq   *%rax
-
-       /* Compute relative timeout.  */
-       movq    8(%rsp), %rax
-       movq    $1000, %rdi
-       mul     %rdi            /* Milli seconds to nano seconds.  */
-       movq    (%r13), %rdi
-       movq    8(%r13), %rsi
-       subq    (%rsp), %rdi
-       subq    %rax, %rsi
-       jns     4f
-       addq    $1000000000, %rsi
-       decq    %rdi
-4:     testq   %rdi, %rdi
-       js      5f              /* Time is already up.  */
-
-       /* Futex call.  */
-       movq    %rdi, (%rsp)    /* Store relative timeout.  */
-       movq    %rsi, 8(%rsp)
-
-       movl    %r14d, %edx
-       movq    %rsp, %r10
-       xorq    %rsi, %rsi      /* movq $FUTEX_WAIT, %rsi */
-       movq    %r12, %rdi
-       movq    $SYS_futex, %rax
-       syscall
-       movq    %rax, %rcx
-
-       movl    $1, %eax
-       LOCK
-       xaddl   %eax, (%rdi)
-       testl   %eax, %eax
-       jne     7f
-
-       movl    $2, (%rdi)
-       xorl    %eax, %eax
-
-8:     addq    $16, %rsp
-       popq    %r14
-       popq    %r13
-       popq    %r12
-       retq
-
-       /* Check whether the time expired.  */
-7:     cmpq    $-ETIMEDOUT, %rcx
-       je      5f
-       jmp     1b
-
-3:     movl    $EINVAL, %eax
-       retq
-
-5:     movl    $ETIMEDOUT, %eax
-       jmp     8b
-       .size   __lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait
-#endif
-
-
-       .globl  __lll_mutex_unlock_wake
-       .type   __lll_mutex_unlock_wake,@function
-       .hidden __lll_mutex_unlock_wake
-       .align  16
-__lll_mutex_unlock_wake:
-       pushq   %rsi
-       pushq   %rdx
-
-       movl    $0, (%rdi)
-       movq    $FUTEX_WAKE, %rsi
-       movl    $1, %edx        /* Wake one thread.  */
-       movq    $SYS_futex, %rax
-       syscall
-
-       popq    %rdx
-       popq    %rsi
-       retq
-       .size   __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake
index fdd2958130fa12fe12963683f82390f2cc009f81..672f2cac0eedfa7521c94cdd55fae1b1b99bb671 100644 (file)
        .align  16
 pthread_barrier_wait:
        /* Get the mutex.  */
-       orl     $-1, %esi
+       xorl    %eax, %eax
+       movl    $1, %esi
        LOCK
-       xaddl   %esi, MUTEX(%rdi)
-       jne     1f
+       cmpxchgl %esi, MUTEX(%rdi)
+       jnz     1f
 
        /* One less waiter.  If this was the last one needed wake
           everybody.  */
@@ -57,8 +58,8 @@ pthread_barrier_wait:
 
        /* Release the mutex.  */
        LOCK
-       addl    $1, MUTEX(%rdi)
-       jng     6f
+       decl    MUTEX(%rdi)
+       jne     6f
 
        /* Wait for the remaining threads.  The call will return immediately
           if the CURR_EVENT memory has meanwhile been changed.  */
@@ -102,25 +103,25 @@ pthread_barrier_wait:
           waking the waiting threads since otherwise a new thread might
           arrive and gets waken up, too.  */
        LOCK
-       addl    $1, MUTEX(%rdi)
-       jng     4f
+       decl    MUTEX(%rdi)
+       jne     4f
 
 5:     orl     $-1, %eax               /* == PTHREAD_BARRIER_SERIAL_THREAD */
 
        retq
 
 1:     addq    $MUTEX, %rdi
-       callq   __lll_lock_wait
+       callq   __lll_mutex_lock_wait
        subq    $MUTEX, %rdi
        jmp     2b
 
 4:     addq    $MUTEX, %rdi
-       callq   __lll_unlock_wake
+       callq   __lll_mutex_unlock_wake
        subq    $MUTEX, %rdi
        jmp     5b
 
 6:     addq    $MUTEX, %rdi
-       callq   __lll_unlock_wake
+       callq   __lll_mutex_unlock_wake
        subq    $MUTEX, %rdi
        jmp     7b
        .size   pthread_barrier_wait,.-pthread_barrier_wait
index d9185925a49e4885424826716ade97993059efa7..e6b2bbf19c5c27b72b6be90062a6a4b0af8789d2 100644 (file)
@@ -46,14 +46,14 @@ __pthread_cond_broadcast:
 
        /* Get internal lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if cond_lock == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, cond_lock(%rdi)
+       cmpxchgl %esi, cond_lock(%rdi)
 #endif
-       testl   %esi, %esi
-       jne     1f
+       jnz     1f
 
 2:     addq    $wakeup_seq, %rdi
        movq    total_seq-wakeup_seq(%rdi), %rcx
index d62310148df3ea15c13def4e43f2deb797be029d..92eadfc4330d7dfee842bce863c65d9732c84db8 100644 (file)
@@ -47,14 +47,14 @@ __pthread_cond_signal:
        /* Get internal lock.  */
        movq    %rdi, %r8
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if cond_lock == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, cond_lock(%rdi)
+       cmpxchgl %esi, cond_lock(%rdi)
 #endif
-       testl   %esi, %esi
-       jne     1f
+       jnz     1f
 
 2:     addq    $wakeup_seq, %rdi
        movq    total_seq(%r8), %rcx
@@ -65,21 +65,11 @@ __pthread_cond_signal:
        addq    $1, (%rdi)
 
        /* Wake up one thread.  */
-       movq    $FUTEX_REQUEUE, %rsi
+       movq    $FUTEX_WAKE, %rsi
        movq    $SYS_futex, %rax
-       xorq    %rdx, %rdx
-       movq    $1, %r10
+       movq    $1, %rdx
        syscall
 
-#ifndef __ASSUME_FUTEX_REQUEUE
-       cmpq    $-EINVAL, %rax
-       je      7f
-#endif
-
-       /* If we moved a thread we in any case have to make the syscall.  */
-       testq   %rax, %rax
-       jne     5f
-
        /* Unlock.  */
 4:     LOCK
 #if cond_lock == 0
@@ -112,15 +102,6 @@ __pthread_cond_signal:
 #endif
        callq   __lll_mutex_unlock_wake
        jmp     6b
-
-#ifndef __ASSUME_FUTEX_REQUEUE
-7:     /* The futex requeue functionality is not available.  */
-       movq    $1, %rdx
-       movq    $FUTEX_WAKE, %rsi
-       movq    $SYS_futex, %rax
-       syscall
-       jmp     4b
-#endif
        .size   __pthread_cond_signal, .-__pthread_cond_signal
 versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
                  GLIBC_2_3_2)
index b2b44495546c5f4eeabc33b3bcdf166d65140630..c0c8f55cfb98b9fd1e9a8099314489efeb479fad 100644 (file)
@@ -80,14 +80,14 @@ __pthread_cond_timedwait:
 
        /* Get internal lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if cond_lock == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, cond_lock(%rdi)
+       cmpxchgl %esi, cond_lock(%rdi)
 #endif
-       testl   %esi, %esi
-       jne     1f
+       jnz     1f
 
        /* Unlock the mutex.  */
 2:     movq    16(%rsp), %rdi
@@ -188,13 +188,13 @@ __pthread_cond_timedwait:
        /* Lock.  */
        movq    8(%rsp), %rdi
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if cond_lock == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, cond_lock(%rdi)
+       cmpxchgl %esi, cond_lock(%rdi)
 #endif
-       testl   %esi, %esi
        jne     5f
 
 6:     movq    woken_seq(%rdi), %rax
index 3942faf1ad764edec5636c7c60e03739721ba3b8..d8681ebe6b36a496b853dadfb2d343856319b681 100644 (file)
@@ -44,14 +44,14 @@ __condvar_cleanup:
        movq    %rdi, %r8
        movq    8(%rdi), %rdi
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if cond_lock == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, cond_lock(%rdi)
+       cmpxchgl %esi, cond_lock(%rdi)
 #endif
-       testl   %esi, %esi
-       je      1f
+       jz      1f
 
 #if cond_lock != 0
        addq    $cond_lock, %rdi
@@ -125,13 +125,13 @@ __pthread_cond_wait:
 
        /* Get internal lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if cond_lock == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, cond_lock(%rdi)
+       cmpxchgl %esi, cond_lock(%rdi)
 #endif
-       testl   %esi, %esi
        jne     1f
 
        /* Unlock the mutex.  */
@@ -186,14 +186,14 @@ __pthread_cond_wait:
        /* Lock.  */
        movq    8(%rsp), %rdi
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if cond_lock == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, cond_lock(%rdi)
+       cmpxchgl %esi, cond_lock(%rdi)
 #endif
-       testl   %esi, %esi
-       jne     5f
+       jnz     5f
 
 6:     movq    woken_seq(%rdi), %rax
 
index 0fd093e7dd95744b645a2fe1147a0d6124f88d7c..43c8cae34c1016406ad5e12fb1f3173349927daf 100644 (file)
@@ -43,14 +43,14 @@ __pthread_rwlock_rdlock:
 
        /* Get the lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if MUTEX == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, MUTEX(%rdi)
+       cmpxchgl %esi, MUTEX(%rdi)
 #endif
-       testl   %esi, %esi
-       jne     1f
+       jnz     1f
 
 2:     movl    WRITER(%rdi), %eax
        testl   %eax, %eax
@@ -82,14 +82,14 @@ __pthread_rwlock_rdlock:
 
        /* Reget the lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if MUTEX == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, MUTEX(%rdi)
+       cmpxchgl %esi, MUTEX(%rdi)
 #endif
-       testl   %esi, %esi
-       jne     12f
+       jnz     12f
 
 13:    decl    READERS_QUEUED(%rdi)
        jmp     2b
index 582e030abca893efbb34dfe45a73e2c7e4f88409..924e20868f65be97c16db9461ff754b7445e04ce 100644 (file)
@@ -53,14 +53,14 @@ pthread_rwlock_timedrdlock:
 
        /* Get the lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if MUTEX == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, MUTEX(%rdi)
+       cmpxchgl %esi, MUTEX(%rdi)
 #endif
-       testl   %esi, %esi
-       jne     1f
+       jnz     1f
 
 2:     movl    WRITER(%r12), %eax
        testl   %eax, %eax
@@ -123,14 +123,14 @@ pthread_rwlock_timedrdlock:
 
        /* Reget the lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if MUTEX == 0
-       xaddl   %esi, (%r12)
+       cmpxchgl %esi, (%r12)
 #else
-       xaddl   %esi, MUTEX(%r12)
+       cmpxchgl %esi, MUTEX(%r12)
 #endif
-       testl   %esi, %esi
-       jne     12f
+       jnz     12f
 
 13:    decl    READERS_QUEUED(%r12)
        cmpq    $-ETIMEDOUT, %rdx
index e7acab538a0c73e1ddc6362ffebca66d9c0cf0f5..ccaef4707019e35d93677f827f2b4adc1d9dc03b 100644 (file)
@@ -52,14 +52,14 @@ pthread_rwlock_timedwrlock:
 
        /* Get the lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if MUTEX == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, MUTEX(%rdi)
+       cmpxchgl %esi, MUTEX(%rdi)
 #endif
-       testl   %esi, %esi
-       jne     1f
+       jnz     1f
 
 2:     movl    WRITER(%r12), %eax
        testl   %eax, %eax
@@ -119,14 +119,14 @@ pthread_rwlock_timedwrlock:
 
        /* Reget the lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if MUTEX == 0
-       xaddl   %esi, (%r12)
+       cmpxchgl %esi, (%r12)
 #else
-       xaddl   %esi, MUTEX(%r12)
+       cmpxchgl %esi, MUTEX(%r12)
 #endif
-       testl   %esi, %esi
-       jne     12f
+       jnz     12f
 
 13:    decl    WRITERS_QUEUED(%r12)
        cmpq    $-ETIMEDOUT, %rdx
index a3d2351b68ed5c8f7e13a8f43be440160a6201fd..89652cc5d7e5e06c7b8b91cc33a23f41068c9578 100644 (file)
 __pthread_rwlock_unlock:
        /* Get the lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if MUTEX == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, MUTEX(%rdi)
+       cmpxchgl %esi, MUTEX(%rdi)
 #endif
-       testl   %esi, %esi
-       jne     1f
+       jnz     1f
 
 2:     cmpq    $0, WRITER(%rdi)
        jne     5f
index f866d2e2719e913b5426b9d96fc45c1f3dd7c2fd..1fcb07eaef246b07a42e7031bb536e751bfbc6fc 100644 (file)
@@ -43,14 +43,14 @@ __pthread_rwlock_wrlock:
 
        /* Get the lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if MUTEX == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, MUTEX(%rdi)
+       cmpxchgl %esi, MUTEX(%rdi)
 #endif
-       testl   %esi, %esi
-       jne     1f
+       jnz     1f
 
 2:     movl    WRITER(%rdi), %eax
        testl   %eax, %eax
@@ -80,14 +80,14 @@ __pthread_rwlock_wrlock:
 
        /* Reget the lock.  */
        movl    $1, %esi
+       xorl    %eax, %eax
        LOCK
 #if MUTEX == 0
-       xaddl   %esi, (%rdi)
+       cmpxchgl %esi, (%rdi)
 #else
-       xaddl   %esi, MUTEX(%rdi)
+       cmpxchgl %esi, MUTEX(%rdi)
 #endif
-       testl   %esi, %esi
-       jne     12f
+       jnz     12f
 
 13:    decl    WRITERS_QUEUED(%rdi)
        jmp     2b
This page took 0.108396 seconds and 5 git commands to generate.