mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-07-10 17:44:41 -06:00
MemMapper: don't change address on non-reserved mappings
This commit is contained in:
parent
6b6a538b3a
commit
d73c5895f2
@ -42,16 +42,15 @@ namespace MemMapper
|
||||
|
||||
void* AllocateMemory(void* baseAddr, size_t size, PAGE_PERMISSION permissionFlags, bool fromReservation)
|
||||
{
|
||||
uint64 page_size = sysconf(_SC_PAGESIZE);
|
||||
if ((uint64) baseAddr % page_size != 0)
|
||||
{
|
||||
baseAddr = (void*) ((uint64)baseAddr & ~(page_size - 1));
|
||||
}
|
||||
|
||||
void* r;
|
||||
if(fromReservation)
|
||||
{
|
||||
if( mprotect(baseAddr, size, GetProt(permissionFlags)) == 0 )
|
||||
uint64 page_size = sysconf(_SC_PAGESIZE);
|
||||
void* page = baseAddr;
|
||||
if ( (uint64) baseAddr % page_size != 0 )
|
||||
page = (void*) ((uint64)baseAddr & ~(page_size - 1));
|
||||
if( mprotect(page, size, GetProt(permissionFlags)) == 0 )
|
||||
r = baseAddr;
|
||||
else
|
||||
r = nullptr;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user