clarify the purpose of this project
[nyanglibc.git] / nptl / pthread_rwlock_wrlock.s
blobc1bfdc8067fd8dfb36270956799653368b971501
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 .globl __pthread_rwlock_wrlock
9 .type __pthread_rwlock_wrlock, @function
10 __pthread_rwlock_wrlock:
11 movl 24(%rdi), %edx
12 #APP
13 # 603 "pthread_rwlock_common.c" 1
14 movl %fs:720,%eax
15 # 0 "" 2
16 #NO_APP
17 cmpl %eax, %edx
18 je .L47
19 pushq %r14
20 pushq %r13
21 pushq %r12
22 pushq %rbp
23 pushq %rbx
24 movl (%rdi), %eax
25 .L3:
26 movl %eax, %ecx
27 movl %eax, %edx
28 orl $2, %ecx
29 lock cmpxchgl %ecx, (%rdi)
30 jne .L3
31 testb $2, %dl
32 movq %rdi, %rbx
33 leaq 12(%rdi), %rbp
34 movl $1, %eax
35 jne .L112
36 .L4:
37 testb $1, %dl
38 movl %eax, 12(%rbx)
39 jne .L22
40 .L20:
41 movl %edx, %eax
42 shrl $3, %eax
43 testl %eax, %eax
44 jne .L25
45 movl %edx, %ecx
46 movl %edx, %eax
47 orl $1, %ecx
48 lock cmpxchgl %ecx, (%rbx)
49 movl %eax, %edx
50 jne .L21
51 movl $1, 8(%rbx)
52 .L22:
53 #APP
54 # 947 "pthread_rwlock_common.c" 1
55 movl %fs:720,%eax
56 # 0 "" 2
57 #NO_APP
58 movl %eax, 24(%rbx)
59 xorl %r8d, %r8d
60 .L1:
61 popq %rbx
62 movl %r8d, %eax
63 popq %rbp
64 popq %r12
65 popq %r13
66 popq %r14
67 ret
68 .p2align 4,,10
69 .p2align 3
70 .L47:
71 movl $35, %r8d
72 movl %r8d, %eax
73 ret
74 .p2align 4,,10
75 .p2align 3
76 .L112:
77 movl 48(%rdi), %r12d
78 testl %r12d, %r12d
79 jne .L113
80 .L5:
81 xorl %ecx, %ecx
82 movl $128, %r13d
83 .L6:
84 testb $2, %dl
85 jne .L7
86 movl %edx, %esi
87 movl %edx, %eax
88 orl $2, %esi
89 lock cmpxchgl %esi, (%rbx)
90 movl %eax, %edx
91 jne .L6
92 testl %r12d, %r12d
93 jne .L114
94 .L9:
95 orl $2, %edx
96 cmpb $1, %cl
97 sbbl %eax, %eax
98 andl $-2, %eax
99 addl $3, %eax
100 jmp .L4
101 .p2align 4,,10
102 .p2align 3
103 .L7:
104 testl %r12d, %r12d
105 jne .L115
106 .L10:
107 movl 28(%rbx), %r8d
108 movl 0(%rbp), %eax
109 testl %r8d, %r8d
110 movl %eax, %edx
111 cmovne %r13d, %r8d
112 andl $-3, %edx
113 cmpl $1, %edx
114 jne .L14
115 cmpl $3, %eax
116 je .L13
117 movl $3, %edx
118 lock cmpxchgl %edx, 0(%rbp)
119 jne .L14
120 .L13:
121 xorl %ecx, %ecx
122 xorl %edx, %edx
123 movl $3, %esi
124 movq %rbp, %rdi
125 call __futex_abstimed_wait64@PLT
126 cmpl $110, %eax
127 movl %eax, %r8d
128 je .L53
129 cmpl $75, %eax
130 je .L53
131 movl (%rbx), %edx
132 movl $1, %ecx
133 jmp .L6
134 .L21:
135 testb $1, %al
136 je .L20
137 .p2align 4,,10
138 .p2align 3
139 .L25:
140 leaq 8(%rbx), %r12
141 xorl %r13d, %r13d
142 .p2align 4,,10
143 .p2align 3
144 .L23:
145 movl (%r12), %eax
146 movl %eax, %edx
147 orl $2, %edx
148 cmpl $2, %edx
149 je .L45
150 testb %r13b, %r13b
151 jne .L22
152 movl (%rbx), %eax
153 testb $1, %al
154 je .L23
155 movl (%r12), %eax
156 movl %eax, %edx
157 orl $2, %edx
158 cmpl $2, %edx
159 jne .L22
160 movl $1, %r13d
161 .L45:
162 movl 28(%rbx), %r14d
163 movl $128, %edx
164 testl %r14d, %r14d
165 cmovne %edx, %r14d
166 testb $2, %al
167 jne .L30
168 movl $2, %edx
169 lock cmpxchgl %edx, (%r12)
170 jne .L23
171 .L30:
172 movl %r14d, %r8d
173 xorl %ecx, %ecx
174 xorl %edx, %edx
175 movl $2, %esi
176 movq %r12, %rdi
177 call __futex_abstimed_wait64@PLT
178 cmpl $110, %eax
179 movl %eax, %r8d
180 je .L28
181 cmpl $75, %eax
182 jne .L23
183 .L28:
184 movl 48(%rbx), %eax
185 testl %eax, %eax
186 je .L32
187 movl 4(%rbx), %eax
188 leaq 4(%rbx), %rdx
189 testl %eax, %eax
190 je .L32
191 xorl %ecx, %ecx
192 xchgl 0(%rbp), %ecx
193 .L36:
194 movl %eax, %esi
195 orl $-2147483648, %esi
196 lock cmpxchgl %esi, (%rdx)
197 jne .L34
198 andl $2, %ecx
199 je .L1
200 movl %r14d, %esi
201 xorl %r10d, %r10d
202 movl $1, %edx
203 xorb $-127, %sil
204 movq %rbp, %rdi
205 movl $202, %eax
206 #APP
207 # 209 "../sysdeps/nptl/futex-internal.h" 1
208 syscall
210 # 0 "" 2
211 #NO_APP
212 cmpq $-4096, %rax
213 jbe .L1
214 cmpl $-22, %eax
215 je .L1
216 cmpl $-14, %eax
217 je .L1
218 .L35:
219 leaq .LC0(%rip), %rdi
220 call __libc_fatal@PLT
221 .L34:
222 testl %eax, %eax
223 jne .L36
224 movl %ecx, 12(%rbx)
225 .p2align 4,,10
226 .p2align 3
227 .L32:
228 movl (%rbx), %eax
229 movl %eax, %edx
230 andl $1, %edx
231 jne .L44
232 xchgl 0(%rbp), %edx
233 .L43:
234 movl %eax, %ecx
235 xorl $2, %ecx
236 andl $-5, %ecx
237 lock cmpxchgl %ecx, (%rbx)
238 movl %eax, %r8d
239 jne .L38
240 andl $2, %edx
241 je .L40
242 movl %r14d, %esi
243 xorl %r10d, %r10d
244 movl $1, %edx
245 xorb $-127, %sil
246 movq %rbp, %rdi
247 movl $202, %eax
248 #APP
249 # 209 "../sysdeps/nptl/futex-internal.h" 1
250 syscall
252 # 0 "" 2
253 #NO_APP
254 cmpq $-4096, %rax
255 ja .L116
256 .L40:
257 andl $4, %r8d
258 je .L51
259 movl %r14d, %esi
260 xorl %r10d, %r10d
261 movl $2147483647, %edx
262 xorb $-127, %sil
263 movq %rbx, %rdi
264 movl $202, %eax
265 #APP
266 # 209 "../sysdeps/nptl/futex-internal.h" 1
267 syscall
269 # 0 "" 2
270 #NO_APP
271 cmpq $-4096, %rax
272 ja .L117
273 .L51:
274 movl $110, %r8d
275 jmp .L1
276 .L38:
277 testb $1, %al
278 je .L43
279 movl %edx, 12(%rbx)
280 .p2align 4,,10
281 .p2align 3
282 .L44:
283 movl (%r12), %eax
284 orl $2, %eax
285 cmpl $2, %eax
286 jne .L22
287 movl (%r12), %eax
288 orl $2, %eax
289 cmpl $2, %eax
290 je .L44
291 jmp .L22
292 .p2align 4,,10
293 .p2align 3
294 .L14:
295 movl (%rbx), %edx
296 jmp .L6
297 .p2align 4,,10
298 .p2align 3
299 .L113:
300 lock addl $1, 4(%rdi)
301 jmp .L5
302 .p2align 4,,10
303 .p2align 3
304 .L115:
305 movl 4(%rbx), %eax
306 leaq 4(%rbx), %rsi
307 testl %eax, %eax
308 jns .L10
309 leal 2147483647(%rax), %edi
310 lock cmpxchgl %edi, (%rsi)
311 jne .L6
312 movl (%rbx), %edx
313 jmp .L9
314 .p2align 4,,10
315 .p2align 3
316 .L114:
317 lock subl $1, 4(%rbx)
318 jmp .L9
319 .L117:
320 cmpl $-22, %eax
321 je .L51
322 cmpl $-14, %eax
323 je .L51
324 jmp .L35
325 .p2align 4,,10
326 .p2align 3
327 .L116:
328 cmpl $-22, %eax
329 je .L40
330 cmpl $-14, %eax
331 je .L40
332 jmp .L35
333 .p2align 4,,10
334 .p2align 3
335 .L53:
336 testl %r12d, %r12d
337 je .L1
338 movl 4(%rbx), %eax
339 leaq 4(%rbx), %rdx
340 .L18:
341 cmpl $-2147483647, %eax
342 je .L49
343 leal -1(%rax), %ecx
344 .L17:
345 lock cmpxchgl %ecx, (%rdx)
346 jne .L18
347 cmpl $-2147483647, %eax
348 jne .L1
349 movl (%rbx), %edx
350 movl $3, %eax
351 orl $2, %edx
352 jmp .L4
353 .L49:
354 xorl %ecx, %ecx
355 jmp .L17
356 .size __pthread_rwlock_wrlock, .-__pthread_rwlock_wrlock
357 .weak pthread_rwlock_wrlock
358 .set pthread_rwlock_wrlock,__pthread_rwlock_wrlock