1 /* Copyright (C) 2002, 2003, 2005, 2007 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
20 #include <kernel-features.h>
21 #include <tcb-offsets.h>
22 #include <lowlevellock.h>
25 .comm __fork_generation, 4, 4
31 .type __pthread_once,@function
40 /* Preserve the function pointer. */
45 /* Not yet initialized or initialization in progress.
46 Get the fork generation counter now. */
55 orl __fork_generation(%rip), %edx
62 /* Check whether another thread already runs the initializer. */
64 jz 3f /* No -> do it. */
66 /* Check whether the initializer execution was interrupted
69 testl $0xfffffffc, %eax
70 jnz 3f /* Different for generation -> run initializer. */
72 /* Somebody else got here first. Wait. */
73 #ifdef __ASSUME_PRIVATE_FUTEX
74 movl $FUTEX_WAIT|FUTEX_PRIVATE_FLAG, %esi
77 movl %fs:PRIVATE_FUTEX, %esi
79 movl $FUTEX_WAIT, %esi
80 orl %fs:PRIVATE_FUTEX, %esi
87 /* Preserve the pointer to the control variable. */
97 /* Get the control variable address back. */
101 /* Sucessful run of the initializer. Signal that we are done. */
108 /* Wake up all other threads. */
109 movl $0x7fffffff, %edx
110 #ifdef __ASSUME_PRIVATE_FUTEX
111 movl $FUTEX_WAKE|FUTEX_PRIVATE_FLAG, %esi
113 movl $FUTEX_WAKE, %esi
114 orl %fs:PRIVATE_FUTEX, %esi
116 movl $SYS_futex, %eax
124 .size __pthread_once,.-__pthread_once
127 .globl __pthread_once_internal
128 __pthread_once_internal = __pthread_once
131 pthread_once = __pthread_once
134 .type clear_once_control,@function
141 movl $0x7fffffff, %edx
142 #ifdef __ASSUME_PRIVATE_FUTEX
143 movl $FUTEX_WAKE|FUTEX_PRIVATE_FLAG, %esi
145 movl $FUTEX_WAKE, %esi
146 orl %fs:PRIVATE_FUTEX, %esi
148 movl $SYS_futex, %eax
153 call _Unwind_Resume@PLT
156 .size clear_once_control,.-clear_once_control
159 .section .gcc_except_table,"a",@progbits
161 .byte 0xff # @LPStart format (omit)
162 .byte 0xff # @TType format (omit)
163 .byte 0x01 # call-site format
165 .uleb128 .Lcstend-.Lcstbegin
167 .uleb128 .LcleanupSTART-.LSTARTCODE
168 .uleb128 .LcleanupEND-.LcleanupSTART
169 .uleb128 clear_once_control-.LSTARTCODE
171 .uleb128 .LcallUR-.LSTARTCODE
172 .uleb128 .LENDCODE-.LcallUR
178 .section .eh_frame,"a",@progbits
180 .long .LENDCIE-.LSTARTCIE # Length of the CIE.
183 .byte 1 # Version number.
185 .string "zPLR" # NUL-terminated augmentation
188 .string "zPL" # NUL-terminated augmentation
191 .uleb128 1 # Code alignment factor.
192 .sleb128 -8 # Data alignment factor.
193 .byte 16 # Return address register
196 .uleb128 7 # Augmentation value length.
197 .byte 0x9b # Personality: DW_EH_PE_pcrel
199 # + DW_EH_PE_indirect
200 .long DW.ref.__gcc_personality_v0-.
201 .byte 0x1b # LSDA Encoding: DW_EH_PE_pcrel
203 .byte 0x1b # FDE Encoding: DW_EH_PE_pcrel
206 .uleb128 10 # Augmentation value length.
207 .byte 0x0 # Personality: absolute
208 .quad __gcc_personality_v0
209 .byte 0x0 # LSDA Encoding: absolute
211 .byte 0x0c # DW_CFA_def_cfa
214 .byte 0x90 # DW_CFA_offset, column 0x10
219 .long .LENDFDE-.LSTARTFDE # Length of the FDE.
221 .long .LSTARTFDE-.LSTARTFRAME # CIE pointer.
223 .long .LSTARTCODE-. # PC-relative start address
225 .long .LENDCODE-.LSTARTCODE # Length of the code.
226 .uleb128 4 # Augmentation size
227 .long .LexceptSTART-.
229 .quad .LSTARTCODE # Start address of the code.
230 .quad .LENDCODE-.LSTARTCODE # Length of the code.
231 .uleb128 8 # Augmentation size
234 .byte 4 # DW_CFA_advance_loc4
235 .long .Lpush_rsi-.LSTARTCODE
236 .byte 14 # DW_CFA_def_cfa_offset
238 .byte 4 # DW_CFA_advance_loc4
239 .long .Lpush_rdi-.Lpush_rsi
240 .byte 14 # DW_CFA_def_cfa_offset
242 .byte 4 # DW_CFA_advance_loc4
243 .long .Lpush_rdi2-.Lpush_rdi
244 .byte 14 # DW_CFA_def_cfa_offset
246 .byte 4 # DW_CFA_advance_loc4
247 .long .Lpop_rdi-.Lpush_rdi2
248 .byte 14 # DW_CFA_def_cfa_offset
250 .byte 4 # DW_CFA_advance_loc4
251 .long .Ladd1-.Lpop_rdi
252 .byte 14 # DW_CFA_def_cfa_offset
254 .byte 4 # DW_CFA_advance_loc4
256 .byte 14 # DW_CFA_def_cfa_offset
258 .byte 4 # DW_CFA_advance_loc4
259 .long clear_once_control-.Ladd2
260 .byte 14 # DW_CFA_def_cfa_offset
263 .byte 4 # DW_CFA_advance_loc4
264 .long .Lpop_rdi3-clear_once_control
265 .byte 14 # DW_CFA_def_cfa_offset
273 .hidden DW.ref.__gcc_personality_v0
274 .weak DW.ref.__gcc_personality_v0
275 .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
277 .type DW.ref.__gcc_personality_v0, @object
278 .size DW.ref.__gcc_personality_v0, 8
279 DW.ref.__gcc_personality_v0:
280 .quad __gcc_personality_v0