mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 11:35:45 +00:00
virtual_memory: Ensure mapped addresses stay inside the user area
* Fixes LLE Libc crashing on linux
This commit is contained in:
parent
40e2d8b9cf
commit
1332c8497b
1 changed files with 2 additions and 1 deletions
|
@ -170,7 +170,8 @@ u64 memory_alloc_aligned(u64 address, u64 size, MemoryMode mode, u64 alignment)
|
|||
}
|
||||
return ptr;
|
||||
#else
|
||||
void* hint_address = reinterpret_cast<void*>(AlignUp(address, alignment));
|
||||
void* hint_address = address == 0 ? reinterpret_cast<void*>(USER_MIN)
|
||||
: reinterpret_cast<void*>(AlignUp(address, alignment));
|
||||
void* ptr = mmap(hint_address, size, convertMemoryMode(mode), MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
ASSERT(ptr != MAP_FAILED);
|
||||
return reinterpret_cast<u64>(ptr);
|
||||
|
|
Loading…
Add table
Reference in a new issue