clarify the purpose of this project
[nyanglibc.git] / shadow / lckpwdf.shared.s
blobcc3107cbd192d60a96953b49feeb3bf6e7ff6a6e
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 #NO_APP
7 .p2align 4,,15
8 .type noop_handler, @function
9 noop_handler:
10 rep ret
11 .size noop_handler, .-noop_handler
12 .section .rodata.str1.1,"aMS",@progbits,1
13 .LC0:
14 .string "/etc/.pwd.lock"
15 .text
16 .p2align 4,,15
17 .globl __lckpwdf
18 .type __lckpwdf, @function
19 __lckpwdf:
20 pushq %r14
21 pushq %r13
22 pushq %r12
23 pushq %rbp
24 pushq %rbx
25 subq $608, %rsp
26 movl lock_fd(%rip), %ebp
27 cmpl $-1, %ebp
28 jne .L10
29 #APP
30 # 98 "lckpwdf.c" 1
31 movl %fs:24,%eax
32 # 0 "" 2
33 #NO_APP
34 testl %eax, %eax
35 jne .L6
36 movl $1, %edx
37 #APP
38 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
39 cmpxchgl %edx, lock(%rip)
40 # 0 "" 2
41 #NO_APP
42 .L7:
43 leaq .LC0(%rip), %rdi
44 xorl %eax, %eax
45 movl $384, %edx
46 movl $524353, %esi
47 call __GI___open
48 cmpl $-1, %eax
49 movl %eax, %ebx
50 movl %eax, lock_fd(%rip)
51 jne .L8
52 #APP
53 # 104 "lckpwdf.c" 1
54 movl %fs:24,%eax
55 # 0 "" 2
56 #NO_APP
57 testl %eax, %eax
58 jne .L9
59 .L20:
60 subl $1, lock(%rip)
61 .L3:
62 addq $608, %rsp
63 movl %ebx, %eax
64 popq %rbx
65 popq %rbp
66 popq %r12
67 popq %r13
68 popq %r14
69 ret
70 .p2align 4,,10
71 .p2align 3
72 .L8:
73 leaq 448(%rsp), %rsi
74 xorl %eax, %eax
75 movl $17, %ecx
76 leaq 288(%rsp), %r12
77 movq $-1, %r13
78 leaq 16(%rsi), %rdx
79 movq %r13, 456(%rsp)
80 movq %rdx, %rdi
81 movq %r12, %rdx
82 rep stosq
83 leaq noop_handler(%rip), %rax
84 movl $14, %edi
85 movq %rax, 448(%rsp)
86 call __GI___sigaction
87 testl %eax, %eax
88 jns .L11
89 .L28:
90 movl lock_fd(%rip), %edi
91 testl %edi, %edi
92 jns .L29
93 .L15:
94 #APP
95 # 128 "lckpwdf.c" 1
96 movl %fs:24,%eax
97 # 0 "" 2
98 #NO_APP
99 testl %eax, %eax
100 jne .L16
101 subl $1, lock(%rip)
102 movl %ebp, %ebx
103 jmp .L3
104 .p2align 4,,10
105 .p2align 3
106 .L11:
107 leaq 32(%rsp), %r14
108 leaq 160(%rsp), %rsi
109 movl $1, %edi
110 movq $8192, 160(%rsp)
111 movq %r14, %rdx
112 call __GI___sigprocmask
113 testl %eax, %eax
114 js .L30
115 movl $15, %edi
116 call __GI_alarm
117 pxor %xmm0, %xmm0
118 movl lock_fd(%rip), %edi
119 movq %rsp, %rdx
120 xorl %eax, %eax
121 movl $1, %ecx
122 movl $7, %esi
123 movw %cx, (%rsp)
124 movups %xmm0, 2(%rsp)
125 movw %ax, 30(%rdx)
126 movq $0, 18(%rdx)
127 xorl %eax, %eax
128 movl $0, 26(%rdx)
129 call __GI___fcntl
130 xorl %edi, %edi
131 movl %eax, %ebx
132 call __GI_alarm
133 xorl %edx, %edx
134 movq %r14, %rsi
135 movl $2, %edi
136 call __GI___sigprocmask
137 xorl %edx, %edx
138 movq %r12, %rsi
139 movl $14, %edi
140 call __GI___sigaction
141 testl %ebx, %ebx
142 js .L31
143 .L17:
144 #APP
145 # 140 "lckpwdf.c" 1
146 movl %fs:24,%eax
147 # 0 "" 2
148 #NO_APP
149 testl %eax, %eax
150 je .L20
151 xorl %eax, %eax
152 #APP
153 # 140 "lckpwdf.c" 1
154 xchgl %eax, lock(%rip)
155 # 0 "" 2
156 #NO_APP
157 cmpl $1, %eax
158 jle .L3
159 .L21:
160 xorl %r10d, %r10d
161 movl $1, %edx
162 movl $129, %esi
163 leaq lock(%rip), %rdi
164 movl $202, %eax
165 #APP
166 # 140 "lckpwdf.c" 1
167 syscall
169 # 0 "" 2
170 #NO_APP
171 jmp .L3
172 .p2align 4,,10
173 .p2align 3
174 .L29:
175 call __GI___close
176 movl %r13d, lock_fd(%rip)
177 jmp .L15
178 .p2align 4,,10
179 .p2align 3
180 .L30:
181 xorl %edx, %edx
182 movq %r12, %rsi
183 movl $14, %edi
184 call __GI___sigaction
185 jmp .L28
186 .p2align 4,,10
187 .p2align 3
188 .L9:
189 xorl %eax, %eax
190 #APP
191 # 104 "lckpwdf.c" 1
192 xchgl %eax, lock(%rip)
193 # 0 "" 2
194 #NO_APP
195 cmpl $1, %eax
196 jg .L21
197 .L10:
198 movl $-1, %ebx
199 jmp .L3
200 .p2align 4,,10
201 .p2align 3
202 .L6:
203 xorl %eax, %eax
204 movl $1, %edx
205 lock cmpxchgl %edx, lock(%rip)
206 je .L7
207 leaq lock(%rip), %rdi
208 call __lll_lock_wait_private
209 jmp .L7
210 .p2align 4,,10
211 .p2align 3
212 .L31:
213 movl lock_fd(%rip), %edi
214 testl %edi, %edi
215 js .L17
216 call __GI___close
217 movl %r13d, lock_fd(%rip)
218 jmp .L17
219 .p2align 4,,10
220 .p2align 3
221 .L16:
222 xorl %eax, %eax
223 #APP
224 # 128 "lckpwdf.c" 1
225 xchgl %eax, lock(%rip)
226 # 0 "" 2
227 #NO_APP
228 cmpl $1, %eax
229 jle .L10
230 xorl %r10d, %r10d
231 movl $1, %edx
232 movl $129, %esi
233 leaq lock(%rip), %rdi
234 movl $202, %eax
235 #APP
236 # 128 "lckpwdf.c" 1
237 syscall
239 # 0 "" 2
240 #NO_APP
241 movl %ebp, %ebx
242 jmp .L3
243 .size __lckpwdf, .-__lckpwdf
244 .weak lckpwdf
245 .set lckpwdf,__lckpwdf
246 .p2align 4,,15
247 .globl __ulckpwdf
248 .type __ulckpwdf, @function
249 __ulckpwdf:
250 movl lock_fd(%rip), %r8d
251 cmpl $-1, %r8d
252 je .L41
253 subq $8, %rsp
254 #APP
255 # 156 "lckpwdf.c" 1
256 movl %fs:24,%eax
257 # 0 "" 2
258 #NO_APP
259 testl %eax, %eax
260 jne .L34
261 movl $1, %edx
262 #APP
263 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
264 cmpxchgl %edx, lock(%rip)
265 # 0 "" 2
266 #NO_APP
267 .L35:
268 movl lock_fd(%rip), %edi
269 call __GI___close
270 movl $-1, lock_fd(%rip)
271 movl %eax, %r8d
272 #APP
273 # 164 "lckpwdf.c" 1
274 movl %fs:24,%eax
275 # 0 "" 2
276 #NO_APP
277 testl %eax, %eax
278 jne .L36
279 subl $1, lock(%rip)
280 .L32:
281 movl %r8d, %eax
282 addq $8, %rsp
284 .p2align 4,,10
285 .p2align 3
286 .L34:
287 xorl %eax, %eax
288 movl $1, %edx
289 lock cmpxchgl %edx, lock(%rip)
290 je .L35
291 leaq lock(%rip), %rdi
292 call __lll_lock_wait_private
293 jmp .L35
294 .p2align 4,,10
295 .p2align 3
296 .L36:
297 xorl %eax, %eax
298 #APP
299 # 164 "lckpwdf.c" 1
300 xchgl %eax, lock(%rip)
301 # 0 "" 2
302 #NO_APP
303 cmpl $1, %eax
304 jle .L32
305 xorl %r10d, %r10d
306 movl $1, %edx
307 movl $129, %esi
308 leaq lock(%rip), %rdi
309 movl $202, %eax
310 #APP
311 # 164 "lckpwdf.c" 1
312 syscall
314 # 0 "" 2
315 #NO_APP
316 jmp .L32
317 .p2align 4,,10
318 .p2align 3
319 .L41:
320 movl %r8d, %eax
322 .size __ulckpwdf, .-__ulckpwdf
323 .weak ulckpwdf
324 .set ulckpwdf,__ulckpwdf
325 .local lock
326 .comm lock,4,4
327 .data
328 .align 4
329 .type lock_fd, @object
330 .size lock_fd, 4
331 lock_fd:
332 .long -1
333 .hidden __lll_lock_wait_private