diff options
-rw-r--r-- | lib/libc/gmon/mcount.c | 11 | ||||
-rw-r--r-- | sys/amd64/include/profile.h | 25 | ||||
-rw-r--r-- | sys/i386/include/profile.h | 25 | ||||
-rw-r--r-- | sys/libkern/mcount.c | 11 |
4 files changed, 40 insertions, 32 deletions
diff --git a/lib/libc/gmon/mcount.c b/lib/libc/gmon/mcount.c index 44d36d1..b44af99 100644 --- a/lib/libc/gmon/mcount.c +++ b/lib/libc/gmon/mcount.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93"; #endif static const char rcsid[] = - "$Id: mcount.c,v 1.5 1995/12/30 07:01:50 bde Exp $"; + "$Id: mcount.c,v 1.6 1996/05/02 08:43:37 phk Exp $"; #endif #include <sys/param.h> @@ -79,8 +79,7 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ register struct gmonparam *p; register long toindex; #ifdef KERNEL - register int s; /* XXX */ - u_long save_eflags; /* XXX */ + MCOUNT_DECL(s) #endif p = &_gmonparam; @@ -93,7 +92,7 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ return; #endif #ifdef KERNEL - MCOUNT_ENTER; + MCOUNT_ENTER(s); #else p->state = GMON_PROF_BUSY; #endif @@ -261,7 +260,7 @@ skip_guprof_stuff: } done: #ifdef KERNEL - MCOUNT_EXIT; + MCOUNT_EXIT(s); #else p->state = GMON_PROF_ON; #endif @@ -269,7 +268,7 @@ done: overflow: p->state = GMON_PROF_ERROR; #ifdef KERNEL - MCOUNT_EXIT; + MCOUNT_EXIT(s); #endif return; } diff --git a/sys/amd64/include/profile.h b/sys/amd64/include/profile.h index d912c40..4b9d51b 100644 --- a/sys/amd64/include/profile.h +++ b/sys/amd64/include/profile.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)profile.h 8.1 (Berkeley) 6/11/93 - * $Id: profile.h,v 1.5 1995/12/29 15:28:54 bde Exp $ + * $Id: profile.h,v 1.6 1996/01/01 17:11:21 bde Exp $ */ #ifndef _MACHINE_PROFILE_H_ @@ -46,6 +46,20 @@ #define _MCOUNT_DECL void mcount #define MCOUNT +#ifdef GUPROF +#define CALIB_SCALE 1000 +#define KCOUNT(p,index) ((p)->kcount[(index) \ + / (HISTFRACTION * sizeof(*(p)->kcount))]) +#define MCOUNT_DECL(s) +#define MCOUNT_ENTER(s) +#define MCOUNT_EXIT(s) +#define PC_TO_I(p, pc) ((fptrint_t)(pc) - (fptrint_t)(p)->lowpc) +#else +#define MCOUNT_DECL(s) u_long s; +#define MCOUNT_ENTER(s) { s = read_eflags(); disable_intr(); } +#define MCOUNT_EXIT(s) (write_eflags(s)) +#endif /* GUPROF */ + #else /* !KERNEL */ #define _MCOUNT_DECL static __inline void _mcount @@ -74,15 +88,6 @@ mcount() \ } #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; diff --git a/sys/i386/include/profile.h b/sys/i386/include/profile.h index d912c40..4b9d51b 100644 --- a/sys/i386/include/profile.h +++ b/sys/i386/include/profile.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)profile.h 8.1 (Berkeley) 6/11/93 - * $Id: profile.h,v 1.5 1995/12/29 15:28:54 bde Exp $ + * $Id: profile.h,v 1.6 1996/01/01 17:11:21 bde Exp $ */ #ifndef _MACHINE_PROFILE_H_ @@ -46,6 +46,20 @@ #define _MCOUNT_DECL void mcount #define MCOUNT +#ifdef GUPROF +#define CALIB_SCALE 1000 +#define KCOUNT(p,index) ((p)->kcount[(index) \ + / (HISTFRACTION * sizeof(*(p)->kcount))]) +#define MCOUNT_DECL(s) +#define MCOUNT_ENTER(s) +#define MCOUNT_EXIT(s) +#define PC_TO_I(p, pc) ((fptrint_t)(pc) - (fptrint_t)(p)->lowpc) +#else +#define MCOUNT_DECL(s) u_long s; +#define MCOUNT_ENTER(s) { s = read_eflags(); disable_intr(); } +#define MCOUNT_EXIT(s) (write_eflags(s)) +#endif /* GUPROF */ + #else /* !KERNEL */ #define _MCOUNT_DECL static __inline void _mcount @@ -74,15 +88,6 @@ mcount() \ } #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; diff --git a/sys/libkern/mcount.c b/sys/libkern/mcount.c index 726ad5a..30cda2d 100644 --- a/sys/libkern/mcount.c +++ b/sys/libkern/mcount.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93"; #endif static const char rcsid[] = - "$Id: mcount.c,v 1.6 1995/12/30 07:24:13 bde Exp $"; + "$Id: mcount.c,v 1.7 1996/05/02 14:20:33 phk Exp $"; #endif #include <sys/param.h> @@ -79,8 +79,7 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ register struct gmonparam *p; register long toindex; #ifdef KERNEL - register int s; /* XXX */ - u_long save_eflags; /* XXX */ + MCOUNT_DECL(s) #endif p = &_gmonparam; @@ -93,7 +92,7 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ return; #endif #ifdef KERNEL - MCOUNT_ENTER; + MCOUNT_ENTER(s); #else p->state = GMON_PROF_BUSY; #endif @@ -261,7 +260,7 @@ skip_guprof_stuff: } done: #ifdef KERNEL - MCOUNT_EXIT; + MCOUNT_EXIT(s); #else p->state = GMON_PROF_ON; #endif @@ -269,7 +268,7 @@ done: overflow: p->state = GMON_PROF_ERROR; #ifdef KERNEL - MCOUNT_EXIT; + MCOUNT_EXIT(s); #endif return; } |