summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/prof_machdep.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1999-05-06 09:44:57 +0000
committerbde <bde@FreeBSD.org>1999-05-06 09:44:57 +0000
commit5b08c51b31821f3ee69a4da34d5618c450494568 (patch)
tree519c2330fe4c5a08795caf7b4c055e6ca5fefe77 /sys/i386/isa/prof_machdep.c
parent897b3119d8cdee2c1e43b35e5c16706c95f19ef1 (diff)
downloadFreeBSD-src-5b08c51b31821f3ee69a4da34d5618c450494568.zip
FreeBSD-src-5b08c51b31821f3ee69a4da34d5618c450494568.tar.gz
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)
Diffstat (limited to 'sys/i386/isa/prof_machdep.c')
-rw-r--r--sys/i386/isa/prof_machdep.c51
1 files changed, 28 insertions, 23 deletions
diff --git a/sys/i386/isa/prof_machdep.c b/sys/i386/isa/prof_machdep.c
index 60167ea..808dd86 100644
--- a/sys/i386/isa/prof_machdep.c
+++ b/sys/i386/isa/prof_machdep.c
@@ -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__ */
OpenPOWER on IntegriCloud