Miscellaneous fixes

This commit is contained in:
Igor Pissolati
2025-04-28 12:48:28 -03:00
parent 9d5338b168
commit a629f77e31
4 changed files with 52 additions and 9 deletions

View File

@@ -515,6 +515,7 @@ void windows_emulator::setup_hooks()
this->emu().hook_interrupt([&](const int interrupt) {
const auto rip = this->emu().read_instruction_pointer();
const auto eflags = this->emu().reg<uint32_t>(x86_register::eflags);
switch (interrupt)
{
@@ -522,7 +523,15 @@ void windows_emulator::setup_hooks()
dispatch_integer_division_by_zero(this->emu(), this->process);
return;
case 1:
this->log.print(color::pink, "Singlestep: 0x%" PRIx64 "\n", rip);
if ((eflags & 0x100) != 0)
{
this->log.print(color::pink, "Singlestep (Trap Flag): 0x%" PRIx64 "\n", rip);
this->emu().reg(x86_register::eflags, eflags & ~0x100);
}
else
{
this->log.print(color::pink, "Singlestep: 0x%" PRIx64 "\n", rip);
}
dispatch_single_step(this->emu(), this->process);
return;
case 3:
@@ -532,6 +541,10 @@ void windows_emulator::setup_hooks()
case 6:
dispatch_illegal_instruction_violation(this->emu(), this->process);
return;
case 45:
this->log.print(color::pink, "DbgPrint: 0x%" PRIx64 "\n", rip);
dispatch_breakpoint(this->emu(), this->process);
return;
default:
break;
}