1 /* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
32 #define SYS_gettimeofday __NR_gettimeofday
40 /* Modified: %rax, %rsi. */
41 .globl __lll_lock_wait
42 .type __lll_lock_wait,@function
43 .hidden __lll_lock_wait
49 xorq %r10, %r10 /* No timeout. */
52 leaq -1(%rsi), %rdx /* account for the preceeded xadd. */
53 movq %r10, %rsi /* movl $FUTEX_WAIT, %ecx */
57 orl $-1, %esi /* Load -1. */
67 .size __lll_lock_wait,.-__lll_lock_wait
71 .globl lll_unlock_wake_cb
72 .type lll_unlock_wake_cb,@function
73 .hidden lll_unlock_wake_cb
86 .size lll_unlock_wake_cb,.-lll_unlock_wake_cb
90 .globl __lll_unlock_wake
91 .type __lll_unlock_wake,@function
92 .hidden __lll_unlock_wake
98 1: movq $FUTEX_WAKE, %rsi
99 movl $1, %edx /* Wake one thread. */
100 movq $SYS_futex, %rax
101 movl %edx, (%rdi) /* Stores '$1'. */
107 .size __lll_unlock_wake,.-__lll_unlock_wake
111 .globl __lll_timedwait_tid
112 .type __lll_timedwait_tid,@function
113 .hidden __lll_timedwait_tid
121 /* Get current time. */
124 movq $SYS_gettimeofday, %rax
127 /* Compute relative timeout. */
130 mul %rdi /* Milli seconds to nano seconds. */
136 addq $1000000000, %rsi
139 js 6f /* Time is already up. */
141 movq %rdi, (%rsp) /* Store relative timeout. */
149 xorq %rsi, %rsi /* movl $FUTEX_WAIT, %ecx */
151 movq $SYS_futex, %rax
161 1: cmpq $-ETIMEDOUT, %rax
164 6: movl $ETIMEDOUT, %eax
167 .size __lll_timedwait_tid,.-__lll_timedwait_tid