]> git.ipfire.org Git - thirdparty/glibc.git/blame - ports/sysdeps/ia64/_mcount.S
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / ports / sysdeps / ia64 / _mcount.S
CommitLineData
d5efd131 1/* Machine-specific calling sequence for `mcount' profiling function. ia64
d4697bc9 2 Copyright (C) 2000-2014 Free Software Foundation, Inc.
d5efd131
MF
3 Contributed by David Mosberger <davidm@hpl.hp.com>
4 This file is part of the GNU C Library.
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
75efb018
MF
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
d5efd131
MF
19
20/* Assembly stub to invoke _mcount(). Compiler generated code calls
21 this stub before executing a function's prologue and without saving
22 any registers. It is therefore necessary to preserve the input
23 registers as they may contain function arguments. To work
24 correctly with frame-less functions, it is also necessary to
25 preserve the return pointer (b0 aka rp).
26
27 State upon entering _mcount:
28
29 r8 address of return value structure (used only when called
30 function returns a large structure)
31 r15 static link (used only for nested functions)
32 in0 ar.pfs to restore before returning to the function that
33 called _mcount
34 in1 gp value to restore before returning to the function that
35 called _mcount
36 in2 return address in the function that invoked the caller
37 of _mcount (frompc)
38 in3 address of the global-offset table entry that holds the
39 profile count dword allocated by the compiler; to get
40 the address of this dword, use "ld8 in2=[in2]; this
41 dword can be used in any way by _mcount (including
42 not at all, as is the case with the current implementation)
43 b0 address to return to after _mcount is done
44*/
45
46#include <sysdep.h>
47
48#undef ret
49
50LEAF(_mcount)
51 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(4)
52 alloc loc1 = ar.pfs, 4, 4, 3, 0
53 mov loc0 = rp
54 .body
55 mov loc2 = r8 // gcc uses r8 to pass pointer to return structure
56 ;;
57 mov loc3 = r15 // gcc uses r15 to pass the static link to nested functions
58 mov out0 = in2
59 mov out1 = rp
60 br.call.sptk.few rp = __mcount
61 ;;
62.here:
63{
64 .mii
65 mov gp = in1
66 mov r2 = ip
67 mov ar.pfs = loc1
68}
69 ;;
70 adds r2 = _mcount_ret_helper - .here, r2
71 mov b7 = loc0
72 mov rp = in2
73 ;;
74 mov r3 = in0
75 mov r8 = loc2
76 mov r15 = loc3
77 mov b6 = r2
78 br.ret.sptk.few b6
79END(_mcount)
80
81LOCAL_LEAF(_mcount_ret_helper)
82 .prologue
83 .altrp b7
84 .save ar.pfs, r3
85 .body
86 alloc r2 = ar.pfs, 0, 0, 8, 0
87 mov ar.pfs = r3
88 br b7
89END(_mcount_ret_helper)
90
91weak_alias (_mcount, mcount)