Merge remote-tracking branch 'upstream/master' into feature/savestates-2

This commit is contained in:
Hamish Milne 2020-03-28 12:46:24 +00:00
commit 03379b2072
17 changed files with 224 additions and 93 deletions

View file

@ -152,13 +152,16 @@ ResultCode VMManager::ChangeMemoryState(VAddr target, u32 size, MemoryState expe
}
CASCADE_RESULT(auto vma, CarveVMARange(target, size));
ASSERT(vma->second.size == size);
vma->second.permissions = new_perms;
vma->second.meminfo_state = new_state;
UpdatePageTableForVMA(vma->second);
MergeAdjacent(vma);
const VMAIter end = vma_map.end();
// The comparison against the end of the range must be done using addresses since VMAs can be
// merged during this process, causing invalidation of the iterators.
while (vma != end && vma->second.base < target_end) {
vma->second.permissions = new_perms;
vma->second.meminfo_state = new_state;
UpdatePageTableForVMA(vma->second);
vma = std::next(MergeAdjacent(vma));
}
return RESULT_SUCCESS;
}