clarify the purpose of this project
[nyanglibc.git] / misc / getsysstats.shared.s
blob45cdcaff516579934001a6d629987978ee94f818
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 .section .rodata.str1.8,"aMS",@progbits,1
7 .align 8
8 .LC0:
9 .string "../sysdeps/unix/sysv/linux/getsysstats.c"
10 .section .rodata.str1.1,"aMS",@progbits,1
11 .LC1:
12 .string "*cp <= *re"
13 #NO_APP
14 .text
15 .p2align 4,,15
16 .type next_line, @function
17 next_line:
18 .LFB75:
20 pushq %r15
21 pushq %r14
22 movq %rdx, %r15
23 pushq %r13
24 pushq %r12
25 movq %rsi, %r14
26 pushq %rbp
27 pushq %rbx
28 movl $10, %esi
29 movq %rcx, %rbx
30 subq $24, %rsp
31 movq (%rcx), %r13
32 movq (%rdx), %r12
33 movl %edi, 12(%rsp)
34 movq %r8, (%rsp)
35 movq %r13, %rbp
36 movq %r12, %rdi
37 subq %r12, %rbp
38 movq %rbp, %rdx
39 call __GI_memchr
40 testq %rax, %rax
41 movq (%rsp), %r8
42 je .L18
43 .L2:
44 addq $1, %rax
45 movq %rax, (%r15)
46 movq (%rbx), %rdx
47 cmpq %rdx, %rax
48 ja .L19
49 cmpq %r12, %rdx
50 je .L7
51 .L1:
52 addq $24, %rsp
53 movq %r12, %rax
54 popq %rbx
55 popq %rbp
56 popq %r12
57 popq %r13
58 popq %r14
59 popq %r15
60 ret
61 .p2align 4,,10
62 .p2align 3
63 .L18:
64 cmpq %r14, %r12
65 je .L3
66 cmpq %r8, %r13
67 je .L20
68 .L3:
69 leaq -1(%r13), %rax
70 jmp .L2
71 .p2align 4,,10
72 .p2align 3
73 .L20:
74 movq %rbp, %rdx
75 movq %r12, %rsi
76 movq %r14, %rdi
77 call __GI_memmove
78 movq (%rbx), %rax
79 movl 12(%rsp), %edi
80 movq %r13, %rdx
81 addq %r14, %rax
82 subq (%r15), %rax
83 movq %rax, (%rbx)
84 movq %r14, (%r15)
85 movq (%rbx), %rsi
86 subq %rsi, %rdx
87 call __GI___read_nocancel
88 testq %rax, %rax
89 js .L7
90 addq (%rbx), %rax
91 movl $10, %esi
92 movq %rax, (%rbx)
93 movq (%r15), %r12
94 movq %rax, %rdx
95 movq %rax, %rbp
96 movq %rax, (%rsp)
97 subq %r12, %rdx
98 movq %r12, %rdi
99 call __GI_memchr
100 testq %rax, %rax
101 jne .L2
102 cmpq %rbp, %r13
103 movq %rbp, %rcx
104 jne .L13
105 movq %rbp, %rax
106 subq %r14, %rax
107 leaq (%rax,%rax,2), %rax
108 leaq 3(%rax), %rbp
109 testq %rax, %rax
110 cmovns %rax, %rbp
111 sarq $2, %rbp
112 addq %r14, %rbp
113 subq %rbp, %rcx
114 movq %rcx, %r14
115 jmp .L9
116 .p2align 4,,10
117 .p2align 3
118 .L23:
119 movq (%rbx), %r12
120 movq %rax, %rdx
121 movl $10, %esi
122 movq %r12, %rdi
123 call __GI_memchr
124 movb $10, (%r12)
125 addq (%rbx), %r13
126 testq %rax, %rax
127 movq %r13, (%rbx)
128 jne .L21
129 cmpq %r13, (%rsp)
130 jne .L22
131 .L9:
132 movl 12(%rsp), %edi
133 movq %rbp, (%rbx)
134 movq %r14, %rdx
135 movq %rbp, %rsi
136 call __GI___read_nocancel
137 testq %rax, %rax
138 movq %rax, %r13
139 jns .L23
140 .L7:
141 xorl %r12d, %r12d
142 jmp .L1
143 .p2align 4,,10
144 .p2align 3
145 .L21:
146 movq (%r15), %r12
147 jmp .L2
148 .L22:
149 movq (%r15), %r12
150 jmp .L3
151 .L13:
152 movq (%rsp), %r13
153 jmp .L3
154 .L19:
155 leaq __PRETTY_FUNCTION__.10848(%rip), %rcx
156 leaq .LC0(%rip), %rsi
157 leaq .LC1(%rip), %rdi
158 movl $119, %edx
159 call __GI___assert_fail
160 .LFE75:
161 .size next_line, .-next_line
162 .p2align 4,,15
163 .type sysinfo_mempages, @function
164 sysinfo_mempages:
165 .LFB78:
167 pushq %rbp
168 pushq %rbx
169 movq %rdi, %rbp
170 movl %esi, %ebx
171 subq $8, %rsp
172 call __GI___getpagesize
173 movslq %eax, %rdx
174 cmpq $1, %rdx
175 jbe .L25
176 cmpl $1, %ebx
177 ja .L26
178 jmp .L25
179 .p2align 4,,10
180 .p2align 3
181 .L42:
182 cmpq $1, %rdx
183 jbe .L25
184 .L26:
185 shrl %ebx
186 shrq %rdx
187 cmpl $1, %ebx
188 ja .L42
189 .L25:
190 movl %ebx, %eax
191 imulq %rbp, %rax
192 cmpq $1, %rdx
193 jbe .L28
194 .p2align 4,,10
195 .p2align 3
196 .L29:
197 shrq %rdx
198 shrq %rax
199 cmpq $1, %rdx
200 jne .L29
201 .L28:
202 addq $8, %rsp
203 popq %rbx
204 popq %rbp
206 .LFE78:
207 .size sysinfo_mempages, .-sysinfo_mempages
208 .section .rodata.str1.8
209 .align 8
210 .LC2:
211 .string "/sys/devices/system/cpu/online"
212 .section .rodata.str1.1
213 .LC3:
214 .string "/proc/stat"
215 .LC4:
216 .string "cpu"
217 .LC5:
218 .string "/proc/cpuinfo"
219 .LC6:
220 .string "processor"
221 .text
222 .p2align 4,,15
223 .globl __GI___get_nprocs
224 .hidden __GI___get_nprocs
225 .type __GI___get_nprocs, @function
226 __GI___get_nprocs:
227 .LFB76:
229 pushq %rbp
230 movl $5, %edi
231 movq %rsp, %rbp
232 pushq %r15
233 pushq %r14
234 leaq -64(%rbp), %r14
235 pushq %r13
236 pushq %r12
237 pushq %rbx
238 movq %r14, %rsi
239 subq $72, %rsp
240 call __GI___clock_gettime
241 movq -64(%rbp), %rax
242 movq %rax, %rcx
243 movq %rax, -96(%rbp)
244 movq timestamp.10853(%rip), %rax
245 cmpq %rcx, %rax
246 je .L76
247 .L44:
248 movl $8192, %edi
249 call __GI___libc_alloca_cutoff
250 cmpl $1, %eax
251 leaq .LC2(%rip), %rdi
252 movl $524288, %esi
253 sbbq %r12, %r12
254 andq $-7680, %r12
255 leaq 8208(%r12), %rax
256 addq $8192, %r12
257 subq %rax, %rsp
258 xorl %eax, %eax
259 leaq 15(%rsp), %r13
260 andq $-16, %r13
261 addq %r13, %r12
262 movq %r13, -88(%rbp)
263 movq %r12, -80(%rbp)
264 movq %r12, -72(%rbp)
265 call __GI___open_nocancel
266 cmpl $-1, %eax
267 movl %eax, %edi
268 movl %eax, -100(%rbp)
269 je .L48
270 leaq -80(%rbp), %rax
271 leaq -72(%rbp), %r15
272 movq %r13, %rsi
273 movq %r12, %r8
274 movq %r15, %rcx
275 movq %rax, %rdx
276 call next_line
277 testq %rax, %rax
278 movq %rax, %r13
279 je .L49
280 xorl %ebx, %ebx
281 .p2align 4,,10
282 .p2align 3
283 .L56:
284 movl $10, %edx
285 movq %r14, %rsi
286 movq %r13, %rdi
287 call __GI_strtoul
288 movq -64(%rbp), %rdx
289 movq %rax, %r15
290 cmpq %r13, %rdx
291 je .L49
292 cmpb $45, (%rdx)
293 je .L77
294 .L51:
295 addl $1, %ebx
296 subl %r15d, %ebx
297 leal (%rbx,%rax), %r15d
298 movq -72(%rbp), %rax
299 movl %r15d, %ebx
300 cmpq %rax, %rdx
301 jb .L78
302 .L67:
303 movl -100(%rbp), %edi
304 call __GI___close_nocancel
305 testl %r15d, %r15d
306 jle .L48
307 .L57:
308 movl %ebx, cached_result.10852(%rip)
309 movq -96(%rbp), %rax
310 movq %rax, timestamp.10853(%rip)
311 .L43:
312 leaq -40(%rbp), %rsp
313 movl %ebx, %eax
314 popq %rbx
315 popq %r12
316 popq %r13
317 popq %r14
318 popq %r15
319 popq %rbp
321 .p2align 4,,10
322 .p2align 3
323 .L77:
324 leaq 1(%rdx), %r13
325 movq %r14, %rsi
326 movl $10, %edx
327 movq %r13, %rdi
328 call __GI_strtoul
329 movq -64(%rbp), %rdx
330 cmpq %r13, %rdx
331 jne .L51
332 .p2align 4,,10
333 .p2align 3
334 .L49:
335 movl -100(%rbp), %edi
336 call __GI___close_nocancel
337 .L48:
338 leaq .LC3(%rip), %rdi
339 xorl %eax, %eax
340 movl $524288, %esi
341 movq %r12, -80(%rbp)
342 movq %r12, -72(%rbp)
343 call __GI___open_nocancel
344 cmpl $-1, %eax
345 movl %eax, %r14d
346 je .L79
347 leaq -80(%rbp), %rax
348 xorl %ebx, %ebx
349 leaq -72(%rbp), %r15
350 movq %rax, %r13
351 jmp .L59
352 .p2align 4,,10
353 .p2align 3
354 .L63:
355 leaq .LC4(%rip), %rdi
356 movl $3, %ecx
357 movq %rax, %rsi
358 repz cmpsb
359 jne .L75
360 movsbl 3(%rax), %eax
361 subl $48, %eax
362 cmpl $10, %eax
363 adcl $0, %ebx
364 .L59:
365 movq -88(%rbp), %rsi
366 movq %r12, %r8
367 movq %r15, %rcx
368 movq %r13, %rdx
369 movl %r14d, %edi
370 call next_line
371 testq %rax, %rax
372 jne .L63
373 .L75:
374 movl %r14d, %edi
375 call __GI___close_nocancel
376 jmp .L57
377 .p2align 4,,10
378 .p2align 3
379 .L78:
380 cmpb $44, (%rdx)
381 movq %rdx, %r13
382 je .L80
383 .L54:
384 cmpb $10, 0(%r13)
385 jne .L56
386 jmp .L67
387 .p2align 4,,10
388 .p2align 3
389 .L80:
390 addq $1, %r13
391 cmpq %r13, %rax
392 ja .L54
393 jmp .L67
394 .p2align 4,,10
395 .p2align 3
396 .L76:
397 movl cached_result.10852(%rip), %ebx
398 testl %ebx, %ebx
399 jns .L43
400 jmp .L44
401 .p2align 4,,10
402 .p2align 3
403 .L79:
404 leaq .LC5(%rip), %rdi
405 xorl %eax, %eax
406 movl $524288, %esi
407 movl $2, %ebx
408 call __GI___open_nocancel
409 cmpl $-1, %eax
410 movl %eax, %r14d
411 je .L57
412 leaq -80(%rbp), %rax
413 xorl %ebx, %ebx
414 leaq -72(%rbp), %r15
415 movq %rax, %r13
416 jmp .L64
417 .p2align 4,,10
418 .p2align 3
419 .L66:
420 leaq .LC6(%rip), %rdi
421 movl $9, %ecx
422 repz cmpsb
423 seta %al
424 setb %dl
425 subl %edx, %eax
426 movsbl %al, %eax
427 cmpl $1, %eax
428 adcl $0, %ebx
429 .L64:
430 movq -88(%rbp), %rsi
431 movq %r12, %r8
432 movq %r15, %rcx
433 movq %r13, %rdx
434 movl %r14d, %edi
435 call next_line
436 testq %rax, %rax
437 movq %rax, %rsi
438 jne .L66
439 jmp .L75
440 .LFE76:
441 .size __GI___get_nprocs, .-__GI___get_nprocs
442 .globl __get_nprocs
443 .set __get_nprocs,__GI___get_nprocs
444 .weak get_nprocs
445 .set get_nprocs,__get_nprocs
446 .section .rodata.str1.1
447 .LC7:
448 .string "/sys/devices/system/cpu"
449 .text
450 .p2align 4,,15
451 .globl __GI___get_nprocs_conf
452 .hidden __GI___get_nprocs_conf
453 .type __GI___get_nprocs_conf, @function
454 __GI___get_nprocs_conf:
455 .LFB77:
457 pushq %r14
458 pushq %r13
459 leaq .LC7(%rip), %rdi
460 pushq %r12
461 pushq %rbp
462 xorl %r12d, %r12d
463 pushq %rbx
464 leaq .LC4(%rip), %r13
465 subq $16, %rsp
466 call __opendir
467 testq %rax, %rax
468 movq %rax, %rbp
469 leaq 8(%rsp), %r14
470 je .L95
471 .p2align 4,,10
472 .p2align 3
473 .L82:
474 movq %rbp, %rdi
475 call __GI___readdir64
476 testq %rax, %rax
477 je .L96
478 .L86:
479 cmpb $4, 18(%rax)
480 jne .L82
481 leaq 19(%rax), %rsi
482 movl $3, %ecx
483 movq %r13, %rdi
484 repz cmpsb
485 jne .L82
486 leaq 22(%rax), %rbx
487 movl $10, %edx
488 movq %r14, %rsi
489 movq %rbx, %rdi
490 call __GI_strtoul
491 cmpq $-1, %rax
492 je .L82
493 movq 8(%rsp), %rax
494 cmpq %rax, %rbx
495 je .L82
496 cmpb $1, (%rax)
497 movq %rbp, %rdi
498 adcl $0, %r12d
499 call __GI___readdir64
500 testq %rax, %rax
501 jne .L86
502 .L96:
503 movq %rbp, %rdi
504 call __closedir
505 addq $16, %rsp
506 movl %r12d, %eax
507 popq %rbx
508 popq %rbp
509 popq %r12
510 popq %r13
511 popq %r14
513 .p2align 4,,10
514 .p2align 3
515 .L95:
516 call __GI___get_nprocs
517 addq $16, %rsp
518 movl %eax, %r12d
519 popq %rbx
520 movl %r12d, %eax
521 popq %rbp
522 popq %r12
523 popq %r13
524 popq %r14
526 .LFE77:
527 .size __GI___get_nprocs_conf, .-__GI___get_nprocs_conf
528 .globl __get_nprocs_conf
529 .set __get_nprocs_conf,__GI___get_nprocs_conf
530 .weak get_nprocs_conf
531 .set get_nprocs_conf,__get_nprocs_conf
532 .p2align 4,,15
533 .globl __GI___get_phys_pages
534 .hidden __GI___get_phys_pages
535 .type __GI___get_phys_pages, @function
536 __GI___get_phys_pages:
537 .LFB79:
539 subq $120, %rsp
540 movq %rsp, %rdi
541 call __sysinfo
542 movl 104(%rsp), %esi
543 movq 32(%rsp), %rdi
544 addq $120, %rsp
545 jmp sysinfo_mempages
546 .LFE79:
547 .size __GI___get_phys_pages, .-__GI___get_phys_pages
548 .globl __get_phys_pages
549 .set __get_phys_pages,__GI___get_phys_pages
550 .weak get_phys_pages
551 .set get_phys_pages,__get_phys_pages
552 .p2align 4,,15
553 .globl __GI___get_avphys_pages
554 .hidden __GI___get_avphys_pages
555 .type __GI___get_avphys_pages, @function
556 __GI___get_avphys_pages:
557 .LFB80:
559 subq $120, %rsp
560 movq %rsp, %rdi
561 call __sysinfo
562 movl 104(%rsp), %esi
563 movq 40(%rsp), %rdi
564 addq $120, %rsp
565 jmp sysinfo_mempages
566 .LFE80:
567 .size __GI___get_avphys_pages, .-__GI___get_avphys_pages
568 .globl __get_avphys_pages
569 .set __get_avphys_pages,__GI___get_avphys_pages
570 .weak get_avphys_pages
571 .set get_avphys_pages,__get_avphys_pages
572 .section .rodata.str1.8
573 .align 8
574 .type __PRETTY_FUNCTION__.10848, @object
575 .size __PRETTY_FUNCTION__.10848, 10
576 __PRETTY_FUNCTION__.10848:
577 .string "next_line"
578 .data
579 .align 4
580 .type cached_result.10852, @object
581 .size cached_result.10852, 4
582 cached_result.10852:
583 .long -1
584 .local timestamp.10853
585 .comm timestamp.10853,8,8
586 .hidden __sysinfo
587 .hidden __closedir
588 .hidden __opendir