mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 15:31:52 +01:00
Avoid duplicating NvDrv buffer unmap code
This commit is contained in:
parent
001064b7bf
commit
f650f32bf0
@ -149,23 +149,7 @@ namespace skyline::service::nvdrv::device::nvhost {
|
|||||||
return PosixResult::InvalidArgument;
|
return PosixResult::InvalidArgument;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto mapping{mappingMap.at(offset)};
|
FreeMappingLocked(offset);
|
||||||
|
|
||||||
if (!mapping->fixed) {
|
|
||||||
auto &allocator{mapping->bigPage ? *vm.bigPageAllocator : *vm.smallPageAllocator};
|
|
||||||
u32 pageSizeBits{mapping->bigPage ? vm.bigPageSizeBits : VM::PageSizeBits};
|
|
||||||
|
|
||||||
allocator.Free(static_cast<u32>(mapping->offset >> pageSizeBits), static_cast<u32>(mapping->size >> pageSizeBits));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sparse mappings shouldn't be fully unmapped, just returned to their sparse state
|
|
||||||
// Only FreeSpace can unmap them fully
|
|
||||||
if (mapping->sparseAlloc)
|
|
||||||
asCtx->gmmu.Map(offset, GMMU::SparsePlaceholderAddress(), mapping->size, {true});
|
|
||||||
else
|
|
||||||
asCtx->gmmu.Unmap(offset, mapping->size);
|
|
||||||
|
|
||||||
mappingMap.erase(offset);
|
|
||||||
} catch (const std::out_of_range &e) {
|
} catch (const std::out_of_range &e) {
|
||||||
Logger::Warn("Couldn't find region to unmap at 0x{:X}", offset);
|
Logger::Warn("Couldn't find region to unmap at 0x{:X}", offset);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user