clarify the purpose of this project
[nyanglibc.git] / libio / iopopen.s
blobb6f05f3de390ff5ece7daa61a63ea72b5ee21b39
1 .text
2 .p2align 4,,15
3 .globl _IO_new_proc_close
4 .type _IO_new_proc_close, @function
5 _IO_new_proc_close:
6 pushq %r14
7 pushq %r13
8 pushq %r12
9 pushq %rbp
10 pushq %rbx
11 movq %rdi, %rbx
12 subq $48, %rsp
13 movq _pthread_cleanup_push_defer@GOTPCREL(%rip), %rbp
14 testq %rbp, %rbp
15 je .L2
16 leaq 16(%rsp), %rdi
17 leaq unlock(%rip), %rsi
18 xorl %edx, %edx
19 call _pthread_cleanup_push_defer@PLT
20 .L3:
21 movq %fs:16, %r12
22 cmpq %r12, 8+proc_file_chain_lock(%rip)
23 je .L4
24 #APP
25 # 260 "iopopen.c" 1
26 movl %fs:24,%eax
27 # 0 "" 2
28 #NO_APP
29 testl %eax, %eax
30 jne .L5
31 movl $1, %edx
32 #APP
33 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
34 cmpxchgl %edx, proc_file_chain_lock(%rip)
35 # 0 "" 2
36 #NO_APP
37 .L6:
38 movq %r12, 8+proc_file_chain_lock(%rip)
39 .L4:
40 movl 4+proc_file_chain_lock(%rip), %ecx
41 movq proc_file_chain(%rip), %rdx
42 movl $-1, %r12d
43 leal 1(%rcx), %eax
44 testq %rdx, %rdx
45 movl %eax, 4+proc_file_chain_lock(%rip)
46 je .L7
47 cmpq %rbx, %rdx
48 jne .L9
49 jmp .L35
50 .p2align 4,,10
51 .p2align 3
52 .L10:
53 cmpq %rbx, %rax
54 je .L36
55 movq %rax, %rdx
56 .L9:
57 movq 232(%rdx), %rax
58 testq %rax, %rax
59 jne .L10
60 movl $-1, %r12d
61 .L7:
62 testl %ecx, %ecx
63 movl %ecx, 4+proc_file_chain_lock(%rip)
64 jne .L12
65 movq $0, 8+proc_file_chain_lock(%rip)
66 #APP
67 # 272 "iopopen.c" 1
68 movl %fs:24,%eax
69 # 0 "" 2
70 #NO_APP
71 testl %eax, %eax
72 jne .L13
73 subl $1, proc_file_chain_lock(%rip)
74 .L12:
75 testq %rbp, %rbp
76 je .L15
77 leaq 16(%rsp), %rdi
78 xorl %esi, %esi
79 call _pthread_cleanup_pop_restore@PLT
80 .L15:
81 cmpl $-1, %r12d
82 je .L16
83 movl 112(%rbx), %edi
84 call __close_nocancel
85 testl %eax, %eax
86 js .L16
87 movq __pthread_setcancelstate@GOTPCREL(%rip), %r12
88 leaq 12(%rsp), %r13
89 leaq 16(%rsp), %r14
90 jmp .L19
91 .p2align 4,,10
92 .p2align 3
93 .L37:
94 movq %r14, %rsi
95 movl $1, %edi
96 call __pthread_setcancelstate@PLT
97 movl 224(%rbx), %edi
98 xorl %edx, %edx
99 movq %r13, %rsi
100 call __waitpid
101 movl 16(%rsp), %edi
102 movl %eax, %ebp
103 xorl %esi, %esi
104 call __pthread_setcancelstate@PLT
105 cmpl $-1, %ebp
106 jne .L18
107 .L38:
108 movq __libc_errno@gottpoff(%rip), %rax
109 cmpl $4, %fs:(%rax)
110 jne .L16
111 .L19:
112 testq %r12, %r12
113 jne .L37
114 movl 224(%rbx), %edi
115 xorl %edx, %edx
116 movq %r13, %rsi
117 call __waitpid
118 movl %eax, %ebp
119 cmpl $-1, %ebp
120 je .L38
121 .L18:
122 movl 12(%rsp), %eax
123 addq $48, %rsp
124 popq %rbx
125 popq %rbp
126 popq %r12
127 popq %r13
128 popq %r14
130 .p2align 4,,10
131 .p2align 3
132 .L16:
133 addq $48, %rsp
134 movl $-1, %eax
135 popq %rbx
136 popq %rbp
137 popq %r12
138 popq %r13
139 popq %r14
141 .p2align 4,,10
142 .p2align 3
143 .L2:
144 leaq unlock(%rip), %rax
145 movq $0, 24(%rsp)
146 movq %rax, 16(%rsp)
147 jmp .L3
148 .p2align 4,,10
149 .p2align 3
150 .L36:
151 addq $232, %rdx
152 .L8:
153 movq 232(%rbx), %rax
154 xorl %r12d, %r12d
155 movq %rax, (%rdx)
156 jmp .L7
157 .L13:
158 #APP
159 # 272 "iopopen.c" 1
160 xchgl %ecx, proc_file_chain_lock(%rip)
161 # 0 "" 2
162 #NO_APP
163 cmpl $1, %ecx
164 jle .L12
165 xorl %r10d, %r10d
166 movl $1, %edx
167 movl $129, %esi
168 leaq proc_file_chain_lock(%rip), %rdi
169 movl $202, %eax
170 #APP
171 # 272 "iopopen.c" 1
172 syscall
174 # 0 "" 2
175 #NO_APP
176 jmp .L12
177 .p2align 4,,10
178 .p2align 3
179 .L5:
180 xorl %eax, %eax
181 movl $1, %edx
182 lock cmpxchgl %edx, proc_file_chain_lock(%rip)
183 je .L6
184 leaq proc_file_chain_lock(%rip), %rdi
185 call __lll_lock_wait_private
186 jmp .L6
187 .p2align 4,,10
188 .p2align 3
189 .L35:
190 leaq proc_file_chain(%rip), %rdx
191 jmp .L8
192 .size _IO_new_proc_close, .-_IO_new_proc_close
193 .weak _IO_proc_close
194 .set _IO_proc_close,_IO_new_proc_close
195 .p2align 4,,15
196 .type unlock, @function
197 unlock:
198 movl 4+proc_file_chain_lock(%rip), %eax
199 subl $1, %eax
200 testl %eax, %eax
201 movl %eax, 4+proc_file_chain_lock(%rip)
202 jne .L39
203 movq $0, 8+proc_file_chain_lock(%rip)
204 #APP
205 # 59 "iopopen.c" 1
206 movl %fs:24,%edx
207 # 0 "" 2
208 #NO_APP
209 testl %edx, %edx
210 jne .L42
211 subl $1, proc_file_chain_lock(%rip)
213 .p2align 4,,10
214 .p2align 3
215 .L42:
216 #APP
217 # 59 "iopopen.c" 1
218 xchgl %eax, proc_file_chain_lock(%rip)
219 # 0 "" 2
220 #NO_APP
221 cmpl $1, %eax
222 jle .L39
223 xorl %r10d, %r10d
224 movl $1, %edx
225 movl $129, %esi
226 leaq proc_file_chain_lock(%rip), %rdi
227 movl $202, %eax
228 #APP
229 # 59 "iopopen.c" 1
230 syscall
232 # 0 "" 2
233 #NO_APP
234 .L39:
235 rep ret
236 .size unlock, .-unlock
237 .section .rodata.str1.1,"aMS",@progbits,1
238 .LC0:
239 .string "sh"
240 .LC1:
241 .string "-c"
242 .LC2:
243 .string "/bin/sh"
244 .text
245 .p2align 4,,15
246 .globl _IO_new_proc_open
247 .type _IO_new_proc_open, @function
248 _IO_new_proc_open:
249 pushq %r15
250 pushq %r14
251 xorl %r14d, %r14d
252 pushq %r13
253 pushq %r12
254 movq %rsi, %r13
255 pushq %rbp
256 pushq %rbx
257 xorl %ebp, %ebp
258 movq %rdi, %rbx
259 xorl %esi, %esi
260 subq $200, %rsp
261 .L45:
262 movzbl (%rdx), %eax
263 testb %al, %al
264 je .L92
265 .L51:
266 addq $1, %rdx
267 cmpb $114, %al
268 je .L47
269 cmpb $119, %al
270 je .L75
271 cmpb $101, %al
272 je .L93
273 .L46:
274 movq __libc_errno@gottpoff(%rip), %rax
275 movl $22, %fs:(%rax)
276 xorl %eax, %eax
277 .L44:
278 addq $200, %rsp
279 popq %rbx
280 popq %rbp
281 popq %r12
282 popq %r13
283 popq %r14
284 popq %r15
286 .p2align 4,,10
287 .p2align 3
288 .L47:
289 movzbl (%rdx), %eax
290 movl $1, %r14d
291 testb %al, %al
292 jne .L51
293 .L92:
294 cmpl %esi, %r14d
295 je .L46
296 cmpl $-1, 112(%rbx)
297 jne .L91
298 leaq 40(%rsp), %rax
299 movl $524288, %esi
300 movq %rax, %rdi
301 movq %rax, 24(%rsp)
302 call __pipe2
303 testl %eax, %eax
304 js .L91
305 movl %r14d, %eax
306 leaq 112(%rsp), %r12
307 xorl $1, %eax
308 cmpl $1, %r14d
309 movl %eax, 20(%rsp)
310 sbbl %eax, %eax
311 movq %r12, %rdi
312 andl $-4, %eax
313 addl $8, %eax
314 movl %eax, 16(%rsp)
315 call __posix_spawn_file_actions_init
316 movslq %r14d, %rax
317 movl 40(%rsp,%rax,4), %esi
318 movq %rax, 8(%rsp)
319 cmpl %r14d, %esi
320 je .L94
321 .L55:
322 movl %r14d, %edx
323 movq %r12, %rdi
324 call __posix_spawn_file_actions_adddup2
325 testl %eax, %eax
326 jne .L57
327 cmpq $0, _pthread_cleanup_push_defer@GOTPCREL(%rip)
328 je .L58
329 leaq 48(%rsp), %rdi
330 leaq unlock(%rip), %rsi
331 xorl %edx, %edx
332 call _pthread_cleanup_push_defer@PLT
333 .L59:
334 movq %fs:16, %r15
335 cmpq %r15, 8+proc_file_chain_lock(%rip)
336 je .L60
337 #APP
338 # 195 "iopopen.c" 1
339 movl %fs:24,%eax
340 # 0 "" 2
341 #NO_APP
342 testl %eax, %eax
343 jne .L61
344 movl $1, %esi
345 #APP
346 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
347 cmpxchgl %esi, proc_file_chain_lock(%rip)
348 # 0 "" 2
349 #NO_APP
350 .L62:
351 movq %r15, 8+proc_file_chain_lock(%rip)
352 .L60:
353 movq proc_file_chain(%rip), %r15
354 addl $1, 4+proc_file_chain_lock(%rip)
355 testq %r15, %r15
356 je .L63
357 .p2align 4,,10
358 .p2align 3
359 .L65:
360 movl 112(%r15), %esi
361 cmpl %esi, %r14d
362 je .L66
363 movq %r12, %rdi
364 call __posix_spawn_file_actions_addclose
365 testl %eax, %eax
366 jne .L68
367 .L66:
368 movq 232(%r15), %r15
369 testq %r15, %r15
370 jne .L65
371 .L63:
372 leaq .LC0(%rip), %rax
373 movq __environ(%rip), %r9
374 leaq 224(%rbx), %rdi
375 leaq 80(%rsp), %r8
376 leaq .LC2(%rip), %rsi
377 xorl %ecx, %ecx
378 movq %rax, 80(%rsp)
379 leaq .LC1(%rip), %rax
380 movq %r12, %rdx
381 movq %r13, 96(%rsp)
382 movq $0, 104(%rsp)
383 movq %rax, 88(%rsp)
384 call __posix_spawn
385 testl %eax, %eax
386 je .L95
387 .L68:
388 xorl %ebp, %ebp
389 .L67:
390 movl 4+proc_file_chain_lock(%rip), %eax
391 subl $1, %eax
392 testl %eax, %eax
393 movl %eax, 4+proc_file_chain_lock(%rip)
394 jne .L71
395 movq $0, 8+proc_file_chain_lock(%rip)
396 #APP
397 # 200 "iopopen.c" 1
398 movl %fs:24,%edx
399 # 0 "" 2
400 #NO_APP
401 testl %edx, %edx
402 jne .L72
403 subl $1, proc_file_chain_lock(%rip)
404 .L71:
405 cmpq $0, _pthread_cleanup_push_defer@GOTPCREL(%rip)
406 je .L74
407 leaq 48(%rsp), %rdi
408 xorl %esi, %esi
409 call _pthread_cleanup_pop_restore@PLT
410 .L74:
411 movq %r12, %rdi
412 call __posix_spawn_file_actions_destroy
413 testb %bpl, %bpl
414 je .L57
415 movl (%rbx), %eax
416 movl 16(%rsp), %r14d
417 andl $-13, %eax
418 orl %eax, %r14d
419 movq %rbx, %rax
420 movl %r14d, (%rbx)
421 jmp .L44
422 .p2align 4,,10
423 .p2align 3
424 .L93:
425 movl $1, %ebp
426 jmp .L45
427 .p2align 4,,10
428 .p2align 3
429 .L75:
430 movl $1, %esi
431 jmp .L45
432 .p2align 4,,10
433 .p2align 3
434 .L94:
435 xorl %edx, %edx
436 xorl %eax, %eax
437 movl $1030, %esi
438 movl %r14d, %edi
439 call __fcntl
440 testl %eax, %eax
441 movl %eax, %r15d
442 jns .L56
443 .p2align 4,,10
444 .p2align 3
445 .L57:
446 movq 8(%rsp), %rax
447 movl 40(%rsp,%rax,4), %edi
448 call __close_nocancel
449 movslq 20(%rsp), %rax
450 movl 40(%rsp,%rax,4), %edi
451 call __close_nocancel
452 movq __libc_errno@gottpoff(%rip), %rax
453 movl $12, %fs:(%rax)
454 .L91:
455 xorl %eax, %eax
456 jmp .L44
457 .p2align 4,,10
458 .p2align 3
459 .L58:
460 leaq unlock(%rip), %rax
461 movq $0, 56(%rsp)
462 movq %rax, 48(%rsp)
463 jmp .L59
464 .p2align 4,,10
465 .p2align 3
466 .L56:
467 movq 8(%rsp), %rax
468 movl 40(%rsp,%rax,4), %edi
469 call __close_nocancel
470 movq 8(%rsp), %rax
471 movl %r15d, %esi
472 movl %r15d, 40(%rsp,%rax,4)
473 jmp .L55
474 .p2align 4,,10
475 .p2align 3
476 .L95:
477 movq 8(%rsp), %rax
478 movl 40(%rsp,%rax,4), %edi
479 call __close_nocancel
480 movslq 20(%rsp), %rax
481 movq 24(%rsp), %rcx
482 testl %ebp, %ebp
483 leaq (%rcx,%rax,4), %r13
484 jne .L69
485 movl 0(%r13), %edi
486 xorl %edx, %edx
487 movl $2, %esi
488 xorl %eax, %eax
489 call __fcntl
490 .L69:
491 movl 0(%r13), %eax
492 movl $1, %ebp
493 movl %eax, 112(%rbx)
494 movq proc_file_chain(%rip), %rax
495 movq %rbx, proc_file_chain(%rip)
496 movq %rax, 232(%rbx)
497 jmp .L67
498 .L61:
499 xorl %eax, %eax
500 movl $1, %esi
501 lock cmpxchgl %esi, proc_file_chain_lock(%rip)
502 je .L62
503 leaq proc_file_chain_lock(%rip), %rdi
504 call __lll_lock_wait_private
505 jmp .L62
506 .L72:
507 #APP
508 # 200 "iopopen.c" 1
509 xchgl %eax, proc_file_chain_lock(%rip)
510 # 0 "" 2
511 #NO_APP
512 cmpl $1, %eax
513 jle .L71
514 xorl %r10d, %r10d
515 movl $1, %edx
516 movl $129, %esi
517 leaq proc_file_chain_lock(%rip), %rdi
518 movl $202, %eax
519 #APP
520 # 200 "iopopen.c" 1
521 syscall
523 # 0 "" 2
524 #NO_APP
525 jmp .L71
526 .size _IO_new_proc_open, .-_IO_new_proc_open
527 .weak _IO_proc_open
528 .set _IO_proc_open,_IO_new_proc_open
529 .p2align 4,,15
530 .globl _IO_new_popen
531 .type _IO_new_popen, @function
532 _IO_new_popen:
533 pushq %r12
534 pushq %rbp
535 movq %rdi, %rbp
536 pushq %rbx
537 movl $256, %edi
538 movq %rsi, %r12
539 call malloc@PLT
540 testq %rax, %rax
541 je .L98
542 leaq 240(%rax), %rdx
543 xorl %esi, %esi
544 movq %rax, %rdi
545 movq %rax, %rbx
546 movq %rdx, 136(%rax)
547 call _IO_init_internal
548 leaq _IO_proc_jumps(%rip), %rax
549 movq %rbx, %rdi
550 movq %rax, 216(%rbx)
551 call _IO_new_file_init_internal
552 movq %r12, %rdx
553 movq %rbp, %rsi
554 movq %rbx, %rdi
555 call _IO_new_proc_open
556 testq %rax, %rax
557 je .L100
558 .L96:
559 movq %rbx, %rax
560 popq %rbx
561 popq %rbp
562 popq %r12
564 .p2align 4,,10
565 .p2align 3
566 .L98:
567 xorl %ebx, %ebx
568 jmp .L96
569 .p2align 4,,10
570 .p2align 3
571 .L100:
572 movq %rbx, %rdi
573 call _IO_un_link
574 movq %rbx, %rdi
575 xorl %ebx, %ebx
576 call free@PLT
577 jmp .L96
578 .size _IO_new_popen, .-_IO_new_popen
579 .weak _IO_popen
580 .set _IO_popen,_IO_new_popen
581 .globl __new_popen
582 .set __new_popen,_IO_new_popen
583 .weak popen
584 .set popen,__new_popen
585 .local proc_file_chain_lock
586 .comm proc_file_chain_lock,16,16
587 .local proc_file_chain
588 .comm proc_file_chain,8,8
589 .section __libc_IO_vtables,"aw",@progbits
590 .align 32
591 .type _IO_proc_jumps, @object
592 .size _IO_proc_jumps, 168
593 _IO_proc_jumps:
594 .quad 0
595 .quad 0
596 .quad _IO_new_file_finish
597 .quad _IO_new_file_overflow
598 .quad _IO_new_file_underflow
599 .quad _IO_default_uflow
600 .quad _IO_default_pbackfail
601 .quad _IO_new_file_xsputn
602 .quad _IO_default_xsgetn
603 .quad _IO_new_file_seekoff
604 .quad _IO_default_seekpos
605 .quad _IO_new_file_setbuf
606 .quad _IO_new_file_sync
607 .quad _IO_file_doallocate
608 .quad _IO_file_read
609 .quad _IO_new_file_write
610 .quad _IO_file_seek
611 .quad _IO_new_proc_close
612 .quad _IO_file_stat
613 .quad _IO_default_showmanyc
614 .quad _IO_default_imbue
615 .weak __pthread_setcancelstate
616 .weak _pthread_cleanup_pop_restore
617 .weak _pthread_cleanup_push_defer
618 .hidden _IO_file_stat
619 .hidden _IO_file_seek
620 .hidden _IO_file_read
621 .hidden _IO_file_doallocate
622 .hidden _IO_default_xsgetn
623 .hidden _IO_default_pbackfail
624 .hidden _IO_default_uflow
625 .hidden _IO_un_link
626 .hidden _IO_new_file_init_internal
627 .hidden _IO_init_internal
628 .hidden __fcntl
629 .hidden __posix_spawn_file_actions_destroy
630 .hidden __posix_spawn
631 .hidden __posix_spawn_file_actions_addclose
632 .hidden __posix_spawn_file_actions_adddup2
633 .hidden __posix_spawn_file_actions_init
634 .hidden __pipe2
635 .hidden __lll_lock_wait_private
636 .hidden __waitpid
637 .hidden __close_nocancel