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