From 39f0345ac71ef6edc01a906eac31bad9ce9b9601 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Wed, 21 Oct 2020 22:29:20 +0100 Subject: [PATCH] Fix bugs introduced by refactoring GPU VMM was mistakenly checking the alignment of the PA rather than the VA and NvMap::Free was not accounting for the handle index starting from one. --- app/src/main/cpp/skyline/gpu/memory_manager.cpp | 2 +- app/src/main/cpp/skyline/services/nvdrv/devices/nvmap.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/memory_manager.cpp b/app/src/main/cpp/skyline/gpu/memory_manager.cpp index 8707f85a..2f4bafbe 100644 --- a/app/src/main/cpp/skyline/gpu/memory_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/memory_manager.cpp @@ -118,7 +118,7 @@ namespace skyline::gpu::vmm { } u64 MemoryManager::MapFixed(u64 address, u8 *pointer, u64 size) { - if (!util::IsAligned(pointer, constant::GpuPageSize)) + if (!util::IsAligned(address, constant::GpuPageSize)) return false; size = util::AlignUp(size, constant::GpuPageSize); diff --git a/app/src/main/cpp/skyline/services/nvdrv/devices/nvmap.cpp b/app/src/main/cpp/skyline/services/nvdrv/devices/nvmap.cpp index 839895f8..c48375c6 100644 --- a/app/src/main/cpp/skyline/services/nvdrv/devices/nvmap.cpp +++ b/app/src/main/cpp/skyline/services/nvdrv/devices/nvmap.cpp @@ -80,7 +80,7 @@ namespace skyline::service::nvdrv::device { std::unique_lock lock(mapMutex); try { - auto &object{maps.at(data.handle)}; + auto &object{maps.at(data.handle - 1)}; if (object.use_count() > 1) { data.pointer = object->pointer; data.flags = 0x0;