1 /* Copyright (C) 2011-2016 Free Software Foundation, Inc.
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).
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.
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.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library. If not, see
18 <http://www.gnu.org/licenses/>. */
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. */
37 ADDI_PTR r29, sp, - (12 * REGSIZE)
41 ADDI_PTR sp, sp, - (13 * REGSIZE)
43 ADDI_PTR r29, r29, REGSIZE
45 cfi_def_cfa_offset (13 * REGSIZE)
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 }
62 ADDI_PTR r29, sp, (2 * REGSIZE)
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) }
75 cfi_def_cfa_offset (0)
86 weak_alias (__mcount, _mcount) /* exported in gmon/Versions */
87 weak_alias (__mcount, mcount) /* exported in stdlib/Versions */