First post, by superfury
Do the x86 debug registers work while in virtual 8086 mode?
What about in real mode? Is DR6 still updated when a single step trap is thrown (setting bit 14)?
Edit: OK. So DR6 is still updated, even in real mode from what I can learn from Bochs' source code (looking into it's exception handling from the exception() call).
I've adjusted my emulator to do the same.
Real and virtual 8086 mode also get debugged in the same way, although just on the logical address part (like in protected mode), which effectively is the same as a physical address in real mode.
Ran WinDBG, used a debugger command to set the DR register up for an instruction faulting:
Kernel base = 0x807c2000 PsLoadedModuleList = 0x8083ce28
System Uptime: not available
Break instruction exception - code 80000003 (first chance)
*******************************************************************************
* *
* You are seeing this message because you pressed either *
* CTRL+C (if you run kd.exe) or, *
* CTRL+BREAK (if you run WinDBG), *
* on your debugger machine's keyboard. *
* *
* THIS IS NOT A BUG OR A SYSTEM CRASH *
* *
* If you did not intend to break into the debugger, press the "g" key, then *
* press the "Enter" key now. This message might immediately reappear. If it *
* does, press "g" and "Enter" again. *
* *
*******************************************************************************
ntkrnlmp!RtlpBreakWithStatusInstruction:
807e984c cc int 3
kd> t
ntkrnlmp!RtlpBreakWithStatusInstruction+1:
807e984d c20400 ret 0x4
kd> t
ntkrnlmp!ExpInitializeExecutive+310:
80964c28 8b4358 mov eax,[ebx+0x58]
kd> g
Breakpoint 0 hit
ntkrnlmp!ExpInitializeExecutive+316:
80964c2e 7206 jb ntkrnlmp!ExpInitializeExecutive+0x31e (80964c36)
kd> ba e 1 80964c31
kd> t
ntkrnlmp!ExpInitializeExecutive+318:
80964c30 53 push ebx
kd> g
CS descriptor lookup failed
Breakpoint 1 hit
4c31:7000 ?? ???
kd> t
*** Fatal System Error: 0x0000007f
(0x0000000D,0x00000000,0x00000000,0x00000000)
A fatal system error has occurred.
Debugger entered on first try; Bugcheck callbacks have not been invoked.
A fatal system error has occurred.
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
Use !analyzebugcheck -v to get more information.
BugCheck 7F, {d, 0, 0, 0}
*** Bugcheck Analysis may not be correct, please followup with the following.
Followup : MachineOwner
ntkrnlmp!RtlpBreakWithStatusInstruction:
807e984c cc int 3
Although the breakpoint hit correctly, somehow the return address was invalid it look like, leading to a 0x7F bugcheck?
Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io