Removed MProtect from AddressSpace

This commit is contained in:
Antonio 2024-08-05 01:27:01 -04:00
parent 1a84804100
commit 4914809672
2 changed files with 0 additions and 23 deletions

View File

@ -465,25 +465,4 @@ void AddressSpace::Protect(VAddr virtual_addr, size_t size, MemoryPermission per
return impl->Protect(virtual_addr, size, true, true, true);
}
int AddressSpace::MProtect(VAddr addr, size_t size, int prot) {
// Use conditional compilation to switch between mprotect and VirtualProtect
int result;
#ifdef _WIN32
// Windows-specific API call
result = VirtualProtect(reinterpret_cast<void*>(addr), size, prot, nullptr);
#else
// POSIX-specific API call
result = ::mprotect(reinterpret_cast<void*>(addr), size, prot);
#endif
if (result != 0) {
LOG_ERROR(Core, "Failed to change memory protection: {}", strerror(errno));
return ORBIS_KERNEL_ERROR_EACCES;
}
LOG_INFO(Core, "Changed protection on range {:#x}-{:#x} to {:#x}", addr, addr + size, prot);
return ORBIS_OK;
}
} // namespace Core

View File

@ -95,8 +95,6 @@ public:
void Protect(VAddr virtual_addr, size_t size, MemoryPermission perms);
int MProtect(VAddr addr, size_t size, int prot);
private:
struct Impl;
std::unique_ptr<Impl> impl;