PlatformRegisters.cpp [plain text]
#include "config.h"
#include <wtf/PlatformRegisters.h>
#include <wtf/PtrTag.h>
namespace WTF {
#if USE(PLATFORM_REGISTERS_WITH_PROFILE) && CPU(ARM64E)
#define USE_UNTAGGED_THREAD_STATE_PTR 1
void* threadStateLRInternal(PlatformRegisters& regs)
{
void* candidateLR = arm_thread_state64_get_lr_fptr(regs);
#if USE(UNTAGGED_THREAD_STATE_PTR)
if (candidateLR && isTaggedWith<CFunctionPtrTag>(candidateLR))
return retagCodePtr<CFunctionPtrTag, PlatformRegistersLRPtrTag>(candidateLR);
candidateLR = bitwise_cast<void*>(arm_thread_state64_get_lr(regs));
if (!candidateLR)
return candidateLR;
return tagCodePtr<PlatformRegistersLRPtrTag>(candidateLR);
#else
return retagCodePtr<CFunctionPtrTag, PlatformRegistersLRPtrTag>(candidateLR);
#endif
}
void* threadStatePCInternal(PlatformRegisters& regs)
{
void* candidatePC = arm_thread_state64_get_pc_fptr(regs);
#if USE(UNTAGGED_THREAD_STATE_PTR)
if (candidatePC && isTaggedWith<CFunctionPtrTag>(candidatePC))
return retagCodePtr<CFunctionPtrTag, PlatformRegistersPCPtrTag>(candidatePC);
candidatePC = bitwise_cast<void*>(arm_thread_state64_get_pc(regs));
if (!candidatePC)
return candidatePC;
return tagCodePtr<PlatformRegistersPCPtrTag>(candidatePC);
#else
return retagCodePtr<CFunctionPtrTag, PlatformRegistersPCPtrTag>(candidatePC);
#endif
}
#endif // USE(PLATFORM_REGISTERS_WITH_PROFILE) && CPU(ARM64E)
}