用bochs调试mbr-深入mbr调试分析

上一篇调试mbr的时候有一个call,如果这个call跟进去的话在一个跳转之后内存地址明显不是mbr代码段了,所以上篇调试中并未对这个call深入分析。
问题如图!错误实例
在jmp之后的代码与ida完全不一样了。

问题出在int 13h这个地方,int 13h在这里是中断,如果单步步入的话就会进入中断处理程序,所以int中断这里需要单步步过

这里不是jb跳转啊,int指令是不能s单步步入的,你看下地址,你没发现吗,都已经跟当前地址差很远了,你在实际调试的时候,最后画的那个圈,已经执行到int 0x13内部去了
注意这里,这个jmp,并不是
这个jmp的意思是跳入到中断处理例程中执行,也就是0xfaae0处。

所以更新后的bochs调试如下:

(0) [0x00000000fffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b         ; ea5be000f0
<bochs:1> b 0x7c00.
:1: syntax error at '.'
<bochs:2> b 0x7c00
<bochs:3> c
(0) Breakpoint 1, 0x0000000000007c00 in ?? ()
Next at t=14090316
(0) [0x0000000000007c00] 0000:7c00 (unk. ctxt): xor ax, ax                ; 33c0
<bochs:4> s
Next at t=14090317
(0) [0x0000000000007c02] 0000:7c02 (unk. ctxt): mov ss, ax                ; 8ed0
<bochs:5> s
Next at t=14090318
(0) [0x0000000000007c04] 0000:7c04 (unk. ctxt): mov sp, 0x7c00            ; bc007c
<bochs:6> s
Next at t=14090319
(0) [0x0000000000007c07] 0000:7c07 (unk. ctxt): sti                       ; fb
<bochs:7> s
Next at t=14090320
(0) [0x0000000000007c08] 0000:7c08 (unk. ctxt): push ax                   ; 50
<bochs:8> s
Next at t=14090321
(0) [0x0000000000007c09] 0000:7c09 (unk. ctxt): pop es                    ; 07
<bochs:9> s
Next at t=14090322
(0) [0x0000000000007c0a] 0000:7c0a (unk. ctxt): push ax                   ; 50
<bochs:10> s
Next at t=14090323
(0) [0x0000000000007c0b] 0000:7c0b (unk. ctxt): pop ds                    ; 1f
<bochs:11> s
Next at t=14090324
(0) [0x0000000000007c0c] 0000:7c0c (unk. ctxt): cld                       ; fc
<bochs:12> s
Next at t=14090325
(0) [0x0000000000007c0d] 0000:7c0d (unk. ctxt): mov si, 0x7c1b            ; be1b7c
<bochs:13> s
Next at t=14090326
(0) [0x0000000000007c10] 0000:7c10 (unk. ctxt): mov di, 0x061b            ; bf1b06
<bochs:14> s
Next at t=14090327
(0) [0x0000000000007c13] 0000:7c13 (unk. ctxt): push ax                   ; 50
<bochs:15> s
Next at t=14090328
(0) [0x0000000000007c14] 0000:7c14 (unk. ctxt): push di                   ; 57
<bochs:16> s
Next at t=14090329
(0) [0x0000000000007c15] 0000:7c15 (unk. ctxt): mov cx, 0x01e5            ; b9e501
<bochs:17> s
Next at t=14090330
(0) [0x0000000000007c18] 0000:7c18 (unk. ctxt): rep movsb byte ptr es:[di], byte ptr ds:[si] ; f3a4
<bochs:18> p
Next at t=14090815
(0) [0x0000000000007c1a] 0000:7c1a (unk. ctxt): retf                      ; cb
<bochs:19> p
Next at t=14090816
(0) [0x000000000000061b] 0000:061b (unk. ctxt): mov bp, 0x07be            ; bdbe07
<bochs:20> s
Next at t=14090817
(0) [0x000000000000061e] 0000:061e (unk. ctxt): mov cl, 0x04              ; b104
<bochs:21> s
Next at t=14090818
(0) [0x0000000000000620] 0000:0620 (unk. ctxt): cmp byte ptr ss:[bp], ch  ; 386e00
<bochs:22> s
Next at t=14090819
(0) [0x0000000000000623] 0000:0623 (unk. ctxt): jl .+9 (0x0000062e)       ; 7c09
<bochs:23> s
Next at t=14090820
(0) [0x000000000000062e] 0000:062e (unk. ctxt): mov si, bp                ; 8bf5
<bochs:24> s
Next at t=14090821
(0) [0x0000000000000630] 0000:0630 (unk. ctxt): add si, 0x0010            ; 83c610
<bochs:25> s
Next at t=14090822
(0) [0x0000000000000633] 0000:0633 (unk. ctxt): dec cx                    ; 49
<bochs:26> s
Next at t=14090823
(0) [0x0000000000000634] 0000:0634 (unk. ctxt): jz .+25 (0x0000064f)      ; 7419
<bochs:27> s
Next at t=14090824
(0) [0x0000000000000636] 0000:0636 (unk. ctxt): cmp byte ptr ds:[si], ch  ; 382c
<bochs:28> s
Next at t=14090825
(0) [0x0000000000000638] 0000:0638 (unk. ctxt): jz .-10 (0x00000630)      ; 74f6
<bochs:29> s
Next at t=14090826
(0) [0x0000000000000630] 0000:0630 (unk. ctxt): add si, 0x0010            ; 83c610
<bochs:30> s
Next at t=14090827
(0) [0x0000000000000633] 0000:0633 (unk. ctxt): dec cx                    ; 49
<bochs:31> s
Next at t=14090828
(0) [0x0000000000000634] 0000:0634 (unk. ctxt): jz .+25 (0x0000064f)      ; 7419
<bochs:32> s
Next at t=14090829
(0) [0x0000000000000636] 0000:0636 (unk. ctxt): cmp byte ptr ds:[si], ch  ; 382c
<bochs:33> s
Next at t=14090830
(0) [0x0000000000000638] 0000:0638 (unk. ctxt): jz .-10 (0x00000630)      ; 74f6
<bochs:34> s
Next at t=14090831
(0) [0x0000000000000630] 0000:0630 (unk. ctxt): add si, 0x0010            ; 83c610
<bochs:35> s
Next at t=14090832
(0) [0x0000000000000633] 0000:0633 (unk. ctxt): dec cx                    ; 49
<bochs:36> s
Next at t=14090833
(0) [0x0000000000000634] 0000:0634 (unk. ctxt): jz .+25 (0x0000064f)      ; 7419
<bochs:37> s
Next at t=14090834
(0) [0x0000000000000636] 0000:0636 (unk. ctxt): cmp byte ptr ds:[si], ch  ; 382c
<bochs:38> s
Next at t=14090835
(0) [0x0000000000000638] 0000:0638 (unk. ctxt): jz .-10 (0x00000630)      ; 74f6
<bochs:39> s
Next at t=14090836
(0) [0x0000000000000630] 0000:0630 (unk. ctxt): add si, 0x0010            ; 83c610
<bochs:40> s
Next at t=14090837
(0) [0x0000000000000633] 0000:0633 (unk. ctxt): dec cx                    ; 49
<bochs:41> s
Next at t=14090838
(0) [0x0000000000000634] 0000:0634 (unk. ctxt): jz .+25 (0x0000064f)      ; 7419
<bochs:42> s
Next at t=14090839
(0) [0x000000000000064f] 0000:064f (unk. ctxt): mov byte ptr ss:[bp+16], cl ; 884e10
<bochs:43> s
Next at t=14090840
(0) [0x0000000000000652] 0000:0652 (unk. ctxt): call .+70 (0x0000069b)    ; e84600
<bochs:44> s
Next at t=14090841
(0) [0x000000000000069b] 0000:069b (unk. ctxt): mov di, 0x0005            ; bf0500
<bochs:45> s
Next at t=14090842
(0) [0x000000000000069e] 0000:069e (unk. ctxt): mov dl, byte ptr ss:[bp]  ; 8a5600
<bochs:46> s
Next at t=14090843
(0) [0x00000000000006a1] 0000:06a1 (unk. ctxt): mov ah, 0x08              ; b408
<bochs:47> s
Next at t=14090844
(0) [0x00000000000006a3] 0000:06a3 (unk. ctxt): int 0x13                  ; cd13
<bochs:48> p
Next at t=14091188
(0) [0x00000000000006a5] 0000:06a5 (unk. ctxt): jb .+35 (0x000006ca)      ; 7223
<bochs:49> s
Next at t=14091189
(0) [0x00000000000006a7] 0000:06a7 (unk. ctxt): mov al, cl                ; 8ac1
<bochs:50> s
Next at t=14091190
(0) [0x00000000000006a9] 0000:06a9 (unk. ctxt): and al, 0x3f              ; 243f
<bochs:51> s
Next at t=14091191
(0) [0x00000000000006ab] 0000:06ab (unk. ctxt): cbw                       ; 98
<bochs:52> s
Next at t=14091192
(0) [0x00000000000006ac] 0000:06ac (unk. ctxt): mov bl, dh                ; 8ade
<bochs:53> s
Next at t=14091193
(0) [0x00000000000006ae] 0000:06ae (unk. ctxt): mov bh, ah                ; 8afc
<bochs:54> s
Next at t=14091194
(0) [0x00000000000006b0] 0000:06b0 (unk. ctxt): inc bx                    ; 43
<bochs:55> s
Next at t=14091195
(0) [0x00000000000006b1] 0000:06b1 (unk. ctxt): mul ax, bx                ; f7e3
<bochs:56> s
Next at t=14091196
(0) [0x00000000000006b3] 0000:06b3 (unk. ctxt): mov dx, cx                ; 8bd1
<bochs:57> s
Next at t=14091197
(0) [0x00000000000006b5] 0000:06b5 (unk. ctxt): xchg dh, dl               ; 86d6
<bochs:58> s
Next at t=14091198
(0) [0x00000000000006b7] 0000:06b7 (unk. ctxt): mov cl, 0x06              ; b106
<bochs:59> s
Next at t=14091199
(0) [0x00000000000006b9] 0000:06b9 (unk. ctxt): shr dh, cl                ; d2ee
<bochs:60> s
Next at t=14091200
(0) [0x00000000000006bb] 0000:06bb (unk. ctxt): inc dx                    ; 42
<bochs:61> s
Next at t=14091201
(0) [0x00000000000006bc] 0000:06bc (unk. ctxt): mul ax, dx                ; f7e2
<bochs:62> s
Next at t=14091202
(0) [0x00000000000006be] 0000:06be (unk. ctxt): cmp word ptr ss:[bp+10], dx ; 39560a
<bochs:63> s
Next at t=14091203
(0) [0x00000000000006c1] 0000:06c1 (unk. ctxt): jnbe .+35 (0x000006e6)    ; 7723
<bochs:64> s
Next at t=14091204
(0) [0x00000000000006c3] 0000:06c3 (unk. ctxt): jb .+5 (0x000006ca)       ; 7205
<bochs:65> s
Next at t=14091205
(0) [0x00000000000006ca] 0000:06ca (unk. ctxt): mov ax, 0x0201            ; b80102
<bochs:66> s
Next at t=14091206
(0) [0x00000000000006cd] 0000:06cd (unk. ctxt): mov bx, 0x7c00            ; bb007c
<bochs:67> s
Next at t=14091207
(0) [0x00000000000006d0] 0000:06d0 (unk. ctxt): mov cx, word ptr ss:[bp+2] ; 8b4e02
<bochs:68> s
Next at t=14091208
(0) [0x00000000000006d3] 0000:06d3 (unk. ctxt): mov dx, word ptr ss:[bp]  ; 8b5600
<bochs:69> s
Next at t=14091209
(0) [0x00000000000006d6] 0000:06d6 (unk. ctxt): int 0x13                  ; cd13
<bochs:70> p
Next at t=14092543
(0) [0x00000000000006d8] 0000:06d8 (unk. ctxt): jnb .+81 (0x0000072b)     ; 7351
<bochs:71> s
Next at t=14092544
(0) [0x000000000000072b] 0000:072b (unk. ctxt): ret                       ; c3
<bochs:72> s
Next at t=14092545
(0) [0x0000000000000655] 0000:0655 (unk. ctxt): jnb .+42 (0x00000681)     ; 732a
<bochs:73> s
Next at t=14092546
(0) [0x0000000000000681] 0000:0681 (unk. ctxt): cmp word ptr ds:0x7dfe, 0xaa55 ; 813efe7d55aa
<bochs:74>

实际启动一共有10个函数被执行了
搞定~~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值