[syslinux] [PATCH 1/9] Recover 3 bytes avoid a call

Frediano Ziglio frediano.ziglio at citrix.com
Wed Oct 3 07:26:06 PDT 2012


after read_sector %edx:%eax are unused or incremented so increment
always at end gaining 3 bytes

Signed-off-by: Frediano Ziglio <frediano.ziglio at citrix.com>
---
 mbr/gptmbr.S |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/mbr/gptmbr.S b/mbr/gptmbr.S
index ae0549f..ef2235d 100644
--- a/mbr/gptmbr.S
+++ b/mbr/gptmbr.S
@@ -142,7 +142,6 @@ next:
 	pushw	%bx
 get_ptab:
 	call	read_sector
-	call	inc64
 	loopw	get_ptab
 
 	/* Find the boot partition */
@@ -240,16 +239,9 @@ saturate_stosl:
 	ret
 
 /*
- * Increment %edx:%eax
- */
-inc64:
-	addl	$1,%eax
-	adcl	$0,%edx
-	ret
-
-/*
  * read_sector: read a single sector pointed to by %edx:%eax to
  * %es:%bx.  CF is set on error.  All registers saved.
+ * %edx:%eax and %es:%bx are incremented to read next sector
  */
 read_sector:
 	pushal
@@ -282,6 +274,15 @@ read_common:
 	popal
 	jc	disk_error
 	addb	$2, %bh		/* bx += 512: point to the next buffer */
+
+	/* fall through and increment sector number */
+
+/*
+ * Increment %edx:%eax
+ */
+inc64:
+	addl	$1,%eax
+	adcl	$0,%edx
 	ret
 
 disk_error:
-- 
1.7.5.4




More information about the Syslinux mailing list