diff options
author | bunnei <bunneidev@gmail.com> | 2018-10-12 18:07:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-12 18:07:14 +0200 |
commit | 0f7ab3e21adf4b71a05fa8858fb19b684c36dbbd (patch) | |
tree | 8017e8ec1e7858ac1d8b65aac8004a1f23c867fc | |
parent | Merge pull request #1482 from lioncash/init (diff) | |
parent | Returned an error before processing other remaps (diff) | |
download | yuzu-0f7ab3e21adf4b71a05fa8858fb19b684c36dbbd.tar yuzu-0f7ab3e21adf4b71a05fa8858fb19b684c36dbbd.tar.gz yuzu-0f7ab3e21adf4b71a05fa8858fb19b684c36dbbd.tar.bz2 yuzu-0f7ab3e21adf4b71a05fa8858fb19b684c36dbbd.tar.lz yuzu-0f7ab3e21adf4b71a05fa8858fb19b684c36dbbd.tar.xz yuzu-0f7ab3e21adf4b71a05fa8858fb19b684c36dbbd.tar.zst yuzu-0f7ab3e21adf4b71a05fa8858fb19b684c36dbbd.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | 13 |
1 files changed, 10 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 8d194e175..c41ef7058 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp @@ -15,6 +15,11 @@ #include "video_core/renderer_base.h" namespace Service::Nvidia::Devices { +namespace NvErrCodes { +enum { + InvalidNmapHandle = -22, +}; +} nvhost_as_gpu::nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} nvhost_as_gpu::~nvhost_as_gpu() = default; @@ -79,14 +84,16 @@ u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) std::memcpy(entries.data(), input.data(), input.size()); auto& gpu = Core::System::GetInstance().GPU(); - for (const auto& entry : entries) { LOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}", entry.offset, entry.nvmap_handle, entry.pages); Tegra::GPUVAddr offset = static_cast<Tegra::GPUVAddr>(entry.offset) << 0x10; - auto object = nvmap_dev->GetObject(entry.nvmap_handle); - ASSERT(object); + if (!object) { + LOG_CRITICAL(Service_NVDRV, "nvmap {} is an invalid handle!", entry.nvmap_handle); + std::memcpy(output.data(), entries.data(), output.size()); + return static_cast<u32>(NvErrCodes::InvalidNmapHandle); + } ASSERT(object->status == nvmap::Object::Status::Allocated); |