1 /* PowerPC-specific implementation of profiling support.
2 Copyright (C) 1997, 1999 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 /* This would be bad. */
27 /* We do profiling as described in the SYSV ELF ABI, _mcount is called
28 with the address of a data word in r0 (that is different for every
29 routine, initialised to 0, and otherwise unused). The caller has put
30 the address the caller will return to in the usual place on the stack,
31 4(r1). _mcount is responsible for ensuring that when it returns no
32 argument-passing registers are disturbed, and that the LR is set back
33 to (what the caller sees as) 4(r1).
35 This is intended so that the following code can be inserted at the
36 front of any routine without changing the routine:
51 /* We need to save the parameter-passing registers. */
65 bl JUMPTARGET(__mcount_internal)
67 /* Restore the registers... */
82 /* ...unwind the stack frame, and return to your usual programming. */