[syslinux:elflink] 4k_sector: Recover 3 bytes avoid a call

syslinux-bot for Frediano Ziglio frediano.ziglio at citrix.com
Wed Feb 13 04:48:03 PST 2013


Commit-ID:  71a16643953b812d7054784c3f7f0f03cf116264
Gitweb:     http://www.syslinux.org/commit/71a16643953b812d7054784c3f7f0f03cf116264
Author:     Frediano Ziglio <frediano.ziglio at citrix.com>
AuthorDate: Fri, 8 Feb 2013 12:58:33 +0000
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Mon, 11 Feb 2013 11:51:53 +0000

4k_sector: Recover 3 bytes avoid a call

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>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 mbr/gptmbr.S | 19 ++++++++++---------
 1 file 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:


More information about the Syslinux-commits mailing list