Fix page fault area range check

Range end check was bugged (always true), also rewrite it so vm::get would be called only once
This commit is contained in:
eladash 2019-03-12 17:45:15 +02:00 committed by Ivan
parent f2bbae9db4
commit 16f86b2458
1 changed files with 5 additions and 5 deletions

View File

@ -1280,13 +1280,13 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
if (auto pf_entries = fxm::get<page_fault_notification_entries>())
{
std::shared_lock lock(pf_entries->mutex);
for (const auto& entry : pf_entries->entries)
if (auto mem = vm::get(vm::any, addr))
{
if (auto mem = vm::get(vm::any, entry.start_addr))
std::shared_lock lock(pf_entries->mutex);
for (const auto& entry : pf_entries->entries)
{
if (entry.start_addr <= addr && addr <= addr + mem->size - 1)
if (entry.start_addr == mem->addr)
{
pf_port_id = entry.port_id;
break;