summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/prefix
diff options
context:
space:
mode:
authorMichael Brown2007-07-05 14:30:49 +0200
committerMichael Brown2007-07-05 14:30:49 +0200
commita0f078d7f5e91a557df14dccf932dad7f7eb5055 (patch)
treeeb178abe483a1520da38e06f6706e053b5185537 /src/arch/i386/prefix
parenthdprefix that works for LBA only (diff)
downloadipxe-a0f078d7f5e91a557df14dccf932dad7f7eb5055.tar.gz
ipxe-a0f078d7f5e91a557df14dccf932dad7f7eb5055.tar.xz
ipxe-a0f078d7f5e91a557df14dccf932dad7f7eb5055.zip
Working with multi-sector reads
Diffstat (limited to 'src/arch/i386/prefix')
-rw-r--r--src/arch/i386/prefix/hdprefix.S48
1 files changed, 40 insertions, 8 deletions
diff --git a/src/arch/i386/prefix/hdprefix.S b/src/arch/i386/prefix/hdprefix.S
index 68392d2c3..ceab20614 100644
--- a/src/arch/i386/prefix/hdprefix.S
+++ b/src/arch/i386/prefix/hdprefix.S
@@ -10,29 +10,61 @@
#include "bootpart.S"
load_image:
- movw $_rom_size, %bp
-1: /* Truncate read length to end of track */
- movzwl %bp, %eax
- movw $1, %ax
- /* Read sectors */
+ /* Get disk geometry */
+ pushal
+ pushw %es
+ movb $0x08, %ah
+ int $0x13
+ jc load_failed
+ movb %cl, max_sector
+ movb %dh, max_head
+ popw %es
+ popal
+
+1: /* Read to end of current track */
+ movb %cl, %al
+ negb %al
+ addb max_sector, %al
+ incb %al
+ andb $0x3f, %al
+ movzbl %al, %eax
call *read_sectors
jc load_failed
+
/* Update %es */
movw %es, %bx
shll $5, %eax
addw %ax, %bx
movw %bx, %es
shrl $5, %eax
+
/* Update LBA address */
addl %eax, %edi
adcl $0, %esi
+
/* Update CHS address */
- // hmmmm
+ andb $0xc0, %cl
+ orb $0x01, %cl
+ incb %dh
+ cmpb max_head, %dh
+ jbe 2f
+ xorb %dh, %dh
+ incb %ch
+ jnc 2f
+ addb $0xc0, %cl
+2:
/* Loop until whole image is read */
- subw %ax, %bp
- jne 1b
+ subl %eax, load_length
+ ja 1b
ljmp $BOOT_SEG, $start_image
+load_length:
+ .long _rom_size
+max_sector:
+ .byte 0
+max_head:
+ .byte 0
+
load_failed:
movw $10f, %si
jmp boot_error