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);
}