diff options
author | Subv <subv2112@gmail.com> | 2016-05-15 19:43:52 +0200 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2016-05-28 20:52:50 +0200 |
commit | 0aef634a54f786c49241c24b8d0c7aa3555b0fa1 (patch) | |
tree | 774d974cc9a4941f7f6d83eedf0345f417d7a74f | |
parent | Memory: Make ReadBlock and WriteBlock accept void pointers. (diff) | |
download | yuzu-0aef634a54f786c49241c24b8d0c7aa3555b0fa1.tar yuzu-0aef634a54f786c49241c24b8d0c7aa3555b0fa1.tar.gz yuzu-0aef634a54f786c49241c24b8d0c7aa3555b0fa1.tar.bz2 yuzu-0aef634a54f786c49241c24b8d0c7aa3555b0fa1.tar.lz yuzu-0aef634a54f786c49241c24b8d0c7aa3555b0fa1.tar.xz yuzu-0aef634a54f786c49241c24b8d0c7aa3555b0fa1.tar.zst yuzu-0aef634a54f786c49241c24b8d0c7aa3555b0fa1.zip |
-rw-r--r-- | src/core/hle/service/fs/archive.cpp | 1 | ||||
-rw-r--r-- | src/core/memory.cpp | 61 |
2 files changed, 60 insertions, 2 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index a7ebfde25..81b9abe4c 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -116,7 +116,6 @@ ResultVal<bool> File::SyncRequest() { } Memory::WriteBlock(address, data.data(), *read); cmd_buff[2] = static_cast<u32>(*read); - Memory::RasterizerFlushAndInvalidateRegion(Memory::VirtualToPhysicalAddress(address), length); break; } diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 2ac3e7de4..8c9e5d46d 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -392,6 +392,20 @@ void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) { GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, dest_buffer, copy_amount); break; } + case PageType::RasterizerCachedMemory: { + RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + + std::memcpy(dest_buffer, GetPointerFromVMA(current_vaddr), copy_amount); + break; + } + case PageType::RasterizerCachedSpecial: { + DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); + + RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + + GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, dest_buffer, copy_amount); + break; + } default: UNREACHABLE(); } @@ -446,6 +460,20 @@ void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, src_buffer, copy_amount); break; } + case PageType::RasterizerCachedMemory: { + RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + + std::memcpy(GetPointerFromVMA(current_vaddr), src_buffer, copy_amount); + break; + } + case PageType::RasterizerCachedSpecial: { + DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); + + RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + + GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, src_buffer, copy_amount); + break; + } default: UNREACHABLE(); } @@ -462,6 +490,8 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) { size_t page_index = dest_addr >> PAGE_BITS; size_t page_offset = dest_addr & PAGE_MASK; + static const std::array<u8, PAGE_SIZE> zeros = {}; + while (remaining_size > 0) { const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size); const VAddr current_vaddr = (page_index << PAGE_BITS) + page_offset; @@ -481,7 +511,20 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) { case PageType::Special: { DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); - static const std::array<u8, PAGE_SIZE> zeros = {}; + GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, zeros.data(), copy_amount); + break; + } + case PageType::RasterizerCachedMemory: { + RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + + std::memset(GetPointerFromVMA(current_vaddr), 0, copy_amount); + break; + } + case PageType::RasterizerCachedSpecial: { + DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); + + RasterizerFlushAndInvalidateRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + GetMMIOHandler(current_vaddr)->WriteBlock(current_vaddr, zeros.data(), copy_amount); break; } @@ -524,6 +567,22 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) { WriteBlock(dest_addr, buffer.data(), buffer.size()); break; } + case PageType::RasterizerCachedMemory: { + RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + + WriteBlock(dest_addr, GetPointerFromVMA(current_vaddr), copy_amount); + break; + } + case PageType::RasterizerCachedSpecial: { + DEBUG_ASSERT(GetMMIOHandler(current_vaddr)); + + RasterizerFlushRegion(VirtualToPhysicalAddress(current_vaddr), copy_amount); + + std::vector<u8> buffer(copy_amount); + GetMMIOHandler(current_vaddr)->ReadBlock(current_vaddr, buffer.data(), buffer.size()); + WriteBlock(dest_addr, buffer.data(), buffer.size()); + break; + } default: UNREACHABLE(); } |