clarify the purpose of this project
[nyanglibc.git] / csu / rtld-check_fds.shared.s
blob0bdb5fff927bdd763659f9c92d6168c86ca83ecd
1 .text
2 .section .rodata.str1.1,"aMS",@progbits,1
3 .LC0:
4 .string "/dev/full"
5 .LC1:
6 .string "/dev/null"
7 .text
8 .p2align 4,,15
9 .type check_one_fd, @function
10 check_one_fd:
11 pushq %r12
12 pushq %rbp
13 xorl %eax, %eax
14 pushq %rbx
15 movl %esi, %ebp
16 movl $1, %esi
17 movl %edi, %ebx
18 subq $144, %rsp
19 call __GI___fcntl64_nocancel
20 cmpl $-1, %eax
21 je .L11
22 .L1:
23 addq $144, %rsp
24 popq %rbx
25 popq %rbp
26 popq %r12
27 ret
28 .L11:
29 cmpl $9, rtld_errno(%rip)
30 jne .L1
31 leaq .LC1(%rip), %rax
32 leaq .LC0(%rip), %rdi
33 xorl %r12d, %r12d
34 cmpl $131072, %ebp
35 movl %ebp, %esi
36 setne %r12b
37 cmove %rax, %rdi
38 xorl %edx, %edx
39 xorl %eax, %eax
40 leaq 259(,%r12,4), %r12
41 call __GI___open_nocancel
42 cmpl %eax, %ebx
43 jne .L5
44 movq %rsp, %rsi
45 movl %ebx, %edi
46 call __GI___fstat64
47 testl %eax, %eax
48 jne .L5
49 movl 24(%rsp), %eax
50 andl $61440, %eax
51 cmpl $8192, %eax
52 jne .L5
53 cmpq %r12, 40(%rsp)
54 je .L1
55 .p2align 4,,10
56 .p2align 3
57 .L5:
58 #APP
59 # 81 "check_fds.c" 1
60 hlt
61 # 0 "" 2
62 #NO_APP
63 jmp .L5
64 .size check_one_fd, .-check_one_fd
65 .p2align 4,,15
66 .globl __libc_check_standard_fds
67 .hidden __libc_check_standard_fds
68 .type __libc_check_standard_fds, @function
69 __libc_check_standard_fds:
70 subq $8, %rsp
71 movl $131073, %esi
72 xorl %edi, %edi
73 call check_one_fd
74 movl $131072, %esi
75 movl $1, %edi
76 call check_one_fd
77 movl $131072, %esi
78 movl $2, %edi
79 addq $8, %rsp
80 jmp check_one_fd
81 .size __libc_check_standard_fds, .-__libc_check_standard_fds
82 .hidden rtld_errno