Common: Fix Mac build

This commit is contained in:
Connor McLaughlin
2024-05-21 23:14:47 +10:00
committed by GitHub
parent b512162956
commit d765f2e15c
+9 -1
View File
@@ -29,6 +29,14 @@
#define MAP_ANONYMOUS MAP_ANON
#endif
// MacOS does not have MAP_FIXED_NOREPLACE, which means our mappings are
// vulnerable to races with the main/Qt threads. TODO: Investigate using
// mach_vm_allocate()/mach_vm_map() instead of mmap(), but Apple's
// documentation for these routines is non-existant...
#if defined(__APPLE__) && !defined(MAP_FIXED_NOREPLACE)
#define MAP_FIXED_NOREPLACE MAP_FIXED
#endif
#include <cerrno>
#include <fcntl.h>
#include <sys/mman.h>
@@ -59,7 +67,7 @@ static struct sigaction s_old_sigsegv_action;
[[maybe_unused]] static bool IsStoreInstruction(uptr ptr)
{
u32 bits;
std::memcpy(&bits, reinterpret_cast<const void*>(pc), sizeof(bits));
std::memcpy(&bits, reinterpret_cast<const void*>(ptr), sizeof(bits));
// Based on vixl's disassembler Instruction::IsStore().
// if (Mask(LoadStoreAnyFMask) != LoadStoreAnyFixed)