1 /* Copyright (C) 2002-2005, 2007, 2009, 2011-2012 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, see
17 <http://www.gnu.org/licenses/>. */
20 #include <shlib-compat.h>
21 #include <pthread-errnos.h>
22 #include <structsem.h>
23 #include <lowlevellock.h>
27 # error "code needs to be rewritten for VALUE != 0"
34 .type sem_timedwait,@function
52 /* Check whether the timeout value is valid. */
64 /* Check for invalid nanosecond field. */
65 cmpl $1000000000, 4(%edi)
75 movl $__NR_gettimeofday, %eax
78 /* Compute relative timeout. */
81 mul %edx /* Milli seconds to nano seconds. */
87 addl $1000000000, %edx
91 js 6f /* Time is already up. */
93 movl %ecx, (%esp) /* Store relative timeout. */
97 call __pthread_enable_asynccancel
100 movl 28(%esp), %ebx /* Load semaphore address. */
102 movl PRIVATE(%ebx), %ecx
104 movl $FUTEX_WAIT, %ecx
105 orl PRIVATE(%ebx), %ecx
109 movl $SYS_futex, %eax
114 call __pthread_disable_asynccancel
119 cmpl $-EWOULDBLOCK, %esi
128 cmpxchgl %ecx, (%ebx)
155 addl $_GLOBAL_OFFSET_TABLE_, %ebx
156 #ifdef NO_TLS_DIRECT_SEG_REFS
157 movl errno@gotntpoff(%ebx), %edx
161 movl errno@gotntpoff(%ebx), %edx
162 movl %esi, %gs:(%edx)
165 movl 28(%esp), %ebx /* Load semaphore address. */
168 .size sem_timedwait,.-sem_timedwait
171 .type sem_wait_cleanup,@function
177 call _Unwind_Resume@PLT
180 .size sem_wait_cleanup,.-sem_wait_cleanup
183 .section .gcc_except_table,"a",@progbits
185 .byte 0xff # @LPStart format (omit)
186 .byte 0xff # @TType format (omit)
187 .byte 0x01 # call-site format
189 .uleb128 .Lcstend-.Lcstbegin
191 .uleb128 .LcleanupSTART-.LSTARTCODE
192 .uleb128 .LcleanupEND-.LcleanupSTART
193 .uleb128 sem_wait_cleanup-.LSTARTCODE
195 .uleb128 .LcallUR-.LSTARTCODE
196 .uleb128 .LENDCODE-.LcallUR
202 .section .eh_frame,"a",@progbits
204 .long .LENDCIE-.LSTARTCIE # Length of the CIE.
207 .byte 1 # Version number.
209 .string "zPLR" # NUL-terminated augmentation
212 .string "zPL" # NUL-terminated augmentation
215 .uleb128 1 # Code alignment factor.
216 .sleb128 -4 # Data alignment factor.
217 .byte 8 # Return address register
220 .uleb128 7 # Augmentation value length.
221 .byte 0x9b # Personality: DW_EH_PE_pcrel
223 # + DW_EH_PE_indirect
224 .long DW.ref.__gcc_personality_v0-.
225 .byte 0x1b # LSDA Encoding: DW_EH_PE_pcrel
227 .byte 0x1b # FDE Encoding: DW_EH_PE_pcrel
230 .uleb128 6 # Augmentation value length.
231 .byte 0x0 # Personality: absolute
232 .long __gcc_personality_v0
233 .byte 0x0 # LSDA Encoding: absolute
235 .byte 0x0c # DW_CFA_def_cfa
238 .byte 0x88 # DW_CFA_offset, column 0x10
243 .long .LENDFDE-.LSTARTFDE # Length of the FDE.
245 .long .LSTARTFDE-.LSTARTFRAME # CIE pointer.
247 .long .LSTARTCODE-. # PC-relative start address
250 .long .LSTARTCODE # Start address of the code.
252 .long .LENDCODE-.LSTARTCODE # Length of the code.
253 .uleb128 4 # Augmentation size
255 .long .LexceptSTART-.
260 .byte 4 # DW_CFA_advance_loc4
261 .long .Lpush_esi-.LSTARTCODE
262 .byte 14 # DW_CFA_def_cfa_offset
264 .byte 0x86 # DW_CFA_offset %esi
266 .byte 4 # DW_CFA_advance_loc4
267 .long .Lpush_edi-.Lpush_esi
268 .byte 14 # DW_CFA_def_cfa_offset
270 .byte 0x87 # DW_CFA_offset %edi
272 .byte 4 # DW_CFA_advance_loc4
273 .long .Lpush_ebx-.Lpush_edi
274 .byte 14 # DW_CFA_def_cfa_offset
276 .byte 0x83 # DW_CFA_offset %ebx
278 .byte 4 # DW_CFA_advance_loc4
279 .long .Lsub_esp-.Lpush_ebx
280 .byte 14 # DW_CFA_def_cfa_offset
282 .byte 4 # DW_CFA_advance_loc4
283 .long .Ladd_esp-.Lsub_esp
284 .byte 14 # DW_CFA_def_cfa_offset
286 .byte 4 # DW_CFA_advance_loc4
287 .long .Lpop_ebx-.Ladd_esp
288 .byte 14 # DW_CFA_def_cfa_offset
290 .byte 0xc3 # DW_CFA_restore %ebx
291 .byte 4 # DW_CFA_advance_loc4
292 .long .Lpop_edi-.Lpop_ebx
293 .byte 14 # DW_CFA_def_cfa_offset
295 .byte 0xc7 # DW_CFA_restore %edi
296 .byte 4 # DW_CFA_advance_loc4
297 .long .Lpop_esi-.Lpop_edi
298 .byte 14 # DW_CFA_def_cfa_offset
300 .byte 0xc6 # DW_CFA_restore %esi
301 .byte 4 # DW_CFA_advance_loc4
302 .long .Lafter_ret-.Lpop_esi
303 .byte 14 # DW_CFA_def_cfa_offset
305 .byte 0x86 # DW_CFA_offset %esi
307 .byte 0x87 # DW_CFA_offset %edi
309 .byte 0x83 # DW_CFA_offset %ebx
316 .hidden DW.ref.__gcc_personality_v0
317 .weak DW.ref.__gcc_personality_v0
318 .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
320 .type DW.ref.__gcc_personality_v0, @object
321 .size DW.ref.__gcc_personality_v0, 4
322 DW.ref.__gcc_personality_v0:
323 .long __gcc_personality_v0