- Add bits for userland profiling. For sun4u this is compile-tested only.
- Replace magic 14 with PIL_TICK.
This commit is contained in:
parent
2308d23a4e
commit
ac474f9545
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169488
@ -11,6 +11,7 @@ FBSD_1.0 {
|
||||
/* PSEUDO syscalls */
|
||||
_exit;
|
||||
|
||||
_mcount;
|
||||
_setjmp;
|
||||
_longjmp;
|
||||
fabs;
|
||||
|
@ -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_ */
|
||||
|
@ -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_ */
|
||||
|
Loading…
Reference in New Issue
Block a user