clarify the purpose of this project
[nyanglibc.git] / nptl / pthread_once.s
blobb8c1bb459183ec572d7377f670ef7f616f096c72
1 .text
2 .section .rodata.str1.8,"aMS",@progbits,1
3 .align 8
4 .LC0:
5 .string "The futex facility returned an unexpected error code.\n"
6 .text
7 .p2align 4,,15
8 .type __pthread_once_slow, @function
9 __pthread_once_slow:
10 pushq %r12
11 pushq %rbp
12 movl $202, %r8d
13 pushq %rbx
14 movq %rsi, %rbp
15 movq %rdi, %rbx
16 movl $1, %r9d
17 subq $32, %rsp
18 .L13:
19 movl (%rbx), %eax
20 .L3:
21 testb $2, %al
22 je .L19
23 .L7:
24 addq $32, %rsp
25 xorl %eax, %eax
26 popq %rbx
27 popq %rbp
28 popq %r12
29 ret
30 .p2align 4,,10
31 .p2align 3
32 .L19:
33 movl __fork_generation(%rip), %edx
34 orl $1, %edx
35 lock cmpxchgl %edx, (%rbx)
36 jne .L3
37 cmpl %eax, %edx
38 jne .L4
39 testb $1, %al
40 je .L4
41 xorl %r10d, %r10d
42 movl $128, %esi
43 movq %rbx, %rdi
44 movl %r8d, %eax
45 #APP
46 # 146 "../sysdeps/nptl/futex-internal.h" 1
47 syscall
49 # 0 "" 2
50 #NO_APP
51 cmpq $-4096, %rax
52 jbe .L13
53 leal 11(%rax), %ecx
54 cmpl $11, %ecx
55 ja .L6
56 movq %r9, %rax
57 salq %cl, %rax
58 testl $2177, %eax
59 jne .L13
60 .L6:
61 leaq .LC0(%rip), %rdi
62 call __libc_fatal@PLT
63 .p2align 4,,10
64 .p2align 3
65 .L4:
66 movq %rsp, %r12
67 leaq clear_once_control(%rip), %rsi
68 movq %rbx, %rdx
69 movq %r12, %rdi
70 call __pthread_cleanup_push@PLT
71 call *%rbp
72 xorl %esi, %esi
73 movq %r12, %rdi
74 call __pthread_cleanup_pop@PLT
75 movl $2, (%rbx)
76 xorl %r10d, %r10d
77 movl $2147483647, %edx
78 movl $129, %esi
79 movq %rbx, %rdi
80 movl $202, %eax
81 #APP
82 # 209 "../sysdeps/nptl/futex-internal.h" 1
83 syscall
85 # 0 "" 2
86 #NO_APP
87 cmpq $-4096, %rax
88 jbe .L7
89 cmpl $-22, %eax
90 je .L7
91 cmpl $-14, %eax
92 je .L7
93 jmp .L6
94 .size __pthread_once_slow, .-__pthread_once_slow
95 .p2align 4,,15
96 .type clear_once_control, @function
97 clear_once_control:
98 movl $0, (%rdi)
99 xorl %r10d, %r10d
100 movl $2147483647, %edx
101 movl $129, %esi
102 movl $202, %eax
103 #APP
104 # 209 "../sysdeps/nptl/futex-internal.h" 1
105 syscall
107 # 0 "" 2
108 #NO_APP
109 cmpq $-4096, %rax
110 ja .L26
111 .L20:
112 rep ret
113 .p2align 4,,10
114 .p2align 3
115 .L26:
116 cmpl $-22, %eax
117 je .L20
118 cmpl $-14, %eax
119 je .L20
120 leaq .LC0(%rip), %rdi
121 subq $8, %rsp
122 call __libc_fatal@PLT
123 .size clear_once_control, .-clear_once_control
124 .p2align 4,,15
125 .globl __pthread_once
126 .type __pthread_once, @function
127 __pthread_once:
128 movl (%rdi), %eax
129 testb $2, %al
130 je .L29
131 xorl %eax, %eax
133 .p2align 4,,10
134 .p2align 3
135 .L29:
136 jmp __pthread_once_slow
137 .size __pthread_once, .-__pthread_once
138 .weak pthread_once
139 .set pthread_once,__pthread_once
140 .comm __fork_generation,8,8