summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-04-23 18:10:00 +0200
committerSubv <subv2112@gmail.com>2018-04-23 18:21:46 +0200
commit0d6eafe11a12863295e05fb7d9d18302b667d583 (patch)
tree42419b2cce4df12ae405a23523bd4f3c33ca9bd7
parentNvdrv/nvhost-as-gpu: Implemented the ioctl REMAP command. (diff)
downloadyuzu-0d6eafe11a12863295e05fb7d9d18302b667d583.tar
yuzu-0d6eafe11a12863295e05fb7d9d18302b667d583.tar.gz
yuzu-0d6eafe11a12863295e05fb7d9d18302b667d583.tar.bz2
yuzu-0d6eafe11a12863295e05fb7d9d18302b667d583.tar.lz
yuzu-0d6eafe11a12863295e05fb7d9d18302b667d583.tar.xz
yuzu-0d6eafe11a12863295e05fb7d9d18302b667d583.tar.zst
yuzu-0d6eafe11a12863295e05fb7d9d18302b667d583.zip
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp10
1 files changed, 10 insertions, 0 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 8c56fa150..8e7ca6123 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
@@ -108,6 +108,16 @@ u32 nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8>& ou
auto object = nvmap_dev->GetObject(params.nvmap_handle);
ASSERT(object);
+ // We can only map objects that have already been assigned a CPU address.
+ ASSERT(object->status == nvmap::Object::Status::Allocated);
+
+ ASSERT(params.buffer_offset == 0);
+
+ // The real nvservices doesn't make a distinction between handles and ids, and
+ // object can only have one handle and it will be the same as its id. Assert that this is the
+ // case to prevent unexpected behavior.
+ ASSERT(object->id == params.nvmap_handle);
+
auto& gpu = Core::System::GetInstance().GPU();
if (params.flags & 1) {