diff options
Diffstat (limited to 'boot/arch/amd64')
| -rw-r--r-- | boot/arch/amd64/mbr/mbr.S | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/boot/arch/amd64/mbr/mbr.S b/boot/arch/amd64/mbr/mbr.S index a548ce7..18740d6 100644 --- a/boot/arch/amd64/mbr/mbr.S +++ b/boot/arch/amd64/mbr/mbr.S @@ -39,9 +39,33 @@ reloc: mov $boot_msg, %si call putstr - cli + /* Load two sectors */ + movw $2, dap_blkcnt + movl $1, dap_lba_low + call disk_read_lba + +1: cli + hlt + jmp 1b + +/* + * Read sectors from the disk + */ +disk_read_lba: + pusha + mov $dap, %si + mov $0x42, %ah + mov drive_num, %dl + int $0x13 + jc .error + popa + ret +.error: + mov $disk_err_msg, %si + call putstr +1: cli hlt - jmp reloc + jmp 1b /* * Write a string to the console @@ -70,8 +94,23 @@ putchr: pop %dx ret +dap: + .byte 0x10 + .byte 0x00 +dap_blkcnt: + .word 0 +dap_destptr: + .word 0x7C00 +dap_destseg: + .word 0x0000 +dap_lba_low: + .long 0 +dap_lba_high: + .long 0 + drive_num: .byte 0x00 -boot_msg: .ascii "booting\0" +boot_msg: .ascii "booting\r\n\0" +disk_err_msg: .ascii "\r\n!!!disk error!!!\r\n\0" .org 510 .byte 0x55 |
