1 | /* Copyright (C) 1997-2022 Free Software Foundation, Inc. |
2 | |
3 | This file is part of the GNU C Library. |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public License as |
7 | published by the Free Software Foundation; either version 2.1 of the |
8 | License, or (at your option) any later version. |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library. If not, see |
17 | <https://www.gnu.org/licenses/>. */ |
18 | |
19 | .global _mcount |
20 | .type _mcount, @function |
21 | _mcount: |
22 | # Save regs. |
23 | addik r1, r1,-4 * 24 |
24 | swi r31, r1, 4 * 23 |
25 | swi r30, r1, 4 * 22 |
26 | swi r29, r1, 4 * 21 |
27 | swi r28, r1, 4 * 20 |
28 | swi r27, r1, 4 * 19 |
29 | swi r26, r1, 4 * 18 |
30 | swi r25, r1, 4 * 17 |
31 | swi r24, r1, 4 * 16 |
32 | swi r23, r1, 4 * 15 |
33 | swi r22, r1, 4 * 14 |
34 | swi r21, r1, 4 * 13 |
35 | swi r20, r1, 4 * 12 |
36 | swi r19, r1, 4 * 11 |
37 | swi r15, r1, 4 * 10 |
38 | swi r12, r1, 4 * 9 |
39 | swi r11, r1, 4 * 8 |
40 | swi r10, r1, 4 * 7 |
41 | swi r8, r1, 4 * 6 |
42 | swi r7, r1, 4 * 5 |
43 | swi r6, r1, 4 * 4 |
44 | swi r5, r1, 4 * 3 |
45 | swi r4, r1, 4 * 2 |
46 | swi r3, r1, 4 * 1 |
47 | swi r2, r1, 4 * 0 |
48 | |
49 | #ifdef SHARED |
50 | mfs r20,rpc |
51 | addik r20,r20,_GLOBAL_OFFSET_TABLE_+8 |
52 | addk r6, r0, r15 # callee is in r15. |
53 | brlid r15, __mcount_internal@PLT |
54 | lwi r5, r1, 4 * 24 # caller is on the stack. |
55 | #else |
56 | # Pass from/to in r5 and r6. |
57 | addk r6, r0, r15 # callee is in r15. |
58 | bralid r15, __mcount_internal |
59 | lwi r5, r1, 4 * 24 # caller is on the stack. |
60 | #endif |
61 | |
62 | # Reload regs |
63 | lwi r31, r1, 4 * 23 |
64 | lwi r30, r1, 4 * 22 |
65 | lwi r29, r1, 4 * 21 |
66 | lwi r28, r1, 4 * 20 |
67 | lwi r27, r1, 4 * 19 |
68 | lwi r26, r1, 4 * 18 |
69 | lwi r25, r1, 4 * 17 |
70 | lwi r24, r1, 4 * 16 |
71 | lwi r23, r1, 4 * 15 |
72 | lwi r22, r1, 4 * 14 |
73 | lwi r21, r1, 4 * 13 |
74 | lwi r20, r1, 4 * 12 |
75 | lwi r19, r1, 4 * 11 |
76 | lwi r15, r1, 4 * 10 |
77 | lwi r12, r1, 4 * 9 |
78 | lwi r11, r1, 4 * 8 |
79 | lwi r10, r1, 4 * 7 |
80 | lwi r8, r1, 4 * 6 |
81 | lwi r7, r1, 4 * 5 |
82 | lwi r6, r1, 4 * 4 |
83 | lwi r5, r1, 4 * 3 |
84 | lwi r4, r1, 4 * 2 |
85 | lwi r3, r1, 4 * 1 |
86 | lwi r2, r1, 4 * 0 |
87 | |
88 | rtsd r15, 8 |
89 | addik r1, r1, 4 * 24 |
90 | |
91 | .size _mcount, . - _mcount |
92 | |