Add some illumination ...

This commit is contained in:
dsl 2009-10-24 10:28:30 +00:00
parent f804115722
commit 836bb82532
1 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cdboot.S,v 1.8 2008/05/03 13:07:31 ad Exp $ */ /* $NetBSD: cdboot.S,v 1.9 2009/10/24 10:28:30 dsl Exp $ */
/*- /*-
* Copyright (c) 2005 The NetBSD Foundation, Inc. * Copyright (c) 2005 The NetBSD Foundation, Inc.
@ -224,6 +224,8 @@ boot_hard_disk:
boot_cdrom: boot_cdrom:
movw $str_banner, %si movw $str_banner, %si
call message call message
/* Read volume descriptor sectors until Primary decriptor found */
movl $VD_LBA, %eax movl $VD_LBA, %eax
next_block: next_block:
movb $1, %dh /* Number of sectors to read */ movb $1, %dh /* Number of sectors to read */
@ -238,6 +240,7 @@ next_block:
call message call message
jmp panic jmp panic
/* Read all of root directory */
pvd_found: pvd_found:
movw $PVD_ADDR+PVD_ROOT_DR, %bx movw $PVD_ADDR+PVD_ROOT_DR, %bx
movl DR_EXTENT(%bx), %eax /* LBA of the root directory */ movl DR_EXTENT(%bx), %eax /* LBA of the root directory */
@ -246,6 +249,8 @@ pvd_found:
movb %dl, %dh /* ... and load it to %dh */ movb %dl, %dh /* ... and load it to %dh */
movl $ROOTDIR_ADDR, %ebx movl $ROOTDIR_ADDR, %ebx
call read_sectors call read_sectors
/* Scan directory entries searching for /boot */
next_entry: next_entry:
cmpb $0, DR_LEN(%bx) cmpb $0, DR_LEN(%bx)
jz last_entry jz last_entry
@ -270,6 +275,7 @@ last_entry:
call message call message
jmp panic jmp panic
/* Found /boot, read contents to 0x1000:0 */
load_loader: load_loader:
movl DR_EXTENT(%bx), %eax movl DR_EXTENT(%bx), %eax
movl DR_DATA_LEN(%bx), %edx movl DR_DATA_LEN(%bx), %edx
@ -278,6 +284,8 @@ load_loader:
movb %dl, %dh movb %dl, %dh
movl $LOADER_ADDR, %ebx movl $LOADER_ADDR, %ebx
call read_sectors call read_sectors
/* Finally call into code of /boot */
movl $boot_params, %esi /* Provide boot_params */ movl $boot_params, %esi /* Provide boot_params */
xorl %edx, %edx xorl %edx, %edx
movb boot_drive, %dl movb boot_drive, %dl
@ -297,8 +305,8 @@ panic:
*/ */
read_sectors: read_sectors:
pusha pusha
movl %eax, edd_lba /* Convert LBA to segment */ movl %eax, edd_lba
shrl $4, %ebx shrl $4, %ebx /* Convert buffer addr to seg:0 */
movw %bx, edd_segment movw %bx, edd_segment
movb %dh, edd_nsecs movb %dh, edd_nsecs
movb boot_drive, %dl movb boot_drive, %dl