2004-10-01  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
	(__lll_mutex_timedlock_wait): I woken but cannot get the lock,
	make sure 2 is stored in the futex and we looked at the old value.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
	(__lll_mutex_timedlock_wait): Likewise.  Fix a few other problems
	which might very well made the code not working at all before.
This commit is contained in:
Ulrich Drepper 2004-10-01 10:33:03 +00:00
parent 0da4ee5543
commit c1b48791e0
3 changed files with 27 additions and 9 deletions

View File

@ -1,3 +1,12 @@
2004-10-01 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
(__lll_mutex_timedlock_wait): I woken but cannot get the lock,
make sure 2 is stored in the futex and we looked at the old value.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
(__lll_mutex_timedlock_wait): Likewise. Fix a few other problems
which might very well made the code not working at all before.
2004-09-28 Ulrich Drepper <drepper@redhat.com> 2004-09-28 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/pthread_kill.c (__pthread_kill): Don't * sysdeps/unix/sysv/linux/pthread_kill.c (__pthread_kill): Don't

View File

@ -132,9 +132,8 @@ __lll_mutex_timedlock_wait:
ENTER_KERNEL ENTER_KERNEL
movl %eax, %ecx movl %eax, %ecx
8: 8: /* NB: %edx == 2 */
xorl %eax, %eax xorl %eax, %eax
movl $2, %edx
LOCK LOCK
cmpxchgl %edx, (%ebx) cmpxchgl %edx, (%ebx)
@ -150,6 +149,12 @@ __lll_mutex_timedlock_wait:
/* Check whether the time expired. */ /* Check whether the time expired. */
7: cmpl $-ETIMEDOUT, %ecx 7: cmpl $-ETIMEDOUT, %ecx
je 5f je 5f
/* Make sure the current holder knows we are going to sleep. */
movl %edx, %eax
xchgl %eax, (%ebx)
testl %eax, %eax
jz 6b
jmp 1b jmp 1b
3: movl $EINVAL, %eax 3: movl $EINVAL, %eax

View File

@ -95,7 +95,7 @@ __lll_mutex_timedlock_wait:
movq %rsp, %rdi movq %rsp, %rdi
xorq %rsi, %rsi xorq %rsi, %rsi
movq $VSYSCALL_ADDR_vgettimeofday, %rax movq $VSYSCALL_ADDR_vgettimeofday, %rax
/* This is a regular function call, all calleer-save registers /* This is a regular function call, all caller-save registers
might be clobbered. */ might be clobbered. */
callq *%rax callq *%rax
@ -132,15 +132,13 @@ __lll_mutex_timedlock_wait:
syscall syscall
movq %rax, %rcx movq %rax, %rcx
movl $1, %eax 8: /* NB: %edx == 2 */
xorl %eax, %eax
LOCK LOCK
cmpxchgl %edx, (%rdi) cmpxchgl %edx, (%rdi)
jnz 7f jnz 7f
movl $2, (%rdi) 6: addq $16, %rsp
xorl %eax, %eax
8: addq $16, %rsp
popq %r14 popq %r14
popq %r13 popq %r13
popq %r12 popq %r12
@ -151,13 +149,19 @@ __lll_mutex_timedlock_wait:
/* Check whether the time expired. */ /* Check whether the time expired. */
7: cmpq $-ETIMEDOUT, %rcx 7: cmpq $-ETIMEDOUT, %rcx
je 5f je 5f
/* Make sure the current holder knows we are going to sleep. */
movl %edx, %eax
xchgl %eax, (%ebx)
testl %eax, %eax
jz 6b
jmp 1b jmp 1b
3: movl $EINVAL, %eax 3: movl $EINVAL, %eax
retq retq
5: movl $ETIMEDOUT, %eax 5: movl $ETIMEDOUT, %eax
jmp 8b jmp 6b
.size __lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait .size __lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait
#endif #endif