summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Memory.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-09-18 07:54:21 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-09-18 07:54:21 +0000
commit5cc53c34c366fa8b6e389c7c1751c50c0f64041a (patch)
tree00effcc2f02134686e78be25d8938c46d4ed3992 /llvm/lib/System/Memory.cpp
parent933b392f657c6abcc6bca68bc14cf77301c6d4cc (diff)
downloadbcm5719-llvm-5cc53c34c366fa8b6e389c7c1751c50c0f64041a.tar.gz
bcm5719-llvm-5cc53c34c366fa8b6e389c7c1751c50c0f64041a.zip
Preliminary support for systems which require changing JIT memory regions privilege from read / write to read / executable.
llvm-svn: 56303
Diffstat (limited to 'llvm/lib/System/Memory.cpp')
-rw-r--r--llvm/lib/System/Memory.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/System/Memory.cpp b/llvm/lib/System/Memory.cpp
index 3660bcb1a4a..2fc6a23a3af 100644
--- a/llvm/lib/System/Memory.cpp
+++ b/llvm/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
+}
OpenPOWER on IntegriCloud