1 /* Copyright (C) 2002 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
25 #define SYS_gettimeofday __NR_gettimeofday
33 .globl __lll_lock_wait
34 .type __lll_lock_wait,@function
35 .hidden __lll_lock_wait
43 xorl %esi, %esi /* No timeout. */
44 xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
46 leal -1(%eax), %edx /* account for the preceeded xadd. */
50 orl $-1, %eax /* Load -1. */
52 cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
66 .size __lll_lock_wait,.-__lll_lock_wait
69 .globl lll_unlock_wake_cb
70 .type lll_unlock_wake_cb,@function
71 .hidden lll_unlock_wake_cb
81 cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
94 .size lll_unlock_wake_cb,.-lll_unlock_wake_cb
97 .globl __lll_unlock_wake
98 .type __lll_unlock_wake,@function
99 .hidden __lll_unlock_wake
107 1: movl $FUTEX_WAKE, %ecx
108 movl $1, %edx /* Wake one thread. */
110 movl %edx, (%ebx) /* Stores '$1'. */
111 movl $SYS_futex, %eax
119 .size __lll_unlock_wake,.-__lll_unlock_wake
122 .globl __lll_timedwait_tid
123 .type __lll_timedwait_tid,@function
124 .hidden __lll_timedwait_tid
135 /* Get current time. */
138 movl $SYS_gettimeofday, %eax
141 /* Compute relative timeout. */
144 mul %edx /* Milli seconds to nano seconds. */
150 addl $1000000000, %edx
153 js 6f /* Time is already up. */
155 movl %ecx, (%esp) /* Store relative timeout. */
163 xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
165 movl $SYS_futex, %eax
181 1: cmpl $-ETIMEDOUT, %edx
183 6: movl $ETIMEDOUT, %eax
185 .size __lll_timedwait_tid,.-__lll_timedwait_tid