Handle unmapped ranges in TranslateRange

This commit is contained in:
Billy Laws 2022-09-29 20:20:57 +01:00
parent acfa58ea8c
commit b310b99bdc
2 changed files with 11 additions and 4 deletions

View File

@ -113,6 +113,9 @@ namespace skyline {
std::pair<span<u8>, size_t> LookupBlockLocked(VaType virt, std::function<void(span<u8>)> cpuAccessCallback = {}) {
const auto &blockEntry{this->blockSegmentTable[virt]};
if (blockEntry.phys == nullptr)
return {span<u8>{}, 0};
VaType segmentOffset{virt - blockEntry.virt};
span<u8> blockSpan{blockEntry.phys, blockEntry.extent};
if (cpuAccessCallback)

View File

@ -248,11 +248,15 @@ namespace skyline {
blockPhys = sparseMap;
}
if (predecessor->phys) {
span cpuBlock{blockPhys, blockSize};
if (cpuAccessCallback)
cpuAccessCallback(cpuBlock);
ranges.push_back(cpuBlock);
} else {
ranges.push_back(span<u8>{static_cast<u8*>(nullptr), blockSize});
}
size -= blockSize;