Update.
[glibc.git] / sysdeps / mips / machine-gmon.h
blob4b6a939a0a0585493507f40e27ae847b02150291
1 /* Machine-specific calling sequence for `mcount' profiling function. MIPS
2 Copyright (C) 1996, 1997, 2000, 2001 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 Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #define _MCOUNT_DECL static void __mcount
22 /* Call __mcount with our the return PC for our caller,
23 and the return PC our caller will return to. */
24 #ifdef __PIC__
25 #define CPLOAD ".cpload $25;"
26 #else
27 #define CPLOAD
28 #endif
30 #define MCOUNT asm(\
31 ".globl _mcount;" \
32 ".align 2;" \
33 ".type _mcount,@function;" \
34 "_mcount:;" \
35 ".set noreorder;" \
36 ".set noat;" \
37 CPLOAD \
38 "sw $4,8($29);" \
39 "sw $5,12($29);" \
40 "sw $6,16($29);" \
41 "sw $7,20($29);" \
42 "sw $1,0($29);" \
43 "sw $31,4($29);" \
44 "move $5,$31;" \
45 "move $4,$1;" \
46 "jal __mcount;" \
47 "nop;" \
48 "lw $4,8($29);" \
49 "lw $5,12($29);" \
50 "lw $6,16($29);" \
51 "lw $7,20($29);" \
52 "lw $31,4($29);" \
53 "lw $1,0($29);" \
54 "addu $29,$29,8;" \
55 "j $31;" \
56 "move $31,$1;" \
57 ".set reorder;" \
58 ".set at");