diff options
author | bunnei <bunneidev@gmail.com> | 2019-03-16 00:05:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-16 00:05:24 -0400 |
commit | 47b622825ca0ff664044abdf2d64a141452a8d1c (patch) | |
tree | ff18141caee2b1a460e6d5e22283e78c073880b0 /src/core/memory.cpp | |
parent | 06ac6460d31036dddf7e4ae12355391035cc30ca (diff) | |
parent | 2eaf6c41a4686028c0abc84d1be6fd48a67cf49f (diff) |
Merge pull request #2237 from bunnei/cache-host-addr
gpu: Use host address for caching instead of guest address.
Diffstat (limited to 'src/core/memory.cpp')
-rw-r--r-- | src/core/memory.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 6591c45d27..4fde530330 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -67,8 +67,11 @@ static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, Pa LOG_DEBUG(HW_Memory, "Mapping {} onto {:016X}-{:016X}", fmt::ptr(memory), base * PAGE_SIZE, (base + size) * PAGE_SIZE); - RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE, - FlushMode::FlushAndInvalidate); + // During boot, current_page_table might not be set yet, in which case we need not flush + if (current_page_table) { + RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE, + FlushMode::FlushAndInvalidate); + } VAddr end = base + size; ASSERT_MSG(end <= page_table.pointers.size(), "out of range mapping at {:016X}", @@ -359,13 +362,13 @@ void RasterizerFlushVirtualRegion(VAddr start, u64 size, FlushMode mode) { auto& gpu = system_instance.GPU(); switch (mode) { case FlushMode::Flush: - gpu.FlushRegion(overlap_start, overlap_size); + gpu.FlushRegion(ToCacheAddr(GetPointer(overlap_start)), overlap_size); break; case FlushMode::Invalidate: - gpu.InvalidateRegion(overlap_start, overlap_size); + gpu.InvalidateRegion(ToCacheAddr(GetPointer(overlap_start)), overlap_size); break; case FlushMode::FlushAndInvalidate: - gpu.FlushAndInvalidateRegion(overlap_start, overlap_size); + gpu.FlushAndInvalidateRegion(ToCacheAddr(GetPointer(overlap_start)), overlap_size); break; } }; |