summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorDavid Marcec <dmarcecguzman@gmail.com>2018-10-11 11:32:21 +0200
committerDavid Marcec <dmarcecguzman@gmail.com>2018-10-11 11:32:21 +0200
commit5dd538cace2718584c51d52c1f7ce9ce294bb58e (patch)
tree587359e8d3ea885b013368a7bc663edcfb25ee1c /src/core/hle
parentMerge pull request #1458 from FernandoS27/fix-render-target-block-settings (diff)
downloadyuzu-5dd538cace2718584c51d52c1f7ce9ce294bb58e.tar
yuzu-5dd538cace2718584c51d52c1f7ce9ce294bb58e.tar.gz
yuzu-5dd538cace2718584c51d52c1f7ce9ce294bb58e.tar.bz2
yuzu-5dd538cace2718584c51d52c1f7ce9ce294bb58e.tar.lz
yuzu-5dd538cace2718584c51d52c1f7ce9ce294bb58e.tar.xz
yuzu-5dd538cace2718584c51d52c1f7ce9ce294bb58e.tar.zst
yuzu-5dd538cace2718584c51d52c1f7ce9ce294bb58e.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp17
1 files changed, 14 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 7555bbe7d..7424fa72f 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,17 @@ 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();
-
+ bool failed_remap{};
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);
+ failed_remap = true;
+ continue;
+ }
ASSERT(object->status == nvmap::Object::Status::Allocated);
@@ -97,6 +105,9 @@ u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output)
ASSERT(returned == offset);
}
std::memcpy(output.data(), entries.data(), output.size());
+ if (failed_remap) {
+ return static_cast<u32>(NvErrCodes::InvalidNmapHandle);
+ }
return 0;
}