[syslinux:master] diskstart: if no partition info is available, use bsHidden

syslinux-bot for H. Peter Anvin hpa at zytor.com
Sat Jun 26 21:33:02 PDT 2010


Commit-ID:  add6ad3cd1f14b71b908059f0c767d51bdd5b207
Gitweb:     http://syslinux.zytor.com/commit/add6ad3cd1f14b71b908059f0c767d51bdd5b207
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sat, 26 Jun 2010 21:31:08 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Sat, 26 Jun 2010 21:31:08 -0700

diskstart: if no partition info is available, use bsHidden

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 at zytor.com>


---
 core/diskstart.inc |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/core/diskstart.inc b/core/diskstart.inc
index bd819a9..01439b8 100644
--- a/core/diskstart.inc
+++ b/core/diskstart.inc
@@ -176,6 +176,8 @@ floppy:
 harddisk:
 		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:
+;
+; 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]
 .gotoffs:
 ;
 ; Get disk drive parameters (don't trust the superblock.)  Don't do this for



More information about the Syslinux-commits mailing list