Merge pull request #9053 from kit-ty-kate/freebsd-arm64
Add support for FreeBSD/arm64
This commit is contained in:
commit
75b4f70e5e
|
@ -9,7 +9,9 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
#ifndef __FreeBSD__
|
||||||
#include <asm/hwcap.h>
|
#include <asm/hwcap.h>
|
||||||
|
#endif
|
||||||
#include <sys/auxv.h>
|
#include <sys/auxv.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -87,7 +89,12 @@ void CPUInfo::Detect()
|
||||||
num_cores = sysconf(_SC_NPROCESSORS_CONF);
|
num_cores = sysconf(_SC_NPROCESSORS_CONF);
|
||||||
strncpy(cpu_string, GetCPUString().c_str(), sizeof(cpu_string));
|
strncpy(cpu_string, GetCPUString().c_str(), sizeof(cpu_string));
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
u_long hwcaps = 0;
|
||||||
|
elf_aux_info(AT_HWCAP, &hwcaps, sizeof(u_long));
|
||||||
|
#else
|
||||||
unsigned long hwcaps = getauxval(AT_HWCAP);
|
unsigned long hwcaps = getauxval(AT_HWCAP);
|
||||||
|
#endif
|
||||||
bFP = hwcaps & HWCAP_FP;
|
bFP = hwcaps & HWCAP_FP;
|
||||||
bASIMD = hwcaps & HWCAP_ASIMD;
|
bASIMD = hwcaps & HWCAP_ASIMD;
|
||||||
bAES = hwcaps & HWCAP_AES;
|
bAES = hwcaps & HWCAP_AES;
|
||||||
|
|
|
@ -35,6 +35,7 @@ typedef CONTEXT SContext;
|
||||||
#define CTX_RIP Rip
|
#define CTX_RIP Rip
|
||||||
#elif _M_ARM64
|
#elif _M_ARM64
|
||||||
#define CTX_REG(x) X[x]
|
#define CTX_REG(x) X[x]
|
||||||
|
#define CTX_LR X[30]
|
||||||
#define CTX_SP Sp
|
#define CTX_SP Sp
|
||||||
#define CTX_PC Pc
|
#define CTX_PC Pc
|
||||||
#else
|
#else
|
||||||
|
@ -115,6 +116,7 @@ typedef mcontext_t SContext;
|
||||||
#define CTX_RIP gregs[REG_RIP]
|
#define CTX_RIP gregs[REG_RIP]
|
||||||
#elif _M_ARM_64
|
#elif _M_ARM_64
|
||||||
#define CTX_REG(x) regs[x]
|
#define CTX_REG(x) regs[x]
|
||||||
|
#define CTX_LR regs[30]
|
||||||
#define CTX_SP sp
|
#define CTX_SP sp
|
||||||
#define CTX_PC pc
|
#define CTX_PC pc
|
||||||
#else
|
#else
|
||||||
|
@ -189,6 +191,11 @@ typedef mcontext_t SContext;
|
||||||
#define CTX_R14 mc_r14
|
#define CTX_R14 mc_r14
|
||||||
#define CTX_R15 mc_r15
|
#define CTX_R15 mc_r15
|
||||||
#define CTX_RIP mc_rip
|
#define CTX_RIP mc_rip
|
||||||
|
#elif _M_ARM_64
|
||||||
|
#define CTX_REG(x) mc_gpregs.gp_x[x]
|
||||||
|
#define CTX_LR mc_gpregs.gp_lr
|
||||||
|
#define CTX_SP mc_gpregs.gp_sp
|
||||||
|
#define CTX_PC mc_gpregs.gp_elr
|
||||||
#else
|
#else
|
||||||
#error No context definition for architecture
|
#error No context definition for architecture
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,7 +27,7 @@ void JitArm64::DoBacktrace(uintptr_t access_address, SContext* ctx)
|
||||||
ERROR_LOG(DYNA_REC, "R%d: 0x%016llx\tR%d: 0x%016llx", i, ctx->CTX_REG(i), i + 1,
|
ERROR_LOG(DYNA_REC, "R%d: 0x%016llx\tR%d: 0x%016llx", i, ctx->CTX_REG(i), i + 1,
|
||||||
ctx->CTX_REG(i + 1));
|
ctx->CTX_REG(i + 1));
|
||||||
|
|
||||||
ERROR_LOG(DYNA_REC, "R30: 0x%016llx\tSP: 0x%016llx", ctx->CTX_REG(30), ctx->CTX_SP);
|
ERROR_LOG(DYNA_REC, "R30: 0x%016llx\tSP: 0x%016llx", ctx->CTX_LR, ctx->CTX_SP);
|
||||||
|
|
||||||
ERROR_LOG(DYNA_REC, "Access Address: 0x%016lx", access_address);
|
ERROR_LOG(DYNA_REC, "Access Address: 0x%016lx", access_address);
|
||||||
ERROR_LOG(DYNA_REC, "PC: 0x%016llx", ctx->CTX_PC);
|
ERROR_LOG(DYNA_REC, "PC: 0x%016llx", ctx->CTX_PC);
|
||||||
|
|
Loading…
Reference in New Issue