I am trying to write my own debugging software for my kernel.
I have managed to get the 'single step' mode to work. (after each instruction a debug exception is fired)
Now I want to get a debug exception when an instruction at a specific memory location is executed.
Here's my code:
Code: Select all
mov eax, break_loc ; the code segment starts at linear mem location 0x0, so offset of break_loc = linear address of break_loc
mov dr0, eax
mov eax, dr7
and eax, 0x0000fc00
or eax, 0x00000202
mov dr7, eax
I think the linear address of 'break_loc' in dr0 should be valid. So where's the mistake?