您的位置:首页 > 编程语言

shoelace源代码分析,bochs调试winiboot

2014-01-05 07:11 411 查看
b 0x7c00

c

到这里是加载的winiboot

boot:  0x7cb3

    push    ax            | remember partition

    addb    al,#ONE            | say which one

    call    putc

    mov    bx,#m_crlf

    call    puts

    pop    ax

    movb    ah,#partition        | size of each partition

    mulb    ah            | offset

    mov    si,#BUFFER+TABLE    | point at partition table

    add    si,ax            | point at partition entry

    pushf                | fake an int 0x13 仿冒磁盘调用

    push    cs

    mov    bx,#BOOTCODE

    push    bx

    mov    ax,#VECTOR        | vector segment

    mov    es,ax

    mov    ax,#0x201        | read one sector    //ah=02,读取磁盘,al=1读取1个扇区

    seg    es

    movb    dh,shead(si)        | head

    seg    es

    movb    cl,ssector(si)        | sector

    seg    es

    movb    ch,scylinder(si)    | cylinder

    movb    dl,diskcode        | disk

    seg    es

    jmpi    @DISK_VECTOR        | read boot    b 0x7ce7

INT 13H,AH=02H 读扇区说明:

调用此功能将从磁盘上把一个或更多的扇区内容读进存贮器。因为这是一个

低级功能,在一个操作中读取的全部扇区必须在同一条磁道上(磁头号和磁道号

相同)。BIOS不能自动地从一条磁道末尾切换到另一条磁道开始,因此用户必须

把跨多条磁道的读操作分为若干条单磁道读操作。

入口参数:
AH=02H 指明调用读扇区功能。

AL 置要读的扇区数目
,不允许使用读磁道末端以外的数值,也不允许

使该寄存器为0。
DL 需要进行读操作的驱动器号。

DH 所读磁盘的磁头号。

CH 磁道号的低8位数。

CL 低5位放入所读起始扇区号,位7-6表示磁道号的高2位。

ES:BX 读出数据的缓冲区地址。
返回参数:

如果CF=1,AX中存放出错状态。读出后的数据在ES:BX区域依次排列。

c

到这里是加载的bootlace

b 0x7c85        readshoehorn

<bochs:26> b 0x7c85

<bochs:27> c

(0) Breakpoint 4, 0x7c85 in ?? ()

Next at t=75146066

(0) [0x00007c85] 07c0:0085 (unk. ctxt): push cs                   ; 0e

<bochs:28> u /30

00007c85: (                    ): push cs                   ; 0e

00007c86: (                    ): pop es                    ; 07

00007c87: (                    ): mov bx, 0x1fe             ; bbfe01

00007c8a: (                    ): pop dx                    ; 5a

00007c8b: (                    ): pop cx                    ; 59

00007c8c: (                    ): inc cx                    ; 41

00007c8d: (                    ): mov ah, 0x0               ; b400

00007c8f: (                    ): int 0x13                  ; cd13

00007c91: (                    ): mov ax, 0x201             ; b80102

00007c94: (                    ): int 0x13                  ; cd13

00007c96: (                    ): jb 0x7c8d                 ; 72f5

00007c98: (                    ): mov ax, 0x1000            ; b80010

00007c9b: (                    ): mul ax, word ptr [ds:0xae] ; f726ae00

00007c9f: (                    ): mov [ds:0x7f0], ax        ; a3f007

00007ca2: (                    ): mov word ptr [ds:0x7f2], dx ; 8916f207

00007ca6: (                    ): call 0x7e97               ; e8ee01

00007ca9: (                    ): call 1000:0000            ; 9a00000010

0x7e87   _shoehorn  0x100000 shoelace

b 0x7ca6

b 0x7e97

b 0x7ca9
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  shoelace bochs 调试