1 /* Copyright (C) 2002, 2003, 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 #include <lowlevellock.h>
22 #include <shlib-compat.h>
23 #include <pthread-errnos.h>
24 #include <structsem.h>
30 .type sem_wait,@function
36 cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect,
37 DW.ref.__gcc_personality_v0)
38 cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART)
40 cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0)
41 cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
47 movl VALUE(%rdi), %eax
57 cmpxchgl %edx, VALUE(%rdi)
64 /* This push is only needed to store the sem_t pointer for the
67 cfi_adjust_cfa_offset(8)
70 addq $1, NWAITERS(%rdi)
73 6: call __pthread_enable_asynccancel
79 movl PRIVATE(%rdi), %esi
81 movl $FUTEX_WAIT, %esi
82 orl PRIVATE(%rdi), %esi
89 call __pthread_disable_asynccancel
95 cmpq $-EWOULDBLOCK, %rcx
102 movl VALUE(%rdi), %eax
110 cmpxchgl %edx, (%rdi)
112 cmpxchgl %edx, VALUE(%rdi)
119 subq $1, NWAITERS(%rdi)
122 cfi_adjust_cfa_offset(-8)
126 cfi_adjust_cfa_offset(8)
129 movq errno@gottpoff(%rip), %rdx
130 movl %ecx, %fs:(%rdx)
132 # error "not supported. %rcx and %rdi must be preserved"
133 callq __errno_location@plt
139 .size sem_wait,.-sem_wait
142 .type sem_wait_cleanup,@function
146 subq $1, NWAITERS(%rdi)
149 call _Unwind_Resume@PLT
153 .size sem_wait_cleanup,.-sem_wait_cleanup
156 .section .gcc_except_table,"a",@progbits
158 .byte DW_EH_PE_omit # @LPStart format
159 .byte DW_EH_PE_omit # @TType format
160 .byte DW_EH_PE_uleb128 # call-site format
161 .uleb128 .Lcstend-.Lcstbegin
163 .uleb128 .LcleanupSTART-.LSTARTCODE
164 .uleb128 .LcleanupEND-.LcleanupSTART
165 .uleb128 sem_wait_cleanup-.LSTARTCODE
167 .uleb128 .LcallUR-.LSTARTCODE
168 .uleb128 .LENDCODE-.LcallUR
175 .hidden DW.ref.__gcc_personality_v0
176 .weak DW.ref.__gcc_personality_v0
177 .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
179 .type DW.ref.__gcc_personality_v0, @object
180 .size DW.ref.__gcc_personality_v0, 8
181 DW.ref.__gcc_personality_v0:
182 .quad __gcc_personality_v0