Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch SH5 profiling support.
details: https://anonhg.NetBSD.org/src/rev/5ac3787116db
branches: trunk
changeset: 533850:5ac3787116db
user: scw <scw%NetBSD.org@localhost>
date: Wed Jul 10 10:24:16 2002 +0000
description:
SH5 profiling support.
diffstat:
sys/arch/evbsh5/include/Makefile | 4 +-
sys/arch/evbsh5/include/profile.h | 3 +
sys/arch/sh5/include/Makefile | 4 +-
sys/arch/sh5/include/asm.h | 6 +-
sys/arch/sh5/include/profile.h | 132 ++++++++++++++++++++++++++++++++++++++
5 files changed, 144 insertions(+), 5 deletions(-)
diffs (200 lines):
diff -r 8cbe7e58a9fa -r 5ac3787116db sys/arch/evbsh5/include/Makefile
--- a/sys/arch/evbsh5/include/Makefile Wed Jul 10 10:22:43 2002 +0000
+++ b/sys/arch/evbsh5/include/Makefile Wed Jul 10 10:24:16 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2002/07/10 08:56:12 scw Exp $
+# $NetBSD: Makefile,v 1.2 2002/07/10 10:24:17 scw Exp $
KDIR= /sys/arch/evbsh5/include
INCSDIR= /usr/include/evbsh5
@@ -11,7 +11,7 @@
frame.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
limits.h lock.h \
- param.h pcb.h pmap.h proc.h ptrace.h \
+ param.h pcb.h pmap.h proc.h profile.h ptrace.h \
reg.h \
setjmp.h signal.h stdarg.h \
types.h \
diff -r 8cbe7e58a9fa -r 5ac3787116db sys/arch/evbsh5/include/profile.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbsh5/include/profile.h Wed Jul 10 10:24:16 2002 +0000
@@ -0,0 +1,3 @@
+/* $NetBSD: profile.h,v 1.1 2002/07/10 10:24:17 scw Exp $ */
+
+#include <sh5/profile.h>
diff -r 8cbe7e58a9fa -r 5ac3787116db sys/arch/sh5/include/Makefile
--- a/sys/arch/sh5/include/Makefile Wed Jul 10 10:22:43 2002 +0000
+++ b/sys/arch/sh5/include/Makefile Wed Jul 10 10:24:16 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2002/07/10 08:56:13 scw Exp $
+# $NetBSD: Makefile,v 1.2 2002/07/10 10:24:16 scw Exp $
KDIR= /sys/arch/sh5/include
INCSDIR= /usr/include/sh5
@@ -11,7 +11,7 @@
frame.h \
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
limits.h lock.h \
- param.h pcb.h pmap.h proc.h ptrace.h \
+ param.h pcb.h pmap.h proc.h profile.h ptrace.h \
reg.h \
setjmp.h signal.h stdarg.h \
trap.h types.h \
diff -r 8cbe7e58a9fa -r 5ac3787116db sys/arch/sh5/include/asm.h
--- a/sys/arch/sh5/include/asm.h Wed Jul 10 10:22:43 2002 +0000
+++ b/sys/arch/sh5/include/asm.h Wed Jul 10 10:24:16 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asm.h,v 1.1 2002/07/05 13:31:56 scw Exp $ */
+/* $NetBSD: asm.h,v 1.2 2002/07/10 10:24:16 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -119,7 +119,11 @@
x:
#endif
+#ifdef GPROF
+#define _PROF_PROLOGUE pta/l _mcount, tr0; blink tr0, r0
+#else
#define _PROF_PROLOGUE
+#endif
#define ENTRY(y) _ENTRY(_C_LABEL(y)) ;\
_PROF_PROLOGUE
diff -r 8cbe7e58a9fa -r 5ac3787116db sys/arch/sh5/include/profile.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sh5/include/profile.h Wed Jul 10 10:24:16 2002 +0000
@@ -0,0 +1,132 @@
+/* $NetBSD: profile.h,v 1.1 2002/07/10 10:24:16 scw Exp $ */
+
+/*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SH5_PROFILE_H
+#define _SH5_PROFILE_H
+
+#define _MCOUNT_DECL void __mcount
+
+/*
+ * See _PROF_PROLOGUE in <sh5/asm.h>
+ * The "selfpc" value is passed on r0, while the "frompc" is passed in r18
+ */
+
+#ifdef _LP64
+#define MCOUNT \
+__asm(" .globl _mcount \n" \
+" .type _mcount,@function \n" \
+"_mcount: \n" \
+" addi r15, -96, r15 \n" \
+" st.q r15, 88, r0 \n" \
+" st.q r15, 80, r14 \n" \
+" or r15, r63, r14 \n" \
+" pta/l ___mcount, tr0 \n" \
+" st.q r15, 72, r18 \n" \
+" st.q r15, 64, r2 \n" \
+" st.q r15, 56, r3 \n" \
+" st.q r15, 48, r4 \n" \
+" st.q r15, 40, r5 \n" \
+" st.q r15, 32, r6 \n" \
+" st.q r15, 24, r7 \n" \
+" st.q r15, 16, r8 \n" \
+" st.q r15, 8, r9 \n" \
+" or r18, r63, r2 \n" \
+" or r0, r63, r3 \n" \
+" blink tr0, r18 \n" \
+" ld.q r15, 88, r0 \n" \
+" ld.q r15, 72, r18 \n" \
+" ld.q r15, 64, r2 \n" \
+" ld.q r15, 56, r3 \n" \
+" ld.q r15, 48, r4 \n" \
+" ld.q r15, 40, r5 \n" \
+" ld.q r15, 32, r6 \n" \
+" ld.q r15, 24, r7 \n" \
+" ld.q r15, 16, r8 \n" \
+" ld.q r15, 8, r9 \n" \
+" ptabs/l r0, tr0 \n" \
+" ld.q r15, 80, r14 \n" \
+" addi r15, 96, r15 \n" \
+" blink tr0, r63 \n"
+
+#else /* !_LP64 */
+
+#define MCOUNT \
+__asm(" .globl _mcount \n" \
+" .type _mcount,@function \n" \
+"_mcount: \n" \
+" addi.l r15, -80, r15 \n" \
+" st.l r15, 76, r0 \n" \
+" st.l r15, 72, r14 \n" \
+" or r15, r63, r14 \n" \
+" pta/l ___mcount, tr0 \n" \
+" st.q r15, 64, r18 \n" \
+" st.q r15, 56, r2 \n" \
+" st.q r15, 48, r3 \n" \
+" st.q r15, 40, r4 \n" \
+" st.q r15, 32, r5 \n" \
+" st.q r15, 24, r6 \n" \
+" st.q r15, 16, r7 \n" \
+" st.q r15, 8, r8 \n" \
+" st.q r15, 0, r9 \n" \
+" or r18, r63, r2 \n" \
+" or r0, r63, r3 \n" \
+" blink tr0, r18 \n" \
+" ld.l r15, 76, r0 \n" \
+" ld.q r15, 64, r18 \n" \
+" ld.q r15, 56, r2 \n" \
+" ld.q r15, 48, r3 \n" \
+" ld.q r15, 40, r4 \n" \
+" ld.q r15, 32, r5 \n" \
+" ld.q r15, 24, r6 \n" \
+" ld.q r15, 16, r7 \n" \
+" ld.q r15, 8, r8 \n" \
+" ld.q r15, 0, r9 \n" \
+" ptabs/l r0, tr0 \n" \
+" ld.l r15, 72, r14 \n" \
+" addi.l r15, 80, r15 \n" \
+" blink tr0, r63 \n"
+
+#ifdef _KERNEL
+#define MCOUNT_ENTER \
+ __asm volatile("getcon sr, %0" : "=r"(s)); \
+ __asm volatile("putcon %0, sr" :: "r"(s | SH5_CONREG_SR_IMASK_ALL))
+
+#define MCOUNT_EXIT \
+ __asm volatile("putcon %0, sr" :: "r"(s))
+#endif
+
+#endif /* _SH5_PROFILE_H */
Home |
Main Index |
Thread Index |
Old Index