上一篇写了安装系统,这篇就开始正式调试啦
1.上节写了个run.bat是通过给bochs.exe主程序传参实现的系统开启,调试也是一个道理
在run.bat目录下写一个debug.bat 使用相同参数调用即可
2.下面是调试过程
Next at t=0
(0) [0x00000000fffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b ; ea5be000f0
<bochs:1> b 0x7c00 //直接给0x7c00下断点
<bochs:2> c //运行到断点,想到与od里面的f9
(0) Breakpoint 1, 0x0000000000007c00 in ?? ()
Next at t=14090316
(0) [0x0000000000007c00] 0000:7c00 (unk. ctxt): xor ax, ax ; 33c0
<bochs:3> u /15 //上面那句是mbr开始,说明找到位置了,直接u/15显示下面15行汇编指令
00007c00: ( ): xor ax, ax ; 33c0
00007c02: ( ): mov ss, ax ; 8ed0
00007c04: ( ): mov sp, 0x7c00 ; bc007c
00007c07: ( ): sti ; fb
00007c08: ( ): push ax ; 50
00007c09: ( ): pop es ; 07
00007c0a: ( ): push ax ; 50
00007c0b: ( ): pop ds ; 1f
00007c0c: ( ): cld ; fc
00007c0d: ( ): mov si, 0x7c1b ; be1b7c
00007c10: ( ): mov di, 0x061b ; bf1b06
00007c13: ( ): push ax ; 50
00007c14: ( ): push di ; 57
00007c15: ( ): mov cx, 0x01e5 ; b9e501
00007c18: ( ): rep movsb byte ptr es:[di], byte ptr ds:[si] ; f3a4
步过的命令是p,步入的命令是s,用这两个调试剩下的就和od里面一样啦