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