clarify the purpose of this project
[nyanglibc.git] / dirent / readdir64_r.s
blob5cc93e4eda35d472c201016377f83f65502806e2
1 .text
2 .p2align 4,,15
3 .globl __readdir64_r
4 .type __readdir64_r, @function
5 __readdir64_r:
6 pushq %r15
7 pushq %r14
8 pushq %r13
9 pushq %r12
10 movq %rdx, %r13
11 pushq %rbp
12 pushq %rbx
13 movq %rdi, %r12
14 movq %rsi, %rbp
15 subq $24, %rsp
16 movq __libc_errno@gottpoff(%rip), %rax
17 movl %fs:(%rax), %eax
18 movl %eax, 4(%rsp)
19 #APP
20 # 38 "../sysdeps/unix/sysv/linux/readdir64_r.c" 1
21 movl %fs:24,%eax
22 # 0 "" 2
23 #NO_APP
24 leaq 4(%rdi), %rbx
25 testl %eax, %eax
26 movq %rbx, 8(%rsp)
27 jne .L2
28 movl $1, %edx
29 #APP
30 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
31 cmpxchgl %edx, 4(%rdi)
32 # 0 "" 2
33 #NO_APP
34 .L3:
35 movq 24(%r12), %r14
36 leaq 48(%r12), %rbx
37 .p2align 4,,10
38 .p2align 3
39 .L4:
40 cmpq %r14, 16(%r12)
41 leaq 48(%r14), %rsi
42 jbe .L30
43 .L6:
44 leaq (%r12,%rsi), %r15
45 movzwl 16(%r15), %eax
46 movq 8(%r15), %rdx
47 movq %rdx, 32(%r12)
48 addq %rax, %r14
49 cmpq $275, %rax
50 movq %r14, 24(%r12)
51 jbe .L12
52 leaq 19(%r15), %rdi
53 call strlen
54 cmpq $255, %rax
55 ja .L13
56 addq $20, %rax
57 .L12:
58 cmpq $0, (%r15)
59 je .L4
60 cmpl $8, %eax
61 movl %eax, %ecx
62 jb .L31
63 movq (%r15), %rdx
64 leaq 8(%rbp), %rdi
65 movq %r15, %rsi
66 andq $-8, %rdi
67 movq %rdx, 0(%rbp)
68 movl %eax, %edx
69 movq -8(%r15,%rdx), %rcx
70 movq %rcx, -8(%rbp,%rdx)
71 movq %rbp, %rcx
72 subq %rdi, %rcx
73 subq %rcx, %rsi
74 addl %eax, %ecx
75 shrl $3, %ecx
76 rep movsq
77 .L16:
78 movq %rbp, 0(%r13)
79 xorl %r9d, %r9d
80 movw %ax, 16(%rbp)
81 .L11:
82 #APP
83 # 115 "../sysdeps/unix/sysv/linux/readdir64_r.c" 1
84 movl %fs:24,%eax
85 # 0 "" 2
86 #NO_APP
87 testl %eax, %eax
88 jne .L19
89 subl $1, 4(%r12)
90 .L1:
91 addq $24, %rsp
92 movl %r9d, %eax
93 popq %rbx
94 popq %rbp
95 popq %r12
96 popq %r13
97 popq %r14
98 popq %r15
99 ret
100 .p2align 4,,10
101 .p2align 3
102 .L30:
103 movq 8(%r12), %rdx
104 movl (%r12), %edi
105 movq %rbx, %rsi
106 call __getdents64
107 cmpq $0, %rax
108 jle .L32
109 movq %rax, 16(%r12)
110 movl $48, %esi
111 xorl %r14d, %r14d
112 jmp .L6
113 .p2align 4,,10
114 .p2align 3
115 .L13:
116 movl $36, 40(%r12)
117 movq $0, (%r15)
118 jmp .L4
119 .p2align 4,,10
120 .p2align 3
121 .L31:
122 testb $4, %al
123 jne .L33
124 testl %ecx, %ecx
125 je .L16
126 movzbl (%r15), %edx
127 testb $2, %cl
128 movb %dl, 0(%rbp)
129 je .L16
130 movzwl -2(%r15,%rcx), %edx
131 movw %dx, -2(%rbp,%rcx)
132 jmp .L16
133 .p2align 4,,10
134 .p2align 3
135 .L32:
136 jne .L8
137 .L28:
138 movl 40(%r12), %r9d
139 .L9:
140 movq $0, 0(%r13)
141 jmp .L11
142 .L8:
143 movq __libc_errno@gottpoff(%rip), %rax
144 movl %fs:(%rax), %r9d
145 cmpl $2, %r9d
146 je .L34
147 movl %r9d, 40(%r12)
148 jmp .L9
149 .L19:
150 xorl %eax, %eax
151 #APP
152 # 115 "../sysdeps/unix/sysv/linux/readdir64_r.c" 1
153 xchgl %eax, 4(%r12)
154 # 0 "" 2
155 #NO_APP
156 cmpl $1, %eax
157 jle .L1
158 xorl %r10d, %r10d
159 movl $1, %edx
160 movl $129, %esi
161 movq 8(%rsp), %rdi
162 movl $202, %eax
163 #APP
164 # 115 "../sysdeps/unix/sysv/linux/readdir64_r.c" 1
165 syscall
167 # 0 "" 2
168 #NO_APP
169 jmp .L1
170 .L2:
171 leaq 4(%rdi), %rbx
172 xorl %eax, %eax
173 movl $1, %edx
174 lock cmpxchgl %edx, (%rbx)
175 je .L3
176 movq %rbx, %rdi
177 call __lll_lock_wait_private
178 jmp .L3
179 .L33:
180 movl (%r15), %edx
181 movl %edx, 0(%rbp)
182 movl -4(%r15,%rcx), %edx
183 movl %edx, -4(%rbp,%rcx)
184 jmp .L16
185 .L34:
186 movl 4(%rsp), %ebx
187 movl %ebx, %fs:(%rax)
188 jmp .L28
189 .size __readdir64_r, .-__readdir64_r
190 .weak readdir64_r
191 .set readdir64_r,__readdir64_r
192 .weak readdir_r
193 .set readdir_r,__readdir64_r
194 .globl __readdir_r
195 .set __readdir_r,__readdir64_r
196 .hidden __lll_lock_wait_private
197 .hidden __getdents64
198 .hidden strlen