clarify the purpose of this project
[nyanglibc.git] / dirent / opendir.s
blob2744f1d6f9e989cd15823365615177df0a2a6c94
1 .text
2 .p2align 4,,15
3 .globl __alloc_dir
4 .hidden __alloc_dir
5 .type __alloc_dir, @function
6 __alloc_dir:
7 pushq %r12
8 pushq %rbp
9 movl %edi, %r12d
10 pushq %rbx
11 subq $16, %rsp
12 testb %sil, %sil
13 je .L13
14 cmpq $32768, 56(%rcx)
15 movl $32768, %ebp
16 movl $1048576, %eax
17 cmovnb 56(%rcx), %rbp
18 cmpq $1048576, %rbp
19 cmova %rax, %rbp
20 leaq 48(%rbp), %rdi
21 call malloc@PLT
22 testq %rax, %rax
23 movq %rax, %rbx
24 je .L14
25 .L6:
26 movl %r12d, (%rbx)
27 movl $0, 4(%rbx)
28 movq %rbp, 8(%rbx)
29 movq $0, 16(%rbx)
30 movq $0, 24(%rbx)
31 movq $0, 32(%rbx)
32 movl $0, 40(%rbx)
33 .L1:
34 addq $16, %rsp
35 movq %rbx, %rax
36 popq %rbx
37 popq %rbp
38 popq %r12
39 ret
40 .p2align 4,,10
41 .p2align 3
42 .L13:
43 xorl %eax, %eax
44 movl $1, %edx
45 movl $2, %esi
46 movq %rcx, 8(%rsp)
47 call __fcntl64_nocancel
48 testl %eax, %eax
49 movq 8(%rsp), %rcx
50 js .L5
51 cmpq $32768, 56(%rcx)
52 movl $32768, %ebp
53 movl $1048576, %eax
54 cmovnb 56(%rcx), %rbp
55 cmpq $1048576, %rbp
56 cmova %rax, %rbp
57 leaq 48(%rbp), %rdi
58 call malloc@PLT
59 testq %rax, %rax
60 movq %rax, %rbx
61 jne .L6
62 .L5:
63 addq $16, %rsp
64 xorl %ebx, %ebx
65 movq %rbx, %rax
66 popq %rbx
67 popq %rbp
68 popq %r12
69 ret
70 .p2align 4,,10
71 .p2align 3
72 .L14:
73 movl %r12d, %edi
74 call __close_nocancel
75 jmp .L1
76 .size __alloc_dir, .-__alloc_dir
77 .p2align 4,,15
78 .type opendir_tail, @function
79 opendir_tail:
80 testl %edi, %edi
81 js .L19
82 pushq %rbp
83 pushq %rbx
84 movl %edi, %ebx
85 subq $152, %rsp
86 movq %rsp, %rbp
87 movq %rbp, %rsi
88 call __fstat64
89 testl %eax, %eax
90 js .L17
91 movl 24(%rsp), %eax
92 andl $61440, %eax
93 cmpl $16384, %eax
94 jne .L24
95 movq %rbp, %rcx
96 movl %ebx, %edi
97 xorl %edx, %edx
98 movl $1, %esi
99 call __alloc_dir
100 addq $152, %rsp
101 popq %rbx
102 popq %rbp
104 .p2align 4,,10
105 .p2align 3
106 .L24:
107 movq __libc_errno@gottpoff(%rip), %rax
108 movl $20, %fs:(%rax)
109 .L17:
110 movl %ebx, %edi
111 call __close_nocancel
112 addq $152, %rsp
113 xorl %eax, %eax
114 popq %rbx
115 popq %rbp
117 .p2align 4,,10
118 .p2align 3
119 .L19:
120 xorl %eax, %eax
122 .size opendir_tail, .-opendir_tail
123 .p2align 4,,15
124 .globl __opendirat
125 .hidden __opendirat
126 .type __opendirat, @function
127 __opendirat:
128 cmpb $0, (%rsi)
129 je .L26
130 subq $8, %rsp
131 movl $591872, %edx
132 xorl %eax, %eax
133 call __openat_nocancel
134 addq $8, %rsp
135 movl %eax, %edi
136 jmp opendir_tail
137 .p2align 4,,10
138 .p2align 3
139 .L26:
140 movq __libc_errno@gottpoff(%rip), %rax
141 movl $2, %fs:(%rax)
142 xorl %eax, %eax
144 .size __opendirat, .-__opendirat
145 .p2align 4,,15
146 .globl __opendir
147 .hidden __opendir
148 .type __opendir, @function
149 __opendir:
150 cmpb $0, (%rdi)
151 je .L31
152 subq $8, %rsp
153 movl $591872, %esi
154 xorl %eax, %eax
155 call __open_nocancel
156 addq $8, %rsp
157 movl %eax, %edi
158 jmp opendir_tail
159 .p2align 4,,10
160 .p2align 3
161 .L31:
162 movq __libc_errno@gottpoff(%rip), %rax
163 movl $2, %fs:(%rax)
164 xorl %eax, %eax
166 .size __opendir, .-__opendir
167 .weak opendir
168 .set opendir,__opendir
169 .hidden __open_nocancel
170 .hidden __openat_nocancel
171 .hidden __fstat64
172 .hidden __close_nocancel
173 .hidden __fcntl64_nocancel