diff --git a/src/core/address_space.cpp b/src/core/address_space.cpp index 6444790f..23511370 100644 --- a/src/core/address_space.cpp +++ b/src/core/address_space.cpp @@ -469,12 +469,12 @@ void* AddressSpace::MapFile(VAddr virtual_addr, size_t size, size_t offset, u32 } void AddressSpace::Unmap(VAddr virtual_addr, size_t size, VAddr start_in_vma, VAddr end_in_vma, - PAddr phys_base, bool is_exec, bool has_backing, bool readonly) { + PAddr phys_base, bool is_exec, bool has_backing, bool readonly_file) { #ifdef _WIN32 // There does not appear to be comparable support for partial unmapping on Windows. // Unfortunately, a least one title was found to require this. The workaround is to unmap // the entire allocation and remap the portions outside of the requested unmapping range. - impl->Unmap(virtual_addr, size, has_backing && !readonly); + impl->Unmap(virtual_addr, size, has_backing && !readonly_file); // TODO: Determine if any titles require partial unmapping support for flexible allocations. ASSERT_MSG(has_backing || (start_in_vma == 0 && end_in_vma == size), diff --git a/src/core/address_space.h b/src/core/address_space.h index dc38de4d..2a3488d5 100644 --- a/src/core/address_space.h +++ b/src/core/address_space.h @@ -92,7 +92,7 @@ public: /// Unmaps specified virtual memory area. void Unmap(VAddr virtual_addr, size_t size, VAddr start_in_vma, VAddr end_in_vma, - PAddr phys_base, bool is_exec, bool has_backing, bool readonly); + PAddr phys_base, bool is_exec, bool has_backing, bool readonly_file); void Protect(VAddr virtual_addr, size_t size, MemoryPermission perms); diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 6c3b5005..552c4039 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -242,11 +242,11 @@ void MemoryManager::UnmapMemory(VAddr virtual_addr, size_t size) { vma.disallow_merge = false; vma.name = ""; MergeAdjacent(vma_map, new_it); - bool readonly = vma.prot == MemoryProt::CpuRead; + bool readonly_file = vma.prot == MemoryProt::CpuRead && type == VMAType::File; // Unmap the memory region. impl.Unmap(vma_base_addr, vma_base_size, start_in_vma, start_in_vma + size, phys_base, is_exec, - has_backing, readonly); + has_backing, readonly_file); TRACK_FREE(virtual_addr, "VMEM"); }