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