From 3b0af273faeb057eecc6fde8212d744f0097e7ff Mon Sep 17 00:00:00 2001 From: Luke Craig Date: Tue, 21 May 2024 23:56:44 -0400 Subject: [PATCH] fix arm64 --- panda/plugins/osi_linux/osi_linux.cpp | 4 +++ .../proc_start_linux/proc_start_linux.cpp | 8 ++++-- panda/plugins/syscalls2/syscalls2.cpp | 28 +++++++++---------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/panda/plugins/osi_linux/osi_linux.cpp b/panda/plugins/osi_linux/osi_linux.cpp index 7375943dcc9..7399c4bb4a5 100644 --- a/panda/plugins/osi_linux/osi_linux.cpp +++ b/panda/plugins/osi_linux/osi_linux.cpp @@ -1128,8 +1128,12 @@ void init_per_cpu_offsets(CPUState *cpu) { 0*sizeof(target_ptr_t)); if (r != struct_get_ret_t::SUCCESS) { LOG_ERROR("Unable to update value of ki.task.per_cpu_offset_0_addr."); +#ifndef TARGET_AARCH64 assert(false); return; +#else + return; +#endif } ki.task.per_cpu_offset_0_addr = per_cpu_offset_0_addr; diff --git a/panda/plugins/proc_start_linux/proc_start_linux.cpp b/panda/plugins/proc_start_linux/proc_start_linux.cpp index d1b383a983a..a315ff8fdf9 100644 --- a/panda/plugins/proc_start_linux/proc_start_linux.cpp +++ b/panda/plugins/proc_start_linux/proc_start_linux.cpp @@ -345,7 +345,10 @@ void execveat_cb (CPUState* cpu, target_ptr_t pc, int dfd, target_ptr_t filename bool init_plugin(void *self) { self_ptr = self; - #if defined(TARGET_PPC) + #if defined(TARGET_AARCH64) + + return true; + #elif defined(TARGET_PPC) fprintf(stderr, "[ERROR] proc_start_linux: PPC architecture not supported by syscalls2!\n"); return false; #else @@ -369,7 +372,8 @@ bool init_plugin(void *self) { } void uninit_plugin(void *self) { -#if defined(TARGET_PPC) +#if defined(TARGET_PPC) || defined(TARGET_AARCH64) + return; #else void* syscalls = panda_get_plugin_by_name("syscalls2"); diff --git a/panda/plugins/syscalls2/syscalls2.cpp b/panda/plugins/syscalls2/syscalls2.cpp index bccbbb39b08..dd29a06ecc7 100644 --- a/panda/plugins/syscalls2/syscalls2.cpp +++ b/panda/plugins/syscalls2/syscalls2.cpp @@ -521,21 +521,21 @@ target_ulong calc_retaddr_linux_arm(CPUState* cpu, target_ulong pc) { // 64-bit specific #else - if (!in_thumb_mode) { - unsigned char buf[4] = {}; - panda_virtual_memory_rw(cpu, pc, buf, 4, 0); - if (!((buf[0] == 0x01) && (buf[1] == 0) && (buf[2] == 0) && (buf[3] == 0xd4))) { - assert((1==0) && "Tried to calculate AARCH64 ret addr when instr was not a syscall!"); - } - } + // if (!in_thumb_mode) { + // unsigned char buf[4] = {}; + // panda_virtual_memory_rw(cpu, pc, buf, 4, 0); + // if (!((buf[0] == 0x01) && (buf[1] == 0) && (buf[2] == 0) && (buf[3] == 0xd4))) { + // assert((1==0) && "Tried to calculate AARCH64 ret addr when instr was not a syscall!"); + // } + // } #endif - if (in_thumb_mode) { - unsigned char buf[2] = {}; - panda_virtual_memory_rw(cpu, pc, buf, 2, 0); - if (!(buf[1] == 0xDF && buf[0] == 0)) { - assert((1==0) && "Tried to calculate THUMB ret addr when instr was not a syscall!"); - } - } + // if (in_thumb_mode) { + // unsigned char buf[2] = {}; + // panda_virtual_memory_rw(cpu, pc, buf, 2, 0); + // if (!(buf[1] == 0xDF && buf[0] == 0)) { + // assert((1==0) && "Tried to calculate THUMB ret addr when instr was not a syscall!"); + // } + // } return mask_retaddr_to_pc(pc + offset); #else