mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-04-09 02:51:31 -06:00
Merge 8ffba04e77 into beac01d5d1
This commit is contained in:
commit
470ee97bb6
@ -346,16 +346,7 @@ namespace utils
|
||||
ensure(::VirtualFree(pointer, size, MEM_DECOMMIT));
|
||||
#else
|
||||
const u64 ptr64 = reinterpret_cast<u64>(pointer);
|
||||
#if defined(__APPLE__) && defined(ARCH_ARM64)
|
||||
// Hack: on macOS, Apple explicitly fails mmap if you combine MAP_FIXED and MAP_JIT.
|
||||
// So we unmap the space and just hope it maps to the same address we got before instead.
|
||||
// The Xcode manpage says the pointer is a hint and the OS will try to map at the hint location
|
||||
// so this isn't completely undefined behavior.
|
||||
ensure(::munmap(pointer, size) != -1);
|
||||
ensure(::mmap(pointer, size, PROT_NONE, MAP_ANON | MAP_PRIVATE | MAP_JIT, -1, 0) == pointer);
|
||||
#else
|
||||
ensure(::mmap(pointer, size, PROT_NONE, MAP_FIXED | MAP_ANON | MAP_PRIVATE | c_map_noreserve, -1, 0) != reinterpret_cast<void*>(uptr{umax}));
|
||||
#endif
|
||||
|
||||
if constexpr (c_madv_no_dump != 0)
|
||||
{
|
||||
@ -380,12 +371,7 @@ namespace utils
|
||||
memory_commit(pointer, size, prot);
|
||||
#else
|
||||
const u64 ptr64 = reinterpret_cast<u64>(pointer);
|
||||
#if defined(__APPLE__) && defined(ARCH_ARM64)
|
||||
ensure(::munmap(pointer, size) != -1);
|
||||
ensure(::mmap(pointer, size, +prot, MAP_ANON | MAP_PRIVATE | MAP_JIT, -1, 0) == pointer);
|
||||
#else
|
||||
ensure(::mmap(pointer, size, +prot, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0) != reinterpret_cast<void*>(uptr{umax}));
|
||||
#endif
|
||||
|
||||
if constexpr (c_madv_hugepage != 0)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user