diff options
-rw-r--r-- | sys/sparc64/include/profile.h | 49 | ||||
-rw-r--r-- | sys/sparc64/sparc64/support.S | 54 | ||||
-rw-r--r-- | sys/sparc64/sparc64/support.s | 54 |
3 files changed, 91 insertions, 66 deletions
diff --git a/sys/sparc64/include/profile.h b/sys/sparc64/include/profile.h index 122fc87..398f5c7 100644 --- a/sys/sparc64/include/profile.h +++ b/sys/sparc64/include/profile.h @@ -32,34 +32,55 @@ #ifndef _MACHINE_PROFILE_H_ #define _MACHINE_PROFILE_H_ +#define FUNCTION_ALIGNMENT 32 #define _MCOUNT_DECL void mcount - -#define FUNCTION_ALIGNMENT 32 +#define MCOUNT typedef u_long fptrdiff_t; -typedef u_long uintfptr_t; - -#define MCOUNT \ -void \ -_mcount() \ -{ \ -} #ifdef _KERNEL -#define MCOUNT_ENTER(s) -#define MCOUNT_EXIT(s) -#define MCOUNT_DECL(s) + +#include <machine/cpufunc.h> + +#define MCOUNT_DECL(s) register_t s; +#define MCOUNT_ENTER(s) s = rdpr(pil); wrpr(pil, 0, 14) +#define MCOUNT_EXIT(s) wrpr(pil, 0, s) + #ifdef GUPROF + +#define CALIB_SCALE 1000 +#define KCOUNT(p,index) \ + ((p)->kcount[(index) / (HISTFRACTION * sizeof(HISTCOUNTER))]) +#define PC_TO_I(p, pc) ((uintfptr_t)(pc) - (uintfptr_t)(p)->lowpc) + struct gmonparam; +extern int cputime_bias; + +int cputime(void); void nullfunc_loop_profiled(void); void nullfunc_profiled(void); void startguprof(struct gmonparam *p); void stopguprof(struct gmonparam *p); -#else + +#else /* GUPROF */ + #define startguprof(p) #define stopguprof(p) + #endif /* GUPROF */ -#endif + +void empty_loop(void); +void kmupetext(uintfptr_t nhighpc); +void mcount(uintfptr_t frompc, uintfptr_t selfpc); +void mexitcount(uintfptr_t selfpc); +void nullfunc(void); +void nullfunc_loop(void); + +#else /* _KERNEL */ + +typedef u_long uintfptr_t; + +#endif /* _KERNEL */ #endif /* !_MACHINE_PROFILE_H_ */ diff --git a/sys/sparc64/sparc64/support.S b/sys/sparc64/sparc64/support.S index 405d813..68cf714 100644 --- a/sys/sparc64/sparc64/support.S +++ b/sys/sparc64/sparc64/support.S @@ -585,7 +585,23 @@ ENTRY(openfirmware_exit) ! never to return END(openfirmware_exit) -#ifdef GUPROF +#ifdef GPROF + +ENTRY(user) + nop + +ENTRY(btrap) + nop + +ENTRY(etrap) + nop + +ENTRY(bintr) + nop + +ENTRY(eintr) + nop + /* * XXX including sys/gmon.h in genassym.c is not possible due to uintfptr_t @@ -595,10 +611,10 @@ END(openfirmware_exit) #define GMON_PROF_OFF 3 #define GMON_PROF_HIRES 4 - _ALIGN_TEXT - .globl __cyg_profile_func_enter - .type __cyg_profile_func_enter,@function -__cyg_profile_func_enter: + .globl _mcount + .set _mcount, __cyg_profile_func_enter + +ENTRY(__cyg_profile_func_enter) SET(_gmonparam, %o3, %o2) lduw [%o2 + GM_STATE], %o3 cmp %o3, GMON_PROF_OFF @@ -609,12 +625,11 @@ __cyg_profile_func_enter: nop 1: retl nop - .size __cyg_profile_func_enter, . - __cyg_profile_func_enter +END(__cyg_profile_func_enter) - _ALIGN_TEXT - .globl __cyg_profile_func_exit - .type __cyg_profile_func_exit,@function -__cyg_profile_func_exit: +#ifdef GUPROF + +ENTRY(__cyg_profile_func_exit) SET(_gmonparam, %o3, %o2) lduw [%o2 + GM_STATE], %o3 cmp %o3, GMON_PROF_HIRES @@ -625,21 +640,8 @@ __cyg_profile_func_exit: nop 1: retl nop - .size __cyg_profile_func_exit, . - __cyg_profile_func_exit - -ENTRY(user) - nop - -ENTRY(btrap) - nop +END(__cyg_profile_func_exit) -ENTRY(etrap) - nop - -ENTRY(bintr) - nop - -ENTRY(eintr) - nop +#endif /* GUPROF */ -#endif +#endif /* GPROF */ diff --git a/sys/sparc64/sparc64/support.s b/sys/sparc64/sparc64/support.s index 405d813..68cf714 100644 --- a/sys/sparc64/sparc64/support.s +++ b/sys/sparc64/sparc64/support.s @@ -585,7 +585,23 @@ ENTRY(openfirmware_exit) ! never to return END(openfirmware_exit) -#ifdef GUPROF +#ifdef GPROF + +ENTRY(user) + nop + +ENTRY(btrap) + nop + +ENTRY(etrap) + nop + +ENTRY(bintr) + nop + +ENTRY(eintr) + nop + /* * XXX including sys/gmon.h in genassym.c is not possible due to uintfptr_t @@ -595,10 +611,10 @@ END(openfirmware_exit) #define GMON_PROF_OFF 3 #define GMON_PROF_HIRES 4 - _ALIGN_TEXT - .globl __cyg_profile_func_enter - .type __cyg_profile_func_enter,@function -__cyg_profile_func_enter: + .globl _mcount + .set _mcount, __cyg_profile_func_enter + +ENTRY(__cyg_profile_func_enter) SET(_gmonparam, %o3, %o2) lduw [%o2 + GM_STATE], %o3 cmp %o3, GMON_PROF_OFF @@ -609,12 +625,11 @@ __cyg_profile_func_enter: nop 1: retl nop - .size __cyg_profile_func_enter, . - __cyg_profile_func_enter +END(__cyg_profile_func_enter) - _ALIGN_TEXT - .globl __cyg_profile_func_exit - .type __cyg_profile_func_exit,@function -__cyg_profile_func_exit: +#ifdef GUPROF + +ENTRY(__cyg_profile_func_exit) SET(_gmonparam, %o3, %o2) lduw [%o2 + GM_STATE], %o3 cmp %o3, GMON_PROF_HIRES @@ -625,21 +640,8 @@ __cyg_profile_func_exit: nop 1: retl nop - .size __cyg_profile_func_exit, . - __cyg_profile_func_exit - -ENTRY(user) - nop - -ENTRY(btrap) - nop +END(__cyg_profile_func_exit) -ENTRY(etrap) - nop - -ENTRY(bintr) - nop - -ENTRY(eintr) - nop +#endif /* GUPROF */ -#endif +#endif /* GPROF */ |