]>
Commit | Line | Data |
---|---|---|
688903eb | 1 | /* Copyright (C) 2011-2018 Free Software Foundation, Inc. |
63d143a2 CM |
2 | This file is part of the GNU C Library. |
3 | Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011. | |
4 | Based on work contributed by David Mosberger (davidm@cs.arizona.edu). | |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Lesser General Public | |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
10 | ||
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Lesser General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Lesser General Public | |
ab84e3ff PE |
17 | License along with the GNU C Library. If not, see |
18 | <http://www.gnu.org/licenses/>. */ | |
63d143a2 CM |
19 | |
20 | /* Assembly stub to invoke __mcount_internal(). Compiler-generated | |
21 | code calls mcount after executing a function's prologue, placing | |
22 | the "lr" register in "r10" for the call. As a result "lr" is the | |
23 | function that invoked mcount, and "r10" is mcount's caller's | |
24 | caller. However, we have to save all the parameter registers here | |
25 | before invoking _mcount_internal. Callee-save and temporary | |
26 | registers need no special attention. We save r10 and restore it to | |
27 | lr on the way out, to properly handle the case of ENTRY() in | |
28 | assembly code, before lr is saved. We use the name __mcount since | |
29 | the gcc community prefers using the reserved namespace. */ | |
30 | ||
31 | #include <sysdep.h> | |
32 | ||
33 | .text | |
34 | ENTRY(__mcount) | |
35 | { | |
8d2d239c | 36 | st sp, lr |
63d143a2 CM |
37 | ADDI_PTR r29, sp, - (12 * REGSIZE) |
38 | } | |
39 | cfi_offset (lr, 0) | |
40 | { | |
41 | ADDI_PTR sp, sp, - (13 * REGSIZE) | |
8d2d239c | 42 | st r29, sp |
63d143a2 CM |
43 | ADDI_PTR r29, r29, REGSIZE |
44 | } | |
45 | cfi_def_cfa_offset (13 * REGSIZE) | |
8d2d239c AZ |
46 | { st r29, r0; ADDI_PTR r29, r29, REGSIZE } |
47 | { st r29, r1; ADDI_PTR r29, r29, REGSIZE } | |
48 | { st r29, r2; ADDI_PTR r29, r29, REGSIZE } | |
49 | { st r29, r3; ADDI_PTR r29, r29, REGSIZE } | |
50 | { st r29, r4; ADDI_PTR r29, r29, REGSIZE } | |
51 | { st r29, r5; ADDI_PTR r29, r29, REGSIZE } | |
52 | { st r29, r6; ADDI_PTR r29, r29, REGSIZE } | |
53 | { st r29, r7; ADDI_PTR r29, r29, REGSIZE } | |
54 | { st r29, r8; ADDI_PTR r29, r29, REGSIZE } | |
55 | { st r29, r9; ADDI_PTR r29, r29, REGSIZE } | |
56 | { st r29, r10; ADDI_PTR r29, r29, REGSIZE; move r0, r10 } | |
63d143a2 CM |
57 | { |
58 | move r1, lr | |
59 | jal __mcount_internal | |
60 | } | |
61 | { | |
62 | ADDI_PTR r29, sp, (2 * REGSIZE) | |
63 | } | |
8d2d239c AZ |
64 | { ld r0, r29; ADDI_PTR r29, r29, REGSIZE } |
65 | { ld r1, r29; ADDI_PTR r29, r29, REGSIZE } | |
66 | { ld r2, r29; ADDI_PTR r29, r29, REGSIZE } | |
67 | { ld r3, r29; ADDI_PTR r29, r29, REGSIZE } | |
68 | { ld r4, r29; ADDI_PTR r29, r29, REGSIZE } | |
69 | { ld r5, r29; ADDI_PTR r29, r29, REGSIZE } | |
70 | { ld r6, r29; ADDI_PTR r29, r29, REGSIZE } | |
71 | { ld r7, r29; ADDI_PTR r29, r29, REGSIZE } | |
72 | { ld r8, r29; ADDI_PTR r29, r29, REGSIZE } | |
73 | { ld r9, r29; ADDI_PTR r29, r29, REGSIZE } | |
74 | { ld r10, r29; ADDI_PTR sp, sp, (13 * REGSIZE) } | |
63d143a2 CM |
75 | cfi_def_cfa_offset (0) |
76 | { | |
8d2d239c | 77 | ld lr, sp |
63d143a2 CM |
78 | } |
79 | { | |
80 | move lr, r10 | |
81 | jrp lr | |
82 | } | |
83 | END(__mcount) | |
84 | ||
85 | #undef mcount | |
86 | weak_alias (__mcount, _mcount) /* exported in gmon/Versions */ | |
87 | weak_alias (__mcount, mcount) /* exported in stdlib/Versions */ |