From 859eeb6d5b183bdcb0fbc856c1e5817b9621a162 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 22 Feb 2015 22:58:10 -0600 Subject: [PATCH] [AArch64] Fix fastmem lha/lhax. When the fastmem loadstore would fail, we would disassemble a few instructions to determine if lhbrx or lhz* This was failing since I was checking the REV16 instruction that appears after the LDRH. Fixed it to make sure it was checking the correct instruction which is SXTH. Fixes an issue where homebrew wouldn't load with fastmem enabled. --- .../Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp index 2a1548317a..c2000ca07f 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp @@ -101,10 +101,16 @@ bool JitArm64::DisasmLoadStore(const u8* ptr, u32* flags, ARM64Reg* reg) { *flags |= BackPatchInfo::FLAG_LOAD; *reg = (ARM64Reg)(inst & 0x1F); - if ((next_inst & 0x7FFFF000) != 0x5AC00000) // REV + if ((next_inst & 0x7FFFF000) == 0x5AC00000) // REV + { + u32 sxth_inst = *(u32*)(ptr + 8); + if ((sxth_inst & 0x7F800000) == 0x13000000) // SXTH + *flags |= BackPatchInfo::FLAG_EXTEND; + } + else + { *flags |= BackPatchInfo::FLAG_REVERSE; - if ((next_inst & 0x7F800000) == 0x13000000) // SXTH - *flags |= BackPatchInfo::FLAG_EXTEND; + } return true; } else if (op == 0xE4) // Store