1 /* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009 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 <pthread-errnos.h>
21 #include <structsem.h>
22 #include <lowlevellock.h>
26 # error "code needs to be rewritten for VALUE != 0"
33 .type sem_timedwait,@function
51 /* Check whether the timeout value is valid. */
63 /* Check for invalid nanosecond field. */
64 cmpl $1000000000, 4(%edi)
74 movl $__NR_gettimeofday, %eax
77 /* Compute relative timeout. */
80 mul %edx /* Milli seconds to nano seconds. */
86 addl $1000000000, %edx
90 js 6f /* Time is already up. */
92 movl %ecx, (%esp) /* Store relative timeout. */
96 call __pthread_enable_asynccancel
99 movl 28(%esp), %ebx /* Load semaphore address. */
101 movl PRIVATE(%ebx), %ecx
103 movl $FUTEX_WAIT, %ecx
104 orl PRIVATE(%ebx), %ecx
108 movl $SYS_futex, %eax
113 call __pthread_disable_asynccancel
118 cmpl $-EWOULDBLOCK, %esi
127 cmpxchgl %ecx, (%ebx)
149 call __x86.get_pc_thunk.bx
154 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 call __errno_location@plt
169 movl 28(%esp), %ebx /* Load semaphore address. */
172 .size sem_timedwait,.-sem_timedwait
175 .type sem_wait_cleanup,@function
181 call _Unwind_Resume@PLT
184 .size sem_wait_cleanup,.-sem_wait_cleanup
187 .section .gcc_except_table,"a",@progbits
189 .byte 0xff # @LPStart format (omit)
190 .byte 0xff # @TType format (omit)
191 .byte 0x01 # call-site format
193 .uleb128 .Lcstend-.Lcstbegin
195 .uleb128 .LcleanupSTART-.LSTARTCODE
196 .uleb128 .LcleanupEND-.LcleanupSTART
197 .uleb128 sem_wait_cleanup-.LSTARTCODE
199 .uleb128 .LcallUR-.LSTARTCODE
200 .uleb128 .LENDCODE-.LcallUR
206 .section .eh_frame,"a",@progbits
208 .long .LENDCIE-.LSTARTCIE # Length of the CIE.
211 .byte 1 # Version number.
213 .string "zPLR" # NUL-terminated augmentation
216 .string "zPL" # NUL-terminated augmentation
219 .uleb128 1 # Code alignment factor.
220 .sleb128 -4 # Data alignment factor.
221 .byte 8 # Return address register
224 .uleb128 7 # Augmentation value length.
225 .byte 0x9b # Personality: DW_EH_PE_pcrel
227 # + DW_EH_PE_indirect
228 .long DW.ref.__gcc_personality_v0-.
229 .byte 0x1b # LSDA Encoding: DW_EH_PE_pcrel
231 .byte 0x1b # FDE Encoding: DW_EH_PE_pcrel
234 .uleb128 6 # Augmentation value length.
235 .byte 0x0 # Personality: absolute
236 .long __gcc_personality_v0
237 .byte 0x0 # LSDA Encoding: absolute
239 .byte 0x0c # DW_CFA_def_cfa
242 .byte 0x88 # DW_CFA_offset, column 0x10
247 .long .LENDFDE-.LSTARTFDE # Length of the FDE.
249 .long .LSTARTFDE-.LSTARTFRAME # CIE pointer.
251 .long .LSTARTCODE-. # PC-relative start address
254 .long .LSTARTCODE # Start address of the code.
256 .long .LENDCODE-.LSTARTCODE # Length of the code.
257 .uleb128 4 # Augmentation size
259 .long .LexceptSTART-.
264 .byte 4 # DW_CFA_advance_loc4
265 .long .Lpush_esi-.LSTARTCODE
266 .byte 14 # DW_CFA_def_cfa_offset
268 .byte 0x86 # DW_CFA_offset %esi
270 .byte 4 # DW_CFA_advance_loc4
271 .long .Lpush_edi-.Lpush_esi
272 .byte 14 # DW_CFA_def_cfa_offset
274 .byte 0x87 # DW_CFA_offset %edi
276 .byte 4 # DW_CFA_advance_loc4
277 .long .Lpush_ebx-.Lpush_edi
278 .byte 14 # DW_CFA_def_cfa_offset
280 .byte 0x83 # DW_CFA_offset %ebx
282 .byte 4 # DW_CFA_advance_loc4
283 .long .Lsub_esp-.Lpush_ebx
284 .byte 14 # DW_CFA_def_cfa_offset
286 .byte 4 # DW_CFA_advance_loc4
287 .long .Ladd_esp-.Lsub_esp
288 .byte 14 # DW_CFA_def_cfa_offset
290 .byte 4 # DW_CFA_advance_loc4
291 .long .Lpop_ebx-.Ladd_esp
292 .byte 14 # DW_CFA_def_cfa_offset
294 .byte 0xc3 # DW_CFA_restore %ebx
295 .byte 4 # DW_CFA_advance_loc4
296 .long .Lpop_edi-.Lpop_ebx
297 .byte 14 # DW_CFA_def_cfa_offset
299 .byte 0xc7 # DW_CFA_restore %edi
300 .byte 4 # DW_CFA_advance_loc4
301 .long .Lpop_esi-.Lpop_edi
302 .byte 14 # DW_CFA_def_cfa_offset
304 .byte 0xc6 # DW_CFA_restore %esi
305 .byte 4 # DW_CFA_advance_loc4
306 .long .Lafter_ret-.Lpop_esi
307 .byte 14 # DW_CFA_def_cfa_offset
309 .byte 0x86 # DW_CFA_offset %esi
311 .byte 0x87 # DW_CFA_offset %edi
313 .byte 0x83 # DW_CFA_offset %ebx
320 .hidden DW.ref.__gcc_personality_v0
321 .weak DW.ref.__gcc_personality_v0
322 .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
324 .type DW.ref.__gcc_personality_v0, @object
325 .size DW.ref.__gcc_personality_v0, 4
326 DW.ref.__gcc_personality_v0:
327 .long __gcc_personality_v0