Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc64 Get kernel profiling to work. Now if only ...



details:   https://anonhg.NetBSD.org/src/rev/12e420a04677
branches:  trunk
changeset: 495676:12e420a04677
user:      eeh <eeh%NetBSD.org@localhost>
date:      Wed Aug 02 22:24:38 2000 +0000

description:
Get kernel profiling to work.  Now if only gprof worked....

diffstat:

 sys/arch/sparc64/conf/Makefile.sparc64 |   7 +++++--
 sys/arch/sparc64/include/asm.h         |   6 +++---
 sys/arch/sparc64/include/profile.h     |  16 ++++++++--------
 sys/arch/sparc64/sparc64/locore.s      |  13 +++++++++----
 4 files changed, 25 insertions(+), 17 deletions(-)

diffs (127 lines):

diff -r a2404ee2b9ab -r 12e420a04677 sys/arch/sparc64/conf/Makefile.sparc64
--- a/sys/arch/sparc64/conf/Makefile.sparc64    Wed Aug 02 22:20:41 2000 +0000
+++ b/sys/arch/sparc64/conf/Makefile.sparc64    Wed Aug 02 22:24:38 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.sparc64,v 1.29 2000/07/24 04:54:16 mycroft Exp $
+#      $NetBSD: Makefile.sparc64,v 1.30 2000/08/02 22:24:38 eeh Exp $
 
 # Makefile for NetBSD
 #
@@ -21,7 +21,6 @@
 # DEBUG is set to -g if debugging.
 # PROF is set to -pg if profiling.
 
-
 .if defined(MAKECONF) && exists(${MAKECONF})
 .include "${MAKECONF}"
 .elif exists(/etc/mk.conf)
@@ -68,6 +67,10 @@
 CWARNFLAGS=    -Wimplicit -Wunused -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wparentheses -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
 #CWARNFLAGS=   -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
 CFLAGS=                ${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
+.if defined(PROF)
+# We need to run the compiler in medlow memory model.
+CFLAGS += -mcmodel=medlow
+.endif
 AFLAGS=                -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
 LINKFLAGS=     -Ttext f1000000 -Tdata f1400000 -e start
 #LINKFLAGS=    -N -Ttext f1000000 -e start
diff -r a2404ee2b9ab -r 12e420a04677 sys/arch/sparc64/include/asm.h
--- a/sys/arch/sparc64/include/asm.h    Wed Aug 02 22:20:41 2000 +0000
+++ b/sys/arch/sparc64/include/asm.h    Wed Aug 02 22:24:38 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asm.h,v 1.14 2000/08/01 00:25:02 eeh Exp $ */
+/*     $NetBSD: asm.h,v 1.15 2000/08/02 22:24:39 eeh Exp $ */
 
 /*
  * Copyright (c) 1994 Allen Briggs
@@ -105,8 +105,8 @@
 
 #ifdef GPROF
 #define _PROF_PROLOGUE \
-       .data; .align 4; 1: .long 0; \
-       .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call mcount; \
+       .data; .align 8; 1: .uaword 0; .uaword 0; \
+       .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call _mcount; \
        or %o0,%lo(1b),%o0; restore
 #else
 #define _PROF_PROLOGUE
diff -r a2404ee2b9ab -r 12e420a04677 sys/arch/sparc64/include/profile.h
--- a/sys/arch/sparc64/include/profile.h        Wed Aug 02 22:20:41 2000 +0000
+++ b/sys/arch/sparc64/include/profile.h        Wed Aug 02 22:24:38 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: profile.h,v 1.3 1998/10/08 02:31:40 eeh Exp $ */
+/*     $NetBSD: profile.h,v 1.4 2000/08/02 22:24:39 eeh Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,16 +45,16 @@
  */
 
 #if    defined(ELF)||defined(__ELF__)
-#define _MCOUNT_SYM "_mcount"
+#define _MCOUNT_SYM "__mcount"
 #else
-#define _MCOUNT_SYM "__mcount"
+#define _MCOUNT_SYM "___mcount"
 #endif
 
 #ifdef PIC
 /* Inline expansion of PICCY_SET() (see <machine/asm.h>). */
 #define MCOUNT \
-       __asm__(".global mcount");\
-       __asm__("mcount:");\
+       __asm__(".global _mcount");\
+       __asm__("_mcount:");\
        __asm__("add %o7, 8, %o1");\
        __asm__("1: rd %pc, %o2");\
        __asm__("add %o2," _MCOUNT_SYM "-1b, %o2");\
@@ -63,15 +63,15 @@
        __asm__("add %i7, 8, %o0");
 #else
 #define MCOUNT \
-       __asm__(".global mcount");\
-       __asm__("mcount:");\
+       __asm__(".global _mcount");\
+       __asm__("_mcount:");\
        __asm__("add %i7, 8, %o0");\
        __asm__("sethi %hi(" _MCOUNT_SYM "), %o2");\
        __asm__("jmpl %o2 + %lo(" _MCOUNT_SYM "), %g0");\
        __asm__("add %o7, 8, %o1");
 #endif
 
-#define        _MCOUNT_DECL    static void _mcount
+#define        _MCOUNT_DECL    static void __mcount
 
 #ifdef _KERNEL
 /*
diff -r a2404ee2b9ab -r 12e420a04677 sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Wed Aug 02 22:20:41 2000 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Wed Aug 02 22:24:38 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.91 2000/08/01 00:40:15 eeh Exp $  */
+/*     $NetBSD: locore.s,v 1.92 2000/08/02 22:24:40 eeh Exp $  */
 /*
  * Copyright (c) 1996-1999 Eduardo Horvath
  * Copyright (c) 1996 Paul Kranenburg
@@ -6868,12 +6868,17 @@
 #endif
 
 #ifdef GPROF
-       .globl  mcount
+       .globl  _mcount
 #define        ENTRY(x) \
        .globl _C_LABEL(x); _C_LABEL(x): ; \
+       .data; \
+       .align 8; \
+0:     .uaword 0; .uaword 0; \
+       .text;  \
        save    %sp, -CC64FSZ, %sp; \
-       call    mcount; \
-       nop; \
+       sethi   %hi(0b), %o0; \
+       call    _mcount; \
+       or      %o0, %lo(0b), %o0; \
        restore
 #else
 #define        ENTRY(x)        .globl _C_LABEL(x); _C_LABEL(x):



Home | Main Index | Thread Index | Old Index