aboutsummaryrefslogtreecommitdiffstats
path: root/mbr
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-07-11 16:45:27 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-07-11 16:45:27 -0700
commita9a2963de68bfb52c51c793c5325608a99f60d91 (patch)
tree747403938bef1df67bdf194e948baa2f5e4e04fa /mbr
parentd9139b2f937aac9b6ee08cc79da35afde4d832b4 (diff)
downloadlwip-a9a2963de68bfb52c51c793c5325608a99f60d91.tar.gz
lwip-a9a2963de68bfb52c51c793c5325608a99f60d91.tar.xz
lwip-a9a2963de68bfb52c51c793c5325608a99f60d91.zip
MBR: always do setup for EBIOS, makes stack handling easier and saves jmp
Diffstat (limited to 'mbr')
-rw-r--r--mbr/mbr.S28
1 files changed, 14 insertions, 14 deletions
diff --git a/mbr/mbr.S b/mbr/mbr.S
index 43b29830..9e89b37c 100644
--- a/mbr/mbr.S
+++ b/mbr/mbr.S
@@ -80,8 +80,8 @@ next:
shrw %cx /* Bit 0 = fixed disk subset */
jnc 1f
- /* We have EBIOS; patch in a jump to read_sector_ebios */
- movw $0xeb+((read_sector_ebios-read_sector_cbios-2)<< 8), (read_sector_cbios)
+ /* We have EBIOS; patch in jump to skip over read_sector_cbios */
+ movw $0xeb+((read_common-read_sector_cbios-2)<< 8), (read_sector_cbios)
1:
popw %dx
@@ -111,9 +111,18 @@ next:
*/
read_sector:
pushal
- movw %sp, %bp
xorl %edx, %edx
movw $bootsec, %bx
+ pushl %edx /* MSW of LBA */
+ pushl %eax /* LSW of LBA */
+ pushw %es /* Buffer segment */
+ pushw %bx /* Buffer offset */
+ pushw $1 /* Sector count */
+ pushw $16 /* Size of packet */
+ movw %sp, %si
+ movb $0x42, %ah
+
+ /* This chunk is skipped if we have ebios */
read_sector_cbios:
divl (secpercyl)
shlb $6, %ah
@@ -125,20 +134,11 @@ read_sector_cbios:
orb %ah, %cl
incw %cx /* Sectors are 1-based */
movw $0x0201, %ax
- jmp read_common
-read_sector_ebios:
- pushl %edx /* MSW of LBA */
- pushl %eax /* LSW of LBA */
- pushw %es /* Buffer segment */
- pushw %bx /* Buffer offset */
- pushw $1 /* Sector count */
- pushw $16 /* Size of packet */
- movw %sp, %si
- movb $0x42, %ah
+
read_common:
movb (driveno), %dl
int $0x13
- movw %bp, %sp
+ addw $16, %sp /* Drop DAPA */
popal
ret