diff options
author | Jim Grosbach <grosbach@apple.com> | 2008-10-20 21:39:23 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2008-10-20 21:39:23 +0000 |
commit | 9396051e3dc723ebdb23fdb1779e4ced74119d6f (patch) | |
tree | 53ba122104e09ee7c535463b3da69823fa27aa46 /llvm/lib/System/Unix | |
parent | 1a59b3b9b8dcf5091994c0af7c21e520b7173980 (diff) | |
download | bcm5719-llvm-9396051e3dc723ebdb23fdb1779e4ced74119d6f.tar.gz bcm5719-llvm-9396051e3dc723ebdb23fdb1779e4ced74119d6f.zip |
Update the stub and callback code to handle lazy compilation. The stub
is re-written by the callback to branch directly to the compiled code
in future invocations.
Added back in range-based memory permission functions for the updating of
the stub on Darwin.
llvm-svn: 57846
Diffstat (limited to 'llvm/lib/System/Unix')
-rw-r--r-- | llvm/lib/System/Unix/Memory.inc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/System/Unix/Memory.inc b/llvm/lib/System/Unix/Memory.inc index 646311d8cd6..cfc5a6871dc 100644 --- a/llvm/lib/System/Unix/Memory.inc +++ b/llvm/lib/System/Unix/Memory.inc @@ -127,3 +127,24 @@ bool llvm::sys::Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) { #endif } +bool llvm::sys::Memory::setRangeWritable(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_WRITE); + return KERN_SUCCESS == kr; +#else + return true; +#endif +} + +bool llvm::sys::Memory::setRangeExecutable(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 +} |