[syslinux:master] Export the 64-bit partition offset and use it in chain.c

syslinux-bot for H. Peter Anvin hpa at zytor.com
Sun Jun 27 12:06:19 PDT 2010


Commit-ID:  b775b0040fe57ef71ec9cd98f9c124a3d116269b
Gitweb:     http://syslinux.zytor.com/commit/b775b0040fe57ef71ec9cd98f9c124a3d116269b
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sun, 27 Jun 2010 12:02:48 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Sun, 27 Jun 2010 12:02:48 -0700

Export the 64-bit partition offset and use it in chain.c

When used with the "fs" option to chain.c32, we need to know our own
filesystem offset.  That means knowing if we used the MBR vs GPT
partition information, as well as if we ended up using the passed-in
information or not.

Resolve this by providing an explicit pointer to the current partition
offset.  Eventually this should be replaced by some kind of statfs()
call.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 com32/include/syslinux/config.h |    2 ++
 com32/modules/chain.c           |    5 +++--
 core/comboot.inc                |    2 ++
 core/isolinux.asm               |   16 ++++++++--------
 doc/comboot.txt                 |    9 +++++----
 5 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/com32/include/syslinux/config.h b/com32/include/syslinux/config.h
index f315f44..79a4750 100644
--- a/com32/include/syslinux/config.h
+++ b/com32/include/syslinux/config.h
@@ -112,6 +112,7 @@ union syslinux_derivative_info {
 	uint32_t _eflags;
 	const void *ptab_ptr;
 	const uint32_t *esdi_ptr;
+	const uint64_t *partoffset;
     } disk;			/* syslinux/extlinux */
     struct {
 	uint16_t _gs, _fs, _es, _ds;
@@ -138,6 +139,7 @@ union syslinux_derivative_info {
 	uint32_t _eflags;
 	const void *spec_packet;
 	const uint32_t *esdi_ptr;
+	const uint64_t *partoffset;
     } iso;			/* isolinux */
 };
 
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 555cff1..b53054e 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -1425,9 +1425,10 @@ int main(int argc, char *argv[])
 	    drive = sdi->disk.drive_number;
 	if (!strcmp(drivename, "fs")
 	    && (sdi->c.filesystem == SYSLINUX_FS_SYSLINUX
-		|| sdi->c.filesystem == SYSLINUX_FS_EXTLINUX))
+		|| sdi->c.filesystem == SYSLINUX_FS_EXTLINUX
+		|| sdi->c.filesystem == SYSLINUX_FS_ISOLINUX))
 	    /* We should lookup the Syslinux partition number and use it */
-	    fs_lba = ((struct part_entry *)sdi->disk.ptab_ptr)->start_lba;
+	    fs_lba = *sdi->disk.partoffset;
     } else {
 	error("Unparsable drive specification\n");
 	goto bail;
diff --git a/core/comboot.inc b/core/comboot.inc
index 91cc15a..65b20be 100644
--- a/core/comboot.inc
+++ b/core/comboot.inc
@@ -593,6 +593,8 @@ comapi_derinfo:
 		mov P_DL,al
 		mov P_FS,cs
 		mov P_SI,OrigESDI
+		mov P_GS,cs
+		mov P_DI,Hidden
 %if IS_SYSLINUX || IS_EXTLINUX
 		mov P_ES,cs
 		mov P_BX,PartInfo
diff --git a/core/isolinux.asm b/core/isolinux.asm
index 8060767..d9d630e 100644
--- a/core/isolinux.asm
+++ b/core/isolinux.asm
@@ -101,7 +101,7 @@ ISOFlags	resb 1			; Flags for ISO directory search
 RetryCount      resb 1			; Used for disk access retries
 
 		alignb 8
-bsHidden	resq 1			; Used in hybrid mode
+Hidden	resq 1			; Used in hybrid mode
 bsSecPerTrack	resw 1			; Used in hybrid mode
 bsHeads		resw 1			; Used in hybrid mode
 
@@ -242,8 +242,8 @@ _start_hybrid:
 		pop eax
 		pop ebx
 .nooffset:
-		mov [cs:bsHidden],eax
-		mov [cs:bsHidden+4],ebx
+		mov [cs:Hidden],eax
+		mov [cs:Hidden+4],ebx
 
 		mov si,bios_cbios
 		jcxz _start_common
@@ -779,8 +779,8 @@ getlinsec_ebios:
 		xor edx,edx
 		shld edx,eax,2
 		shl eax,2			; Convert to HDD sectors
-		add eax,[bsHidden]
-		adc edx,[bsHidden+4]
+		add eax,[Hidden]
+		adc edx,[Hidden+4]
 		shl bp,2
 
 .loop:
@@ -852,7 +852,7 @@ getlinsec_ebios:
 getlinsec_cbios:
 		xor edx,edx
 		shl eax,2			; Convert to HDD sectors
-		add eax,[bsHidden]
+		add eax,[Hidden]
 		shl bp,2
 
 .loop:
@@ -1165,8 +1165,8 @@ init_fs:
 .hybrid:
 		movzx ebp,word [MaxTransfer]
 .common:
-	        mov ecx,[bsHidden]
-	        mov ebx,[bsHidden+4]
+	        mov ecx,[Hidden]
+	        mov ebx,[Hidden+4]
                 mov si,[bsHeads]
 		mov di,[bsSecPerTrack]
 		pm_call fs_init
diff --git a/doc/comboot.txt b/doc/comboot.txt
index 9e9f99a..4b4b880 100644
--- a/doc/comboot.txt
+++ b/doc/comboot.txt
@@ -426,8 +426,12 @@ AX=000Ah [2.00]	Get Derivative-Specific Information
 	Output:	AL	31h (SYSLINUX), 34h (EXTLINUX)
 		DL	drive number
 		CL	sector size as a power of 2 (9 = 512 bytes) [3.35]
+		CH	mode [3.73]
+			1 = CBIOS mode
+			2 = EBIOS mode
 		ES:BX	pointer to partition table entry (if DL >= 80h)
 		FS:SI	pointer to initial ES:DI value [3.53]
+		GS:DI	pointer to partition offset (QWORD) [4.00]
 
 		Note: This function was broken in EXTLINUX 3.00-3.02.
 
@@ -501,6 +505,7 @@ AX=000Ah [2.00]	Get Derivative-Specific Information
 			2 = Hybrid (hard disk), EBIOS mode
 		ES:BX	pointer to El Torito spec packet
 		FS:SI	pointer to initial ES:DI value [3.53]
+		GS:DI	pointer to partition offset (QWORD) [4.00]
 
 		Note: Some very broken El Torito implementations do
 		not provide the spec packet information.  If so, ES:BX
@@ -508,10 +513,6 @@ AX=000Ah [2.00]	Get Derivative-Specific Information
 		AX=4B01h to obtain the spec packet directly from the
 		BIOS if necessary.
 
-	This call gives information specific to a particular Syslinux
-	derivative.  The value returned in AL is the same as is
-	returned in DL by INT 22h AX=0001h.
-
 
 AX=000Bh [2.00]	Get Serial Console Configuration
 



More information about the Syslinux-commits mailing list