summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/profile.h
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1996-01-01 17:11:21 +0000
committerbde <bde@FreeBSD.org>1996-01-01 17:11:21 +0000
commite5ebed44731a32498b7ec04a7e45b9d74e924e85 (patch)
tree7e1df1d7d20f66c46bd12e1dfa2779cd94e132e2 /sys/amd64/include/profile.h
parent09bad61c4ca4ebe784865f2aaec94c136397579e (diff)
downloadFreeBSD-src-e5ebed44731a32498b7ec04a7e45b9d74e924e85.zip
FreeBSD-src-e5ebed44731a32498b7ec04a7e45b9d74e924e85.tar.gz
Fixed user-mode mcount which I broke in the previous revision.
Do it the old way for now. Moved recent additions around a lot to minimise ifdefs. Added prototypes.
Diffstat (limited to 'sys/amd64/include/profile.h')
-rw-r--r--sys/amd64/include/profile.h46
1 files changed, 33 insertions, 13 deletions
diff --git a/sys/amd64/include/profile.h b/sys/amd64/include/profile.h
index c55d629..d912c40 100644
--- a/sys/amd64/include/profile.h
+++ b/sys/amd64/include/profile.h
@@ -31,17 +31,29 @@
* SUCH DAMAGE.
*
* @(#)profile.h 8.1 (Berkeley) 6/11/93
- * $Id: profile.h,v 1.4 1994/09/15 16:27:14 paul Exp $
+ * $Id: profile.h,v 1.5 1995/12/29 15:28:54 bde Exp $
*/
#ifndef _MACHINE_PROFILE_H_
#define _MACHINE_PROFILE_H_
-#if 0
-#define _MCOUNT_DECL static inline void _mcount
+#ifdef KERNEL
+/*
+ * The kernel uses assembler stubs instead of unportable inlines.
+ * This is mainly to save a little time when profiling is not enabled,
+ * which is the usual case for the kernel.
+ */
+#define _MCOUNT_DECL void mcount
+#define MCOUNT
+
+#else /* !KERNEL */
+
+#define _MCOUNT_DECL static __inline void _mcount
#define MCOUNT \
-extern void mcount() asm("mcount"); void mcount() { \
+void \
+mcount() \
+{ \
fptrint_t selfpc, frompc; \
/* \
* Find the return address for mcount, \
@@ -60,18 +72,16 @@ extern void mcount() asm("mcount"); void mcount() { \
frompc = ((fptrint_t *)frompc)[1]; \
_mcount(frompc, selfpc); \
}
-#else
-#define _MCOUNT_DECL void mcount
-#define MCOUNT
-#endif
-
-#define MCOUNT_ENTER { save_eflags = read_eflags(); disable_intr(); }
-#define MCOUNT_EXIT (write_eflags(save_eflags))
+#endif /* KERNEL */
+#ifdef KERNEL
#define CALIB_SCALE 1000
#define KCOUNT(p,index) ((p)->kcount[(index) \
/ (HISTFRACTION * sizeof(*(p)->kcount))])
+#define MCOUNT_ENTER { save_eflags = read_eflags(); disable_intr(); }
+#define MCOUNT_EXIT (write_eflags(save_eflags))
#define PC_TO_I(p, pc) ((fptrint_t)(pc) - (fptrint_t)(p)->lowpc)
+#endif
/* An unsigned integral type that can hold function pointers. */
typedef u_int fptrint_t;
@@ -82,8 +92,18 @@ typedef u_int fptrint_t;
*/
typedef int fptrdiff_t;
-u_int cputime __P((void));
+__BEGIN_DECLS
+#ifdef KERNEL
void mcount __P((fptrint_t frompc, fptrint_t selfpc));
+#else
+void mcount __P((void)) __asm("mcount");
+static void _mcount __P((fptrint_t frompc, fptrint_t selfpc));
+#endif
+
+#ifdef GUPROF
+u_int cputime __P((void));
void mexitcount __P((fptrint_t selfpc));
+#endif
+__END_DECLS
-#endif /* !MACHINE_PROFILE_H */
+#endif /* !_MACHINE_PROFILE_H_ */
OpenPOWER on IntegriCloud