diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-03-15 07:54:39 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-03-15 07:54:39 +0000 |
commit | 92ed3daf013788e18a1bb339721aa76389039863 (patch) | |
tree | e352d669df04589cba266925d9b0edb08f92834e /nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S | |
parent | 9b89567d852543f4610fcc31c6aacecb9c658b42 (diff) | |
download | glibc-92ed3daf013788e18a1bb339721aa76389039863.tar.gz glibc-92ed3daf013788e18a1bb339721aa76389039863.tar.xz glibc-92ed3daf013788e18a1bb339721aa76389039863.zip |
Update.
* tst-basic1.c (do_test): Add cast to avoid warning. * tst-basic2.c (do_test): Likewise.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S | 74 |
1 files changed, 40 insertions, 34 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S index a6a02a98a5..75c6cc42b4 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S @@ -22,11 +22,13 @@ #include <pthread-errnos.h> -#define SYS_gettimeofday __NR_gettimeofday #define SYS_futex 202 #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 +/* For the calculation see asm/vsyscall.h. */ +#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000 + #ifndef UP # define LOCK lock #else @@ -40,10 +42,12 @@ .type pthread_rwlock_timedwrlock,@function .align 16 pthread_rwlock_timedwrlock: + pushq %r12 + pushq %r13 subq $16, %rsp - movq %rdi, %r8 - movq %rsi, %r9 + movq %rdi, %r12 + movq %rsi, %r13 /* Get the lock. */ movl $1, %esi @@ -56,41 +60,41 @@ pthread_rwlock_timedwrlock: testl %esi, %esi jne 1f -2: movq WRITER(%r8), %rax +2: movq WRITER(%r12), %rax testq %rax, %rax jne 14f - cmpl $0, NR_READERS(%r8) + cmpl $0, NR_READERS(%r12) je 5f /* Check the value of the timeout parameter. */ -3: cmpq $1000000000, 8(%r9) +3: cmpq $1000000000, 8(%r13) jae 19f - incl WRITERS_QUEUED(%r8) + incl WRITERS_QUEUED(%r12) je 4f - movl WRITERS_WAKEUP(%r8), %edx + movl WRITERS_WAKEUP(%r12), %edx LOCK #if MUTEX == 0 - decl (%r8) + decl (%r12) #else - decl MUTEX(%r8) + decl MUTEX(%r12) #endif jne 10f /* Get current time. */ 11: movq %rsp, %rdi xorq %rsi, %rsi - movq $SYS_gettimeofday, %rax - syscall + movq $VSYSCALL_ADDR_vgettimeofday, %rax + callq *%rax /* Compute relative timeout. */ movq 8(%rsp), %rax movq $1000, %rdi mul %rdi /* Milli seconds to nano seconds. */ - movq (%r9), %rcx - movq 8(%r9), %rdi + movq (%r13), %rcx + movq 8(%r13), %rdi subq (%rsp), %rcx subq %rax, %rdi jns 15f @@ -105,7 +109,7 @@ pthread_rwlock_timedwrlock: xorq %rsi, %rsi /* movq $FUTEX_WAIT, %rsi */ movq %rsp, %r10 - leaq WRITERS_WAKEUP(%r8), %rdi + leaq WRITERS_WAKEUP(%r12), %rdi movq $SYS_futex, %rax syscall movq %rax, %rdx @@ -115,35 +119,37 @@ pthread_rwlock_timedwrlock: movl $1, %esi LOCK #if MUTEX == 0 - xaddl %esi, (%r8) + xaddl %esi, (%r12) #else - xaddl %esi, MUTEX(%r8) + xaddl %esi, MUTEX(%r12) #endif testl %esi, %esi jne 12f -13: decl WRITERS_QUEUED(%r8) +13: decl WRITERS_QUEUED(%r12) cmpq $-ETIMEDOUT, %rdx jne 2b -18: movq $ETIMEDOUT, %rcx +18: movq $ETIMEDOUT, %rdx jmp 9f -5: xorq %rcx, %rcx +5: xorq %rcx, %rdx movq %fs:SELF, %rax - movq %rax, WRITER(%r8) + movq %rax, WRITER(%r12) 9: LOCK #if MUTEX == 0 - decl (%r8) + decl (%r12) #else - decl MUTEX(%r8) + decl MUTEX(%r12) #endif jne 6f -7: movq %rcx, %rax +7: movq %rdx, %rax addq $16, %rsp + popq %r13 + popq %r12 retq 1: @@ -155,37 +161,37 @@ pthread_rwlock_timedwrlock: 14: cmpq %fs:SELF, %rax jne 3b -20: movq $EDEADLK, %rcx +20: movq $EDEADLK, %rdx jmp 9b 6: #if MUTEX == 0 - movq %r8, %rdi + movq %r12, %rdi #else - leal MUTEX(%r8), %rdi + leal MUTEX(%r12), %rdi #endif callq __lll_mutex_unlock_wake jmp 7b /* Overflow. */ -4: decl WRITERS_QUEUED(%r8) - movq $EAGAIN, %rcx +4: decl WRITERS_QUEUED(%r12) + movq $EAGAIN, %rdx jmp 9b 10: #if MUTEX == 0 - movq %r8, %rdi + movq %r12, %rdi #else - leaq MUTEX(%r8), %rdi + leaq MUTEX(%r12), %rdi #endif callq __lll_mutex_unlock_wake jmp 11b 12: #if MUTEX == 0 - movq %r8, %rdi + movq %r12, %rdi #else - leaq MUTEX(%r8), %rdi + leaq MUTEX(%r12), %rdi #endif callq __lll_mutex_lock_wait jmp 13b @@ -193,6 +199,6 @@ pthread_rwlock_timedwrlock: 16: movq $-ETIMEDOUT, %rdx jmp 17b -19: movq $EINVAL, %rcx +19: movq $EINVAL, %rdx jmp 9b .size pthread_rwlock_timedwrlock,.-pthread_rwlock_timedwrlock |