clarify the purpose of this project
[nyanglibc.git] / csu / check_fds.s
blob72c0825bed0335d5dfb072b60ac7675dac4ee4b0
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 __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 movq __libc_errno@gottpoff(%rip), %rax
30 cmpl $9, %fs:(%rax)
31 jne .L1
32 leaq .LC1(%rip), %rax
33 leaq .LC0(%rip), %rdi
34 xorl %r12d, %r12d
35 cmpl $131072, %ebp
36 movl %ebp, %esi
37 setne %r12b
38 cmove %rax, %rdi
39 xorl %edx, %edx
40 xorl %eax, %eax
41 leaq 259(,%r12,4), %r12
42 call __open_nocancel
43 cmpl %eax, %ebx
44 jne .L5
45 movq %rsp, %rsi
46 movl %ebx, %edi
47 call __fstat64
48 testl %eax, %eax
49 jne .L5
50 movl 24(%rsp), %eax
51 andl $61440, %eax
52 cmpl $8192, %eax
53 jne .L5
54 cmpq %r12, 40(%rsp)
55 je .L1
56 .p2align 4,,10
57 .p2align 3
58 .L5:
59 #APP
60 # 81 "check_fds.c" 1
61 hlt
62 # 0 "" 2
63 #NO_APP
64 jmp .L5
65 .size check_one_fd, .-check_one_fd
66 .p2align 4,,15
67 .globl __libc_check_standard_fds
68 .hidden __libc_check_standard_fds
69 .type __libc_check_standard_fds, @function
70 __libc_check_standard_fds:
71 subq $8, %rsp
72 movl $131073, %esi
73 xorl %edi, %edi
74 call check_one_fd
75 movl $131072, %esi
76 movl $1, %edi
77 call check_one_fd
78 movl $131072, %esi
79 movl $2, %edi
80 addq $8, %rsp
81 jmp check_one_fd
82 .size __libc_check_standard_fds, .-__libc_check_standard_fds
83 .hidden __fstat64
84 .hidden __open_nocancel
85 .hidden __fcntl64_nocancel