Changeset View
Changeset View
Standalone View
Standalone View
sys/i386/include/profile.h
Show All 37 Lines | |||||
#ifndef _KERNEL | #ifndef _KERNEL | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
#define FUNCTION_ALIGNMENT 4 | #define FUNCTION_ALIGNMENT 4 | ||||
#define _MCOUNT_DECL static __inline void _mcount | #define _MCOUNT_DECL static __inline void _mcount | ||||
#ifdef __GNUCLIKE_ASM | |||||
#define MCOUNT \ | #define MCOUNT \ | ||||
void \ | void \ | ||||
mcount() \ | mcount() \ | ||||
{ \ | { \ | ||||
uintfptr_t selfpc, frompc, ecx; \ | uintfptr_t selfpc, frompc, ecx; \ | ||||
/* \ | /* \ | ||||
* In gcc 4.2, ecx might be used in the caller as the arg \ | * In gcc 4.2, ecx might be used in the caller as the arg \ | ||||
* pointer if the stack realignment option is set (-mstackrealign) \ | * pointer if the stack realignment option is set (-mstackrealign) \ | ||||
Show All 15 Lines | mcount() \ | ||||
* the caller's frame pointer. The caller's raddr is in the \ | * the caller's frame pointer. The caller's raddr is in the \ | ||||
* caller's frame following the caller's caller's frame pointer.\ | * caller's frame following the caller's caller's frame pointer.\ | ||||
*/ \ | */ \ | ||||
__asm("movl (%%ebp),%0" : "=r" (frompc)); \ | __asm("movl (%%ebp),%0" : "=r" (frompc)); \ | ||||
frompc = ((uintfptr_t *)frompc)[1]; \ | frompc = ((uintfptr_t *)frompc)[1]; \ | ||||
_mcount(frompc, selfpc); \ | _mcount(frompc, selfpc); \ | ||||
__asm("" : : "c" (ecx)); \ | __asm("" : : "c" (ecx)); \ | ||||
} | } | ||||
#else /* !__GNUCLIKE_ASM */ | |||||
#define MCOUNT | |||||
#endif /* __GNUCLIKE_ASM */ | |||||
typedef u_int uintfptr_t; | typedef u_int uintfptr_t; | ||||
/* | /* | ||||
* An unsigned integral type that can hold non-negative difference between | * An unsigned integral type that can hold non-negative difference between | ||||
* function pointers. | * function pointers. | ||||
*/ | */ | ||||
typedef u_int fptrdiff_t; | typedef u_int fptrdiff_t; | ||||
__BEGIN_DECLS | __BEGIN_DECLS | ||||
#ifdef __GNUCLIKE_ASM | |||||
void mcount(void) __asm(".mcount"); | void mcount(void) __asm(".mcount"); | ||||
#endif | |||||
__END_DECLS | __END_DECLS | ||||
#endif /* !_KERNEL */ | #endif /* !_KERNEL */ | ||||
#endif /* !_MACHINE_PROFILE_H_ */ | #endif /* !_MACHINE_PROFILE_H_ */ |