mirror of https://github.com/ipxe/ipxe.git
Working with multi-sector reads
parent
66208dd65d
commit
a0f078d7f5
|
@ -10,29 +10,61 @@
|
||||||
#include "bootpart.S"
|
#include "bootpart.S"
|
||||||
|
|
||||||
load_image:
|
load_image:
|
||||||
movw $_rom_size, %bp
|
/* Get disk geometry */
|
||||||
1: /* Truncate read length to end of track */
|
pushal
|
||||||
movzwl %bp, %eax
|
pushw %es
|
||||||
movw $1, %ax
|
movb $0x08, %ah
|
||||||
/* Read sectors */
|
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
|
call *read_sectors
|
||||||
jc load_failed
|
jc load_failed
|
||||||
|
|
||||||
/* Update %es */
|
/* Update %es */
|
||||||
movw %es, %bx
|
movw %es, %bx
|
||||||
shll $5, %eax
|
shll $5, %eax
|
||||||
addw %ax, %bx
|
addw %ax, %bx
|
||||||
movw %bx, %es
|
movw %bx, %es
|
||||||
shrl $5, %eax
|
shrl $5, %eax
|
||||||
|
|
||||||
/* Update LBA address */
|
/* Update LBA address */
|
||||||
addl %eax, %edi
|
addl %eax, %edi
|
||||||
adcl $0, %esi
|
adcl $0, %esi
|
||||||
|
|
||||||
/* Update CHS address */
|
/* 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 */
|
/* Loop until whole image is read */
|
||||||
subw %ax, %bp
|
subl %eax, load_length
|
||||||
jne 1b
|
ja 1b
|
||||||
ljmp $BOOT_SEG, $start_image
|
ljmp $BOOT_SEG, $start_image
|
||||||
|
|
||||||
|
load_length:
|
||||||
|
.long _rom_size
|
||||||
|
max_sector:
|
||||||
|
.byte 0
|
||||||
|
max_head:
|
||||||
|
.byte 0
|
||||||
|
|
||||||
load_failed:
|
load_failed:
|
||||||
movw $10f, %si
|
movw $10f, %si
|
||||||
jmp boot_error
|
jmp boot_error
|
||||||
|
|
Loading…
Reference in New Issue