vk: Fix cyclic read-write in dma_block::load/flush

Some DMA block entries are stubs whose parents are DMA_block_EXT
entries.
Performing load() in this case becomes a memcpy(address,
same_address_again, length) which wastes performance and introduces
bugs.
This commit is contained in:
kd-11 2021-02-21 21:54:13 +03:00 committed by kd-11
parent 8be2a55ccc
commit b7c2bfbcde

View File

@ -95,6 +95,13 @@ namespace vk
void dma_block::flush(const utils::address_range& range)
{
if (inheritance_info.parent)
{
// Parent may be a different type of block
inheritance_info.parent->flush(range);
return;
}
auto src = map_range(range);
auto dst = vm::get_super_ptr(range.start);
std::memcpy(dst, src, range.length());
@ -105,6 +112,13 @@ namespace vk
void dma_block::load(const utils::address_range& range)
{
if (inheritance_info.parent)
{
// Parent may be a different type of block
inheritance_info.parent->load(range);
return;
}
auto src = vm::get_super_ptr(range.start);
auto dst = map_range(range);
std::memcpy(dst, src, range.length());