summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2023-08-25 17:04:16 +0200
committerGitHub <noreply@github.com>2023-08-25 17:04:16 +0200
commit2f2de400e13b7c83ea708b5a110e3b6fe8c5438a (patch)
tree4a61e1e9cb341e0355e8d203aa602ac5bacca8d4
parentMerge pull request #11327 from liamwhite/skyline-2 (diff)
parentnvhost_as_gpu: ensure mappings are aligned to big page size when deallocated (diff)
downloadyuzu-2f2de400e13b7c83ea708b5a110e3b6fe8c5438a.tar
yuzu-2f2de400e13b7c83ea708b5a110e3b6fe8c5438a.tar.gz
yuzu-2f2de400e13b7c83ea708b5a110e3b6fe8c5438a.tar.bz2
yuzu-2f2de400e13b7c83ea708b5a110e3b6fe8c5438a.tar.lz
yuzu-2f2de400e13b7c83ea708b5a110e3b6fe8c5438a.tar.xz
yuzu-2f2de400e13b7c83ea708b5a110e3b6fe8c5438a.tar.zst
yuzu-2f2de400e13b7c83ea708b5a110e3b6fe8c5438a.zip
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
index 07e570a9f..7d7bb8687 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
@@ -204,9 +204,11 @@ void nvhost_as_gpu::FreeMappingLocked(u64 offset) {
if (!mapping->fixed) {
auto& allocator{mapping->big_page ? *vm.big_page_allocator : *vm.small_page_allocator};
u32 page_size_bits{mapping->big_page ? vm.big_page_size_bits : VM::PAGE_SIZE_BITS};
+ u32 page_size{mapping->big_page ? vm.big_page_size : VM::YUZU_PAGESIZE};
+ u64 aligned_size{Common::AlignUp(mapping->size, page_size)};
allocator.Free(static_cast<u32>(mapping->offset >> page_size_bits),
- static_cast<u32>(mapping->size >> page_size_bits));
+ static_cast<u32>(aligned_size >> page_size_bits));
}
// Sparse mappings shouldn't be fully unmapped, just returned to their sparse state