summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 */