|
From: laurent c. <mar...@gm...> - 2025-02-19 15:17:49
|
Hello,
I'm a UEFI firmware engineer. We sometimes have to do changes very early in
the BIOS flow after cold reset (the few thousands of instructions after the
reset vector) and Bochs and its built-in debugger has been very useful to
test these changes for some years now.
I have upgraded my custom simulator recently to use Bochs 3.0 and I have
run into an issue where the x86 instruction execution loop in function
*cpu_loop_debugger* seems to ignore the STOP_TRACE bit and fetch invalid
instructions beyond taken branches.
More specifically, I'm concerned by this test at line 117 in cpu.cc
if (BX_CPU_THIS_PTR async_event & ~BX_ASYNC_EVENT_STOP_TRACE) break;
This test breaks the execution loop on all "async events" except STOP_TRACE
so wouldn't it ignore STOP_TRACE bit set by branch instructions?
Moreover this test seems to contradict the purpose of line 93
// stop tracing after every instruction to handle in internal debugger
BX_CPU_THIS_PTR async_event |= BX_ASYNC_EVENT_STOP_TRACE;
How can it "stop tracing after every instruction" if the STOP_TRACE bit
isn't tested after executing an instruction?
Hope my question makes sense. Thanks for this very helpful open-source x86
emulator!
|