From 9f1c5efd635c2886959695f9b4e546b27b5de989 Mon Sep 17 00:00:00 2001 From: Luke Craig Date: Wed, 23 Oct 2024 14:54:10 -0400 Subject: [PATCH] FIX: aarch64 magic parsing --- panda/plugins/hypercaller/hypercaller.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/panda/plugins/hypercaller/hypercaller.cpp b/panda/plugins/hypercaller/hypercaller.cpp index a0f62c061bc..0cd32091457 100644 --- a/panda/plugins/hypercaller/hypercaller.cpp +++ b/panda/plugins/hypercaller/hypercaller.cpp @@ -40,12 +40,16 @@ void unregister_hypercall(uint32_t magic){ uint32_t get_magic(CPUState *cpu){ uint32_t magic; CPUArchState * env = (CPUArchState *)cpu->env_ptr; -#if defined(TARGET_AARCH64) - //XR - magic = env->xregs[8]; -#elif defined(TARGET_ARM) + +#if defined(TARGET_ARM) // r7 magic = env->regs[7]; +#if defined(TARGET_AARCH64) + if (env->aarch64 != 0){ + // XR + magic = env->xregs[8]; + } +#endif #elif defined(TARGET_MIPS) // V0 magic = env->active_tc.gpr[2];