From a5bb1ac6e31d2087e2c2ee325acadbbe9cb566a3 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Wed, 25 Dec 2019 14:37:28 -0400 Subject: [PATCH] NvServices: Correct Ioctl Remap. This commit corrects a padding value in Ioctl Remap that was actually an offset to the mapping address. --- src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | 6 ++++-- src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h | 2 +- 2 files changed, 5 insertions(+), 3 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 07c88465ea..195421cc04 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp @@ -104,10 +104,12 @@ u32 nvhost_as_gpu::Remap(const std::vector& input, std::vector& output) ASSERT(object->status == nvmap::Object::Status::Allocated); - u64 size = static_cast(entry.pages) << 0x10; + const u64 size = static_cast(entry.pages) << 0x10; ASSERT(size <= object->size); + const u64 map_offset = static_cast(entry.map_offset) << 0x10; - GPUVAddr returned = gpu.MemoryManager().MapBufferEx(object->addr, offset, size); + const GPUVAddr returned = + gpu.MemoryManager().MapBufferEx(object->addr + map_offset, offset, size); ASSERT(returned == offset); } std::memcpy(output.data(), entries.data(), output.size()); diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h index 169fb8f0e8..f79fcc0653 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h @@ -62,7 +62,7 @@ private: u16_le flags; u16_le kind; u32_le nvmap_handle; - INSERT_PADDING_WORDS(1); + u32_le map_offset; u32_le offset; u32_le pages; };