mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Core: Don't create page table mappings before R/C bits are set
This gets rid of the hack of setting the R and C bits pessimistically, reversing the performance regression in Rogue Squadron 3.
This commit is contained in:
@@ -123,9 +123,13 @@ void MemArena::ReleaseMemoryRegion()
|
||||
}
|
||||
}
|
||||
|
||||
void* MemArena::MapInMemoryRegion(s64 offset, size_t size, void* base)
|
||||
void* MemArena::MapInMemoryRegion(s64 offset, size_t size, void* base, bool writeable)
|
||||
{
|
||||
void* retval = mmap(base, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, m_shm_fd, offset);
|
||||
int prot = PROT_READ;
|
||||
if (writeable)
|
||||
prot |= PROT_WRITE;
|
||||
|
||||
void* retval = mmap(base, size, prot, MAP_SHARED | MAP_FIXED, m_shm_fd, offset);
|
||||
if (retval == MAP_FAILED)
|
||||
{
|
||||
NOTICE_LOG_FMT(MEMMAP, "mmap failed");
|
||||
@@ -137,6 +141,18 @@ void* MemArena::MapInMemoryRegion(s64 offset, size_t size, void* base)
|
||||
}
|
||||
}
|
||||
|
||||
bool MemArena::ChangeMappingProtection(void* view, size_t size, bool writeable)
|
||||
{
|
||||
int prot = PROT_READ;
|
||||
if (writeable)
|
||||
prot |= PROT_WRITE;
|
||||
|
||||
int retval = mprotect(view, size, prot);
|
||||
if (retval != 0)
|
||||
NOTICE_LOG_FMT(MEMMAP, "mprotect failed");
|
||||
return retval == 0;
|
||||
}
|
||||
|
||||
void MemArena::UnmapFromMemoryRegion(void* view, size_t size)
|
||||
{
|
||||
void* retval = mmap(view, size, PROT_NONE, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
|
||||
|
||||
Reference in New Issue
Block a user