From c2b57e513e7da99d52267b5d9fc9ca1bf9c7c8e5 Mon Sep 17 00:00:00 2001 From: Dale Rahn Date: Mon, 11 Nov 2002 16:44:05 +0000 Subject: Proper defines for powerpc kernel profiling. --- sys/arch/powerpc/include/profile.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sys/arch/powerpc/include') 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 */ -- cgit v1.2.3