diff --git a/Common/CodeBlock.h b/Common/CodeBlock.h index 03ae3f860..a0f5dd55f 100644 --- a/Common/CodeBlock.h +++ b/Common/CodeBlock.h @@ -68,6 +68,10 @@ public: // If not WX Exclusive, no need to call ProtectMemoryPages because we never change the protection from RWX. PoisonMemory(offset); ResetCodePtr(offset); + if (PlatformIsWXExclusive()) { + // Need to re-protect the part we didn't clear. + ProtectMemoryPages(region, offset, MEM_PROT_READ | MEM_PROT_EXEC); + } } // BeginWrite/EndWrite assume that we keep appending. diff --git a/Core/MIPS/ARM64/Arm64Jit.cpp b/Core/MIPS/ARM64/Arm64Jit.cpp index ae9b6b8f4..d656c0f95 100644 --- a/Core/MIPS/ARM64/Arm64Jit.cpp +++ b/Core/MIPS/ARM64/Arm64Jit.cpp @@ -129,6 +129,7 @@ void Arm64Jit::ClearCache() { ILOG("ARM64Jit: Clearing the cache!"); blocks.Clear(); ClearCodeSpace(jitStartOffset); + FlushIcacheSection(region + jitStartOffset, region + region_size - jitStartOffset); } void Arm64Jit::InvalidateCacheAt(u32 em_address, int length) {