diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp index e2d9b50d42..3042cfedba 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp @@ -94,6 +94,9 @@ const u8 *TrampolineCache::GetReadTrampoline(const InstructionInfo &info) CALL(thunks.ProtectFunction((void *)&Memory::Read_U16, 1)); SHL(32, R(EAX), Imm8(16)); break; + case 1: + CALL(thunks.ProtectFunction((void *)&Memory::Read_U8, 1)); + break; } ABI_PopAllCallerSavedRegsAndAdjustStack(); if (dataReg != EAX) { @@ -180,10 +183,6 @@ const u8 *JitBase::BackPatch(u8 *codePtr, int accessType, u32 emAddress, void *c codePtr, emAddress); }*/ - if (info.operandSize == 1) { - BackPatchError(StringFromFormat("BackPatch - no support for operand size %i", info.operandSize), codePtr, emAddress); - } - if (info.otherReg != RBX) PanicAlert("BackPatch : Base reg not RBX." "\n\nAttempted to access %08x.", emAddress); diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp index f43604fa9b..cc1327c695 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp @@ -96,7 +96,11 @@ void EmuCodeBlock::UnsafeLoadToEAX(const Gen::OpArg & opAddress, int accessSize, MOVZX(32, accessSize, EAX, MDisp(EAX, (u32)Memory::base + offset)); } #endif - + + // Add a 2 bytes NOP to have some space for the backpatching + if (accessSize == 8) + NOP(2); + if (accessSize == 32) { BSWAP(32, EAX); @@ -120,13 +124,11 @@ void EmuCodeBlock::SafeLoadToEAX(const Gen::OpArg & opAddress, int accessSize, s { #if defined(_M_X64) #ifdef ENABLE_MEM_CHECK - if (accessSize != 8 && !Core::g_CoreStartupParameter.bMMU && !Core::g_CoreStartupParameter.bEnableDebugging) + if (!Core::g_CoreStartupParameter.bMMU && !Core::g_CoreStartupParameter.bEnableDebugging) #else - if (accessSize != 8 && !Core::g_CoreStartupParameter.bMMU) + if (!Core::g_CoreStartupParameter.bMMU) #endif { - // We don't support 8 bit loads backpatching at the moment, but they - // are very rare. UnsafeLoadToEAX(opAddress, accessSize, offset, signExtend); } else