diff options
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux')
3 files changed, 23 insertions, 17 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S index 709fcf4ca8..d62310148d 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S @@ -45,17 +45,18 @@ __pthread_cond_signal: /* Get internal lock. */ + movq %rdi, %r8 movl $1, %esi LOCK #if cond_lock == 0 - xaddl %esi, (%r8) + xaddl %esi, (%rdi) #else - xaddl %esi, cond_lock(%r8) + xaddl %esi, cond_lock(%rdi) #endif testl %esi, %esi jne 1f -2: leaq wakeup_seq(%r8), %rdi +2: addq $wakeup_seq, %rdi movq total_seq(%r8), %rcx cmpq (%rdi), %rcx jbe 4f @@ -64,7 +65,7 @@ __pthread_cond_signal: addq $1, (%rdi) /* Wake up one thread. */ - movq $FUTEX_WAKE, %rsi + movq $FUTEX_REQUEUE, %rsi movq $SYS_futex, %rax xorq %rdx, %rdx movq $1, %r10 @@ -81,7 +82,11 @@ __pthread_cond_signal: /* Unlock. */ 4: LOCK +#if cond_lock == 0 + decl (%r8) +#else decl cond_lock(%r8) +#endif jne 5f 6: xorl %eax, %eax @@ -98,7 +103,7 @@ __pthread_cond_signal: #endif jmp 2b - /* Unlock in loop requires waekup. */ + /* Unlock in loop requires wakeup. */ 5: #if cond_lock != 0 addq $cond_lock-wakeup_seq, %rdi @@ -111,10 +116,11 @@ __pthread_cond_signal: #ifndef __ASSUME_FUTEX_REQUEUE 7: /* The futex requeue functionality is not available. */ movq $1, %rdx - movq $FUTEX_WAKE, %esi + 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) diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S index c8fd4ea129..b64953ba83 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S @@ -76,6 +76,8 @@ __pthread_cond_timedwait: movq %rsi, 16(%rsp) movq %rdx, %r13 + movq %rsi, dep_mutex(%rdi) + /* Get internal lock. */ movl $1, %esi LOCK @@ -88,9 +90,7 @@ __pthread_cond_timedwait: jne 1f /* Unlock the mutex. */ -2: movq %rdi, %rax - movq 16(%rsp), %rdi - movq %rdi, dep_mutex(%rax) +2: movq 16(%rsp), %rdi callq __pthread_mutex_unlock_internal testl %eax, %eax @@ -124,7 +124,7 @@ __pthread_cond_timedwait: jne 3f 4: callq __pthread_enable_asynccancel - movq %rax, (%rsp) + movl %eax, (%rsp) /* Get the current time. */ #ifdef __NR_clock_gettime @@ -181,7 +181,7 @@ __pthread_cond_timedwait: syscall movq %rax, %r14 - movq (%rsp), %rdi + movl (%rsp), %edi callq __pthread_disable_asynccancel /* Lock. */ diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S index 5189972fc7..2c6c6ce338 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S @@ -87,7 +87,7 @@ __condvar_cleanup: movq 16(%r8), %rdi callq __pthread_mutex_cond_lock -3: retq + retq .size __condvar_cleanup, .-__condvar_cleanup @@ -121,6 +121,8 @@ __pthread_cond_wait: movq %rdi, 8(%rsp) movq %rsi, 16(%rsp) + movq %rsi, dep_mutex(%rdi) + /* Get internal lock. */ movl $1, %esi LOCK @@ -133,9 +135,7 @@ __pthread_cond_wait: jne 1f /* Unlock the mutex. */ -2: movq %rdi, %rax - movq 16(%rsp), %rdi - movq %rdi, dep_mutex(%rax) +2: movq 16(%rsp), %rdi callq __pthread_mutex_unlock_internal testl %eax, %eax @@ -169,7 +169,7 @@ __pthread_cond_wait: jne 3f 4: callq __pthread_enable_asynccancel - movq %rax, (%rsp) + movl %eax, (%rsp) movq 8(%rsp), %rdi xorq %r10, %r10 @@ -179,7 +179,7 @@ __pthread_cond_wait: movq %r10, %rsi /* movq $FUTEX_WAIT, %rsi */ syscall - movq (%rsp), %rdi + movl (%rsp), %edi callq __pthread_disable_asynccancel /* Lock. */ |