Remove a useless wrapper function

This commit is contained in:
Henrik Rydgård 2017-01-26 10:01:14 +01:00
parent 635b2ada43
commit 4a0437d0ed
2 changed files with 2 additions and 5 deletions

View File

@ -86,9 +86,9 @@ public:
void EndWrite() {
// OK, we're done. Re-protect the memory we touched.
if (PlatformIsWXExclusive()) {
if (PlatformIsWXExclusive() && writeStart_ != nullptr) {
const uint8_t *end = GetCodePtr();
ProtectMemoryPages(writeStart_, end, MEM_PROT_READ | MEM_PROT_EXEC);
ProtectMemoryPages(writeStart_, end - writeStart_, MEM_PROT_READ | MEM_PROT_EXEC);
writeStart_ = nullptr;
}
}

View File

@ -37,9 +37,6 @@ void* AllocateExecutableMemory(size_t size);
void* AllocateMemoryPages(size_t size, uint32_t memProtFlags);
// Note that on platforms returning PlatformIsWXExclusive, you cannot set a page to be both readable and writable at the same time.
bool ProtectMemoryPages(const void* ptr, size_t size, uint32_t memProtFlags);
inline void ProtectMemoryPages(const void *start, const void *end, uint32_t memProtFlags) {
ProtectMemoryPages((void *)start, (const uint8_t *)end - (const uint8_t *)start, memProtFlags);
}
void FreeMemoryPages(void* ptr, size_t size);
// Regular aligned memory. Don't try to apply memory protection willy-nilly to memory allocated this way as in-page alignment is unknown (though could be checked).