|
Packit |
6c4009 |
/* Machine-specific calling sequence for `mcount' profiling function. MIPS
|
|
Packit |
6c4009 |
Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library. If not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <sgidefs.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define _MCOUNT_DECL(frompc,selfpc) \
|
|
Packit |
6c4009 |
static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Call __mcount with the return PC for our caller,
|
|
Packit |
6c4009 |
and the return PC our caller will return to. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if _MIPS_SIM == _ABIO32
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __PIC__
|
|
Packit |
6c4009 |
# define CPLOAD ".cpload $25;"
|
|
Packit |
6c4009 |
# define CPRESTORE ".cprestore 44\n\t"
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define CPLOAD
|
|
Packit |
6c4009 |
# define CPRESTORE
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define MCOUNT asm(\
|
|
Packit |
6c4009 |
".globl _mcount;\n\t" \
|
|
Packit |
6c4009 |
".align 2;\n\t" \
|
|
Packit |
6c4009 |
".set push;\n\t" \
|
|
Packit |
6c4009 |
".set nomips16;\n\t" \
|
|
Packit |
6c4009 |
".type _mcount,@function;\n\t" \
|
|
Packit |
6c4009 |
".ent _mcount\n\t" \
|
|
Packit |
6c4009 |
"_mcount:\n\t" \
|
|
Packit |
6c4009 |
".frame $sp,44,$31\n\t" \
|
|
Packit |
6c4009 |
".set noreorder;\n\t" \
|
|
Packit |
6c4009 |
".set noat;\n\t" \
|
|
Packit |
6c4009 |
CPLOAD \
|
|
Packit |
6c4009 |
"subu $29,$29,48;\n\t" \
|
|
Packit |
6c4009 |
CPRESTORE \
|
|
Packit |
6c4009 |
"sw $4,24($29);\n\t" \
|
|
Packit |
6c4009 |
"sw $5,28($29);\n\t" \
|
|
Packit |
6c4009 |
"sw $6,32($29);\n\t" \
|
|
Packit |
6c4009 |
"sw $7,36($29);\n\t" \
|
|
Packit |
6c4009 |
"sw $2,40($29);\n\t" \
|
|
Packit |
6c4009 |
"sw $1,16($29);\n\t" \
|
|
Packit |
6c4009 |
"sw $31,20($29);\n\t" \
|
|
Packit |
6c4009 |
"move $5,$31;\n\t" \
|
|
Packit |
6c4009 |
"move $4,$1;\n\t" \
|
|
Packit |
6c4009 |
"jal __mcount;\n\t" \
|
|
Packit |
6c4009 |
"nop;\n\t" \
|
|
Packit |
6c4009 |
"lw $4,24($29);\n\t" \
|
|
Packit |
6c4009 |
"lw $5,28($29);\n\t" \
|
|
Packit |
6c4009 |
"lw $6,32($29);\n\t" \
|
|
Packit |
6c4009 |
"lw $7,36($29);\n\t" \
|
|
Packit |
6c4009 |
"lw $2,40($29);\n\t" \
|
|
Packit |
6c4009 |
"lw $31,20($29);\n\t" \
|
|
Packit |
6c4009 |
"lw $1,16($29);\n\t" \
|
|
Packit |
6c4009 |
"addu $29,$29,56;\n\t" \
|
|
Packit |
6c4009 |
"j $31;\n\t" \
|
|
Packit |
6c4009 |
"move $31,$1;\n\t" \
|
|
Packit |
6c4009 |
".end _mcount;\n\t" \
|
|
Packit |
6c4009 |
".set pop");
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __PIC__
|
|
Packit |
6c4009 |
# define CPSETUP ".cpsetup $25, 88, _mcount;"
|
|
Packit |
6c4009 |
# define CPRETURN ".cpreturn;"
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define CPSETUP
|
|
Packit |
6c4009 |
# define CPRETURN
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if _MIPS_SIM == _ABIN32
|
|
Packit |
6c4009 |
# if !defined __mips_isa_rev || __mips_isa_rev < 6
|
|
Packit |
6c4009 |
# define PTR_ADDU_STRING "add" /* no u */
|
|
Packit |
6c4009 |
# define PTR_SUBU_STRING "sub" /* no u */
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define PTR_ADDU_STRING "addu"
|
|
Packit |
6c4009 |
# define PTR_SUBU_STRING "subu"
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#elif _MIPS_SIM == _ABI64
|
|
Packit |
6c4009 |
# define PTR_ADDU_STRING "daddu"
|
|
Packit |
6c4009 |
# define PTR_SUBU_STRING "dsubu"
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# error "Unknown ABI"
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define MCOUNT asm(\
|
|
Packit |
6c4009 |
".globl _mcount;\n\t" \
|
|
Packit |
6c4009 |
".align 3;\n\t" \
|
|
Packit |
6c4009 |
".set push;\n\t" \
|
|
Packit |
6c4009 |
".set nomips16;\n\t" \
|
|
Packit |
6c4009 |
".type _mcount,@function;\n\t" \
|
|
Packit |
6c4009 |
".ent _mcount\n\t" \
|
|
Packit |
6c4009 |
"_mcount:\n\t" \
|
|
Packit |
6c4009 |
".frame $sp,88,$31\n\t" \
|
|
Packit |
6c4009 |
".set noreorder;\n\t" \
|
|
Packit |
6c4009 |
".set noat;\n\t" \
|
|
Packit |
6c4009 |
PTR_SUBU_STRING " $29,$29,96;\n\t" \
|
|
Packit |
6c4009 |
CPSETUP \
|
|
Packit |
6c4009 |
"sd $4,24($29);\n\t" \
|
|
Packit |
6c4009 |
"sd $5,32($29);\n\t" \
|
|
Packit |
6c4009 |
"sd $6,40($29);\n\t" \
|
|
Packit |
6c4009 |
"sd $7,48($29);\n\t" \
|
|
Packit |
6c4009 |
"sd $8,56($29);\n\t" \
|
|
Packit |
6c4009 |
"sd $9,64($29);\n\t" \
|
|
Packit |
6c4009 |
"sd $10,72($29);\n\t" \
|
|
Packit |
6c4009 |
"sd $11,80($29);\n\t" \
|
|
Packit |
6c4009 |
"sd $2,16($29);\n\t" \
|
|
Packit |
6c4009 |
"sd $1,0($29);\n\t" \
|
|
Packit |
6c4009 |
"sd $31,8($29);\n\t" \
|
|
Packit |
6c4009 |
"move $5,$31;\n\t" \
|
|
Packit |
6c4009 |
"move $4,$1;\n\t" \
|
|
Packit |
6c4009 |
"jal __mcount;\n\t" \
|
|
Packit |
6c4009 |
"nop;\n\t" \
|
|
Packit |
6c4009 |
"ld $4,24($29);\n\t" \
|
|
Packit |
6c4009 |
"ld $5,32($29);\n\t" \
|
|
Packit |
6c4009 |
"ld $6,40($29);\n\t" \
|
|
Packit |
6c4009 |
"ld $7,48($29);\n\t" \
|
|
Packit |
6c4009 |
"ld $8,56($29);\n\t" \
|
|
Packit |
6c4009 |
"ld $9,64($29);\n\t" \
|
|
Packit |
6c4009 |
"ld $10,72($29);\n\t" \
|
|
Packit |
6c4009 |
"ld $11,80($29);\n\t" \
|
|
Packit |
6c4009 |
"ld $2,16($29);\n\t" \
|
|
Packit |
6c4009 |
"ld $31,8($29);\n\t" \
|
|
Packit |
6c4009 |
"ld $1,0($29);\n\t" \
|
|
Packit |
6c4009 |
CPRETURN \
|
|
Packit |
6c4009 |
PTR_ADDU_STRING " $29,$29,96;\n\t" \
|
|
Packit |
6c4009 |
"j $31;\n\t" \
|
|
Packit |
6c4009 |
"move $31,$1;\n\t" \
|
|
Packit |
6c4009 |
".end _mcount;\n\t" \
|
|
Packit |
6c4009 |
".set pop");
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif
|