diff options
-rw-r--r-- | lib/libc/sparc64/Symbol.map | 1 | ||||
-rw-r--r-- | sys/sparc64/include/profile.h | 40 | ||||
-rw-r--r-- | sys/sun4v/include/profile.h | 40 |
3 files changed, 73 insertions, 8 deletions
diff --git a/lib/libc/sparc64/Symbol.map b/lib/libc/sparc64/Symbol.map index a2e8505..d7fd308 100644 --- a/lib/libc/sparc64/Symbol.map +++ b/lib/libc/sparc64/Symbol.map @@ -11,6 +11,7 @@ FBSD_1.0 { /* PSEUDO syscalls */ _exit; + _mcount; _setjmp; _longjmp; fabs; diff --git a/sys/sparc64/include/profile.h b/sys/sparc64/include/profile.h index 8779ea5..6c7d1b2 100644 --- a/sys/sparc64/include/profile.h +++ b/sys/sparc64/include/profile.h @@ -32,18 +32,24 @@ #ifndef _MACHINE_PROFILE_H_ #define _MACHINE_PROFILE_H_ -#define FUNCTION_ALIGNMENT 32 -#define _MCOUNT_DECL void mcount -#define MCOUNT +#if !defined(_KERNEL) && !defined(_SYS_CDEFS_H_) +#error this file needs sys/cdefs.h as a prerequisite +#endif + +#define FUNCTION_ALIGNMENT 32 typedef u_long fptrdiff_t; #ifdef _KERNEL #include <machine/cpufunc.h> +#include <machine/intr_machdep.h> + +#define _MCOUNT_DECL void mcount +#define MCOUNT #define MCOUNT_DECL(s) register_t s; -#define MCOUNT_ENTER(s) s = rdpr(pil); wrpr(pil, 0, 14) +#define MCOUNT_ENTER(s) s = rdpr(pil); wrpr(pil, 0, PIL_TICK) #define MCOUNT_EXIT(s) wrpr(pil, 0, s) void bintr(void); @@ -65,6 +71,32 @@ void mcount(uintfptr_t frompc, uintfptr_t selfpc); typedef u_long uintfptr_t; +#define _MCOUNT_DECL static __inline void __mcount + +#ifdef __GNUCLIKE_ASM +#define MCOUNT \ +void \ +_mcount() \ +{ \ + uintfptr_t frompc, selfpc; \ + \ + /* \ + * Find the return address for mcount, \ + * and the return address for mcount's caller. \ + * \ + * selfpc = pc pushed by call to mcount \ + */ \ + __asm("add %%o7, 8, %0" : "=r" (selfpc)); \ + /* \ + * frompc = pc pushed by call to mcount's caller. \ + */ \ + __asm("add %%i7, 8, %0" : "=r" (frompc)); \ + __mcount(frompc, selfpc); \ +} +#else /* !__GNUCLIKE_ASM */ +#define MCOUNT +#endif /* __GNUCLIKE_ASM */ + #endif /* _KERNEL */ #endif /* !_MACHINE_PROFILE_H_ */ diff --git a/sys/sun4v/include/profile.h b/sys/sun4v/include/profile.h index 8779ea5..6c7d1b2 100644 --- a/sys/sun4v/include/profile.h +++ b/sys/sun4v/include/profile.h @@ -32,18 +32,24 @@ #ifndef _MACHINE_PROFILE_H_ #define _MACHINE_PROFILE_H_ -#define FUNCTION_ALIGNMENT 32 -#define _MCOUNT_DECL void mcount -#define MCOUNT +#if !defined(_KERNEL) && !defined(_SYS_CDEFS_H_) +#error this file needs sys/cdefs.h as a prerequisite +#endif + +#define FUNCTION_ALIGNMENT 32 typedef u_long fptrdiff_t; #ifdef _KERNEL #include <machine/cpufunc.h> +#include <machine/intr_machdep.h> + +#define _MCOUNT_DECL void mcount +#define MCOUNT #define MCOUNT_DECL(s) register_t s; -#define MCOUNT_ENTER(s) s = rdpr(pil); wrpr(pil, 0, 14) +#define MCOUNT_ENTER(s) s = rdpr(pil); wrpr(pil, 0, PIL_TICK) #define MCOUNT_EXIT(s) wrpr(pil, 0, s) void bintr(void); @@ -65,6 +71,32 @@ void mcount(uintfptr_t frompc, uintfptr_t selfpc); typedef u_long uintfptr_t; +#define _MCOUNT_DECL static __inline void __mcount + +#ifdef __GNUCLIKE_ASM +#define MCOUNT \ +void \ +_mcount() \ +{ \ + uintfptr_t frompc, selfpc; \ + \ + /* \ + * Find the return address for mcount, \ + * and the return address for mcount's caller. \ + * \ + * selfpc = pc pushed by call to mcount \ + */ \ + __asm("add %%o7, 8, %0" : "=r" (selfpc)); \ + /* \ + * frompc = pc pushed by call to mcount's caller. \ + */ \ + __asm("add %%i7, 8, %0" : "=r" (frompc)); \ + __mcount(frompc, selfpc); \ +} +#else /* !__GNUCLIKE_ASM */ +#define MCOUNT +#endif /* __GNUCLIKE_ASM */ + #endif /* _KERNEL */ #endif /* !_MACHINE_PROFILE_H_ */ |