]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/mips/machine-gmon.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / mips / machine-gmon.h
CommitLineData
781b52c5 1/* Machine-specific calling sequence for `mcount' profiling function. MIPS
b168057a 2 Copyright (C) 1996-2015 Free Software Foundation, Inc.
781b52c5
UD
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
3214b89b
AJ
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.
781b52c5
UD
9
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
3214b89b 13 Lesser General Public License for more details.
781b52c5 14
3214b89b 15 You should have received a copy of the GNU Lesser General Public
ab84e3ff
PE
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
781b52c5 18
24c4c341
AJ
19#include <sgidefs.h>
20
4bf39226
AJ
21#define _MCOUNT_DECL(frompc,selfpc) \
22static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)
781b52c5 23
7b44519f 24/* Call __mcount with the return PC for our caller,
781b52c5 25 and the return PC our caller will return to. */
7b44519f 26
73a227e2 27#if _MIPS_SIM == _ABIO32
7b44519f 28
73a35fc4 29#ifdef __PIC__
7b44519f
AO
30# define CPLOAD ".cpload $25;"
31# define CPRESTORE ".cprestore 44\n\t"
781b52c5 32#else
7b44519f
AO
33# define CPLOAD
34# define CPRESTORE
781b52c5
UD
35#endif
36
37#define MCOUNT asm(\
c8523a3c
AJ
38 ".globl _mcount;\n\t" \
39 ".align 2;\n\t" \
43301bd3
MR
40 ".set push;\n\t" \
41 ".set nomips16;\n\t" \
c8523a3c
AJ
42 ".type _mcount,@function;\n\t" \
43 ".ent _mcount\n\t" \
44 "_mcount:\n\t" \
45 ".frame $sp,44,$31\n\t" \
46 ".set noreorder;\n\t" \
47 ".set noat;\n\t" \
781b52c5 48 CPLOAD \
c8523a3c
AJ
49 "subu $29,$29,48;\n\t" \
50 CPRESTORE \
51 "sw $4,24($29);\n\t" \
52 "sw $5,28($29);\n\t" \
53 "sw $6,32($29);\n\t" \
54 "sw $7,36($29);\n\t" \
55 "sw $2,40($29);\n\t" \
56 "sw $1,16($29);\n\t" \
57 "sw $31,20($29);\n\t" \
58 "move $5,$31;\n\t" \
59 "move $4,$1;\n\t" \
60 "jal __mcount;\n\t" \
61 "nop;\n\t" \
62 "lw $4,24($29);\n\t" \
63 "lw $5,28($29);\n\t" \
64 "lw $6,32($29);\n\t" \
65 "lw $7,36($29);\n\t" \
66 "lw $2,40($29);\n\t" \
67 "lw $31,20($29);\n\t" \
68 "lw $1,16($29);\n\t" \
69 "addu $29,$29,56;\n\t" \
70 "j $31;\n\t" \
71 "move $31,$1;\n\t" \
43301bd3
MR
72 ".end _mcount;\n\t" \
73 ".set pop");
7b44519f
AO
74
75#else
76
77#ifdef __PIC__
78# define CPSETUP ".cpsetup $25, 88, _mcount;"
79# define CPRETURN ".cpreturn;"
80#else
81# define CPSETUP
82# define CPRETURN
83#endif
84
73a227e2 85#if _MIPS_SIM == _ABIN32
04d55561
SE
86# if __mips_isa_rev < 6
87# define PTR_ADDU_STRING "add" /* no u */
88# define PTR_SUBU_STRING "sub" /* no u */
89# else
90# define PTR_ADDU_STRING "addu"
91# define PTR_SUBU_STRING "subu"
92# endif
73a227e2 93#elif _MIPS_SIM == _ABI64
7b44519f
AO
94# define PTR_ADDU_STRING "daddu"
95# define PTR_SUBU_STRING "dsubu"
96#else
97# error "Unknown ABI"
98#endif
99
100#define MCOUNT asm(\
101 ".globl _mcount;\n\t" \
102 ".align 3;\n\t" \
43301bd3
MR
103 ".set push;\n\t" \
104 ".set nomips16;\n\t" \
7b44519f
AO
105 ".type _mcount,@function;\n\t" \
106 ".ent _mcount\n\t" \
107 "_mcount:\n\t" \
108 ".frame $sp,88,$31\n\t" \
109 ".set noreorder;\n\t" \
110 ".set noat;\n\t" \
111 PTR_SUBU_STRING " $29,$29,96;\n\t" \
112 CPSETUP \
113 "sd $4,24($29);\n\t" \
114 "sd $5,32($29);\n\t" \
115 "sd $6,40($29);\n\t" \
116 "sd $7,48($29);\n\t" \
117 "sd $8,56($29);\n\t" \
118 "sd $9,64($29);\n\t" \
119 "sd $10,72($29);\n\t" \
120 "sd $11,80($29);\n\t" \
121 "sd $2,16($29);\n\t" \
122 "sd $1,0($29);\n\t" \
123 "sd $31,8($29);\n\t" \
124 "move $5,$31;\n\t" \
125 "move $4,$1;\n\t" \
126 "jal __mcount;\n\t" \
127 "nop;\n\t" \
128 "ld $4,24($29);\n\t" \
129 "ld $5,32($29);\n\t" \
130 "ld $6,40($29);\n\t" \
131 "ld $7,48($29);\n\t" \
132 "ld $8,56($29);\n\t" \
133 "ld $9,64($29);\n\t" \
134 "ld $10,72($29);\n\t" \
135 "ld $11,80($29);\n\t" \
136 "ld $2,16($29);\n\t" \
137 "ld $31,8($29);\n\t" \
138 "ld $1,0($29);\n\t" \
139 CPRETURN \
140 PTR_ADDU_STRING " $29,$29,96;\n\t" \
141 "j $31;\n\t" \
142 "move $31,$1;\n\t" \
43301bd3
MR
143 ".end _mcount;\n\t" \
144 ".set pop");
7b44519f
AO
145
146#endif