Profiling fixes from Ethan Solomita <ethan@geocast.com>.

Merge Kernel MCOUNT and user MCOUNT.

The earlier code which was inserted to call _mcount in profiling
assembler routines is busted badly.  This gets it working with PIC
code and should work with any arbitrary assembler routine.
This commit is contained in:
castor 2000-06-12 23:42:10 +00:00
parent 58ca6aac15
commit 751cd4ffb0
1 changed files with 18 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: asm.h,v 1.22 1999/04/24 08:10:33 simonb Exp $ */
/* $NetBSD: asm.h,v 1.23 2000/06/12 23:42:10 castor Exp $ */
/*
* Copyright (c) 1992, 1993
@ -62,21 +62,26 @@
/*
* Define -pg profile entry code.
* XXX assume .set noreorder for kernel, .set reorder for user code.
* Must always be noreorder, must never use a macro instruction
* Final addiu to t9 must always equal the size of this _KERN_MCOUNT
*/
#define _KERN_MCOUNT \
.set noat; \
move $1,$31; \
jal _mcount; \
subu sp,sp,8; \
.set at
#define _KERN_MCOUNT \
.set push; \
.set noreorder; \
.set noat; \
sw t9,-4(sp); \
move AT,ra; \
lui t9,%hi(_mcount); \
addiu t9,t9,%lo(_mcount); \
jalr t9; \
subu sp,sp,16; \
lw t9,4(sp); \
addiu sp,sp,8; \
addiu t9,t9,36; \
.set pop;
#ifdef GPROF
# if defined(_KERNEL) || defined(_LOCORE)
# define MCOUNT _KERN_MCOUNT
# else
# define MCOUNT .set noreorder; _KERN_MCOUNT ; .set reorder;
# endif
#define MCOUNT _KERN_MCOUNT
#else
#define MCOUNT
#endif