diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp index d8bb2bfc55..e1807cfbb4 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp @@ -1347,6 +1347,12 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, bool UseProfile, bool Mak Core::g_CoreStartupParameter.iTLBHack) { mem_mask |= Memory::ADDR_MASK_MEM1; } +#ifdef ENABLE_MEM_CHECK + if (Core::g_CoreStartupParameter.bEnableDebugging) + { + mem_mask |= Memory::EXRAM_MASK; + } +#endif Jit->TEST(32, regLocForInst(RI, getOp2(I)), Imm32(mem_mask)); FixupBranch safe = Jit->J_CC(CC_NZ); // Fast routine diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp index 1b3155bf63..8abf0fc18a 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp @@ -118,7 +118,11 @@ void EmuCodeBlock::UnsafeLoadToEAX(const Gen::OpArg & opAddress, int accessSize, void EmuCodeBlock::SafeLoadToEAX(const Gen::OpArg & opAddress, int accessSize, s32 offset, bool signExtend) { +#ifdef ENABLE_MEM_CHECK + if (Core::g_CoreStartupParameter.bUseFastMem && (accessSize == 32) && !Core::g_CoreStartupParameter.bMMU && !Core::g_CoreStartupParameter.bEnableDebugging) +#else if (Core::g_CoreStartupParameter.bUseFastMem && (accessSize == 32) && !Core::g_CoreStartupParameter.bMMU) +#endif { // BackPatch only supports 32-bits accesses UnsafeLoadToEAX(opAddress, accessSize, offset, signExtend); @@ -130,7 +134,14 @@ void EmuCodeBlock::SafeLoadToEAX(const Gen::OpArg & opAddress, int accessSize, s { mem_mask |= Memory::ADDR_MASK_MEM1; } - + +#ifdef ENABLE_MEM_CHECK + if (Core::g_CoreStartupParameter.bEnableDebugging) + { + mem_mask |= Memory::EXRAM_MASK; + } +#endif + if (opAddress.IsImm()) { u32 address = (u32)opAddress.offset + offset; @@ -232,6 +243,13 @@ void EmuCodeBlock::SafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int acce mem_mask |= Memory::ADDR_MASK_MEM1; } +#ifdef ENABLE_MEM_CHECK + if (Core::g_CoreStartupParameter.bEnableDebugging) + { + mem_mask |= Memory::EXRAM_MASK; + } +#endif + TEST(32, R(reg_addr), Imm32(mem_mask)); FixupBranch fast = J_CC(CC_Z); @@ -256,6 +274,13 @@ void EmuCodeBlock::SafeWriteFloatToReg(X64Reg xmm_value, X64Reg reg_addr) mem_mask |= Memory::ADDR_MASK_MEM1; } +#ifdef ENABLE_MEM_CHECK + if (Core::g_CoreStartupParameter.bEnableDebugging) + { + mem_mask |= Memory::EXRAM_MASK; + } +#endif + TEST(32, R(reg_addr), Imm32(mem_mask)); if (false && cpu_info.bSSSE3) { // This path should be faster but for some reason it causes errors so I've disabled it.