diff options
author | Zephyron <zephyron@citron-emu.org> | 2025-02-09 15:40:24 +1000 |
---|---|---|
committer | Zephyron <zephyron@citron-emu.org> | 2025-02-09 15:40:24 +1000 |
commit | 5af4803e42f206d6332e812997e5db45ea01d0b5 (patch) | |
tree | b775c0ec01cc43e34842376943095c66f9763e49 /src/common/host_memory.h | |
parent | becaf850ab7b21456b7799fbaa31c65e20be0a92 (diff) |
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
Diffstat (limited to 'src/common/host_memory.h')
-rw-r--r-- | src/common/host_memory.h | 7 |
1 files changed, 7 insertions, 0 deletions
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; } |