From f650f32bf092f329d18ba8271ca52c5d0f1293bd Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sun, 30 Oct 2022 16:32:49 +0000 Subject: [PATCH] Avoid duplicating NvDrv buffer unmap code --- .../services/nvdrv/devices/nvhost/as_gpu.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost/as_gpu.cpp b/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost/as_gpu.cpp index 5c9a7277..17fa98a9 100644 --- a/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost/as_gpu.cpp +++ b/app/src/main/cpp/skyline/services/nvdrv/devices/nvhost/as_gpu.cpp @@ -149,23 +149,7 @@ namespace skyline::service::nvdrv::device::nvhost { return PosixResult::InvalidArgument; try { - auto mapping{mappingMap.at(offset)}; - - if (!mapping->fixed) { - auto &allocator{mapping->bigPage ? *vm.bigPageAllocator : *vm.smallPageAllocator}; - u32 pageSizeBits{mapping->bigPage ? vm.bigPageSizeBits : VM::PageSizeBits}; - - allocator.Free(static_cast(mapping->offset >> pageSizeBits), static_cast(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); + FreeMappingLocked(offset); } catch (const std::out_of_range &e) { Logger::Warn("Couldn't find region to unmap at 0x{:X}", offset); }