diff options
author | WaluigiWare64 <68647953+WaluigiWare64@users.noreply.github.com> | 2021-02-22 15:13:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-22 15:13:39 +0000 |
commit | 532dc57025c4a9643f708dcfde32ce8cd4b453a9 (patch) | |
tree | dc33134e70b35816b00b380727c6f2bdfca5c686 /src/ARMJIT_A64/ARMJIT_Compiler.cpp | |
parent | 0aa0ae6c69c883999a935a63d8d8c1efd7708e28 (diff) |
Fix the JIT Code Memory on ARM64 Macs (#916)
Diffstat (limited to 'src/ARMJIT_A64/ARMJIT_Compiler.cpp')
-rw-r--r-- | src/ARMJIT_A64/ARMJIT_Compiler.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ARMJIT_A64/ARMJIT_Compiler.cpp b/src/ARMJIT_A64/ARMJIT_Compiler.cpp index d681d6f..e57c75d 100644 --- a/src/ARMJIT_A64/ARMJIT_Compiler.cpp +++ b/src/ARMJIT_A64/ARMJIT_Compiler.cpp @@ -15,6 +15,10 @@ extern char __start__; #include <stdlib.h> +#ifdef __APPLE__ + #include <pthread.h> +#endif + using namespace Arm64Gen; extern "C" void ARM_Ret(); @@ -226,7 +230,12 @@ Compiler::Compiler() u64 pageSize = sysconf(_SC_PAGE_SIZE); u8* pageAligned = (u8*)(((u64)JitMem & ~(pageSize - 1)) + pageSize); u64 alignedSize = (((u64)JitMem + sizeof(JitMem)) & ~(pageSize - 1)) - (u64)pageAligned; - mprotect(pageAligned, alignedSize, PROT_EXEC | PROT_READ | PROT_WRITE); + #ifdef __APPLE__ + pageAligned = (u8*)mmap(NULL, 1024*1024*16, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS | MAP_JIT,-1, 0); + pthread_jit_write_protect_np(false); + #else + mprotect(pageAligned, alignedSize, PROT_EXEC | PROT_READ | PROT_WRITE); + #endif SetCodeBase(pageAligned, pageAligned); JitMemMainSize = alignedSize; |