[Memory] Replace forgotten InvalidateRange in NtReadFile

This commit is contained in:
Triang3l 2019-07-30 09:06:23 +03:00
parent 4aceeb73c4
commit b5fb84473d
3 changed files with 22 additions and 2 deletions

View File

@ -172,8 +172,8 @@ dword_result_t NtReadFile(dword_t file_handle, dword_t event_handle,
// some games NtReadFile() directly into texture memory
// TODO(rick): better checking of physical address
if (buffer.guest_address() >= 0xA0000000) {
cpu::MMIOHandler::global_handler()->InvalidateRange(
buffer.guest_address(), buffer_length);
kernel_memory()->TriggerWatches(buffer.guest_address(), buffer_length,
true);
}
// Synchronous.

View File

@ -460,6 +460,21 @@ void Memory::CancelAccessWatch(uintptr_t watch_handle) {
mmio_handler_->CancelAccessWatch(watch_handle);
}
bool Memory::TriggerWatches(uint32_t virtual_address, uint32_t length,
bool is_write) {
BaseHeap* heap = LookupHeap(virtual_address);
if (heap == &heaps_.vA0000000 || heap == &heaps_.vC0000000 ||
heap == &heaps_.vE0000000) {
// TODO(Triang3l): Remove InvalidateRange when legacy (old Vulkan renderer)
// watches are removed.
cpu::MMIOHandler::global_handler()->InvalidateRange(virtual_address,
length);
return static_cast<PhysicalHeap*>(heap)->TriggerWatches(virtual_address,
length, is_write);
}
return false;
}
void* Memory::RegisterPhysicalWriteWatch(PhysicalWriteWatchCallback callback,
void* callback_context) {
PhysicalWriteWatchEntry* entry = new PhysicalWriteWatchEntry;

View File

@ -388,6 +388,11 @@ class Memory {
// protection placed by the watches.
void WatchPhysicalMemoryWrite(uint32_t physical_address, uint32_t length);
// Forces triggering of watch callbacks for a virtual address range if pages
// are watched there and unwatching them. Returns whether any page was
// watched.
bool TriggerWatches(uint32_t virtual_address, uint32_t length, bool is_write);
// Allocates virtual memory from the 'system' heap.
// System memory is kept separate from game memory but is still accessible
// using normal guest virtual addresses. Kernel structures and other internal