Fixed profiling of elf kernels. Made high resolution profiling compile
for elf kernels (it is broken for all kernels due to lack of egcs support). Renaming of many assembler labels is avoided by declaring by declaring the labels that need to be visible to gprof as having type "function" and depending on the elf version of gprof being zealous about discarding the others. A few type declarations are still missing, mainly for SMP. PR: 9413 Submitted by: Assar Westerlund <assar@sics.se> (initial parts)
This commit is contained in:
parent
5c32431080
commit
ea2b3e3d1b
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: swtch.s,v 1.78 1999/04/02 17:59:39 alc Exp $
|
||||
* $Id: swtch.s,v 1.79 1999/04/28 01:03:25 luoqi Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -250,6 +250,7 @@ rem3id: .asciz "remrq.id"
|
||||
* to wait for something to come ready.
|
||||
*/
|
||||
ALIGN_TEXT
|
||||
.type _idle,@function
|
||||
_idle:
|
||||
xorl %ebp,%ebp
|
||||
movl %ebp,_switchtime
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: exception.s,v 1.58 1999/04/16 21:22:12 peter Exp $
|
||||
* $Id: exception.s,v 1.59 1999/04/28 01:03:18 luoqi Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -74,7 +74,8 @@
|
||||
/*
|
||||
* Trap and fault vector routines
|
||||
*/
|
||||
#define IDTVEC(name) ALIGN_TEXT; .globl __CONCAT(_X,name); __CONCAT(_X,name):
|
||||
#define IDTVEC(name) ALIGN_TEXT; .globl __CONCAT(_X,name); \
|
||||
.type __CONCAT(_X,name),@function; __CONCAT(_X,name):
|
||||
#define TRAP(a) pushl $(a) ; jmp _alltraps
|
||||
|
||||
/*
|
||||
@ -199,6 +200,7 @@ IDTVEC(align)
|
||||
|
||||
SUPERALIGN_TEXT
|
||||
.globl _alltraps
|
||||
.type _alltraps,@function
|
||||
_alltraps:
|
||||
pushal
|
||||
pushl %ds
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: exception.s,v 1.58 1999/04/16 21:22:12 peter Exp $
|
||||
* $Id: exception.s,v 1.59 1999/04/28 01:03:18 luoqi Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -74,7 +74,8 @@
|
||||
/*
|
||||
* Trap and fault vector routines
|
||||
*/
|
||||
#define IDTVEC(name) ALIGN_TEXT; .globl __CONCAT(_X,name); __CONCAT(_X,name):
|
||||
#define IDTVEC(name) ALIGN_TEXT; .globl __CONCAT(_X,name); \
|
||||
.type __CONCAT(_X,name),@function; __CONCAT(_X,name):
|
||||
#define TRAP(a) pushl $(a) ; jmp _alltraps
|
||||
|
||||
/*
|
||||
@ -199,6 +200,7 @@ IDTVEC(align)
|
||||
|
||||
SUPERALIGN_TEXT
|
||||
.globl _alltraps
|
||||
.type _alltraps,@function
|
||||
_alltraps:
|
||||
pushal
|
||||
pushl %ds
|
||||
|
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.66 1999/03/28 23:28:18 dt Exp $
|
||||
* $Id: npx.c,v 1.67 1999/04/16 21:22:24 peter Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -157,6 +157,7 @@ inthand_t probeintr;
|
||||
__asm(" \n\
|
||||
.text \n\
|
||||
.p2align 2,0x90 \n\
|
||||
.type " __XSTRING(CNAME(probeintr)) ",@function \n\
|
||||
" __XSTRING(CNAME(probeintr)) ": \n\
|
||||
ss \n\
|
||||
incl " __XSTRING(CNAME(npx_intrs_while_probing)) " \n\
|
||||
@ -174,6 +175,7 @@ inthand_t probetrap;
|
||||
__asm(" \n\
|
||||
.text \n\
|
||||
.p2align 2,0x90 \n\
|
||||
.type " __XSTRING(CNAME(probetrap)) ",@function \n\
|
||||
" __XSTRING(CNAME(probetrap)) ": \n\
|
||||
ss \n\
|
||||
incl " __XSTRING(CNAME(npx_traps_while_probing)) " \n\
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: prof_machdep.c,v 1.10 1998/04/19 15:41:06 bde Exp $
|
||||
* $Id: prof_machdep.c,v 1.11 1998/12/14 18:21:34 bde Exp $
|
||||
*/
|
||||
|
||||
#ifdef GUPROF
|
||||
@ -39,8 +39,11 @@
|
||||
#include <machine/clock.h>
|
||||
#include <machine/perfmon.h>
|
||||
#include <machine/profile.h>
|
||||
#undef MCOUNT
|
||||
#endif
|
||||
|
||||
#include <machine/asmacros.h>
|
||||
|
||||
#ifdef PC98
|
||||
#include <pc98/pc98/pc98.h>
|
||||
#else
|
||||
@ -73,25 +76,26 @@ GMON_PROF_OFF = 3 \n\
|
||||
.text \n\
|
||||
.align 4,0x90 \n\
|
||||
.globl __mcount \n\
|
||||
.type __mcount,@function \n\
|
||||
__mcount: \n\
|
||||
# \n\
|
||||
# Check that we are profiling. Do it early for speed. \n\
|
||||
# \n\
|
||||
cmpl $GMON_PROF_OFF,__gmonparam+GM_STATE \n\
|
||||
je Lmcount_exit \n\
|
||||
cmpl $GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\
|
||||
je .mcount_exit \n\
|
||||
# \n\
|
||||
# __mcount is the same as mcount except the caller \n\
|
||||
# __mcount is the same as [.]mcount except the caller \n\
|
||||
# hasn't changed the stack except to call here, so the \n\
|
||||
# caller's raddr is above our raddr. \n\
|
||||
# \n\
|
||||
movl 4(%esp),%edx \n\
|
||||
jmp Lgot_frompc \n\
|
||||
jmp .got_frompc \n\
|
||||
\n\
|
||||
.align 4,0x90 \n\
|
||||
.globl mcount \n\
|
||||
mcount: \n\
|
||||
cmpl $GMON_PROF_OFF,__gmonparam+GM_STATE \n\
|
||||
je Lmcount_exit \n\
|
||||
.globl " __XSTRING(HIDENAME(mcount)) " \n\
|
||||
" __XSTRING(HIDENAME(mcount)) ": \n\
|
||||
cmpl $GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\
|
||||
je .mcount_exit \n\
|
||||
# \n\
|
||||
# The caller's stack frame has already been built, so \n\
|
||||
# %ebp is the caller's frame pointer. The caller's \n\
|
||||
@ -99,7 +103,7 @@ mcount: \n\
|
||||
# caller's frame pointer. \n\
|
||||
# \n\
|
||||
movl 4(%ebp),%edx \n\
|
||||
Lgot_frompc: \n\
|
||||
.got_frompc: \n\
|
||||
# \n\
|
||||
# Our raddr is the caller's pc. \n\
|
||||
# \n\
|
||||
@ -109,10 +113,10 @@ Lgot_frompc: \n\
|
||||
pushl %eax \n\
|
||||
pushl %edx \n\
|
||||
cli \n\
|
||||
call _mcount \n\
|
||||
call " __XSTRING(CNAME(mcount)) " \n\
|
||||
addl $8,%esp \n\
|
||||
popfl \n\
|
||||
Lmcount_exit: \n\
|
||||
.mcount_exit: \n\
|
||||
ret \n\
|
||||
");
|
||||
#else /* !__GNUC__ */
|
||||
@ -121,41 +125,42 @@ Lmcount_exit: \n\
|
||||
|
||||
#ifdef GUPROF
|
||||
/*
|
||||
* mexitcount saves the return register(s), loads selfpc and calls
|
||||
* [.]mexitcount saves the return register(s), loads selfpc and calls
|
||||
* mexitcount(selfpc) to do the work. Someday it should be in a machine
|
||||
* dependent file together with cputime(), __mcount and mcount. cputime()
|
||||
* dependent file together with cputime(), __mcount and [.]mcount. cputime()
|
||||
* can't just be put in machdep.c because it has to be compiled without -pg.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
__asm(" \n\
|
||||
.text \n\
|
||||
# \n\
|
||||
# Dummy label to be seen when gprof -u hides mexitcount. \n\
|
||||
# Dummy label to be seen when gprof -u hides [.]mexitcount. \n\
|
||||
# \n\
|
||||
.align 4,0x90 \n\
|
||||
.globl __mexitcount \n\
|
||||
.type __mexitcount,@function \n\
|
||||
__mexitcount: \n\
|
||||
nop \n\
|
||||
\n\
|
||||
GMON_PROF_HIRES = 4 \n\
|
||||
\n\
|
||||
.align 4,0x90 \n\
|
||||
.globl mexitcount \n\
|
||||
mexitcount: \n\
|
||||
cmpl $GMON_PROF_HIRES,__gmonparam+GM_STATE \n\
|
||||
jne Lmexitcount_exit \n\
|
||||
.globl " __XSTRING(HIDENAME(mexitcount)) " \n\
|
||||
" __XSTRING(HIDENAME(mexitcount)) ": \n\
|
||||
cmpl $GMON_PROF_HIRES," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\
|
||||
jne .mexitcount_exit \n\
|
||||
pushl %edx \n\
|
||||
pushl %eax \n\
|
||||
movl 8(%esp),%eax \n\
|
||||
pushfl \n\
|
||||
pushl %eax \n\
|
||||
cli \n\
|
||||
call _mexitcount \n\
|
||||
call " __XSTRING(CNAME(mexitcount)) " \n\
|
||||
addl $4,%esp \n\
|
||||
popfl \n\
|
||||
popl %eax \n\
|
||||
popl %edx \n\
|
||||
Lmexitcount_exit: \n\
|
||||
.mexitcount_exit: \n\
|
||||
ret \n\
|
||||
");
|
||||
#else /* !__GNUC__ */
|
||||
@ -340,8 +345,8 @@ stopguprof(gp)
|
||||
__asm(" \n\
|
||||
.text \n\
|
||||
.align 4,0x90 \n\
|
||||
.globl mexitcount \n\
|
||||
mexitcount: \n\
|
||||
.globl " __XSTRING(HIDENAME(mexitcount)) " \n\
|
||||
" __XSTRING(HIDENAME(mexitcount)) ": \n\
|
||||
ret \n\
|
||||
");
|
||||
#else /* !__GNUC__ */
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: swtch.s,v 1.78 1999/04/02 17:59:39 alc Exp $
|
||||
* $Id: swtch.s,v 1.79 1999/04/28 01:03:25 luoqi Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -250,6 +250,7 @@ rem3id: .asciz "remrq.id"
|
||||
* to wait for something to come ready.
|
||||
*/
|
||||
ALIGN_TEXT
|
||||
.type _idle,@function
|
||||
_idle:
|
||||
xorl %ebp,%ebp
|
||||
movl %ebp,_switchtime
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: asmacros.h,v 1.15 1997/03/09 13:57:33 bde Exp $
|
||||
* $Id: asmacros.h,v 1.16 1997/04/22 06:55:32 jdp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_ASMACROS_H_
|
||||
@ -65,13 +65,13 @@
|
||||
#define SUPERALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */
|
||||
|
||||
#define GEN_ENTRY(name) ALIGN_TEXT; .globl CNAME(name); \
|
||||
CNAME(name):
|
||||
.type CNAME(name),@function; CNAME(name):
|
||||
#define NON_GPROF_ENTRY(name) GEN_ENTRY(name)
|
||||
#define NON_GPROF_RET .byte 0xc3 /* opcode for `ret' */
|
||||
|
||||
#ifdef GPROF
|
||||
/*
|
||||
* __mcount is like mcount except that doesn't require its caller to set
|
||||
* __mcount is like [.]mcount except that doesn't require its caller to set
|
||||
* up a frame pointer. It must be called before pushing anything onto the
|
||||
* stack. gcc should eventually generate code to call __mcount in most
|
||||
* cases. This would make -pg in combination with -fomit-frame-pointer
|
||||
@ -80,19 +80,19 @@
|
||||
* inadequate for good handling of special cases, e.g., -fpic works best
|
||||
* with profiling after the prologue.
|
||||
*
|
||||
* mexitcount is a new function to support non-statistical profiling if an
|
||||
* [.]mexitcount is a new function to support non-statistical profiling if an
|
||||
* accurate clock is available. For C sources, calls to it are generated
|
||||
* by the FreeBSD extension `-mprofiler-epilogue' to gcc. It is best to
|
||||
* call mexitcount at the end of a function like the MEXITCOUNT macro does,
|
||||
* call [.]mexitcount at the end of a function like the MEXITCOUNT macro does,
|
||||
* but gcc currently generates calls to it at the start of the epilogue to
|
||||
* avoid problems with -fpic.
|
||||
*
|
||||
* mcount and __mexitcount may clobber the call-used registers and %ef.
|
||||
* mexitcount may clobber %ecx and %ef.
|
||||
* [.]mcount and __mcount may clobber the call-used registers and %ef.
|
||||
* [.]mexitcount may clobber %ecx and %ef.
|
||||
*
|
||||
* Cross-jumping makes non-statistical profiling timing more complicated.
|
||||
* It is handled in many cases by calling mexitcount before jumping. It is
|
||||
* handled for conditional jumps using CROSSJUMP() and CROSSJUMP_LABEL().
|
||||
* It is handled in many cases by calling [.]mexitcount before jumping. It
|
||||
* is handled for conditional jumps using CROSSJUMP() and CROSSJUMP_LABEL().
|
||||
* It is handled for some fault-handling jumps by not sharing the exit
|
||||
* routine.
|
||||
*
|
||||
@ -118,7 +118,7 @@
|
||||
#define FAKE_MCOUNT(caller) pushl caller ; call __mcount ; popl %ecx
|
||||
#define MCOUNT call __mcount
|
||||
#define MCOUNT_LABEL(name) GEN_ENTRY(name) ; nop ; ALIGN_TEXT
|
||||
#define MEXITCOUNT call mexitcount
|
||||
#define MEXITCOUNT call HIDENAME(mexitcount)
|
||||
#define ret MEXITCOUNT ; NON_GPROF_RET
|
||||
|
||||
#else /* !GPROF */
|
||||
|
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.66 1999/03/28 23:28:18 dt Exp $
|
||||
* $Id: npx.c,v 1.67 1999/04/16 21:22:24 peter Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -157,6 +157,7 @@ inthand_t probeintr;
|
||||
__asm(" \n\
|
||||
.text \n\
|
||||
.p2align 2,0x90 \n\
|
||||
.type " __XSTRING(CNAME(probeintr)) ",@function \n\
|
||||
" __XSTRING(CNAME(probeintr)) ": \n\
|
||||
ss \n\
|
||||
incl " __XSTRING(CNAME(npx_intrs_while_probing)) " \n\
|
||||
@ -174,6 +175,7 @@ inthand_t probetrap;
|
||||
__asm(" \n\
|
||||
.text \n\
|
||||
.p2align 2,0x90 \n\
|
||||
.type " __XSTRING(CNAME(probetrap)) ",@function \n\
|
||||
" __XSTRING(CNAME(probetrap)) ": \n\
|
||||
ss \n\
|
||||
incl " __XSTRING(CNAME(npx_traps_while_probing)) " \n\
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: exception.s,v 1.58 1999/04/16 21:22:12 peter Exp $
|
||||
* $Id: exception.s,v 1.59 1999/04/28 01:03:18 luoqi Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -74,7 +74,8 @@
|
||||
/*
|
||||
* Trap and fault vector routines
|
||||
*/
|
||||
#define IDTVEC(name) ALIGN_TEXT; .globl __CONCAT(_X,name); __CONCAT(_X,name):
|
||||
#define IDTVEC(name) ALIGN_TEXT; .globl __CONCAT(_X,name); \
|
||||
.type __CONCAT(_X,name),@function; __CONCAT(_X,name):
|
||||
#define TRAP(a) pushl $(a) ; jmp _alltraps
|
||||
|
||||
/*
|
||||
@ -199,6 +200,7 @@ IDTVEC(align)
|
||||
|
||||
SUPERALIGN_TEXT
|
||||
.globl _alltraps
|
||||
.type _alltraps,@function
|
||||
_alltraps:
|
||||
pushal
|
||||
pushl %ds
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: swtch.s,v 1.78 1999/04/02 17:59:39 alc Exp $
|
||||
* $Id: swtch.s,v 1.79 1999/04/28 01:03:25 luoqi Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -250,6 +250,7 @@ rem3id: .asciz "remrq.id"
|
||||
* to wait for something to come ready.
|
||||
*/
|
||||
ALIGN_TEXT
|
||||
.type _idle,@function
|
||||
_idle:
|
||||
xorl %ebp,%ebp
|
||||
movl %ebp,_switchtime
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: asmacros.h,v 1.15 1997/03/09 13:57:33 bde Exp $
|
||||
* $Id: asmacros.h,v 1.16 1997/04/22 06:55:32 jdp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_ASMACROS_H_
|
||||
@ -65,13 +65,13 @@
|
||||
#define SUPERALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */
|
||||
|
||||
#define GEN_ENTRY(name) ALIGN_TEXT; .globl CNAME(name); \
|
||||
CNAME(name):
|
||||
.type CNAME(name),@function; CNAME(name):
|
||||
#define NON_GPROF_ENTRY(name) GEN_ENTRY(name)
|
||||
#define NON_GPROF_RET .byte 0xc3 /* opcode for `ret' */
|
||||
|
||||
#ifdef GPROF
|
||||
/*
|
||||
* __mcount is like mcount except that doesn't require its caller to set
|
||||
* __mcount is like [.]mcount except that doesn't require its caller to set
|
||||
* up a frame pointer. It must be called before pushing anything onto the
|
||||
* stack. gcc should eventually generate code to call __mcount in most
|
||||
* cases. This would make -pg in combination with -fomit-frame-pointer
|
||||
@ -80,19 +80,19 @@
|
||||
* inadequate for good handling of special cases, e.g., -fpic works best
|
||||
* with profiling after the prologue.
|
||||
*
|
||||
* mexitcount is a new function to support non-statistical profiling if an
|
||||
* [.]mexitcount is a new function to support non-statistical profiling if an
|
||||
* accurate clock is available. For C sources, calls to it are generated
|
||||
* by the FreeBSD extension `-mprofiler-epilogue' to gcc. It is best to
|
||||
* call mexitcount at the end of a function like the MEXITCOUNT macro does,
|
||||
* call [.]mexitcount at the end of a function like the MEXITCOUNT macro does,
|
||||
* but gcc currently generates calls to it at the start of the epilogue to
|
||||
* avoid problems with -fpic.
|
||||
*
|
||||
* mcount and __mexitcount may clobber the call-used registers and %ef.
|
||||
* mexitcount may clobber %ecx and %ef.
|
||||
* [.]mcount and __mcount may clobber the call-used registers and %ef.
|
||||
* [.]mexitcount may clobber %ecx and %ef.
|
||||
*
|
||||
* Cross-jumping makes non-statistical profiling timing more complicated.
|
||||
* It is handled in many cases by calling mexitcount before jumping. It is
|
||||
* handled for conditional jumps using CROSSJUMP() and CROSSJUMP_LABEL().
|
||||
* It is handled in many cases by calling [.]mexitcount before jumping. It
|
||||
* is handled for conditional jumps using CROSSJUMP() and CROSSJUMP_LABEL().
|
||||
* It is handled for some fault-handling jumps by not sharing the exit
|
||||
* routine.
|
||||
*
|
||||
@ -118,7 +118,7 @@
|
||||
#define FAKE_MCOUNT(caller) pushl caller ; call __mcount ; popl %ecx
|
||||
#define MCOUNT call __mcount
|
||||
#define MCOUNT_LABEL(name) GEN_ENTRY(name) ; nop ; ALIGN_TEXT
|
||||
#define MEXITCOUNT call mexitcount
|
||||
#define MEXITCOUNT call HIDENAME(mexitcount)
|
||||
#define ret MEXITCOUNT ; NON_GPROF_RET
|
||||
|
||||
#else /* !GPROF */
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: asnames.h,v 1.31 1999/04/16 21:22:16 peter Exp $
|
||||
* $Id: asnames.h,v 1.32 1999/04/28 01:03:57 luoqi Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_ASNAMES_H_
|
||||
@ -175,6 +175,7 @@
|
||||
#define _bcopy bcopy
|
||||
#define _bcopy_vector bcopy_vector
|
||||
#define _bigJump bigJump
|
||||
#define _bintr bintr
|
||||
#define _bio_imask bio_imask
|
||||
#define _bluetrap bluetrap
|
||||
#define _bootCodeSeg bootCodeSeg
|
||||
@ -187,6 +188,7 @@
|
||||
#define _boothowto boothowto
|
||||
#define _bootinfo bootinfo
|
||||
#define _bootstrap_gdt bootstrap_gdt
|
||||
#define _btrap btrap
|
||||
#define _bzero bzero
|
||||
#define _cam_imask cam_imask
|
||||
#define _checkstate_cpus checkstate_cpus
|
||||
@ -219,6 +221,7 @@
|
||||
#define _divide_by_zero divide_by_zero
|
||||
#define _divide_kernel divide_kernel
|
||||
#define _do_page_zero_idle do_page_zero_idle
|
||||
#define _doreti doreti
|
||||
#define _edata edata
|
||||
#define _eintrcnt eintrcnt
|
||||
#define _eintrnames eintrnames
|
||||
@ -239,6 +242,7 @@
|
||||
#define _get_mplock get_mplock
|
||||
#define _get_syscall_lock get_syscall_lock
|
||||
#define _getmicrouptime getmicrouptime
|
||||
#define _idle idle
|
||||
#define _idqs idqs
|
||||
#define _ihandlers ihandlers
|
||||
#define _imen imen
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)ipl.s
|
||||
*
|
||||
* $Id: ipl.s,v 1.25 1999/04/11 15:51:15 peter Exp $
|
||||
* $Id: ipl.s,v 1.26 1999/04/28 01:04:14 luoqi Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -107,6 +107,7 @@ _netisrs:
|
||||
* Handle return from interrupts, traps and syscalls.
|
||||
*/
|
||||
SUPERALIGN_TEXT
|
||||
.type _doreti,@function
|
||||
_doreti:
|
||||
#ifdef SMP
|
||||
TEST_CIL
|
||||
@ -417,6 +418,7 @@ dummynetisr:
|
||||
*/
|
||||
ALIGN_TEXT
|
||||
.globl _swi_generic
|
||||
.type _swi_generic,@function
|
||||
_swi_generic:
|
||||
pushl %ecx
|
||||
FAKE_MCOUNT(4(%esp))
|
||||
|
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.66 1999/03/28 23:28:18 dt Exp $
|
||||
* $Id: npx.c,v 1.67 1999/04/16 21:22:24 peter Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -157,6 +157,7 @@ inthand_t probeintr;
|
||||
__asm(" \n\
|
||||
.text \n\
|
||||
.p2align 2,0x90 \n\
|
||||
.type " __XSTRING(CNAME(probeintr)) ",@function \n\
|
||||
" __XSTRING(CNAME(probeintr)) ": \n\
|
||||
ss \n\
|
||||
incl " __XSTRING(CNAME(npx_intrs_while_probing)) " \n\
|
||||
@ -174,6 +175,7 @@ inthand_t probetrap;
|
||||
__asm(" \n\
|
||||
.text \n\
|
||||
.p2align 2,0x90 \n\
|
||||
.type " __XSTRING(CNAME(probetrap)) ",@function \n\
|
||||
" __XSTRING(CNAME(probetrap)) ": \n\
|
||||
ss \n\
|
||||
incl " __XSTRING(CNAME(npx_traps_while_probing)) " \n\
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: prof_machdep.c,v 1.10 1998/04/19 15:41:06 bde Exp $
|
||||
* $Id: prof_machdep.c,v 1.11 1998/12/14 18:21:34 bde Exp $
|
||||
*/
|
||||
|
||||
#ifdef GUPROF
|
||||
@ -39,8 +39,11 @@
|
||||
#include <machine/clock.h>
|
||||
#include <machine/perfmon.h>
|
||||
#include <machine/profile.h>
|
||||
#undef MCOUNT
|
||||
#endif
|
||||
|
||||
#include <machine/asmacros.h>
|
||||
|
||||
#ifdef PC98
|
||||
#include <pc98/pc98/pc98.h>
|
||||
#else
|
||||
@ -73,25 +76,26 @@ GMON_PROF_OFF = 3 \n\
|
||||
.text \n\
|
||||
.align 4,0x90 \n\
|
||||
.globl __mcount \n\
|
||||
.type __mcount,@function \n\
|
||||
__mcount: \n\
|
||||
# \n\
|
||||
# Check that we are profiling. Do it early for speed. \n\
|
||||
# \n\
|
||||
cmpl $GMON_PROF_OFF,__gmonparam+GM_STATE \n\
|
||||
je Lmcount_exit \n\
|
||||
cmpl $GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\
|
||||
je .mcount_exit \n\
|
||||
# \n\
|
||||
# __mcount is the same as mcount except the caller \n\
|
||||
# __mcount is the same as [.]mcount except the caller \n\
|
||||
# hasn't changed the stack except to call here, so the \n\
|
||||
# caller's raddr is above our raddr. \n\
|
||||
# \n\
|
||||
movl 4(%esp),%edx \n\
|
||||
jmp Lgot_frompc \n\
|
||||
jmp .got_frompc \n\
|
||||
\n\
|
||||
.align 4,0x90 \n\
|
||||
.globl mcount \n\
|
||||
mcount: \n\
|
||||
cmpl $GMON_PROF_OFF,__gmonparam+GM_STATE \n\
|
||||
je Lmcount_exit \n\
|
||||
.globl " __XSTRING(HIDENAME(mcount)) " \n\
|
||||
" __XSTRING(HIDENAME(mcount)) ": \n\
|
||||
cmpl $GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\
|
||||
je .mcount_exit \n\
|
||||
# \n\
|
||||
# The caller's stack frame has already been built, so \n\
|
||||
# %ebp is the caller's frame pointer. The caller's \n\
|
||||
@ -99,7 +103,7 @@ mcount: \n\
|
||||
# caller's frame pointer. \n\
|
||||
# \n\
|
||||
movl 4(%ebp),%edx \n\
|
||||
Lgot_frompc: \n\
|
||||
.got_frompc: \n\
|
||||
# \n\
|
||||
# Our raddr is the caller's pc. \n\
|
||||
# \n\
|
||||
@ -109,10 +113,10 @@ Lgot_frompc: \n\
|
||||
pushl %eax \n\
|
||||
pushl %edx \n\
|
||||
cli \n\
|
||||
call _mcount \n\
|
||||
call " __XSTRING(CNAME(mcount)) " \n\
|
||||
addl $8,%esp \n\
|
||||
popfl \n\
|
||||
Lmcount_exit: \n\
|
||||
.mcount_exit: \n\
|
||||
ret \n\
|
||||
");
|
||||
#else /* !__GNUC__ */
|
||||
@ -121,41 +125,42 @@ Lmcount_exit: \n\
|
||||
|
||||
#ifdef GUPROF
|
||||
/*
|
||||
* mexitcount saves the return register(s), loads selfpc and calls
|
||||
* [.]mexitcount saves the return register(s), loads selfpc and calls
|
||||
* mexitcount(selfpc) to do the work. Someday it should be in a machine
|
||||
* dependent file together with cputime(), __mcount and mcount. cputime()
|
||||
* dependent file together with cputime(), __mcount and [.]mcount. cputime()
|
||||
* can't just be put in machdep.c because it has to be compiled without -pg.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
__asm(" \n\
|
||||
.text \n\
|
||||
# \n\
|
||||
# Dummy label to be seen when gprof -u hides mexitcount. \n\
|
||||
# Dummy label to be seen when gprof -u hides [.]mexitcount. \n\
|
||||
# \n\
|
||||
.align 4,0x90 \n\
|
||||
.globl __mexitcount \n\
|
||||
.type __mexitcount,@function \n\
|
||||
__mexitcount: \n\
|
||||
nop \n\
|
||||
\n\
|
||||
GMON_PROF_HIRES = 4 \n\
|
||||
\n\
|
||||
.align 4,0x90 \n\
|
||||
.globl mexitcount \n\
|
||||
mexitcount: \n\
|
||||
cmpl $GMON_PROF_HIRES,__gmonparam+GM_STATE \n\
|
||||
jne Lmexitcount_exit \n\
|
||||
.globl " __XSTRING(HIDENAME(mexitcount)) " \n\
|
||||
" __XSTRING(HIDENAME(mexitcount)) ": \n\
|
||||
cmpl $GMON_PROF_HIRES," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\
|
||||
jne .mexitcount_exit \n\
|
||||
pushl %edx \n\
|
||||
pushl %eax \n\
|
||||
movl 8(%esp),%eax \n\
|
||||
pushfl \n\
|
||||
pushl %eax \n\
|
||||
cli \n\
|
||||
call _mexitcount \n\
|
||||
call " __XSTRING(CNAME(mexitcount)) " \n\
|
||||
addl $4,%esp \n\
|
||||
popfl \n\
|
||||
popl %eax \n\
|
||||
popl %edx \n\
|
||||
Lmexitcount_exit: \n\
|
||||
.mexitcount_exit: \n\
|
||||
ret \n\
|
||||
");
|
||||
#else /* !__GNUC__ */
|
||||
@ -340,8 +345,8 @@ stopguprof(gp)
|
||||
__asm(" \n\
|
||||
.text \n\
|
||||
.align 4,0x90 \n\
|
||||
.globl mexitcount \n\
|
||||
mexitcount: \n\
|
||||
.globl " __XSTRING(HIDENAME(mexitcount)) " \n\
|
||||
" __XSTRING(HIDENAME(mexitcount)) ": \n\
|
||||
ret \n\
|
||||
");
|
||||
#else /* !__GNUC__ */
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)subr_prof.c 8.3 (Berkeley) 9/23/93
|
||||
* $Id: subr_prof.c,v 1.27 1998/07/14 05:09:46 bde Exp $
|
||||
* $Id: subr_prof.c,v 1.28 1998/09/05 14:30:11 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -47,6 +47,7 @@
|
||||
#ifdef GPROF
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/gmon.h>
|
||||
#undef MCOUNT
|
||||
|
||||
static MALLOC_DEFINE(M_GPROF, "gprof", "kernel profiling buffer");
|
||||
|
||||
@ -56,6 +57,8 @@ SYSINIT(kmem, SI_SUB_KPROF, SI_ORDER_FIRST, kmstartup, NULL)
|
||||
struct gmonparam _gmonparam = { GMON_PROF_OFF };
|
||||
|
||||
#ifdef GUPROF
|
||||
#include <machine/asmacros.h>
|
||||
|
||||
void
|
||||
nullfunc_loop_profiled()
|
||||
{
|
||||
@ -174,7 +177,7 @@ kmstartup(dummy)
|
||||
startguprof(p);
|
||||
for (i = 0; i < CALIB_SCALE; i++)
|
||||
#if defined(__i386__) && __GNUC__ >= 2
|
||||
__asm("call mexitcount; 1:"
|
||||
__asm("call " __XSTRING(HIDENAME(mexitcount)) "; 1:"
|
||||
: : : "ax", "bx", "cx", "dx", "memory");
|
||||
__asm("movl $1b,%0" : "=rm" (tmp_addr));
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user