1997-06-21 02:02:21 +00:00
|
|
|
/* Machine-specific calling sequence for `mcount' profiling function. MIPS
|
2020-01-01 00:14:33 +00:00
|
|
|
Copyright (C) 1996-2020 Free Software Foundation, Inc.
|
1997-06-21 02:02:21 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:56:23 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1997-06-21 02:02:21 +00:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:56:23 +00:00
|
|
|
Lesser General Public License for more details.
|
1997-06-21 02:02:21 +00:00
|
|
|
|
2001-07-06 04:56:23 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-03-09 23:56:38 +00:00
|
|
|
License along with the GNU C Library. If not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
1997-06-21 02:02:21 +00:00
|
|
|
|
2004-07-20 16:35:32 +00:00
|
|
|
#include <sgidefs.h>
|
|
|
|
|
2002-02-08 18:56:57 +00:00
|
|
|
#define _MCOUNT_DECL(frompc,selfpc) \
|
|
|
|
static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)
|
1997-06-21 02:02:21 +00:00
|
|
|
|
2003-03-17 15:53:37 +00:00
|
|
|
/* Call __mcount with the return PC for our caller,
|
1997-06-21 02:02:21 +00:00
|
|
|
and the return PC our caller will return to. */
|
2003-03-17 15:53:37 +00:00
|
|
|
|
2004-11-24 04:37:35 +00:00
|
|
|
#if _MIPS_SIM == _ABIO32
|
2003-03-17 15:53:37 +00:00
|
|
|
|
2000-03-31 05:44:27 +00:00
|
|
|
#ifdef __PIC__
|
2003-03-17 15:53:37 +00:00
|
|
|
# define CPLOAD ".cpload $25;"
|
|
|
|
# define CPRESTORE ".cprestore 44\n\t"
|
1997-06-21 02:02:21 +00:00
|
|
|
#else
|
2003-03-17 15:53:37 +00:00
|
|
|
# define CPLOAD
|
|
|
|
# define CPRESTORE
|
1997-06-21 02:02:21 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define MCOUNT asm(\
|
2002-02-11 10:23:36 +00:00
|
|
|
".globl _mcount;\n\t" \
|
|
|
|
".align 2;\n\t" \
|
2013-02-27 23:45:07 +00:00
|
|
|
".set push;\n\t" \
|
|
|
|
".set nomips16;\n\t" \
|
2002-02-11 10:23:36 +00:00
|
|
|
".type _mcount,@function;\n\t" \
|
|
|
|
".ent _mcount\n\t" \
|
|
|
|
"_mcount:\n\t" \
|
|
|
|
".frame $sp,44,$31\n\t" \
|
|
|
|
".set noreorder;\n\t" \
|
|
|
|
".set noat;\n\t" \
|
1997-06-21 02:02:21 +00:00
|
|
|
CPLOAD \
|
2002-02-11 10:23:36 +00:00
|
|
|
"subu $29,$29,48;\n\t" \
|
|
|
|
CPRESTORE \
|
|
|
|
"sw $4,24($29);\n\t" \
|
|
|
|
"sw $5,28($29);\n\t" \
|
|
|
|
"sw $6,32($29);\n\t" \
|
|
|
|
"sw $7,36($29);\n\t" \
|
|
|
|
"sw $2,40($29);\n\t" \
|
|
|
|
"sw $1,16($29);\n\t" \
|
|
|
|
"sw $31,20($29);\n\t" \
|
|
|
|
"move $5,$31;\n\t" \
|
|
|
|
"move $4,$1;\n\t" \
|
|
|
|
"jal __mcount;\n\t" \
|
|
|
|
"nop;\n\t" \
|
|
|
|
"lw $4,24($29);\n\t" \
|
|
|
|
"lw $5,28($29);\n\t" \
|
|
|
|
"lw $6,32($29);\n\t" \
|
|
|
|
"lw $7,36($29);\n\t" \
|
|
|
|
"lw $2,40($29);\n\t" \
|
|
|
|
"lw $31,20($29);\n\t" \
|
|
|
|
"lw $1,16($29);\n\t" \
|
|
|
|
"addu $29,$29,56;\n\t" \
|
|
|
|
"j $31;\n\t" \
|
|
|
|
"move $31,$1;\n\t" \
|
2013-02-27 23:45:07 +00:00
|
|
|
".end _mcount;\n\t" \
|
|
|
|
".set pop");
|
2003-03-17 15:53:37 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#ifdef __PIC__
|
|
|
|
# define CPSETUP ".cpsetup $25, 88, _mcount;"
|
|
|
|
# define CPRETURN ".cpreturn;"
|
|
|
|
#else
|
|
|
|
# define CPSETUP
|
|
|
|
# define CPRETURN
|
|
|
|
#endif
|
|
|
|
|
2004-11-24 04:37:35 +00:00
|
|
|
#if _MIPS_SIM == _ABIN32
|
2015-08-18 21:52:22 +00:00
|
|
|
# if !defined __mips_isa_rev || __mips_isa_rev < 6
|
2014-12-19 22:37:44 +00:00
|
|
|
# define PTR_ADDU_STRING "add" /* no u */
|
|
|
|
# define PTR_SUBU_STRING "sub" /* no u */
|
|
|
|
# else
|
|
|
|
# define PTR_ADDU_STRING "addu"
|
|
|
|
# define PTR_SUBU_STRING "subu"
|
|
|
|
# endif
|
2004-11-24 04:37:35 +00:00
|
|
|
#elif _MIPS_SIM == _ABI64
|
2003-03-17 15:53:37 +00:00
|
|
|
# define PTR_ADDU_STRING "daddu"
|
|
|
|
# define PTR_SUBU_STRING "dsubu"
|
|
|
|
#else
|
|
|
|
# error "Unknown ABI"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define MCOUNT asm(\
|
|
|
|
".globl _mcount;\n\t" \
|
|
|
|
".align 3;\n\t" \
|
2013-02-27 23:45:07 +00:00
|
|
|
".set push;\n\t" \
|
|
|
|
".set nomips16;\n\t" \
|
2003-03-17 15:53:37 +00:00
|
|
|
".type _mcount,@function;\n\t" \
|
|
|
|
".ent _mcount\n\t" \
|
|
|
|
"_mcount:\n\t" \
|
|
|
|
".frame $sp,88,$31\n\t" \
|
|
|
|
".set noreorder;\n\t" \
|
|
|
|
".set noat;\n\t" \
|
|
|
|
PTR_SUBU_STRING " $29,$29,96;\n\t" \
|
|
|
|
CPSETUP \
|
|
|
|
"sd $4,24($29);\n\t" \
|
|
|
|
"sd $5,32($29);\n\t" \
|
|
|
|
"sd $6,40($29);\n\t" \
|
|
|
|
"sd $7,48($29);\n\t" \
|
|
|
|
"sd $8,56($29);\n\t" \
|
|
|
|
"sd $9,64($29);\n\t" \
|
|
|
|
"sd $10,72($29);\n\t" \
|
|
|
|
"sd $11,80($29);\n\t" \
|
|
|
|
"sd $2,16($29);\n\t" \
|
|
|
|
"sd $1,0($29);\n\t" \
|
|
|
|
"sd $31,8($29);\n\t" \
|
|
|
|
"move $5,$31;\n\t" \
|
|
|
|
"move $4,$1;\n\t" \
|
|
|
|
"jal __mcount;\n\t" \
|
|
|
|
"nop;\n\t" \
|
|
|
|
"ld $4,24($29);\n\t" \
|
|
|
|
"ld $5,32($29);\n\t" \
|
|
|
|
"ld $6,40($29);\n\t" \
|
|
|
|
"ld $7,48($29);\n\t" \
|
|
|
|
"ld $8,56($29);\n\t" \
|
|
|
|
"ld $9,64($29);\n\t" \
|
|
|
|
"ld $10,72($29);\n\t" \
|
|
|
|
"ld $11,80($29);\n\t" \
|
|
|
|
"ld $2,16($29);\n\t" \
|
|
|
|
"ld $31,8($29);\n\t" \
|
|
|
|
"ld $1,0($29);\n\t" \
|
|
|
|
CPRETURN \
|
|
|
|
PTR_ADDU_STRING " $29,$29,96;\n\t" \
|
|
|
|
"j $31;\n\t" \
|
|
|
|
"move $31,$1;\n\t" \
|
2013-02-27 23:45:07 +00:00
|
|
|
".end _mcount;\n\t" \
|
|
|
|
".set pop");
|
2003-03-17 15:53:37 +00:00
|
|
|
|
|
|
|
#endif
|