clarify the purpose of this project
[nyanglibc.git] / locale / loadarchive.s.in
blobb27d4ad39299684355a6e57c18406f622699de0d
1 .text
2 .section .rodata.str1.1,"aMS",@progbits,1
3 .LC0:
4 .string "loadarchive.c"
5 .section .rodata.str1.8,"aMS",@progbits,1
6 .align 8
7 .LC1:
8 .string "headmap.len == archive_stat.st_size"
9 .text
10 .p2align 4,,15
11 .globl _nl_load_locale_from_archive
12 .hidden _nl_load_locale_from_archive
13 .type _nl_load_locale_from_archive, @function
14 _nl_load_locale_from_archive:
15 pushq %rbp
16 movq %rsp, %rbp
17 pushq %r15
18 pushq %r14
19 pushq %r13
20 pushq %r12
21 movq %rsi, %r13
22 pushq %rbx
23 subq $264, %rsp
24 movl %edi, -288(%rbp)
25 movl $30, %edi
26 movq (%rsi), %rbx
27 call __sysconf
28 movq archloaded(%rip), %r14
29 testq %r14, %r14
30 jne .L7
31 jmp .L2
32 .p2align 4,,10
33 .p2align 3
34 .L75:
35 movq %r15, %rsi
36 movq %rbx, %rdi
37 call strcmp
38 testl %eax, %eax
39 je .L74
40 movq (%r14), %r14
41 testq %r14, %r14
42 je .L2
43 .L7:
44 movq 8(%r14), %r15
45 cmpq %rbx, %r15
46 jne .L75
47 .L3:
48 movslq -288(%rbp), %r12
49 movq %rbx, 0(%r13)
50 movq 16(%r14,%r12,8), %rax
51 .L1:
52 leaq -40(%rbp), %rsp
53 popq %rbx
54 popq %r12
55 popq %r13
56 popq %r14
57 popq %r15
58 popq %rbp
59 ret
60 .p2align 4,,10
61 .p2align 3
62 .L2:
63 movl $46, %esi
64 movq %rbx, %rdi
65 call strchr
66 testq %rax, %rax
67 je .L8
68 testb $-65, 1(%rax)
69 jne .L76
70 .L8:
71 cmpq $0, archmapped(%rip)
72 je .L12
73 movq headmap(%rip), %r14
74 testq %r14, %r14
75 je .L72
76 .L14:
77 movq %rbx, %rdi
78 call strlen
79 testq %rax, %rax
80 movl %eax, %r9d
81 je .L32
82 movq %rbx, %rdx
83 addq %rbx, %rax
84 .p2align 4,,10
85 .p2align 3
86 .L19:
87 movzbl (%rdx), %ecx
88 roll $9, %r9d
89 addq $1, %rdx
90 addl %ecx, %r9d
91 cmpq %rax, %rdx
92 jne .L19
93 testl %r9d, %r9d
94 movl %r9d, %ecx
95 je .L32
96 .L18:
97 movl 8(%r14), %eax
98 movl 16(%r14), %esi
99 cmpl $2, %esi
100 movq %rax, -296(%rbp)
101 jbe .L72
102 movl %esi, %r10d
103 movq %rcx, %rax
104 xorl %edx, %edx
105 divq %r10
106 subl $2, %esi
107 movq %rcx, %rax
108 movq %rdx, %r8
109 xorl %edx, %edx
110 divq %rsi
111 addq $1, %rdx
112 leaq (%rdx,%rdx,2), %r11
113 leaq 0(,%r11,4), %r12
114 .L23:
115 movq -296(%rbp), %rcx
116 leaq (%r8,%r8,2), %rax
117 leaq (%rcx,%rax,4), %rcx
118 leaq (%r14,%rcx), %r15
119 jmp .L22
120 .p2align 4,,10
121 .p2align 3
122 .L20:
123 addq %rdx, %r8
124 addq %r12, %r15
125 cmpq %r8, %r10
126 jbe .L77
127 .L22:
128 movl 4(%r15), %esi
129 testl %esi, %esi
130 je .L72
131 cmpl %r9d, (%r15)
132 jne .L20
133 addq %r14, %rsi
134 movq %rbx, %rdi
135 movl %r9d, -284(%rbp)
136 movq %rdx, -280(%rbp)
137 movq %r8, -272(%rbp)
138 movq %r10, -264(%rbp)
139 call strcmp
140 testl %eax, %eax
141 movq -264(%rbp), %r10
142 movq -272(%rbp), %r8
143 movq -280(%rbp), %rdx
144 movl -284(%rbp), %r9d
145 jne .L20
146 movl 8(%r15), %eax
147 testl %eax, %eax
148 je .L72
149 leaq (%r14,%rax), %rdi
150 movl 12+headmap(%rip), %eax
151 cmpq 48+archive_stat(%rip), %rax
152 movq %rax, %r9
153 jne .L24
154 leaq -256(%rbp), %r15
155 xorl %edx, %edx
156 movq %r15, %rcx
157 jmp .L25
158 .p2align 4,,10
159 .p2align 3
160 .L26:
161 addq $1, %rdx
162 addq $16, %rcx
163 .L25:
164 cmpq $6, %rdx
165 je .L26
166 movl 4(%rdi,%rdx,8), %eax
167 movl 8(%rdi,%rdx,8), %esi
168 leal (%rax,%rsi), %r8d
169 cmpl %r8d, %r9d
170 jb .L72
171 addq %r14, %rax
172 cmpl $12, %edx
173 movq %rax, (%rcx)
174 movl %esi, %eax
175 movq %rax, 8(%rcx)
176 jne .L26
177 movl $120, %edi
178 call malloc@PLT
179 testq %rax, %rax
180 movq %rax, %r14
181 je .L72
182 movq 0(%r13), %rdi
183 call __strdup
184 testq %rax, %rax
185 movq %rax, 8(%r14)
186 je .L78
187 movq archloaded(%rip), %rax
188 xorl %ebx, %ebx
189 movq %r14, archloaded(%rip)
190 movq %rax, (%r14)
191 jmp .L30
192 .p2align 4,,10
193 .p2align 3
194 .L28:
195 addq $1, %rbx
196 addq $16, %r15
197 .L30:
198 cmpq $6, %rbx
199 je .L28
200 movq 8(%r15), %rdx
201 movq (%r15), %rsi
202 movl %ebx, %edi
203 call _nl_intern_locale_data
204 testq %rax, %rax
205 movq %rax, 16(%r14,%rbx,8)
206 je .L29
207 movq 8(%r14), %rdx
208 movl $2, 24(%rax)
209 movl $-1, 48(%rax)
210 movq %rdx, (%rax)
211 .L29:
212 cmpl $12, %ebx
213 jne .L28
214 movslq -288(%rbp), %r12
215 movq 8(%r14), %rax
216 movq %rax, 0(%r13)
217 movq 16(%r14,%r12,8), %rax
218 jmp .L1
219 .p2align 4,,10
220 .p2align 3
221 .L74:
222 movq %r15, %rbx
223 jmp .L3
224 .L78:
225 movq %r14, %rdi
226 call free@PLT
227 .L72:
228 leaq -40(%rbp), %rsp
229 xorl %eax, %eax
230 popq %rbx
231 popq %r12
232 popq %r13
233 popq %r14
234 popq %r15
235 popq %rbp
237 .p2align 4,,10
238 .p2align 3
239 .L32:
240 movl $4294967295, %ecx
241 movl $-1, %r9d
242 jmp .L18
243 .L76:
244 leaq 1(%rax), %r14
245 movl $64, %esi
246 movq %r14, %rdi
247 call __strchrnul@PLT
248 movq %rax, %r15
249 movq %r14, %rdi
250 movq %rax, -264(%rbp)
251 subq %r14, %r15
252 movq %r15, %rsi
253 call _nl_normalize_codeset@PLT
254 testq %rax, %rax
255 movq %rax, %r12
256 je .L72
257 movq %r15, %rdx
258 movq %r14, %rsi
259 movq %rax, %rdi
260 call strncmp
261 testl %eax, %eax
262 jne .L10
263 cmpb $0, (%r12,%r15)
264 je .L11
265 .L10:
266 movq %r12, %rdi
267 call strlen
268 movq -264(%rbp), %rdi
269 movq %rax, %r15
270 call strlen
271 movq %r14, %rdx
272 leaq 1(%rax), %r8
273 movq %rbx, %rsi
274 subq %rbx, %rdx
275 leaq (%rdx,%r15), %rax
276 movq %r8, -272(%rbp)
277 leaq 30(%r8,%rax), %rax
278 andq $-16, %rax
279 subq %rax, %rsp
280 leaq 15(%rsp), %r14
281 andq $-16, %r14
282 movq %r14, %rdi
283 movq %r14, %rbx
284 call __mempcpy@PLT
285 movq %r15, %rdx
286 movq %r12, %rsi
287 movq %rax, %rdi
288 call __mempcpy@PLT
289 movq -272(%rbp), %r8
290 movq -264(%rbp), %rsi
291 movq %rax, %rdi
292 movq %r8, %rdx
293 call memcpy@PLT
294 .L11:
295 movq %r12, %rdi
296 call free@PLT
297 jmp .L8
298 .p2align 4,,10
299 .p2align 3
300 .L77:
301 subq %r10, %r8
302 jmp .L23
303 .L12:
304 leaq headmap(%rip), %rax
305 leaq archfname(%rip), %rdi
306 movl $524288, %esi
307 movq %rax, archmapped(%rip)
308 xorl %eax, %eax
309 call __open_nocancel
310 testl %eax, %eax
311 movl %eax, %r15d
312 js .L72
313 leaq archive_stat(%rip), %rsi
314 movl %eax, %edi
315 call __fstat64
316 cmpl $-1, %eax
317 jne .L79
318 .L17:
319 movl %r15d, %edi
320 call __close_nocancel
321 leaq -40(%rbp), %rsp
322 xorl %eax, %eax
323 popq %rbx
324 popq %r12
325 popq %r13
326 popq %r14
327 popq %r15
328 popq %rbp
330 .L79:
331 movq 48+archive_stat(%rip), %r12
332 xorl %r9d, %r9d
333 xorl %edi, %edi
334 movl %r15d, %r8d
335 movl $2, %ecx
336 movl $1, %edx
337 movq %r12, %rsi
338 call __mmap64
339 cmpq $-1, %rax
340 movq %rax, %r14
341 je .L17
342 movl 16(%rax), %eax
343 leaq (%rax,%rax,2), %rdx
344 movl 8(%r14), %eax
345 leaq (%rax,%rdx,4), %rax
346 movl 36(%r14), %edx
347 leaq (%rdx,%rdx,2), %rdx
348 leaq (%rdx,%rdx,8), %rcx
349 movl 32(%r14), %edx
350 leaq (%rdx,%rcx,4), %rdx
351 cmpq %rdx, %rax
352 cmovl %rdx, %rax
353 movl 24(%r14), %edx
354 addl 20(%r14), %edx
355 cmpq %rdx, %rax
356 cmovl %rdx, %rax
357 cmpq %rax, %r12
358 jnb .L16
359 movq %r12, %rsi
360 movq %r14, %rdi
361 call __munmap
362 jmp .L17
363 .L16:
364 movl %r15d, %edi
365 call __close_nocancel
366 movq %r14, headmap(%rip)
367 movl %r12d, 12+headmap(%rip)
368 jmp .L14
369 .L24:
370 leaq __PRETTY_FUNCTION__.9440(%rip), %rcx
371 leaq .LC0(%rip), %rsi
372 leaq .LC1(%rip), %rdi
373 movl $310, %edx
374 call __assert_fail
375 .size _nl_load_locale_from_archive, .-_nl_load_locale_from_archive
376 .section .rodata.str1.1
377 .LC2:
378 .string "archmapped == &headmap"
379 .section __libc_freeres_fn,"ax",@progbits
380 .p2align 4,,15
381 .globl _nl_archive_subfreeres
382 .hidden _nl_archive_subfreeres
383 .type _nl_archive_subfreeres, @function
384 _nl_archive_subfreeres:
385 pushq %r12
386 pushq %rbp
387 movq archloaded(%rip), %rbp
388 pushq %rbx
389 testq %rbp, %rbp
390 je .L81
391 .p2align 4,,10
392 .p2align 3
393 .L85:
394 movq 8(%rbp), %rdi
395 movq 0(%rbp), %r12
396 xorl %ebx, %ebx
397 call free@PLT
398 jmp .L89
399 .p2align 4,,10
400 .p2align 3
401 .L82:
402 addq $1, %rbx
403 .L89:
404 cmpq $6, %rbx
405 je .L82
406 movq 16(%rbp,%rbx,8), %rdi
407 testq %rdi, %rdi
408 je .L83
409 movq 32(%rdi), %rax
410 testq %rax, %rax
411 je .L84
412 call *%rax
413 movq 16(%rbp,%rbx,8), %rdi
414 .L84:
415 call free@PLT
416 .L83:
417 cmpl $12, %ebx
418 jne .L82
419 movq %rbp, %rdi
420 movq %r12, %rbp
421 call free@PLT
422 testq %r12, %r12
423 jne .L85
424 .L81:
425 movq archmapped(%rip), %rbx
426 movq $0, archloaded(%rip)
427 testq %rbx, %rbx
428 je .L80
429 leaq headmap(%rip), %rax
430 cmpq %rax, %rbx
431 jne .L111
432 movl 12(%rbx), %esi
433 movq (%rbx), %rdi
434 movq $0, archmapped(%rip)
435 call __munmap
436 movq 16(%rbx), %rbx
437 testq %rbx, %rbx
438 je .L80
439 .p2align 4,,10
440 .p2align 3
441 .L88:
442 movl 12(%rbx), %esi
443 movq (%rbx), %rdi
444 movq 16(%rbx), %rbp
445 call __munmap
446 movq %rbx, %rdi
447 movq %rbp, %rbx
448 call free@PLT
449 testq %rbp, %rbp
450 jne .L88
451 .L80:
452 popq %rbx
453 popq %rbp
454 popq %r12
456 .L111:
457 leaq __PRETTY_FUNCTION__.9480(%rip), %rcx
458 leaq .LC0(%rip), %rsi
459 leaq .LC2(%rip), %rdi
460 movl $534, %edx
461 call __assert_fail
462 .size _nl_archive_subfreeres, .-_nl_archive_subfreeres
463 .section .rodata.str1.16,"aMS",@progbits,1
464 .align 16
465 .type __PRETTY_FUNCTION__.9480, @object
466 .size __PRETTY_FUNCTION__.9480, 23
467 __PRETTY_FUNCTION__.9480:
468 .string "_nl_archive_subfreeres"
469 .align 16
470 .type __PRETTY_FUNCTION__.9440, @object
471 .size __PRETTY_FUNCTION__.9440, 29
472 __PRETTY_FUNCTION__.9440:
473 .string "_nl_load_locale_from_archive"
474 .local archloaded
475 .comm archloaded,8,8
476 .local archive_stat
477 .comm archive_stat,144,32
478 .local headmap
479 .comm headmap,24,16
480 .local archmapped
481 .comm archmapped,8,8
482 .section .rodata.str1.32,"aMS",@progbits,1
483 .align 32
484 .type archfname, @object
485 archfname:
486 .string "CONF_PREFIX/lib/locale/locale-archive"
487 .size archfname, .-archfname
488 .hidden __assert_fail
489 .hidden __munmap
490 .hidden __mmap64
491 .hidden __close_nocancel
492 .hidden __fstat64
493 .hidden __open_nocancel
494 .hidden strncmp
495 .hidden _nl_intern_locale_data
496 .hidden __strdup
497 .hidden strlen
498 .hidden strchr
499 .hidden strcmp
500 .hidden __sysconf