summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2002-11-11 16:44:05 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2002-11-11 16:44:05 +0000
commitc2b57e513e7da99d52267b5d9fc9ca1bf9c7c8e5 (patch)
tree552ab0d76045d54ce2cd1f05e681b291e128c059 /sys/arch/powerpc
parent2e4714f29daba0dc9c630fb5509084b5bff0dd01 (diff)
Proper defines for powerpc kernel profiling.
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r--sys/arch/powerpc/include/profile.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/arch/powerpc/include/profile.h b/sys/arch/powerpc/include/profile.h
index ea974344f06..2fcf2125a22 100644
--- a/sys/arch/powerpc/include/profile.h
+++ b/sys/arch/powerpc/include/profile.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: profile.h,v 1.4 2002/09/15 09:01:59 deraadt Exp $ */
+/* $OpenBSD: profile.h,v 1.5 2002/11/11 16:44:04 drahn Exp $ */
/*
* Copyright (c) 1998 Dale Rahn. All rights reserved.
@@ -70,4 +70,15 @@
.Lfe2: \n\
.size _mcount, .Lfe2-_mcount \n\
");
-#define _MCOUNT_DECL static __mcount
+#define _MCOUNT_DECL static void __mcount
+#ifdef _KERNEL
+#define MCOUNT_ENTER \
+ __asm volatile("mfmsr %0" : "=r"(s)); \
+ if ((s & (PSL_IR | PSL_DR)) != (PSL_IR | PSL_DR)) \
+ return; /* prof not possible in real mode */ \
+ s &= ~PSL_POW; \
+ __asm volatile("mtmsr %0" :: "r"(s & ~PSL_EE))
+
+#define MCOUNT_EXIT \
+ __asm volatile("mtmsr %0" :: "r"(s))
+#endif /* _KERNEL */