mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-17 04:17:15 +01:00
Memory: Handle RasterizerCachedMemory and RasterizerCachedSpecial page types in the memory block manipulation functions.
This commit is contained in:
parent
660499ac01
commit
0aef634a54
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user