From 491480967254c8b4218880e2063c4a163022c72f Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 5 Aug 2024 01:27:01 -0400 Subject: [PATCH] Removed MProtect from AddressSpace --- src/core/address_space.cpp | 21 --------------------- src/core/address_space.h | 2 -- 2 files changed, 23 deletions(-) diff --git a/src/core/address_space.cpp b/src/core/address_space.cpp index 16344211..741cd4fe 100644 --- a/src/core/address_space.cpp +++ b/src/core/address_space.cpp @@ -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(addr), size, prot, nullptr); -#else - // POSIX-specific API call - result = ::mprotect(reinterpret_cast(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 diff --git a/src/core/address_space.h b/src/core/address_space.h index 311310f2..29f74f56 100644 --- a/src/core/address_space.h +++ b/src/core/address_space.h @@ -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;