From 5af4803e42f206d6332e812997e5db45ea01d0b5 Mon Sep 17 00:00:00 2001 From: Zephyron Date: Sun, 9 Feb 2025 15:40:24 +1000 Subject: common: Enhance memory mapping safety and debugging - Reduce max_memory_size from 512GB to 1GB for safer allocation limits - Add memory operation logging for debugging purposes - Implement MapMemory() with additional safety checks and large allocation handling - Add validation checks for memory mappings - Introduce chunked allocation strategy for large memory requests - Add detailed error logging for memory operations --- src/common/host_memory.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/common/host_memory.h') diff --git a/src/common/host_memory.h b/src/common/host_memory.h index 7d4a94123..438edd659 100644 --- a/src/common/host_memory.h +++ b/src/common/host_memory.h @@ -52,6 +52,13 @@ public: void ClearBackingRegion(size_t physical_offset, size_t length, u32 fill_value); + /// Attempts to map memory with additional safety checks and chunking for large allocations + /// @param virtual_offset The virtual memory address to map to + /// @param host_offset The physical memory address to map from + /// @param length The size of the mapping in bytes + /// @return true if mapping succeeded, false if it failed + bool MapMemory(uint64_t virtual_offset, uint64_t host_offset, uint64_t length); + [[nodiscard]] u8* BackingBasePointer() noexcept { return backing_base; } -- cgit v1.2.3