mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-13 09:14:38 +00:00
[JIT/Memory] Fix up semantic of setExecutable().
setExecutable() should do everything that's needed to make the memory executable on host, i.e. unconditionally set permissions + invalidate instruction cache. llvm-rtdyld will be updated in my next commit. Discusseed with: Lang Hames (as part of D13631). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253341 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8dc1efba58
commit
fa084bd00c
@ -264,15 +264,12 @@ bool Memory::setWritable (MemoryBlock &M, std::string *ErrMsg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) {
|
bool Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) {
|
||||||
#if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
|
|
||||||
if (M.Address == 0 || M.Size == 0) return false;
|
if (M.Address == 0 || M.Size == 0) return false;
|
||||||
Memory::InvalidateInstructionCache(M.Address, M.Size);
|
Memory::InvalidateInstructionCache(M.Address, M.Size);
|
||||||
|
#if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
|
||||||
kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)M.Address,
|
kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)M.Address,
|
||||||
(vm_size_t)M.Size, 0, VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_COPY);
|
(vm_size_t)M.Size, 0, VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_COPY);
|
||||||
return KERN_SUCCESS == kr;
|
return KERN_SUCCESS == kr;
|
||||||
#elif defined(__arm__) || defined(__aarch64__)
|
|
||||||
Memory::InvalidateInstructionCache(M.Address, M.Size);
|
|
||||||
return true;
|
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user