aboutsummaryrefslogtreecommitdiffstats
path: root/mbr
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-25 15:37:28 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-25 15:37:28 -0700
commitdc688778521d28b28596386d67af28bc1d7e6d1c (patch)
tree4b89a9889758d6883b57bf2ac95e2ddb73945a20 /mbr
parent9d1cde418a4f0dc6cccf4af7eae340e75de2f3d4 (diff)
downloadlwip-dc688778521d28b28596386d67af28bc1d7e6d1c.tar.gz
lwip-dc688778521d28b28596386d67af28bc1d7e6d1c.tar.xz
lwip-dc688778521d28b28596386d67af28bc1d7e6d1c.zip
altmbr: fix accounting of logical partitions
Unlike the main MBR, we need to keep careful count when we process logical partitions... and we weren't. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'mbr')
-rw-r--r--mbr/altmbr.S28
1 files changed, 13 insertions, 15 deletions
diff --git a/mbr/altmbr.S b/mbr/altmbr.S
index 4a502ed0..794ab623 100644
--- a/mbr/altmbr.S
+++ b/mbr/altmbr.S
@@ -195,31 +195,30 @@ scan_partition_table:
/* Scan the primary partition table */
movw $ptab, %si
movw $4, %cx
+ /* Is it a primary partition table? */
+ andl %edx, %edx
+ jnz 7f
push %si
push %cx
- /* Is it a primary partition? */
- andl %edx, %edx
- jnz 6f
-
5:
decb (partition)
jz boot
addw $16, %bx
loopw 5b
-6:
- /* No active partitions found, look for extended partitions */
- popw %cx /* %cx <- 4 */
- popw %si /* %si <- ptab */
-7:
- movl 20(%bp), %edx /* "Root" */
+ popw %cx /* %cx <- 4 */
+ popw %si /* %si <- ptab */
+ /* No primary partitions found, look for extended/logical partitions */
+7:
movb 4(%si), %al
- cmpb $0x0f, %al /* 0x0f = Win9x extended */
+ andb %al, %al
+ jz 12f /* Not a valid partition */
+ cmpb $0x0f, %al /* 0x0f = Win9x extended */
je 8f
- andb $~0x80, %al /* 0x85 = Linux extended */
- cmpb $0x05, %al /* 0x05 = MS-DOS extended */
+ andb $~0x80, %al /* 0x85 = Linux extended */
+ cmpb $0x05, %al /* 0x05 = MS-DOS extended */
jne 9f
/* It is an extended partition. Read the extended partition and
@@ -243,9 +242,8 @@ scan_partition_table:
/* fall through */
9:
/* Not an extended partition */
- andb %al, %al
- jz 12f /* Not a valid partition */
andl %edx, %edx /* Are we inside an extended part? */
+ jz 12f
/* If so, this is a logical partition */
decb (partition)
je boot