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