summaryrefslogtreecommitdiff
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/memory.cpp')
-rw-r--r--src/core/memory.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index b3f50223b..26be74df4 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -6,7 +6,6 @@
6 6
7#include "common/assert.h" 7#include "common/assert.h"
8#include "common/atomic_ops.h" 8#include "common/atomic_ops.h"
9#include "common/cache_management.h"
10#include "common/common_types.h" 9#include "common/common_types.h"
11#include "common/logging/log.h" 10#include "common/logging/log.h"
12#include "common/page_table.h" 11#include "common/page_table.h"
@@ -340,10 +339,9 @@ struct Memory::Impl {
340 LOG_ERROR(HW_Memory, "Unmapped cache maintenance @ {:#018X}", current_vaddr); 339 LOG_ERROR(HW_Memory, "Unmapped cache maintenance @ {:#018X}", current_vaddr);
341 throw InvalidMemoryException(); 340 throw InvalidMemoryException();
342 }, 341 },
343 [&](const std::size_t block_size, u8* const host_ptr) { cb(block_size, host_ptr); }, 342 [&](const std::size_t block_size, u8* const host_ptr) {},
344 [&](const VAddr current_vaddr, const std::size_t block_size, u8* const host_ptr) { 343 [&](const VAddr current_vaddr, const std::size_t block_size, u8* const host_ptr) {
345 system.GPU().FlushRegion(current_vaddr, block_size); 344 cb(current_vaddr, block_size);
346 cb(block_size, host_ptr);
347 }, 345 },
348 [](const std::size_t block_size) {}); 346 [](const std::size_t block_size) {});
349 } catch (InvalidMemoryException&) { 347 } catch (InvalidMemoryException&) {
@@ -354,27 +352,30 @@ struct Memory::Impl {
354 } 352 }
355 353
356 Result InvalidateDataCache(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size) { 354 Result InvalidateDataCache(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size) {
357 auto perform = [&](const std::size_t block_size, u8* const host_ptr) { 355 auto on_rasterizer = [&](const VAddr current_vaddr, const std::size_t block_size) {
358 // Do nothing; this operation (dc ivac) cannot be supported 356 // dc ivac: Invalidate to point of coherency
359 // from EL0 357 // GPU flush -> CPU invalidate
358 system.GPU().FlushRegion(current_vaddr, block_size);
360 }; 359 };
361 return PerformCacheOperation(process, dest_addr, size, perform); 360 return PerformCacheOperation(process, dest_addr, size, on_rasterizer);
362 } 361 }
363 362
364 Result StoreDataCache(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size) { 363 Result StoreDataCache(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size) {
365 auto perform = [&](const std::size_t block_size, u8* const host_ptr) { 364 auto on_rasterizer = [&](const VAddr current_vaddr, const std::size_t block_size) {
366 // dc cvac: Store to point of coherency 365 // dc cvac: Store to point of coherency
367 Common::DataCacheLineCleanByVAToPoC(host_ptr, block_size); 366 // CPU flush -> GPU invalidate
367 system.GPU().InvalidateRegion(current_vaddr, block_size);
368 }; 368 };
369 return PerformCacheOperation(process, dest_addr, size, perform); 369 return PerformCacheOperation(process, dest_addr, size, on_rasterizer);
370 } 370 }
371 371
372 Result FlushDataCache(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size) { 372 Result FlushDataCache(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size) {
373 auto perform = [&](const std::size_t block_size, u8* const host_ptr) { 373 auto on_rasterizer = [&](const VAddr current_vaddr, const std::size_t block_size) {
374 // dc civac: Store to point of coherency, and invalidate from cache 374 // dc civac: Store to point of coherency, and invalidate from cache
375 Common::DataCacheLineCleanAndInvalidateByVAToPoC(host_ptr, block_size); 375 // CPU flush -> GPU invalidate
376 system.GPU().InvalidateRegion(current_vaddr, block_size);
376 }; 377 };
377 return PerformCacheOperation(process, dest_addr, size, perform); 378 return PerformCacheOperation(process, dest_addr, size, on_rasterizer);
378 } 379 }
379 380
380 void MarkRegionDebug(VAddr vaddr, u64 size, bool debug) { 381 void MarkRegionDebug(VAddr vaddr, u64 size, bool debug) {