1 /* Copyright (C) 2002-2003, 2005, 2007, 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"
33 .type __new_sem_wait,@function
67 6: call __pthread_enable_asynccancel
71 movl PRIVATE(%ebx), %ecx
73 movl $FUTEX_WAIT, %ecx
74 orl PRIVATE(%ebx), %ecx
83 call __pthread_disable_asynccancel
88 cmpl $-EWOULDBLOCK, %esi
115 addl $_GLOBAL_OFFSET_TABLE_, %ebx
116 #ifdef NO_TLS_DIRECT_SEG_REFS
117 movl errno@gotntpoff(%ebx), %edx
121 movl errno@gotntpoff(%ebx), %edx
122 movl %esi, %gs:(%edx)
127 .size __new_sem_wait,.-__new_sem_wait
128 versioned_symbol(libpthread, __new_sem_wait, sem_wait, GLIBC_2_1)
131 .type sem_wait_cleanup,@function
137 call _Unwind_Resume@PLT
140 .size sem_wait_cleanup,.-sem_wait_cleanup
143 .section .gcc_except_table,"a",@progbits
145 .byte 0xff # @LPStart format (omit)
146 .byte 0xff # @TType format (omit)
147 .byte 0x01 # call-site format
149 .uleb128 .Lcstend-.Lcstbegin
151 .uleb128 .LcleanupSTART-.LSTARTCODE
152 .uleb128 .LcleanupEND-.LcleanupSTART
153 .uleb128 sem_wait_cleanup-.LSTARTCODE
155 .uleb128 .LcallUR-.LSTARTCODE
156 .uleb128 .LENDCODE-.LcallUR
162 .section .eh_frame,"a",@progbits
164 .long .LENDCIE-.LSTARTCIE # Length of the CIE.
167 .byte 1 # Version number.
169 .string "zPLR" # NUL-terminated augmentation
172 .string "zPL" # NUL-terminated augmentation
175 .uleb128 1 # Code alignment factor.
176 .sleb128 -4 # Data alignment factor.
177 .byte 8 # Return address register
180 .uleb128 7 # Augmentation value length.
181 .byte 0x9b # Personality: DW_EH_PE_pcrel
183 # + DW_EH_PE_indirect
184 .long DW.ref.__gcc_personality_v0-.
185 .byte 0x1b # LSDA Encoding: DW_EH_PE_pcrel
187 .byte 0x1b # FDE Encoding: DW_EH_PE_pcrel
190 .uleb128 6 # Augmentation value length.
191 .byte 0x0 # Personality: absolute
192 .long __gcc_personality_v0
193 .byte 0x0 # LSDA Encoding: absolute
195 .byte 0x0c # DW_CFA_def_cfa
198 .byte 0x88 # DW_CFA_offset, column 0x10
203 .long .LENDFDE-.LSTARTFDE # Length of the FDE.
205 .long .LSTARTFDE-.LSTARTFRAME # CIE pointer.
207 .long .LSTARTCODE-. # PC-relative start address
210 .long .LSTARTCODE # Start address of the code.
212 .long .LENDCODE-.LSTARTCODE # Length of the code.
213 .uleb128 4 # Augmentation size
215 .long .LexceptSTART-.
220 .byte 4 # DW_CFA_advance_loc4
221 .long .Lpush_ebx-.LSTARTCODE
222 .byte 14 # DW_CFA_def_cfa_offset
224 .byte 0x83 # DW_CFA_offset %ebx
226 .byte 4 # DW_CFA_advance_loc4
227 .long .Lpush_esi-.Lpush_ebx
228 .byte 14 # DW_CFA_def_cfa_offset
230 .byte 0x86 # DW_CFA_offset %esi
232 .byte 4 # DW_CFA_advance_loc4
233 .long .Lsub_esp-.Lpush_esi
234 .byte 14 # DW_CFA_def_cfa_offset
236 .byte 4 # DW_CFA_advance_loc4
237 .long .Ladd_esp-.Lsub_esp
238 .byte 14 # DW_CFA_def_cfa_offset
240 .byte 0xc3 # DW_CFA_restore %ebx
241 .byte 0xc6 # DW_CFA_restore %esi
242 .byte 4 # DW_CFA_advance_loc4
243 .long .Lafter_ret-.Ladd_esp
244 .byte 14 # DW_CFA_def_cfa_offset
246 .byte 0x83 # DW_CFA_offset %ebx
248 .byte 0x86 # DW_CFA_offset %esi
255 .hidden DW.ref.__gcc_personality_v0
256 .weak DW.ref.__gcc_personality_v0
257 .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
259 .type DW.ref.__gcc_personality_v0, @object
260 .size DW.ref.__gcc_personality_v0, 4
261 DW.ref.__gcc_personality_v0:
262 .long __gcc_personality_v0
266 #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
267 .section ".text.compat", "ax"
268 .global __old_sem_wait
269 .type __old_sem_wait,@function
274 cfi_adjust_cfa_offset(4)
276 cfi_adjust_cfa_offset(4)
278 cfi_adjust_cfa_offset(4)
290 cmpxchgl %edx, (%ebx)
294 5: movl 4(%esp), %esi
299 cfi_adjust_cfa_offset(-12)
302 cfi_adjust_cfa_offset(12)
305 1: call __pthread_enable_asynccancel
309 movl $SYS_futex, %eax
316 call __pthread_disable_asynccancel
320 cmpl $-EWOULDBLOCK, %esi
329 addl $_GLOBAL_OFFSET_TABLE_, %ebx
330 #ifdef NO_TLS_DIRECT_SEG_REFS
331 movl errno@gotntpoff(%ebx), %edx
335 movl errno@gotntpoff(%ebx), %edx
336 movl %esi, %gs:(%edx)
341 .size __old_sem_wait,.-__old_sem_wait
342 compat_symbol(libpthread, __old_sem_wait, sem_wait, GLIBC_2_0)