aboutsummaryrefslogtreecommitdiff
path: root/lib/System/Memory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/System/Memory.cpp')
-rw-r--r--lib/System/Memory.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/System/Memory.cpp b/lib/System/Memory.cpp
index 3660bcb1a4..2fc6a23a3a 100644
--- a/lib/System/Memory.cpp
+++ b/lib/System/Memory.cpp
@@ -58,3 +58,14 @@ void llvm::sys::Memory::InvalidateInstructionCache(const void *Addr,
#endif // end PPC
}
+
+bool llvm::sys::Memory::SetRXPrivilege(const void *Addr, size_t Size) {
+#if defined(__APPLE__) && defined(__arm__)
+ kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)Addr,
+ (vm_size_t)Size, 0,
+ VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_COPY);
+ return KERN_SUCCESS == kr;
+#else
+ return true;
+#endif
+}