|
Packit Service |
82fcde |
/* Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
This file is part of the GNU C Library.
|
|
Packit Service |
82fcde |
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
82fcde |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License as published by the Free Software Foundation; either
|
|
Packit Service |
82fcde |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
82fcde |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
82fcde |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
82fcde |
Lesser General Public License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License along with the GNU C Library; if not, see
|
|
Packit Service |
82fcde |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <sysdep.h>
|
|
Packit Service |
82fcde |
#include <pthread-errnos.h>
|
|
Packit Service |
82fcde |
#include <kernel-features.h>
|
|
Packit Service |
82fcde |
#include <lowlevellock.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <stap-probe.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.text
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#define LOAD_PRIVATE_FUTEX_WAIT(reg) \
|
|
Packit Service |
82fcde |
movl $(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg
|
|
Packit Service |
82fcde |
#define LOAD_PRIVATE_FUTEX_WAKE(reg) \
|
|
Packit Service |
82fcde |
movl $(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), reg
|
|
Packit Service |
82fcde |
#define LOAD_FUTEX_WAIT(reg) \
|
|
Packit Service |
82fcde |
xorl $(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg
|
|
Packit Service |
82fcde |
#define LOAD_FUTEX_WAIT_ABS(reg) \
|
|
Packit Service |
82fcde |
xorl $(FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME), reg
|
|
Packit Service |
82fcde |
#define LOAD_FUTEX_WAKE(reg) \
|
|
Packit Service |
82fcde |
xorl $(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), reg
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.globl __lll_lock_wait_private
|
|
Packit Service |
82fcde |
.type __lll_lock_wait_private,@function
|
|
Packit Service |
82fcde |
.hidden __lll_lock_wait_private
|
|
Packit Service |
82fcde |
.align 16
|
|
Packit Service |
82fcde |
__lll_lock_wait_private:
|
|
Packit Service |
82fcde |
cfi_startproc
|
|
Packit Service |
82fcde |
pushq %r10
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
pushq %rdx
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
cfi_offset(%r10, -16)
|
|
Packit Service |
82fcde |
cfi_offset(%rdx, -24)
|
|
Packit Service |
82fcde |
xorq %r10, %r10 /* No timeout. */
|
|
Packit Service |
82fcde |
movl $2, %edx
|
|
Packit Service |
82fcde |
LOAD_PRIVATE_FUTEX_WAIT (%esi)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
cmpl %edx, %eax /* NB: %edx == 2 */
|
|
Packit Service |
82fcde |
jne 2f
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
1: LIBC_PROBE (lll_lock_wait_private, 1, %rdi)
|
|
Packit Service |
82fcde |
movl $SYS_futex, %eax
|
|
Packit Service |
82fcde |
syscall
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
2: movl %edx, %eax
|
|
Packit Service |
82fcde |
xchgl %eax, (%rdi) /* NB: lock is implied */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
testl %eax, %eax
|
|
Packit Service |
82fcde |
jnz 1b
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
popq %rdx
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%rdx)
|
|
Packit Service |
82fcde |
popq %r10
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%r10)
|
|
Packit Service |
82fcde |
retq
|
|
Packit Service |
82fcde |
cfi_endproc
|
|
Packit Service |
82fcde |
.size __lll_lock_wait_private,.-__lll_lock_wait_private
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#if !IS_IN (libc)
|
|
Packit Service |
82fcde |
.globl __lll_lock_wait
|
|
Packit Service |
82fcde |
.type __lll_lock_wait,@function
|
|
Packit Service |
82fcde |
.hidden __lll_lock_wait
|
|
Packit Service |
82fcde |
.align 16
|
|
Packit Service |
82fcde |
__lll_lock_wait:
|
|
Packit Service |
82fcde |
cfi_startproc
|
|
Packit Service |
82fcde |
pushq %r10
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
pushq %rdx
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
cfi_offset(%r10, -16)
|
|
Packit Service |
82fcde |
cfi_offset(%rdx, -24)
|
|
Packit Service |
82fcde |
xorq %r10, %r10 /* No timeout. */
|
|
Packit Service |
82fcde |
movl $2, %edx
|
|
Packit Service |
82fcde |
LOAD_FUTEX_WAIT (%esi)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
cmpl %edx, %eax /* NB: %edx == 2 */
|
|
Packit Service |
82fcde |
jne 2f
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
1: LIBC_PROBE (lll_lock_wait, 2, %rdi, %rsi)
|
|
Packit Service |
82fcde |
movl $SYS_futex, %eax
|
|
Packit Service |
82fcde |
syscall
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
2: movl %edx, %eax
|
|
Packit Service |
82fcde |
xchgl %eax, (%rdi) /* NB: lock is implied */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
testl %eax, %eax
|
|
Packit Service |
82fcde |
jnz 1b
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
popq %rdx
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%rdx)
|
|
Packit Service |
82fcde |
popq %r10
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%r10)
|
|
Packit Service |
82fcde |
retq
|
|
Packit Service |
82fcde |
cfi_endproc
|
|
Packit Service |
82fcde |
.size __lll_lock_wait,.-__lll_lock_wait
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* %rdi: futex
|
|
Packit Service |
82fcde |
%rsi: flags
|
|
Packit Service |
82fcde |
%rdx: timeout
|
|
Packit Service |
82fcde |
%eax: futex value
|
|
Packit Service |
82fcde |
*/
|
|
Packit Service |
82fcde |
.globl __lll_timedlock_wait
|
|
Packit Service |
82fcde |
.type __lll_timedlock_wait,@function
|
|
Packit Service |
82fcde |
.hidden __lll_timedlock_wait
|
|
Packit Service |
82fcde |
.align 16
|
|
Packit Service |
82fcde |
__lll_timedlock_wait:
|
|
Packit Service |
82fcde |
cfi_startproc
|
|
Packit Service |
82fcde |
# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
|
|
Packit Service |
82fcde |
# ifdef PIC
|
|
Packit Service |
82fcde |
cmpl $0, __have_futex_clock_realtime(%rip)
|
|
Packit Service |
82fcde |
# else
|
|
Packit Service |
82fcde |
cmpl $0, __have_futex_clock_realtime
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
je .Lreltmo
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
cmpq $0, (%rdx)
|
|
Packit Service |
82fcde |
js 5f
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pushq %r9
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
cfi_rel_offset(%r9, 0)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movq %rdx, %r10
|
|
Packit Service |
82fcde |
movl $0xffffffff, %r9d
|
|
Packit Service |
82fcde |
LOAD_FUTEX_WAIT_ABS (%esi)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movl $2, %edx
|
|
Packit Service |
82fcde |
cmpl %edx, %eax
|
|
Packit Service |
82fcde |
jne 2f
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
1: movl $SYS_futex, %eax
|
|
Packit Service |
82fcde |
movl $2, %edx
|
|
Packit Service |
82fcde |
syscall
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
2: xchgl %edx, (%rdi) /* NB: lock is implied */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
testl %edx, %edx
|
|
Packit Service |
82fcde |
jz 3f
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
cmpl $-ETIMEDOUT, %eax
|
|
Packit Service |
82fcde |
je 4f
|
|
Packit Service |
82fcde |
cmpl $-EINVAL, %eax
|
|
Packit Service |
82fcde |
jne 1b
|
|
Packit Service |
82fcde |
4: movl %eax, %edx
|
|
Packit Service |
82fcde |
negl %edx
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
3: movl %edx, %eax
|
|
Packit Service |
82fcde |
popq %r9
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%r9)
|
|
Packit Service |
82fcde |
retq
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
5: movl $ETIMEDOUT, %eax
|
|
Packit Service |
82fcde |
retq
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
|
|
Packit Service |
82fcde |
.Lreltmo:
|
|
Packit Service |
82fcde |
/* Check for a valid timeout value. */
|
|
Packit Service |
82fcde |
cmpq $1000000000, 8(%rdx)
|
|
Packit Service |
82fcde |
jae 3f
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
pushq %r8
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
pushq %r9
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
pushq %r12
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
pushq %r13
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
pushq %r14
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
cfi_offset(%r8, -16)
|
|
Packit Service |
82fcde |
cfi_offset(%r9, -24)
|
|
Packit Service |
82fcde |
cfi_offset(%r12, -32)
|
|
Packit Service |
82fcde |
cfi_offset(%r13, -40)
|
|
Packit Service |
82fcde |
cfi_offset(%r14, -48)
|
|
Packit Service |
82fcde |
pushq %rsi
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Stack frame for the timespec and timeval structs. */
|
|
Packit Service |
82fcde |
subq $24, %rsp
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(24)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movq %rdi, %r12
|
|
Packit Service |
82fcde |
movq %rdx, %r13
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movl $2, %edx
|
|
Packit Service |
82fcde |
xchgl %edx, (%r12)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
testl %edx, %edx
|
|
Packit Service |
82fcde |
je 6f
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
1:
|
|
Packit Service |
82fcde |
/* Get current time. */
|
|
Packit Service |
82fcde |
movq %rsp, %rdi
|
|
Packit Service |
82fcde |
xorl %esi, %esi
|
|
Packit Service |
82fcde |
/* This call works because we directly jump to a system call entry
|
|
Packit Service |
82fcde |
which preserves all the registers. */
|
|
Packit Service |
82fcde |
call JUMPTARGET(__gettimeofday)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Compute relative timeout. */
|
|
Packit Service |
82fcde |
movq 8(%rsp), %rax
|
|
Packit Service |
82fcde |
movl $1000, %edi
|
|
Packit Service |
82fcde |
mul %rdi /* Milli seconds to nano seconds. */
|
|
Packit Service |
82fcde |
movq (%r13), %rdi
|
|
Packit Service |
82fcde |
movq 8(%r13), %rsi
|
|
Packit Service |
82fcde |
subq (%rsp), %rdi
|
|
Packit Service |
82fcde |
subq %rax, %rsi
|
|
Packit Service |
82fcde |
jns 4f
|
|
Packit Service |
82fcde |
addq $1000000000, %rsi
|
|
Packit Service |
82fcde |
decq %rdi
|
|
Packit Service |
82fcde |
4: testq %rdi, %rdi
|
|
Packit Service |
82fcde |
js 2f /* Time is already up. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Store relative timeout. */
|
|
Packit Service |
82fcde |
movq %rdi, (%rsp)
|
|
Packit Service |
82fcde |
movq %rsi, 8(%rsp)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Futex call. */
|
|
Packit Service |
82fcde |
movl $2, %edx
|
|
Packit Service |
82fcde |
movl $1, %eax
|
|
Packit Service |
82fcde |
movq %rsp, %r10
|
|
Packit Service |
82fcde |
movl 24(%rsp), %esi
|
|
Packit Service |
82fcde |
LOAD_FUTEX_WAIT (%esi)
|
|
Packit Service |
82fcde |
movq %r12, %rdi
|
|
Packit Service |
82fcde |
movl $SYS_futex, %eax
|
|
Packit Service |
82fcde |
syscall
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* NB: %edx == 2 */
|
|
Packit Service |
82fcde |
xchgl %edx, (%r12)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
testl %edx, %edx
|
|
Packit Service |
82fcde |
je 6f
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
cmpl $-ETIMEDOUT, %eax
|
|
Packit Service |
82fcde |
jne 1b
|
|
Packit Service |
82fcde |
2: movl $ETIMEDOUT, %edx
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
6: addq $32, %rsp
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-32)
|
|
Packit Service |
82fcde |
popq %r14
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%r14)
|
|
Packit Service |
82fcde |
popq %r13
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%r13)
|
|
Packit Service |
82fcde |
popq %r12
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%r12)
|
|
Packit Service |
82fcde |
popq %r9
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%r9)
|
|
Packit Service |
82fcde |
popq %r8
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%r8)
|
|
Packit Service |
82fcde |
movl %edx, %eax
|
|
Packit Service |
82fcde |
retq
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
3: movl $EINVAL, %eax
|
|
Packit Service |
82fcde |
retq
|
|
Packit Service |
82fcde |
# endif
|
|
Packit Service |
82fcde |
cfi_endproc
|
|
Packit Service |
82fcde |
.size __lll_timedlock_wait,.-__lll_timedlock_wait
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.globl __lll_unlock_wake_private
|
|
Packit Service |
82fcde |
.type __lll_unlock_wake_private,@function
|
|
Packit Service |
82fcde |
.hidden __lll_unlock_wake_private
|
|
Packit Service |
82fcde |
.align 16
|
|
Packit Service |
82fcde |
__lll_unlock_wake_private:
|
|
Packit Service |
82fcde |
cfi_startproc
|
|
Packit Service |
82fcde |
pushq %rsi
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
pushq %rdx
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
cfi_offset(%rsi, -16)
|
|
Packit Service |
82fcde |
cfi_offset(%rdx, -24)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movl $0, (%rdi)
|
|
Packit Service |
82fcde |
LOAD_PRIVATE_FUTEX_WAKE (%esi)
|
|
Packit Service |
82fcde |
movl $1, %edx /* Wake one thread. */
|
|
Packit Service |
82fcde |
movl $SYS_futex, %eax
|
|
Packit Service |
82fcde |
syscall
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
popq %rdx
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%rdx)
|
|
Packit Service |
82fcde |
popq %rsi
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%rsi)
|
|
Packit Service |
82fcde |
retq
|
|
Packit Service |
82fcde |
cfi_endproc
|
|
Packit Service |
82fcde |
.size __lll_unlock_wake_private,.-__lll_unlock_wake_private
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#if !IS_IN (libc)
|
|
Packit Service |
82fcde |
.globl __lll_unlock_wake
|
|
Packit Service |
82fcde |
.type __lll_unlock_wake,@function
|
|
Packit Service |
82fcde |
.hidden __lll_unlock_wake
|
|
Packit Service |
82fcde |
.align 16
|
|
Packit Service |
82fcde |
__lll_unlock_wake:
|
|
Packit Service |
82fcde |
cfi_startproc
|
|
Packit Service |
82fcde |
pushq %rsi
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
pushq %rdx
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
cfi_offset(%rsi, -16)
|
|
Packit Service |
82fcde |
cfi_offset(%rdx, -24)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movl $0, (%rdi)
|
|
Packit Service |
82fcde |
LOAD_FUTEX_WAKE (%esi)
|
|
Packit Service |
82fcde |
movl $1, %edx /* Wake one thread. */
|
|
Packit Service |
82fcde |
movl $SYS_futex, %eax
|
|
Packit Service |
82fcde |
syscall
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
popq %rdx
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%rdx)
|
|
Packit Service |
82fcde |
popq %rsi
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%rsi)
|
|
Packit Service |
82fcde |
retq
|
|
Packit Service |
82fcde |
cfi_endproc
|
|
Packit Service |
82fcde |
.size __lll_unlock_wake,.-__lll_unlock_wake
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
.globl __lll_timedwait_tid
|
|
Packit Service |
82fcde |
.type __lll_timedwait_tid,@function
|
|
Packit Service |
82fcde |
.hidden __lll_timedwait_tid
|
|
Packit Service |
82fcde |
.align 16
|
|
Packit Service |
82fcde |
__lll_timedwait_tid:
|
|
Packit Service |
82fcde |
cfi_startproc
|
|
Packit Service |
82fcde |
pushq %r12
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
pushq %r13
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(8)
|
|
Packit Service |
82fcde |
cfi_offset(%r12, -16)
|
|
Packit Service |
82fcde |
cfi_offset(%r13, -24)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movq %rdi, %r12
|
|
Packit Service |
82fcde |
movq %rsi, %r13
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Align stack to 16 bytes when calling __gettimeofday. */
|
|
Packit Service |
82fcde |
subq $24, %rsp
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(24)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Get current time. */
|
|
Packit Service |
82fcde |
2: movq %rsp, %rdi
|
|
Packit Service |
82fcde |
xorl %esi, %esi
|
|
Packit Service |
82fcde |
/* This call works because we directly jump to a system call entry
|
|
Packit Service |
82fcde |
which preserves all the registers. */
|
|
Packit Service |
82fcde |
call JUMPTARGET(__gettimeofday)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Compute relative timeout. */
|
|
Packit Service |
82fcde |
movq 8(%rsp), %rax
|
|
Packit Service |
82fcde |
movl $1000, %edi
|
|
Packit Service |
82fcde |
mul %rdi /* Milli seconds to nano seconds. */
|
|
Packit Service |
82fcde |
movq (%r13), %rdi
|
|
Packit Service |
82fcde |
movq 8(%r13), %rsi
|
|
Packit Service |
82fcde |
subq (%rsp), %rdi
|
|
Packit Service |
82fcde |
subq %rax, %rsi
|
|
Packit Service |
82fcde |
jns 5f
|
|
Packit Service |
82fcde |
addq $1000000000, %rsi
|
|
Packit Service |
82fcde |
decq %rdi
|
|
Packit Service |
82fcde |
5: testq %rdi, %rdi
|
|
Packit Service |
82fcde |
js 6f /* Time is already up. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movq %rdi, (%rsp) /* Store relative timeout. */
|
|
Packit Service |
82fcde |
movq %rsi, 8(%rsp)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movl (%r12), %edx
|
|
Packit Service |
82fcde |
testl %edx, %edx
|
|
Packit Service |
82fcde |
jz 4f
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
movq %rsp, %r10
|
|
Packit Service |
82fcde |
/* XXX The kernel so far uses global futex for the wakeup at
|
|
Packit Service |
82fcde |
all times. */
|
|
Packit Service |
82fcde |
#if FUTEX_WAIT == 0
|
|
Packit Service |
82fcde |
xorl %esi, %esi
|
|
Packit Service |
82fcde |
#else
|
|
Packit Service |
82fcde |
movl $FUTEX_WAIT, %esi
|
|
Packit Service |
82fcde |
#endif
|
|
Packit Service |
82fcde |
movq %r12, %rdi
|
|
Packit Service |
82fcde |
movl $SYS_futex, %eax
|
|
Packit Service |
82fcde |
syscall
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
cmpl $0, (%rdi)
|
|
Packit Service |
82fcde |
jne 1f
|
|
Packit Service |
82fcde |
4: xorl %eax, %eax
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
8: addq $24, %rsp
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-24)
|
|
Packit Service |
82fcde |
popq %r13
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%r13)
|
|
Packit Service |
82fcde |
popq %r12
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(-8)
|
|
Packit Service |
82fcde |
cfi_restore(%r12)
|
|
Packit Service |
82fcde |
retq
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
cfi_adjust_cfa_offset(32)
|
|
Packit Service |
82fcde |
1: cmpq $-ETIMEDOUT, %rax
|
|
Packit Service |
82fcde |
jne 2b
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
6: movl $ETIMEDOUT, %eax
|
|
Packit Service |
82fcde |
jmp 8b
|
|
Packit Service |
82fcde |
cfi_endproc
|
|
Packit Service |
82fcde |
.size __lll_timedwait_tid,.-__lll_timedwait_tid
|
|
Packit Service |
82fcde |
#endif
|