I am writing a bootloader for a dual-system (Win7, Ubuntu). After selecting Win7 in the selection interface, the system jumps to the breakpoint I set at 0x7c00. However, when I use 'layout asm' to examine this area, I find no changes. The stage2 part of Win7 has not been moved to this area.

I used LBA to boot Win7's stage2 and wrote a DAP. Using GDP for debugging, I found that int13 was successful, but stage2 was not loaded into 0x7c00

[bits 16]
org 0x7c00
global _start
_start:
    cli
    xor eax, eax     
    mov ss, eax       
    mov esp, 0x2000   
    mov ds, eax      
    mov esi, 0x7c00 
    push es           
    mov edi, 0x6000
    mov ecx, 0x0200 
    rep movsb            
    sti
    jmp 0x0: 0x6029
    ;clear screen
    mov ax, 0x0600
    mov bx, 0x0700
    mov cx, 0
    mov dx, 0x184f
    int 0x10

    xor bx, bx

    ;display information on the screen
    mov ah, 0x0e   ;teletype
    mov bh, 0x00   ;first page
    mov bl, 0x07   ;intialize the color
    mov si, msg1
    call print_string
    call newline
    mov si, msg2
    call print_string

    call loop_for_input

loop_for_input:
    call get_input

    mov ah, 0x0e
    int 0x10

    cmp al, '1'
    je load_windows
    cmp al, '2'
    je load_ubuntu
    jmp loop_for_input

load_windows:
    mov ah, 0x42
    mov dl, 0x80
    lea si, [dap]
    int 0x13
    cmp ah, 0x00
    je read_success
    mov ah, 0x0e
    mov al, 'E'
    int 0x10
    jmp $

read_success:
    mov ah, 0x0e
    mov al, 'S'
    int 0x10
    jmp 0x0:0x7c00
load_ubuntu:
    ; debugging
    mov al, 'U'
    mov ah, 0x0e
    int 0x10

    mov ax, 0x0201
    mov bx, 0x7e00
    mov cx, 0x0328
    mov dx, 0x0080
    int 0x13

    ; debugging
    cmp ah, 0x00
    mov ah, 0x0e
    mov al, 'E'
    int 0x10
    jmp $

dap:
    db 0x10
    db 0
    dw 1
    dw 0x7c00
    dd 0x0800
    dq 0

print_string:
    lodsb
    test al,al
    jz done
    int 0x10
    jmp print_string
done:
    ret

newline:
    mov ah, 0x0e    ;teletype
    mov al, 0x0a    ;line feed
    int 0x10
    mov al, 0x0d    ;carriage return
    int 0x10
    ret

get_input:
    xor ax, ax
    int 0x16
    ret

msg1 db '1.Windows', 0
msg2 db '2.Ubuntu', 0

boot_disk_flag db 0xFF

    times 446-($-$$) db 0    ; full 446 bytes

    partition_table_entry_1 db 0x80    
                            db 0x20, 0x21, 0x00
                            db 0x07
                            db 0xDF, 0x13, 0x0C
                            dd 0x00000800
                            dd 0x00032000

    partition_table_entry_2 db 0x80
                            db 0x14, 0x0C, 0x07
                            db 0x83
                            db 0xFF, 0xFF, 0x00
                            dd 0x00000328
                            dd 0x00032000


    times 32 db 0


    dw 0xAA55          ; the boot signature
0

There are 0 best solutions below