1 /* Machine-specific calling sequence for `mcount' profiling function. alpha
2 Copyright (C) 1995, 1996 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 Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 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 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If
18 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19 Cambridge, MA 02139, USA. */
21 /* Assembly stub to invoke _mcount(). Compiler generated code calls
22 this stub after executing a function's prologue and without saving any
23 registers. It is therefore necessary to preserve a0..a5 as they may
24 contain function arguments. To work correctly with frame- less
25 functions, it is also necessary to preserve ra. Finally, division
26 routines are invoked with a special calling convention and the
27 compiler treats those calls as if they were instructions. In
28 particular, it doesn't save any of the temporary registers (caller
29 saved registers). It is therefore necessary to preserve all
30 caller-saved registers as well
32 Upon entering _mcount, register $at holds the return address and ra
33 holds the return address of the function's caller (selfpc and frompc,
34 respectively in gmon.c language...). */
46 mov ra, a0 # a0 = caller-pc
48 mov $at, a1 # a1 = self-pc
80 ldq $at, 0x10(sp) # restore self-pc
87 mov $at, pv # make pv point to return address
88 ldq t0, 0x48(sp) # this is important under OSF/1 to
89 ldq t1, 0x50(sp) # ensure that the code that we return
90 ldq t2, 0x58(sp) # can correctly compute its gp
107 weak_alias (_mcount, mcount)