From f1443bec1e8b09d0e94099b434bc45d0f843a280 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 7 Jan 2015 14:32:50 -0600 Subject: [PATCH] [AArch64] Add a memory dump routine. Allows me to easily disassemble a block of code from the Nexus 9 by dumping it to logcat. --- Source/Core/Core/PowerPC/JitArm64/Jit.cpp | 8 ++++++++ Source/Core/Core/PowerPC/JitArm64/Jit.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index 6f1b087854..f664df6cbf 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -179,6 +179,14 @@ void JitArm64::WriteExitDestInR(ARM64Reg Reg) BR(EncodeRegTo64(Reg)); } +void JitArm64::DumpCode(const u8* start, const u8* end) +{ + std::string output = ""; + for (u8* code = (u8*)start; code < end; code += 4) + output += StringFromFormat("%08x", Common::swap32(*(u32*)code)); + WARN_LOG(DYNA_REC, "Code dump from %p to %p:\n%s", start, end, output.c_str()); +} + void JitArm64::Run() { CompiledCode pExecAddr = (CompiledCode)asm_routines.enterCode; diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.h b/Source/Core/Core/PowerPC/JitArm64/Jit.h index ebef27173e..45b2f9bf91 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.h +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.h @@ -116,6 +116,9 @@ private: ARM64FloatEmitter m_float_emit; + // Dump a memory range of code + void DumpCode(const u8* start, const u8* end); + // The key is the backpatch flags std::map m_backpatch_info;