1 /* Machine-specific calling sequence for `mcount' profiling function. alpha
2 Copyright (C) 1995-2014 Free Software Foundation, Inc.
3 Contributed by David Mosberger (davidm@cs.arizona.edu).
4 This file is part of the GNU C Library.
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(). Compiler generated code calls
21 this stub after executing a function's prologue and without saving any
22 registers. It is therefore necessary to preserve a0..a5 as they may
23 contain function arguments. To work correctly with frame- less
24 functions, it is also necessary to preserve ra. Finally, division
25 routines are invoked with a special calling convention and the
26 compiler treats those calls as if they were instructions. In
27 particular, it doesn't save any of the temporary registers (caller
28 saved registers). It is therefore necessary to preserve all
29 caller-saved registers as well.
31 Upon entering _mcount, register $at holds the return address and ra
32 holds the return address of the function's caller (selfpc and frompc,
33 respectively in gmon.c language...). */
44 mov ra, a0 # a0 = caller-pc
46 mov $at, a1 # a1 = self-pc
78 ldq $at, 0x10(sp) # restore self-pc
85 mov $at, pv # make pv point to return address
86 ldq t0, 0x48(sp) # this is important under OSF/1 to
87 ldq t1, 0x50(sp) # ensure that the code that we return
88 ldq t2, 0x58(sp) # can correctly compute its gp
105 weak_alias (_mcount, mcount)