mirror of
git://sourceware.org/git/glibc.git
synced 2025-01-30 12:31:53 +08:00
More random patches.
This commit is contained in:
parent
39d8c1a2f4
commit
7abed17041
@ -82,14 +82,13 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden;
|
|||||||
"testl %0, %0\n\t" \
|
"testl %0, %0\n\t" \
|
||||||
"jne 1f\n\t" \
|
"jne 1f\n\t" \
|
||||||
".subsection 1\n" \
|
".subsection 1\n" \
|
||||||
"1:\tmovl %0, %%esi\n\t" \
|
"1:\tleaq %4, %%rdi\n\t" \
|
||||||
"leaq %4, %%rdi\n\t" \
|
|
||||||
"movq %7, %%rdx\n\t" \
|
"movq %7, %%rdx\n\t" \
|
||||||
"call __lll_mutex_timedlock_wait\n\t" \
|
"call __lll_mutex_timedlock_wait\n\t" \
|
||||||
"jmp 2f\n\t" \
|
"jmp 2f\n\t" \
|
||||||
".previous\n" \
|
".previous\n" \
|
||||||
"2:" \
|
"2:" \
|
||||||
: "=a" (result), "=&D" (ignore1), "=&S" (ignore2), \
|
: "=S" (result), "=&D" (ignore1), "=&a" (ignore2), \
|
||||||
"=&d" (ignore3), "=m" (futex) \
|
"=&d" (ignore3), "=m" (futex) \
|
||||||
: "0" (1), "4" (futex), "m" (timeout) \
|
: "0" (1), "4" (futex), "m" (timeout) \
|
||||||
: "memory", "cx", "cc", "r10"); \
|
: "memory", "cx", "cc", "r10"); \
|
||||||
|
@ -80,13 +80,14 @@ __lll_mutex_timedlock_wait:
|
|||||||
|
|
||||||
pushq %r12
|
pushq %r12
|
||||||
pushq %r13
|
pushq %r13
|
||||||
|
pushq %r14
|
||||||
|
|
||||||
/* Stack frame for the timespec and timeval structs. */
|
/* Stack frame for the timespec and timeval structs. */
|
||||||
subq $16, %rsp
|
subq $16, %rsp
|
||||||
|
|
||||||
movq %rdi, %r12
|
movq %rdi, %r12
|
||||||
movq %rdx, %r13
|
movq %rdx, %r13
|
||||||
leaq 1(%rax), %rdx
|
leaq 1(%rsi), %r14
|
||||||
|
|
||||||
/* Get current time. */
|
/* Get current time. */
|
||||||
1: movq %rsp, %rdi
|
1: movq %rsp, %rdi
|
||||||
@ -112,24 +113,26 @@ __lll_mutex_timedlock_wait:
|
|||||||
|
|
||||||
/* Futex call. */
|
/* Futex call. */
|
||||||
movq %rdi, (%rsp) /* Store relative timeout. */
|
movq %rdi, (%rsp) /* Store relative timeout. */
|
||||||
movq %rsi, 4(%rsp)
|
movq %rsi, 8(%rsp)
|
||||||
|
|
||||||
|
movl %r14d, %edx
|
||||||
movq %rsp, %r10
|
movq %rsp, %r10
|
||||||
xorq %rsi, %rsi /* movq $FUTEX_WAIT, %rsi */
|
xorq %rsi, %rsi /* movq $FUTEX_WAIT, %rsi */
|
||||||
movq %r12, %rdi
|
movq %r12, %rdi
|
||||||
movq $SYS_futex, %rax
|
movq $SYS_futex, %rax
|
||||||
syscall
|
syscall
|
||||||
|
|
||||||
movl $1, %edx
|
movl $1, %r14d
|
||||||
LOCK
|
LOCK
|
||||||
xaddl %edx, (%rdi)
|
xaddl %r14d, (%rdi)
|
||||||
testl %edx, %edx
|
testl %r14d, %r14d
|
||||||
jne 7f
|
jne 7f
|
||||||
|
|
||||||
movl $2, (%rdi)
|
movl $2, (%rdi)
|
||||||
xorl %eax, %eax
|
xorl %eax, %eax
|
||||||
|
|
||||||
8: addq $16, %rsp
|
8: addq $16, %rsp
|
||||||
|
popq %r14
|
||||||
popq %r13
|
popq %r13
|
||||||
popq %r12
|
popq %r12
|
||||||
retq
|
retq
|
||||||
|
@ -48,6 +48,23 @@ __pthread_cond_timedwait:
|
|||||||
pushq %r13
|
pushq %r13
|
||||||
pushq %r14
|
pushq %r14
|
||||||
subq $80, %rsp
|
subq $80, %rsp
|
||||||
|
/* Stack frame:
|
||||||
|
|
||||||
|
rsp + 80
|
||||||
|
+--------------------------+
|
||||||
|
rsp + 48 | cleanup buffer |
|
||||||
|
+--------------------------+
|
||||||
|
rsp + 40 | old wake_seq value |
|
||||||
|
+--------------------------+
|
||||||
|
rsp + 24 | timeout value |
|
||||||
|
+--------------------------+
|
||||||
|
rsp + 16 | mutex pointer |
|
||||||
|
+--------------------------+
|
||||||
|
rsp + 8 | condvar pointer |
|
||||||
|
+--------------------------+
|
||||||
|
rsp + 0 | old cancellation mode |
|
||||||
|
+--------------------------+
|
||||||
|
*/
|
||||||
|
|
||||||
/* Prepare structure passed to cancellation handler. */
|
/* Prepare structure passed to cancellation handler. */
|
||||||
movq %rdi, 8(%rsp)
|
movq %rdi, 8(%rsp)
|
||||||
@ -73,7 +90,7 @@ __pthread_cond_timedwait:
|
|||||||
jne 16f
|
jne 16f
|
||||||
|
|
||||||
movq 8(%rsp), %rdi
|
movq 8(%rsp), %rdi
|
||||||
addq $1, total_seq(%rdi)
|
incq total_seq(%rdi)
|
||||||
|
|
||||||
/* Install cancellation handler. */
|
/* Install cancellation handler. */
|
||||||
#ifdef PIC
|
#ifdef PIC
|
||||||
@ -113,7 +130,7 @@ __pthread_cond_timedwait:
|
|||||||
movq $1000, %rdx
|
movq $1000, %rdx
|
||||||
mul %rdx /* Milli seconds to nano seconds. */
|
mul %rdx /* Milli seconds to nano seconds. */
|
||||||
movq (%r13), %rcx
|
movq (%r13), %rcx
|
||||||
movq 4(%r13), %rdx
|
movq 8(%r13), %rdx
|
||||||
subq 24(%rsp), %rcx
|
subq 24(%rsp), %rcx
|
||||||
subq %rax, %rdx
|
subq %rax, %rdx
|
||||||
jns 12f
|
jns 12f
|
||||||
|
@ -61,9 +61,9 @@ __condvar_cleanup:
|
|||||||
subq $cond_lock, %rdi
|
subq $cond_lock, %rdi
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
1: addq $1, wakeup_seq(%rdi)
|
1: incq wakeup_seq(%rdi)
|
||||||
|
|
||||||
addq $1, woken_seq(%rdi)
|
incq woken_seq(%rdi)
|
||||||
|
|
||||||
/* Wake up all waiters to make sure no signal gets lost. */
|
/* Wake up all waiters to make sure no signal gets lost. */
|
||||||
addq $wakeup_seq, %rdi
|
addq $wakeup_seq, %rdi
|
||||||
@ -103,6 +103,21 @@ __condvar_cleanup:
|
|||||||
__pthread_cond_wait:
|
__pthread_cond_wait:
|
||||||
pushq %r12
|
pushq %r12
|
||||||
subq $64, %rsp
|
subq $64, %rsp
|
||||||
|
/* Stack frame:
|
||||||
|
|
||||||
|
rsp + 64
|
||||||
|
+--------------------------+
|
||||||
|
rsp + 32 | cleanup buffer |
|
||||||
|
+--------------------------+
|
||||||
|
rsp + 24 | old wake_seq value |
|
||||||
|
+--------------------------+
|
||||||
|
rsp + 16 | mutex pointer |
|
||||||
|
+--------------------------+
|
||||||
|
rsp + 8 | condvar pointer |
|
||||||
|
+--------------------------+
|
||||||
|
rsp + 0 | old cancellation mode |
|
||||||
|
+--------------------------+
|
||||||
|
*/
|
||||||
|
|
||||||
/* Prepare structure passed to cancellation handler. */
|
/* Prepare structure passed to cancellation handler. */
|
||||||
movq %rdi, 8(%rsp)
|
movq %rdi, 8(%rsp)
|
||||||
@ -127,7 +142,7 @@ __pthread_cond_wait:
|
|||||||
jne 12f
|
jne 12f
|
||||||
|
|
||||||
movq 8(%rsp), %rdi
|
movq 8(%rsp), %rdi
|
||||||
addq $1, total_seq(%rdi)
|
incq total_seq(%rdi)
|
||||||
|
|
||||||
/* Install cancellation handler. */
|
/* Install cancellation handler. */
|
||||||
#ifdef PIC
|
#ifdef PIC
|
||||||
|
@ -60,7 +60,7 @@ sem_timedwait:
|
|||||||
movq %rsi, %r9
|
movq %rsi, %r9
|
||||||
|
|
||||||
/* Check for invalid nanosecond field. */
|
/* Check for invalid nanosecond field. */
|
||||||
cmpq $1000000000, 4(%r9)
|
cmpq $1000000000, 8(%r9)
|
||||||
movl $EINVAL, %eax
|
movl $EINVAL, %eax
|
||||||
jae 6f
|
jae 6f
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user