Make sure to reset memory protection as appropriate. Remove unused WriteProtect on codeblocks (to be redesigned)

This commit is contained in:
Henrik Rydgard 2016-08-28 13:37:30 +02:00
parent 323eb72b7c
commit 13e73f8c86
3 changed files with 1 additions and 19 deletions

View File

@ -60,6 +60,7 @@ public:
void ClearCodeSpace() {
PoisonMemory();
ResetCodePtr();
ProtectMemoryPages(region, region_size, MEM_PROT_READ | MEM_PROT_WRITE | MEM_PROT_EXEC);
}
// Call this when shutting down. Don't rely on the destructor, even though it'll do the job.
@ -73,12 +74,6 @@ public:
region_size = 0;
}
// Cannot currently be undone. Will write protect the entire code region.
// Start over if you need to change the code (call FreeCodeSpace(), AllocCodeSpace()).
void WriteProtect() {
ProtectMemoryPages(region, region_size, MEM_PROT_READ | MEM_PROT_EXEC);
}
void SetCodePtr(u8 *ptr) override {
T::SetCodePointer(ptr);
}

View File

@ -496,14 +496,6 @@ void MIPSCodeBlock::FreeCodeSpace() {
region_size = 0;
}
void MIPSCodeBlock::WriteProtect() {
ProtectMemoryPages(region, region_size, MEM_PROT_READ | MEM_PROT_EXEC);
}
void MIPSCodeBlock::UnWriteProtect() {
ProtectMemoryPages(region, region_size, MEM_PROT_READ | MEM_PROT_EXEC | MEM_PROT_WRITE);
}
}
#endif

View File

@ -299,11 +299,6 @@ public:
return ptr >= region && ptr < region + region_size;
}
// Can possibly be undone. Will write protect the entire code region.
// Start over if you need to change the code, though (call FreeCodeSpace(), AllocCodeSpace().)
void WriteProtect();
void UnWriteProtect();
void ResetCodePtr() {
SetCodePtr(region);
}