diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-09-18 07:54:21 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-09-18 07:54:21 +0000 |
commit | bc4707a2554ac04ba006bf70035e7bc7270236a9 (patch) | |
tree | de53bff1fc81864b96c267cd930d7ea35a2dad3e /lib/System/Memory.cpp | |
parent | 057d0c35358841aba449d203622416431163cb83 (diff) |
Preliminary support for systems which require changing JIT memory regions privilege from read / write to read / executable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56303 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Memory.cpp')
-rw-r--r-- | lib/System/Memory.cpp | 11 |
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 +} |