Make sure to reset memory protection as appropriate. Remove unused WriteProtect on codeblocks (to be redesigned)
This commit is contained in:
parent
323eb72b7c
commit
13e73f8c86
3 changed files with 1 additions and 19 deletions
|
@ -60,6 +60,7 @@ public:
|
||||||
void ClearCodeSpace() {
|
void ClearCodeSpace() {
|
||||||
PoisonMemory();
|
PoisonMemory();
|
||||||
ResetCodePtr();
|
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.
|
// 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;
|
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 {
|
void SetCodePtr(u8 *ptr) override {
|
||||||
T::SetCodePointer(ptr);
|
T::SetCodePointer(ptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -496,14 +496,6 @@ void MIPSCodeBlock::FreeCodeSpace() {
|
||||||
region_size = 0;
|
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
|
#endif
|
||||||
|
|
|
@ -299,11 +299,6 @@ public:
|
||||||
return ptr >= region && ptr < region + region_size;
|
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() {
|
void ResetCodePtr() {
|
||||||
SetCodePtr(region);
|
SetCodePtr(region);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue