mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-28 05:45:38 -06:00
Only iterate to next VMA if we're past the current VMA. (#4158)
It's possible we're merging with a later memory area. If that occurred here, we would end up iterating past where we need to be, which then messes up logic.
This commit is contained in:
parent
2bb20e4650
commit
0a722d69e6
@ -1223,13 +1223,16 @@ s32 MemoryManager::SetDirectMemoryType(VAddr addr, u64 size, s32 memory_type) {
|
||||
// Increment phys_handle
|
||||
phys_handle++;
|
||||
}
|
||||
|
||||
// Check if VMA can be merged with adjacent areas after physical area modifications.
|
||||
vma_handle = MergeAdjacent(vma_map, vma_handle);
|
||||
}
|
||||
current_addr += size_in_vma;
|
||||
remaining_size -= size_in_vma;
|
||||
vma_handle++;
|
||||
|
||||
// Check if VMA can be merged with adjacent areas after modifications.
|
||||
vma_handle = MergeAdjacent(vma_map, vma_handle);
|
||||
if (vma_handle->second.base + vma_handle->second.size <= current_addr) {
|
||||
// If we're now in the next VMA, then go to the next handle.
|
||||
vma_handle++;
|
||||
}
|
||||
}
|
||||
|
||||
return ORBIS_OK;
|
||||
@ -1262,10 +1265,15 @@ void MemoryManager::NameVirtualRange(VAddr virtual_addr, u64 size, std::string_v
|
||||
vma.name = name;
|
||||
}
|
||||
}
|
||||
it = MergeAdjacent(vma_map, it);
|
||||
remaining_size -= size_in_vma;
|
||||
current_addr += size_in_vma;
|
||||
it++;
|
||||
|
||||
// Check if VMA can be merged with adjacent areas after modifications.
|
||||
it = MergeAdjacent(vma_map, it);
|
||||
if (it->second.base + it->second.size <= current_addr) {
|
||||
// If we're now in the next VMA, then go to the next handle.
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user