diff options
author | Jim Grosbach <grosbach@apple.com> | 2008-10-03 16:17:20 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2008-10-03 16:17:20 +0000 |
commit | cce6c297c54b4c9c8615c77e97cd64e70812ea60 (patch) | |
tree | 2a65c3ce20bd2065ace4af4a03507d11dcbc03a0 /include | |
parent | 48b828fdb467655fa630fed41e49e2a481fb6dab (diff) | |
download | external_llvm-cce6c297c54b4c9c8615c77e97cd64e70812ea60.zip external_llvm-cce6c297c54b4c9c8615c77e97cd64e70812ea60.tar.gz external_llvm-cce6c297c54b4c9c8615c77e97cd64e70812ea60.tar.bz2 |
On Darwin ARM, memory needs special handling to do JIT. This patch expands
this handling to work properly for modifying stub functions, relocations
back to entry points after JIT compilation, etc..
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57013 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ExecutionEngine/JITMemoryManager.h | 8 | ||||
-rw-r--r-- | include/llvm/System/Memory.h | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/include/llvm/ExecutionEngine/JITMemoryManager.h b/include/llvm/ExecutionEngine/JITMemoryManager.h index e1f2763..0d79d14 100644 --- a/include/llvm/ExecutionEngine/JITMemoryManager.h +++ b/include/llvm/ExecutionEngine/JITMemoryManager.h @@ -35,6 +35,14 @@ public: /// JIT Memory Manager if the client does not provide one to the JIT. static JITMemoryManager *CreateDefaultMemManager(); + /// setMemoryWritable - When code generation is in progress, + /// the code pages may need permissions changed. + virtual void setMemoryWritable(void) = 0; + + /// setMemoryExecutable - When code generation is done and we're ready to + /// start execution, the code pages may need permissions changed. + virtual void setMemoryExecutable(void) = 0; + //===--------------------------------------------------------------------===// // Global Offset Table Management //===--------------------------------------------------------------------===// diff --git a/include/llvm/System/Memory.h b/include/llvm/System/Memory.h index 86895e2..4d0828b 100644 --- a/include/llvm/System/Memory.h +++ b/include/llvm/System/Memory.h @@ -70,10 +70,15 @@ namespace sys { /// platforms. static void InvalidateInstructionCache(const void *Addr, size_t Len); - /// SetRXPrivilege - Before the JIT can run a block of code, it has to be + /// setExecutable - Before the JIT can run a block of code, it has to be /// given read and executable privilege. Return true if it is already r-x /// or the system is able to change its previlege. - static bool SetRXPrivilege(const void *Addr, size_t Size); + static bool setExecutable (MemoryBlock &M, std::string *ErrMsg = 0); + + /// setWritable - When adding to a block of code, the JIT may need + /// to mark a block of code as RW since the protections are on page + /// boundaries, and the JIT internal allocations are not page aligned. + static bool setWritable (MemoryBlock &M, std::string *ErrMsg = 0); }; } } |