From ceadcbc3e8b41bd55c08ac7a449bd0d89d1f0f78 Mon Sep 17 00:00:00 2001 From: 3fault Date: Tue, 1 Jul 2025 17:50:45 -0400 Subject: [PATCH] Add dispatch_guard_page_violation to exception_dispatch --- src/windows-emulator/exception_dispatch.cpp | 11 +++++++++++ src/windows-emulator/exception_dispatch.hpp | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/windows-emulator/exception_dispatch.cpp b/src/windows-emulator/exception_dispatch.cpp index e4626cf2..df4164b1 100644 --- a/src/windows-emulator/exception_dispatch.cpp +++ b/src/windows-emulator/exception_dispatch.cpp @@ -2,6 +2,7 @@ #include "exception_dispatch.hpp" #include "process_context.hpp" #include "cpu_context.hpp" +#include namespace { @@ -182,6 +183,16 @@ void dispatch_access_violation(x86_64_emulator& emu, const process_context& proc }); } +void dispatch_guard_page_violation(x86_64_emulator& emu, const process_context& proc, const uint64_t address, + const memory_operation operation) +{ + dispatch_exception(emu, proc, STATUS_GUARD_PAGE_VIOLATION, + { + map_violation_operation_to_parameter(operation), + address, + }); +} + void dispatch_illegal_instruction_violation(x86_64_emulator& emu, const process_context& proc) { dispatch_exception(emu, proc, STATUS_ILLEGAL_INSTRUCTION, {}); diff --git a/src/windows-emulator/exception_dispatch.hpp b/src/windows-emulator/exception_dispatch.hpp index 4a717c3d..428c55ef 100644 --- a/src/windows-emulator/exception_dispatch.hpp +++ b/src/windows-emulator/exception_dispatch.hpp @@ -19,6 +19,8 @@ void dispatch_exception(x86_64_emulator& emu, const process_context& proc, const void dispatch_access_violation(x86_64_emulator& emu, const process_context& proc, uint64_t address, memory_operation operation); +void dispatch_guard_page_violation(x86_64_emulator& emu, const process_context& proc, uint64_t address, + memory_operation operation); void dispatch_illegal_instruction_violation(x86_64_emulator& emu, const process_context& proc); void dispatch_integer_division_by_zero(x86_64_emulator& emu, const process_context& proc); void dispatch_single_step(x86_64_emulator& emu, const process_context& proc);