From f4b9e54b2280eea66fe449416251d6c50ce0d3a8 Mon Sep 17 00:00:00 2001 From: Zephyron Date: Sat, 1 Feb 2025 21:50:33 +1000 Subject: common/nvdrv: improve memory validation and error handling Implements several improvements to memory handling and validation: - host_memory: Add IsValidMapping() and IsDirectMappingEnabled() methods to validate memory access - host_memory: Fix virtual base offset calculation to use proper pointer arithmetic - host_memory: Add size field to track allocation size - nvhost_ctrl_gpu: Return InvalidState instead of InvalidValue for TPC mask buffer size validation - Update copyright year for citron The changes improve memory safety by adding explicit validation checks and fixing pointer arithmetic in the virtual memory implementation. --- src/common/host_memory.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/common/host_memory.h') diff --git a/src/common/host_memory.h b/src/common/host_memory.h index 72fbb05af..7d4a94123 100644 --- a/src/common/host_memory.h +++ b/src/common/host_memory.h @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project +// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once @@ -82,6 +83,8 @@ private: // Fallback if fastmem is not supported on this platform std::unique_ptr> fallback_buffer; + + size_t size; }; } // namespace Common -- cgit v1.2.3