1 /* Copyright (C) 2002-2014 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)
149 movl 28(%esp), %ebx /* Load semaphore address. */
159 addl $_GLOBAL_OFFSET_TABLE_, %ebx
160 #ifdef NO_TLS_DIRECT_SEG_REFS
161 movl errno@gotntpoff(%ebx), %edx
165 movl errno@gotntpoff(%ebx), %edx
166 movl %esi, %gs:(%edx)
171 .size sem_timedwait,.-sem_timedwait
174 .type sem_wait_cleanup,@function
180 call _Unwind_Resume@PLT
183 .size sem_wait_cleanup,.-sem_wait_cleanup
186 .section .gcc_except_table,"a",@progbits
188 .byte 0xff # @LPStart format (omit)
189 .byte 0xff # @TType format (omit)
190 .byte 0x01 # call-site format
192 .uleb128 .Lcstend-.Lcstbegin
194 .uleb128 .LcleanupSTART-.LSTARTCODE
195 .uleb128 .LcleanupEND-.LcleanupSTART
196 .uleb128 sem_wait_cleanup-.LSTARTCODE
198 .uleb128 .LcallUR-.LSTARTCODE
199 .uleb128 .LENDCODE-.LcallUR
205 .section .eh_frame,"a",@progbits
207 .long .LENDCIE-.LSTARTCIE # Length of the CIE.
210 .byte 1 # Version number.
212 .string "zPLR" # NUL-terminated augmentation
215 .string "zPL" # NUL-terminated augmentation
218 .uleb128 1 # Code alignment factor.
219 .sleb128 -4 # Data alignment factor.
220 .byte 8 # Return address register
223 .uleb128 7 # Augmentation value length.
224 .byte 0x9b # Personality: DW_EH_PE_pcrel
226 # + DW_EH_PE_indirect
227 .long DW.ref.__gcc_personality_v0-.
228 .byte 0x1b # LSDA Encoding: DW_EH_PE_pcrel
230 .byte 0x1b # FDE Encoding: DW_EH_PE_pcrel
233 .uleb128 6 # Augmentation value length.
234 .byte 0x0 # Personality: absolute
235 .long __gcc_personality_v0
236 .byte 0x0 # LSDA Encoding: absolute
238 .byte 0x0c # DW_CFA_def_cfa
241 .byte 0x88 # DW_CFA_offset, column 0x10
246 .long .LENDFDE-.LSTARTFDE # Length of the FDE.
248 .long .LSTARTFDE-.LSTARTFRAME # CIE pointer.
250 .long .LSTARTCODE-. # PC-relative start address
253 .long .LSTARTCODE # Start address of the code.
255 .long .LENDCODE-.LSTARTCODE # Length of the code.
256 .uleb128 4 # Augmentation size
258 .long .LexceptSTART-.
263 .byte 4 # DW_CFA_advance_loc4
264 .long .Lpush_esi-.LSTARTCODE
265 .byte 14 # DW_CFA_def_cfa_offset
267 .byte 0x86 # DW_CFA_offset %esi
269 .byte 4 # DW_CFA_advance_loc4
270 .long .Lpush_edi-.Lpush_esi
271 .byte 14 # DW_CFA_def_cfa_offset
273 .byte 0x87 # DW_CFA_offset %edi
275 .byte 4 # DW_CFA_advance_loc4
276 .long .Lpush_ebx-.Lpush_edi
277 .byte 14 # DW_CFA_def_cfa_offset
279 .byte 0x83 # DW_CFA_offset %ebx
281 .byte 4 # DW_CFA_advance_loc4
282 .long .Lsub_esp-.Lpush_ebx
283 .byte 14 # DW_CFA_def_cfa_offset
285 .byte 4 # DW_CFA_advance_loc4
286 .long .Ladd_esp-.Lsub_esp
287 .byte 14 # DW_CFA_def_cfa_offset
289 .byte 4 # DW_CFA_advance_loc4
290 .long .Lpop_ebx-.Ladd_esp
291 .byte 14 # DW_CFA_def_cfa_offset
293 .byte 0xc3 # DW_CFA_restore %ebx
294 .byte 4 # DW_CFA_advance_loc4
295 .long .Lpop_edi-.Lpop_ebx
296 .byte 14 # DW_CFA_def_cfa_offset
298 .byte 0xc7 # DW_CFA_restore %edi
299 .byte 4 # DW_CFA_advance_loc4
300 .long .Lpop_esi-.Lpop_edi
301 .byte 14 # DW_CFA_def_cfa_offset
303 .byte 0xc6 # DW_CFA_restore %esi
304 .byte 4 # DW_CFA_advance_loc4
305 .long .Lafter_ret-.Lpop_esi
306 .byte 14 # DW_CFA_def_cfa_offset
308 .byte 0x86 # DW_CFA_offset %esi
310 .byte 0x87 # DW_CFA_offset %edi
312 .byte 0x83 # DW_CFA_offset %ebx
319 .hidden DW.ref.__gcc_personality_v0
320 .weak DW.ref.__gcc_personality_v0
321 .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
323 .type DW.ref.__gcc_personality_v0, @object
324 .size DW.ref.__gcc_personality_v0, 4
325 DW.ref.__gcc_personality_v0:
326 .long __gcc_personality_v0