yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

SMMU: Fix 8Gb layout.

This commit is contained in:
Fernando Sahmkow 2024-01-05 03:47:48 +01:00 committed by Liam
parent 590d9b7e1d
commit a874ab0133
2 changed files with 8 additions and 5 deletions

View File

@ -340,8 +340,8 @@ T* DeviceMemoryManager<Traits>::GetPointer(DAddr address) {
if (phys_addr == 0) [[unlikely]] { if (phys_addr == 0) [[unlikely]] {
return nullptr; return nullptr;
} }
return GetPointerFromRaw<T>( return GetPointerFromRaw<T>((static_cast<PAddr>(phys_addr - 1) << Memory::YUZU_PAGEBITS) +
static_cast<PAddr>(((phys_addr - 1) << Memory::YUZU_PAGEBITS) + offset)); offset);
} }
template <typename Traits> template <typename Traits>
@ -353,8 +353,8 @@ const T* DeviceMemoryManager<Traits>::GetPointer(DAddr address) const {
if (phys_addr == 0) [[unlikely]] { if (phys_addr == 0) [[unlikely]] {
return nullptr; return nullptr;
} }
return GetPointerFromRaw<T>( return GetPointerFromRaw<T>((static_cast<PAddr>(phys_addr - 1) << Memory::YUZU_PAGEBITS) +
static_cast<PAddr>(((phys_addr - 1) << Memory::YUZU_PAGEBITS) + offset)); offset);
} }
template <typename Traits> template <typename Traits>
@ -405,7 +405,7 @@ void DeviceMemoryManager<Traits>::WalkBlock(DAddr addr, std::size_t size, auto o
continue; continue;
} }
auto* mem_ptr = GetPointerFromRaw<u8>( auto* mem_ptr = GetPointerFromRaw<u8>(
static_cast<PAddr>(((phys_addr - 1) << Memory::YUZU_PAGEBITS) + page_offset)); (static_cast<PAddr>(phys_addr - 1) << Memory::YUZU_PAGEBITS) + page_offset);
on_memory(copy_amount, mem_ptr); on_memory(copy_amount, mem_ptr);
} }
} }

View File

@ -762,6 +762,9 @@ void MemoryManager::FlushCaching() {
} }
const u8* MemoryManager::GetSpan(const GPUVAddr src_addr, const std::size_t size) const { 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); auto dev_addr = GpuToCpuAddress(src_addr);
if (dev_addr) { if (dev_addr) {
return memory.GetSpan(*dev_addr, size); return memory.GetSpan(*dev_addr, size);