clarify the purpose of this project
[nyanglibc.git] / gmon / mcount.s
blobccff849a87b099b94c634b9e7a73d4c972db82ee
1 .text
2 .p2align 4,,15
3 .globl __mcount_internal
4 .type __mcount_internal, @function
5 __mcount_internal:
6 pushq %rbp
7 xorl %eax, %eax
8 movl $1, %edx
9 movq %rsp, %rbp
10 lock cmpxchgq %rdx, _gmonparam(%rip)
11 jne .L1
12 subq 64+_gmonparam(%rip), %rdi
13 cmpq %rdi, 80+_gmonparam(%rip)
14 jb .L3
15 movq 96+_gmonparam(%rip), %rcx
16 movq 24+_gmonparam(%rip), %rax
17 shrq %cl, %rdi
18 movslq %edi, %rdi
19 leaq (%rax,%rdi,8), %r8
20 movq 40+_gmonparam(%rip), %rdi
21 movq (%r8), %rax
22 testq %rax, %rax
23 jne .L4
24 movq 16(%rdi), %rax
25 addq $1, %rax
26 cmpq 56+_gmonparam(%rip), %rax
27 movq %rax, 16(%rdi)
28 jb .L15
29 .L5:
30 movq $2, _gmonparam(%rip)
31 .L1:
32 popq %rbp
33 ret
34 .p2align 4,,10
35 .p2align 3
36 .L16:
37 movq 16(%rdx), %rsi
38 addq $1, 8(%rdx)
39 movq %rsi, 16(%rcx)
40 movq (%r8), %rcx
41 movq %rcx, 16(%rdx)
42 movq %rax, (%r8)
43 .p2align 4,,10
44 .p2align 3
45 .L3:
46 movq $0, _gmonparam(%rip)
47 .L17:
48 popq %rbp
49 ret
50 .p2align 4,,10
51 .p2align 3
52 .L4:
53 leaq (%rax,%rax,2), %rax
54 leaq (%rdi,%rax,8), %rcx
55 cmpq %rsi, (%rcx)
56 jne .L6
57 addq $1, 8(%rcx)
58 jmp .L3
59 .p2align 4,,10
60 .p2align 3
61 .L7:
62 leaq (%rax,%rax,2), %rdx
63 leaq (%rdi,%rdx,8), %rdx
64 cmpq %rsi, (%rdx)
65 je .L16
66 movq %rdx, %rcx
67 .L6:
68 movq 16(%rcx), %rax
69 testq %rax, %rax
70 jne .L7
71 movq 16(%rdi), %rax
72 addq $1, %rax
73 cmpq 56+_gmonparam(%rip), %rax
74 movq %rax, 16(%rdi)
75 jnb .L5
76 leaq (%rax,%rax,2), %rdx
77 leaq (%rdi,%rdx,8), %rdx
78 movq %rsi, (%rdx)
79 movq $1, 8(%rdx)
80 movq (%r8), %rcx
81 movq %rcx, 16(%rdx)
82 movq %rax, (%r8)
83 jmp .L3
84 .p2align 4,,10
85 .p2align 3
86 .L15:
87 movq %rax, (%r8)
88 leaq (%rax,%rax,2), %rax
89 leaq (%rdi,%rax,8), %rax
90 movq %rsi, (%rax)
91 movq $1, 8(%rax)
92 movq $0, 16(%rax)
93 movq $0, _gmonparam(%rip)
94 jmp .L17
95 .size __mcount_internal, .-__mcount_internal
96 .hidden _gmonparam