Permalink
Browse files

arm64jit: Reprotect fixed code after icache flush.

  • Loading branch information...
unknownbrackets committed Dec 28, 2017
1 parent 4a27e99 commit 257a4fdd127791805e02f7db60b3672526c8e94c
Showing with 5 additions and 0 deletions.
  1. +4 −0 Common/CodeBlock.h
  2. +1 −0 Core/MIPS/ARM64/Arm64Jit.cpp
View
@@ -68,6 +68,10 @@ template<class T> class CodeBlock : public CodeBlockCommon, public T {
// 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.
@@ -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) {

0 comments on commit 257a4fd

Please sign in to comment.