From 85e38b765755d3b42b0cf9363a214ec1200c20a2 Mon Sep 17 00:00:00 2001 From: gibbed Date: Sat, 18 Jun 2016 18:26:04 -0500 Subject: [PATCH] Invalidate physical memory passed to NtReadFile. --- src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc index 85404e549..f30fbf826 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc @@ -194,6 +194,14 @@ dword_result_t NtReadFile(dword_t file_handle, dword_t event_handle, if (XSUCCEEDED(result)) { if (true || file->is_synchronous()) { + // some games NtReadFile() directly into texture memory + // TODO(rick): better checking of physical address + if (buffer.guest_address() >= 0xA0000000) { + auto heap = kernel_memory()->LookupHeap(buffer.guest_address()); + cpu::MMIOHandler::global_handler()->InvalidateRange( + heap->GetPhysicalAddress(buffer.guest_address()), buffer_length); + } + // Synchronous. size_t bytes_read = 0; result = file->Read(