From a874ab0133459b713205a87738234fae03dc715b Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Fri, 5 Jan 2024 03:47:48 +0100 Subject: [PATCH] SMMU: Fix 8Gb layout. --- src/core/device_memory_manager.inc | 10 +++++----- src/video_core/memory_manager.cpp | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/device_memory_manager.inc b/src/core/device_memory_manager.inc index a0eb4214e..5241293b6 100644 --- a/src/core/device_memory_manager.inc +++ b/src/core/device_memory_manager.inc @@ -340,8 +340,8 @@ T* DeviceMemoryManager::GetPointer(DAddr address) { if (phys_addr == 0) [[unlikely]] { return nullptr; } - return GetPointerFromRaw( - static_cast(((phys_addr - 1) << Memory::YUZU_PAGEBITS) + offset)); + return GetPointerFromRaw((static_cast(phys_addr - 1) << Memory::YUZU_PAGEBITS) + + offset); } template @@ -353,8 +353,8 @@ const T* DeviceMemoryManager::GetPointer(DAddr address) const { if (phys_addr == 0) [[unlikely]] { return nullptr; } - return GetPointerFromRaw( - static_cast(((phys_addr - 1) << Memory::YUZU_PAGEBITS) + offset)); + return GetPointerFromRaw((static_cast(phys_addr - 1) << Memory::YUZU_PAGEBITS) + + offset); } template @@ -405,7 +405,7 @@ void DeviceMemoryManager::WalkBlock(DAddr addr, std::size_t size, auto o continue; } auto* mem_ptr = GetPointerFromRaw( - static_cast(((phys_addr - 1) << Memory::YUZU_PAGEBITS) + page_offset)); + (static_cast(phys_addr - 1) << Memory::YUZU_PAGEBITS) + page_offset); on_memory(copy_amount, mem_ptr); } } diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index ac1417fbc..b18b44e42 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -762,6 +762,9 @@ void MemoryManager::FlushCaching() { } const u8* MemoryManager::GetSpan(const GPUVAddr src_addr, const std::size_t size) const { + if (!IsContinuousRange(src_addr, size)) { + return nullptr; + } auto dev_addr = GpuToCpuAddress(src_addr); if (dev_addr) { return memory.GetSpan(*dev_addr, size);