Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/include/profile.h
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
typedef __uintfptr_t uintfptr_t; | typedef __uintfptr_t uintfptr_t; | ||||
#define _MCOUNT_DECL \ | #define _MCOUNT_DECL \ | ||||
static void _mcount(uintfptr_t frompc, uintfptr_t selfpc) __used; \ | static void _mcount(uintfptr_t frompc, uintfptr_t selfpc) __used; \ | ||||
static void _mcount | static void _mcount | ||||
#ifdef __GNUCLIKE_ASM | |||||
/* | /* | ||||
* Call into _mcount. On arm64 the .mcount is a function so callers will | * Call into _mcount. On arm64 the .mcount is a function so callers will | ||||
* handle caller saved registers. As we don't directly touch any callee | * handle caller saved registers. As we don't directly touch any callee | ||||
* saved registers we can just load the two arguments and use a tail call | * saved registers we can just load the two arguments and use a tail call | ||||
* into the MI _mcount function. | * into the MI _mcount function. | ||||
* | * | ||||
* When building with gcc frompc will be in x0, however this is not the | * When building with gcc frompc will be in x0, however this is not the | ||||
* case on clang. As such we need to load it from the stack. As long as | * case on clang. As such we need to load it from the stack. As long as | ||||
Show All 20 Lines | |||||
* all clang versions we care about would need to be fixed before we could | * all clang versions we care about would need to be fixed before we could | ||||
* make this change. | * make this change. | ||||
*/ | */ | ||||
void | void | ||||
mcount(uintfptr_t frompc) | mcount(uintfptr_t frompc) | ||||
{ | { | ||||
_mcount(frompc, __builtin_return_address(0)); | _mcount(frompc, __builtin_return_address(0)); | ||||
} | } | ||||
#endif | |||||
#else | |||||
#define MCOUNT | |||||
#endif | #endif | ||||
#endif /* !_KERNEL */ | #endif /* !_KERNEL */ | ||||
#endif /* !_MACHINE_PROFILE_H_ */ | #endif /* !_MACHINE_PROFILE_H_ */ |