From aee2ec5dbc3145d15909a22a1fdea957e16fb3a4 Mon Sep 17 00:00:00 2001 From: IndecisiveTurtle <47210458+raphaelthegreat@users.noreply.github.com> Date: Thu, 25 Jul 2024 02:06:23 +0300 Subject: [PATCH] memory: Remove uneeded assert --- src/core/memory.cpp | 9 +++------ src/core/memory.h | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 2ebd3b4a..94484edc 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -252,7 +252,6 @@ int MemoryManager::MapFile(void** out_addr, VAddr virtual_addr, size_t size, Mem void MemoryManager::UnmapMemory(VAddr virtual_addr, size_t size) { std::scoped_lock lk{mutex}; - // TODO: Partial unmaps are technically supported by the guest. const auto it = FindVMA(virtual_addr); ASSERT_MSG(it->second.Contains(virtual_addr, size), "Existing mapping does not contain requested unmap range"); @@ -267,7 +266,7 @@ void MemoryManager::UnmapMemory(VAddr virtual_addr, size_t size) { } // Mark region as free and attempt to coalesce it with neighbours. - const auto new_it = CarveVMA(virtual_addr, size, true); + const auto new_it = CarveVMA(virtual_addr, size); auto& vma = new_it->second; vma.type = VMAType::Free; vma.prot = MemoryProt::NoAccess; @@ -375,14 +374,12 @@ std::pair MemoryManager::GetVulkanBuffer(VAddr addr) { return std::make_pair(*it->second.buffer, addr - it->first); } -MemoryManager::VMAHandle MemoryManager::CarveVMA(VAddr virtual_addr, size_t size, - bool allow_mapped) { +MemoryManager::VMAHandle MemoryManager::CarveVMA(VAddr virtual_addr, size_t size) { auto vma_handle = FindVMA(virtual_addr); ASSERT_MSG(vma_handle != vma_map.end(), "Virtual address not in vm_map"); const VirtualMemoryArea& vma = vma_handle->second; - ASSERT_MSG((vma.type == VMAType::Free || vma.type == VMAType::Reserved || allow_mapped) && - vma.base <= virtual_addr, + ASSERT_MSG(vma.base <= virtual_addr, "Adding a mapping to already mapped region"); const VAddr start_in_vma = virtual_addr - vma.base; diff --git a/src/core/memory.h b/src/core/memory.h index 11027bb7..79bb41cb 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -202,8 +202,7 @@ private: return iter; } - VMAHandle CarveVMA(VAddr virtual_addr, size_t size, - bool allow_mapped = false); + VMAHandle CarveVMA(VAddr virtual_addr, size_t size); DirectMemoryArea& CarveDmemArea(PAddr addr, size_t size);