memory: Remove uneeded assert
This commit is contained in:
parent
1440741fe9
commit
aee2ec5dbc
|
@ -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) {
|
void MemoryManager::UnmapMemory(VAddr virtual_addr, size_t size) {
|
||||||
std::scoped_lock lk{mutex};
|
std::scoped_lock lk{mutex};
|
||||||
|
|
||||||
// TODO: Partial unmaps are technically supported by the guest.
|
|
||||||
const auto it = FindVMA(virtual_addr);
|
const auto it = FindVMA(virtual_addr);
|
||||||
ASSERT_MSG(it->second.Contains(virtual_addr, size),
|
ASSERT_MSG(it->second.Contains(virtual_addr, size),
|
||||||
"Existing mapping does not contain requested unmap range");
|
"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.
|
// 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;
|
auto& vma = new_it->second;
|
||||||
vma.type = VMAType::Free;
|
vma.type = VMAType::Free;
|
||||||
vma.prot = MemoryProt::NoAccess;
|
vma.prot = MemoryProt::NoAccess;
|
||||||
|
@ -375,14 +374,12 @@ std::pair<vk::Buffer, size_t> MemoryManager::GetVulkanBuffer(VAddr addr) {
|
||||||
return std::make_pair(*it->second.buffer, addr - it->first);
|
return std::make_pair(*it->second.buffer, addr - it->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryManager::VMAHandle MemoryManager::CarveVMA(VAddr virtual_addr, size_t size,
|
MemoryManager::VMAHandle MemoryManager::CarveVMA(VAddr virtual_addr, size_t size) {
|
||||||
bool allow_mapped) {
|
|
||||||
auto vma_handle = FindVMA(virtual_addr);
|
auto vma_handle = FindVMA(virtual_addr);
|
||||||
ASSERT_MSG(vma_handle != vma_map.end(), "Virtual address not in vm_map");
|
ASSERT_MSG(vma_handle != vma_map.end(), "Virtual address not in vm_map");
|
||||||
|
|
||||||
const VirtualMemoryArea& vma = vma_handle->second;
|
const VirtualMemoryArea& vma = vma_handle->second;
|
||||||
ASSERT_MSG((vma.type == VMAType::Free || vma.type == VMAType::Reserved || allow_mapped) &&
|
ASSERT_MSG(vma.base <= virtual_addr,
|
||||||
vma.base <= virtual_addr,
|
|
||||||
"Adding a mapping to already mapped region");
|
"Adding a mapping to already mapped region");
|
||||||
|
|
||||||
const VAddr start_in_vma = virtual_addr - vma.base;
|
const VAddr start_in_vma = virtual_addr - vma.base;
|
||||||
|
|
|
@ -202,8 +202,7 @@ private:
|
||||||
return iter;
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
VMAHandle CarveVMA(VAddr virtual_addr, size_t size,
|
VMAHandle CarveVMA(VAddr virtual_addr, size_t size);
|
||||||
bool allow_mapped = false);
|
|
||||||
|
|
||||||
DirectMemoryArea& CarveDmemArea(PAddr addr, size_t size);
|
DirectMemoryArea& CarveDmemArea(PAddr addr, size_t size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue