[syslinux] [PATCH 2/4] 4k_sector: Save some bytes adding a function to set bx before read_sector

Frediano Ziglio frediano.ziglio at citrix.com
Fri Feb 8 04:58:34 PST 2013


Mostly of the time bx was set as phdr before calling read_sector
so add a specific function to set %bx and call read_sector
gaining 2 bytes

Signed-off-by: Frediano Ziglio <frediano.ziglio at citrix.com>
---
 mbr/gptmbr.S |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/mbr/gptmbr.S b/mbr/gptmbr.S
index ef2235d..f73b472 100644
--- a/mbr/gptmbr.S
+++ b/mbr/gptmbr.S
@@ -118,9 +118,7 @@ next:
 	xorl	%eax,%eax
 	cltd
 	incw	%ax		/* %edx:%eax = 1 */
-	movw	$phdr, %bx
-	pushw	%bx		/* -8(%bp) phdr == bootsect */
-	call	read_sector
+	call	read_sector_phdr
 
 	/* Number of partition sectors */
 	/* We assume the partition table is 32K or less, and that
@@ -215,8 +213,7 @@ found_part:
 boot:
 	movl	(32+20)(%si),%eax
 	movl	(36+20)(%si),%edx
-	popw	%bx
-	call	read_sector
+	call	read_sector_phdr
 	cmpw	$0xaa55, -2(%bx)
 	jne	missing_os	/* Not a valid boot sector */
 	movw	%bp, %sp	/* driveno == bootsec-6 */
@@ -238,6 +235,11 @@ saturate_stosl:
 1:	stosl
 	ret
 
+read_sector_phdr:
+	movw	$phdr, %bx
+
+	/* fall through and read sector */
+
 /*
  * read_sector: read a single sector pointed to by %edx:%eax to
  * %es:%bx.  CF is set on error.  All registers saved.
-- 
1.7.9.5



More information about the Syslinux mailing list