clarify the purpose of this project
[nyanglibc.git] / misc / getloadavg.s
blob6619eaf3ecabec8d58e247892b4da1940c530cd3
1 .text
2 .section .rodata.str1.1,"aMS",@progbits,1
3 .LC0:
4 .string "/proc/loadavg"
5 .text
6 .p2align 4,,15
7 .globl getloadavg
8 .type getloadavg, @function
9 getloadavg:
10 pushq %r15
11 pushq %r14
12 xorl %eax, %eax
13 pushq %r13
14 pushq %r12
15 movq %rdi, %r12
16 pushq %rbp
17 pushq %rbx
18 leaq .LC0(%rip), %rdi
19 movl %esi, %r14d
20 xorl %esi, %esi
21 subq $104, %rsp
22 call __open_nocancel
23 testl %eax, %eax
24 js .L6
25 leaq 16(%rsp), %rbx
26 movl %eax, %ebp
27 movl $64, %edx
28 movl %eax, %edi
29 movq %rbx, %rsi
30 call __read_nocancel
31 movl %ebp, %edi
32 movq %rax, %r13
33 movl $-1, %ebp
34 call __close_nocancel
35 testq %r13, %r13
36 jle .L1
37 cmpl $3, %r14d
38 movb $0, 15(%rsp,%r13)
39 movl $3, %r13d
40 cmovle %r14d, %r13d
41 xorl %ebp, %ebp
42 testl %r14d, %r14d
43 jle .L1
44 leaq 8(%rsp), %r15
45 leaq _nl_C_locobj(%rip), %r14
46 jmp .L5
47 .p2align 4,,10
48 .p2align 3
49 .L4:
50 addl $1, %ebp
51 addq $8, %r12
52 movq %rax, %rbx
53 cmpl %r13d, %ebp
54 jge .L1
55 .L5:
56 movq %r14, %rdx
57 movq %r15, %rsi
58 movq %rbx, %rdi
59 call __strtod_l
60 movq 8(%rsp), %rax
61 movsd %xmm0, (%r12)
62 cmpq %rbx, %rax
63 jne .L4
64 .L6:
65 movl $-1, %ebp
66 .L1:
67 addq $104, %rsp
68 movl %ebp, %eax
69 popq %rbx
70 popq %rbp
71 popq %r12
72 popq %r13
73 popq %r14
74 popq %r15
75 ret
76 .size getloadavg, .-getloadavg
77 .hidden __strtod_l
78 .hidden _nl_C_locobj
79 .hidden __close_nocancel
80 .hidden __read_nocancel
81 .hidden __open_nocancel