clarify the purpose of this project
[nyanglibc.git] / nptl / pthread_rwlock_rdlock.s
blobd5ac215f50c4dbe2f559b1022c90713e56aaa0ef
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_rdlock
9 .type __pthread_rwlock_rdlock, @function
10 __pthread_rwlock_rdlock:
11 movl 24(%rdi), %edx
12 #APP
13 # 298 "pthread_rwlock_common.c" 1
14 movl %fs:720,%eax
15 # 0 "" 2
16 #NO_APP
17 cmpl %eax, %edx
18 je .L29
19 pushq %r12
20 pushq %rbp
21 pushq %rbx
22 cmpl $2, 48(%rdi)
23 movq %rdi, %rbx
24 je .L3
25 .L10:
26 movl $8, %eax
27 lock xaddl %eax, (%rbx)
28 addl $8, %eax
29 .L4:
30 testl %eax, %eax
31 js .L12
32 testb $1, %al
33 jne .L13
34 .L32:
35 xorl %edx, %edx
36 .L1:
37 popq %rbx
38 movl %edx, %eax
39 popq %rbp
40 popq %r12
41 ret
42 .p2align 4,,10
43 .p2align 3
44 .L3:
45 movl (%rdi), %esi
46 movl $128, %ebp
47 .L7:
48 movl %esi, %eax
49 andl $3, %eax
50 cmpl $2, %eax
51 jne .L10
52 movl %esi, %eax
53 shrl $3, %eax
54 testl %eax, %eax
55 je .L10
56 movl %esi, %edx
57 movl %esi, %eax
58 orl $4, %edx
59 lock cmpxchgl %edx, (%rbx)
60 movl %eax, %esi
61 je .L6
62 jmp .L7
63 .p2align 4,,10
64 .p2align 3
65 .L56:
66 cmpl $75, %eax
67 je .L1
68 .L6:
69 movl (%rbx), %esi
70 testb $4, %sil
71 je .L7
72 movl 28(%rbx), %r8d
73 movq %rbx, %rdi
74 testl %r8d, %r8d
75 cmovne %ebp, %r8d
76 xorl %edx, %edx
77 xorl %ecx, %ecx
78 call __futex_abstimed_wait64@PLT
79 cmpl $110, %eax
80 movl %eax, %edx
81 jne .L56
82 popq %rbx
83 movl %edx, %eax
84 popq %rbp
85 popq %r12
86 ret
87 .p2align 4,,10
88 .p2align 3
89 .L13:
90 movl %eax, %edx
91 andl $3, %edx
92 cmpl $1, %edx
93 jne .L57
94 movl %eax, %edx
95 xorl $1, %edx
96 lock cmpxchgl %edx, (%rbx)
97 jne .L13
98 leaq 8(%rbx), %rdi
99 xorl %eax, %eax
100 xchgl (%rdi), %eax
101 testb $2, %al
102 je .L32
103 cmpl $1, 28(%rbx)
104 movl $2147483647, %edx
105 movl $202, %eax
106 sbbl %esi, %esi
107 xorl %r10d, %r10d
108 andl $128, %esi
109 addl $1, %esi
110 #APP
111 # 209 "../sysdeps/nptl/futex-internal.h" 1
112 syscall
114 # 0 "" 2
115 #NO_APP
116 cmpq $-4096, %rax
117 jbe .L32
118 cmpl $-22, %eax
119 je .L32
120 cmpl $-14, %eax
121 je .L32
122 leaq .LC0(%rip), %rdi
123 call __libc_fatal@PLT
124 .p2align 4,,10
125 .p2align 3
126 .L29:
127 movl $35, %edx
128 movl %edx, %eax
130 .p2align 4,,10
131 .p2align 3
132 .L12:
133 leal -8(%rax), %edx
134 lock cmpxchgl %edx, (%rbx)
135 jne .L4
136 movl $11, %edx
137 jmp .L1
138 .L57:
139 leaq 8(%rbx), %rbp
140 xorl %r12d, %r12d
141 .L18:
142 movl 0(%rbp), %eax
143 movl %eax, %edx
144 orl $2, %edx
145 cmpl $3, %edx
146 je .L27
147 testb %r12b, %r12b
148 jne .L32
149 movl (%rbx), %eax
150 testb $1, %al
151 jne .L18
152 movl 0(%rbp), %eax
153 movl %eax, %edx
154 orl $2, %edx
155 cmpl $3, %edx
156 jne .L32
157 movl $1, %r12d
158 .L27:
159 movl 28(%rbx), %r8d
160 movl $128, %edx
161 testl %r8d, %r8d
162 cmovne %edx, %r8d
163 testb $2, %al
164 jne .L23
165 movl $3, %edx
166 lock cmpxchgl %edx, 0(%rbp)
167 jne .L18
168 .L23:
169 xorl %edx, %edx
170 xorl %ecx, %ecx
171 movl $3, %esi
172 movq %rbp, %rdi
173 call __futex_abstimed_wait64@PLT
174 cmpl $110, %eax
175 movl %eax, %edx
176 je .L21
177 cmpl $75, %eax
178 jne .L18
179 .L21:
180 movl (%rbx), %eax
181 .L24:
182 testb $1, %al
183 je .L26
184 leal -8(%rax), %ecx
185 lock cmpxchgl %ecx, (%rbx)
186 je .L1
187 jmp .L24
188 .p2align 4,,10
189 .p2align 3
190 .L26:
191 movl 0(%rbp), %eax
192 orl $2, %eax
193 cmpl $3, %eax
194 je .L26
195 jmp .L32
196 .size __pthread_rwlock_rdlock, .-__pthread_rwlock_rdlock
197 .weak pthread_rwlock_rdlock
198 .set pthread_rwlock_rdlock,__pthread_rwlock_rdlock