diff options
authorH. Peter Anvin <hpa@zytor.com>2010-06-26 21:31:08 -0700
committerH. Peter Anvin <hpa@zytor.com>2010-06-26 21:31:08 -0700
commitadd6ad3cd1f14b71b908059f0c767d51bdd5b207 (patch)
parente8f2cf44b1ee708093880cf4071a0ee6d72a044a (diff)
diskstart: if no partition info is available, use bsHiddensyslinux-4.00-pre63
If we have no partition information available, use the bsHidden field (which is set by the extlinux installer in the case of non-FAT). This gives at least a hope of working correctly (for < 2 TiB disks, at least) with the stock Vista/Win7 MBR. Also, add a check for partition type != 0. This helps catch the case when DS:SI points into all-zero memory. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1 files changed, 7 insertions, 2 deletions
diff --git a/core/diskstart.inc b/core/diskstart.inc
index bd819a9c..01439b86 100644
--- a/core/diskstart.inc
+++ b/core/diskstart.inc
@@ -176,6 +176,8 @@ floppy:
test byte [di-76],7Fh ; Sanity check: "active flag" should
jnz .no_partition ; be 00 or 80
+ cmp [di-76+4],cl ; Sanity check: partition type != 0
+ je .no_partition
cmp eax,'!GPT' ; !GPT signature?
jne .mbr
cmp byte [di-76+4],0EDh ; Synthetic GPT partition entry?
@@ -190,10 +192,13 @@ harddisk:
push dword [di-76+8] ; Partition offset (dword)
jmp .gotoffs
+; No partition table given... assume that the Hidden field in the boot sector
+; tells the truth (in particular, is zero if this is an unpartitioned disk.)
push cx
push cx
- push cx
- push cx
+ push dword [bsHidden]
; Get disk drive parameters (don't trust the superblock.) Don't do this for