hi. today i've discovered that windows 7 boot loader uses 'xchg bx, bx' in loop and it's hard to load windows with magic breakpoint enabled without patching bootloader with 'xchg bx, bx' => nop substitution. maybe it will be good to have config option, to specify REGister for xchg's magic breakpoint - xchg REG, REG.
Stanislav Shwartsman
2012-04-27
I could give you a patch to implement this.
In the cpu/data_xfer16.cc search for xchg function with magic breakpoint code.
// Note for mortals: the instruction to trigger this is "xchgw %bx,%bx"
if (bx_dbg.magic_break_enabled && (i->nnn() == 3) && (i->rm() == 3))
{
BX_CPU_THIS_PTR magic_break = 1;
BX_NEXT_INSTR(i);
}
Change '== 3' to any other register you like.
Stanislav
Anonymous
2012-04-28
thanks for your answer, i've already done this. it will be good to have config option such as magic_breakpoint_xchg_register=dx, for example, to specify xchg dx, dx as magic breakpoint instruction (currently i'm using dx register). seems that microsoft have used bochs to debug their boot loader.