CPU/Recompiler: Use MAP_JIT for code space on Apple Silicon

This commit is contained in:
Connor McLaughlin 2021-03-19 18:47:31 +10:00
commit 5bbbb8d3d5
3 changed files with 63 additions and 6 deletions

View file

@ -29,6 +29,13 @@ public:
/// Flushes the instruction cache on the host for the specified range.
static void FlushInstructionCache(void* address, u32 size);
/// For Apple Silicon - Toggles write protection on the JIT space.
#if defined(__APPLE__) && defined(__aarch64__)
static void WriteProtect(bool enabled);
#else
ALWAYS_INLINE static void WriteProtect(bool enabled) {}
#endif
private:
u8* m_code_ptr = nullptr;
u8* m_free_code_ptr = nullptr;
@ -45,4 +52,3 @@ private:
u32 m_old_protection = 0;
bool m_owns_buffer = false;
};