clarify the purpose of this project
[nyanglibc.git] / stdio-common / reg-modifier.shared.s
blob642f8eb42bcb2a3b87d7f7edc79c5b4371ada683
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 #NO_APP
7 .section __libc_freeres_fn,"ax",@progbits
8 .p2align 4,,15
9 .type free_mem, @function
10 free_mem:
11 movq __printf_modifier_table(%rip), %rax
12 testq %rax, %rax
13 je .L1
14 pushq %rbp
15 pushq %rbx
16 xorl %ebp, %ebp
17 subq $8, %rsp
18 .p2align 4,,10
19 .p2align 3
20 .L5:
21 movq (%rax,%rbp), %rdi
22 testq %rdi, %rdi
23 je .L3
24 .p2align 4,,10
25 .p2align 3
26 .L4:
27 movq (%rdi), %rbx
28 call free@PLT
29 testq %rbx, %rbx
30 movq %rbx, %rdi
31 jne .L4
32 movq __printf_modifier_table(%rip), %rax
33 .L3:
34 addq $8, %rbp
35 cmpq $2040, %rbp
36 jne .L5
37 addq $8, %rsp
38 movq %rax, %rdi
39 popq %rbx
40 popq %rbp
41 jmp free@PLT
42 .L1:
43 rep ret
44 .size free_mem, .-free_mem
45 .text
46 .p2align 4,,15
47 .globl __register_printf_modifier
48 .type __register_printf_modifier, @function
49 __register_printf_modifier:
50 pushq %r12
51 pushq %rbp
52 pushq %rbx
53 movl (%rdi), %eax
54 subl $1, %eax
55 cmpl $254, %eax
56 ja .L17
57 movq %rdi, %rbx
58 jmp .L16
59 .p2align 4,,10
60 .p2align 3
61 .L19:
62 cmpl $255, %edx
63 ja .L17
64 .L16:
65 addq $4, %rbx
66 movl (%rbx), %edx
67 testl %edx, %edx
68 jne .L19
69 movl next_bit(%rip), %eax
70 subl $16, %eax
71 cmpl $7, %eax
72 jbe .L35
73 movq %rdi, %rbp
74 #APP
75 # 65 "reg-modifier.c" 1
76 movl %fs:24,%eax
77 # 0 "" 2
78 #NO_APP
79 testl %eax, %eax
80 jne .L21
81 movl $1, %edx
82 #APP
83 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
84 cmpxchgl %edx, lock(%rip)
85 # 0 "" 2
86 #NO_APP
87 .L22:
88 cmpq $0, __printf_modifier_table(%rip)
89 je .L23
90 .L26:
91 subq %rbp, %rbx
92 leaq 16(%rbx), %rdi
93 call malloc@PLT
94 testq %rax, %rax
95 movq %rax, %r12
96 je .L24
97 movzbl 0(%rbp), %edx
98 movq __printf_modifier_table(%rip), %rax
99 sarq $2, %rbx
100 movl next_bit(%rip), %ecx
101 leaq 4(%rbp), %rsi
102 leaq 12(%r12), %rdi
103 movq (%rax,%rdx,8), %rax
104 movq %rbx, %rdx
105 movq %rax, (%r12)
106 leal 1(%rcx), %eax
107 movl %eax, next_bit(%rip)
108 movl $1, %eax
109 sall %cl, %eax
110 movl %eax, 8(%r12)
111 call __wmemcpy
112 movzbl 0(%rbp), %edx
113 movq __printf_modifier_table(%rip), %rax
114 movl 8(%r12), %r8d
115 movq %r12, (%rax,%rdx,8)
116 .L27:
117 #APP
118 # 92 "reg-modifier.c" 1
119 movl %fs:24,%eax
120 # 0 "" 2
121 #NO_APP
122 testl %eax, %eax
123 jne .L28
124 subl $1, lock(%rip)
125 .L15:
126 popq %rbx
127 movl %r8d, %eax
128 popq %rbp
129 popq %r12
131 .p2align 4,,10
132 .p2align 3
133 .L17:
134 movq __libc_errno@gottpoff(%rip), %rax
135 movl $-1, %r8d
136 movl $22, %fs:(%rax)
137 movl %r8d, %eax
138 popq %rbx
139 popq %rbp
140 popq %r12
142 .p2align 4,,10
143 .p2align 3
144 .L23:
145 movl $8, %esi
146 movl $255, %edi
147 call calloc@PLT
148 testq %rax, %rax
149 movq %rax, __printf_modifier_table(%rip)
150 jne .L26
151 .p2align 4,,10
152 .p2align 3
153 .L24:
154 movl $-1, %r8d
155 jmp .L27
156 .L28:
157 xorl %eax, %eax
158 #APP
159 # 92 "reg-modifier.c" 1
160 xchgl %eax, lock(%rip)
161 # 0 "" 2
162 #NO_APP
163 cmpl $1, %eax
164 jle .L15
165 xorl %r10d, %r10d
166 movl $1, %edx
167 movl $129, %esi
168 leaq lock(%rip), %rdi
169 movl $202, %eax
170 #APP
171 # 92 "reg-modifier.c" 1
172 syscall
174 # 0 "" 2
175 #NO_APP
176 jmp .L15
177 .p2align 4,,10
178 .p2align 3
179 .L21:
180 movl $1, %ecx
181 movl %edx, %eax
182 lock cmpxchgl %ecx, lock(%rip)
183 je .L22
184 leaq lock(%rip), %rdi
185 call __lll_lock_wait_private
186 jmp .L22
187 .L35:
188 movq __libc_errno@gottpoff(%rip), %rax
189 movl $-1, %r8d
190 movl $28, %fs:(%rax)
191 jmp .L15
192 .size __register_printf_modifier, .-__register_printf_modifier
193 .weak register_printf_modifier
194 .set register_printf_modifier,__register_printf_modifier
195 .p2align 4,,15
196 .globl __handle_registered_modifier_mb
197 .hidden __handle_registered_modifier_mb
198 .type __handle_registered_modifier_mb, @function
199 __handle_registered_modifier_mb:
200 movq (%rdi), %r11
201 movq __printf_modifier_table(%rip), %rax
202 movzbl (%r11), %edx
203 movq (%rax,%rdx,8), %r9
204 testq %r9, %r9
205 je .L45
206 pushq %r14
207 pushq %r13
208 xorl %r14d, %r14d
209 pushq %r12
210 pushq %rbp
211 xorl %r12d, %r12d
212 pushq %rbx
213 movzbl 1(%r11), %ebp
214 leaq 1(%r11), %rbx
215 xorl %r13d, %r13d
216 movl %ebp, %r10d
217 .p2align 4,,10
218 .p2align 3
219 .L43:
220 testb %r10b, %r10b
221 leaq 12(%r9), %r8
222 movl 12(%r9), %edx
223 je .L46
224 testl %edx, %edx
225 je .L47
226 cmpl %ebp, %edx
227 jne .L40
228 movq %rbx, %rcx
229 jmp .L41
230 .p2align 4,,10
231 .p2align 3
232 .L58:
233 testl %edx, %edx
234 je .L44
235 cmpl %edx, %eax
236 jne .L40
237 .L41:
238 addq $1, %rcx
239 movzbl (%rcx), %eax
240 addq $4, %r8
241 movl (%r8), %edx
242 testb %al, %al
243 jne .L58
244 .L38:
245 testl %edx, %edx
246 je .L44
247 .p2align 4,,10
248 .p2align 3
249 .L40:
250 movq (%r9), %r9
251 testq %r9, %r9
252 jne .L43
253 testl %r13d, %r13d
254 movl $1, %eax
255 je .L36
256 orw %r13w, 14(%rsi)
257 xorl %eax, %eax
258 movq %r14, (%rdi)
259 .L36:
260 popq %rbx
261 popq %rbp
262 popq %r12
263 popq %r13
264 popq %r14
266 .L47:
267 movq %rbx, %rcx
268 .p2align 4,,10
269 .p2align 3
270 .L44:
271 movq %rcx, %rax
272 movslq %r12d, %rdx
273 subq %r11, %rax
274 cmpq %rdx, %rax
275 jle .L40
276 movl %eax, %r12d
277 movl 8(%r9), %r13d
278 movq %rcx, %r14
279 jmp .L40
280 .L46:
281 movq %rbx, %rcx
282 jmp .L38
283 .L45:
284 movl $1, %eax
286 .size __handle_registered_modifier_mb, .-__handle_registered_modifier_mb
287 .p2align 4,,15
288 .globl __handle_registered_modifier_wc
289 .hidden __handle_registered_modifier_wc
290 .type __handle_registered_modifier_wc, @function
291 __handle_registered_modifier_wc:
292 movq (%rdi), %r11
293 movq __printf_modifier_table(%rip), %rax
294 movl (%r11), %edx
295 movq (%rax,%rdx,8), %r9
296 testq %r9, %r9
297 je .L68
298 pushq %r13
299 pushq %r12
300 xorl %r13d, %r13d
301 pushq %rbp
302 pushq %rbx
303 leaq 4(%r11), %rbx
304 movl 4(%r11), %r10d
305 xorl %ebp, %ebp
306 xorl %r12d, %r12d
307 .p2align 4,,10
308 .p2align 3
309 .L66:
310 testl %r10d, %r10d
311 leaq 12(%r9), %rcx
312 movl 12(%r9), %eax
313 je .L69
314 testl %eax, %eax
315 je .L70
316 cmpl %r10d, %eax
317 jne .L63
318 movq %rbx, %rdx
319 jmp .L64
320 .p2align 4,,10
321 .p2align 3
322 .L81:
323 testl %eax, %eax
324 je .L67
325 cmpl %r8d, %eax
326 jne .L63
327 .L64:
328 addq $4, %rdx
329 movl (%rdx), %r8d
330 addq $4, %rcx
331 movl (%rcx), %eax
332 testl %r8d, %r8d
333 jne .L81
334 .L61:
335 testl %eax, %eax
336 je .L67
337 .p2align 4,,10
338 .p2align 3
339 .L63:
340 movq (%r9), %r9
341 testq %r9, %r9
342 jne .L66
343 testl %r12d, %r12d
344 movl $1, %eax
345 je .L59
346 orw %r12w, 14(%rsi)
347 xorl %eax, %eax
348 movq %r13, (%rdi)
349 .L59:
350 popq %rbx
351 popq %rbp
352 popq %r12
353 popq %r13
355 .L70:
356 movq %rbx, %rdx
357 .p2align 4,,10
358 .p2align 3
359 .L67:
360 movq %rdx, %rax
361 movslq %ebp, %rcx
362 subq %r11, %rax
363 sarq $2, %rax
364 cmpq %rcx, %rax
365 jle .L63
366 movl %eax, %ebp
367 movl 8(%r9), %r12d
368 movq %rdx, %r13
369 jmp .L63
370 .L69:
371 movq %rbx, %rdx
372 jmp .L61
373 .L68:
374 movl $1, %eax
376 .size __handle_registered_modifier_wc, .-__handle_registered_modifier_wc
377 .section __libc_subfreeres,"aw",@progbits
378 .align 8
379 .type __elf_set___libc_subfreeres_element_free_mem__, @object
380 .size __elf_set___libc_subfreeres_element_free_mem__, 8
381 __elf_set___libc_subfreeres_element_free_mem__:
382 .quad free_mem
383 .local next_bit
384 .comm next_bit,4,4
385 .local lock
386 .comm lock,4,4
387 .hidden __printf_modifier_table
388 .comm __printf_modifier_table,8,8
389 .hidden __lll_lock_wait_private
390 .hidden __wmemcpy