[syslinux:elflink] 4k_sector: Save some bytes adding a function to set bx before read_sector
syslinux-bot for Frediano Ziglio
frediano.ziglio at citrix.com
Wed Feb 13 04:48:04 PST 2013
Commit-ID: b681bd70ac5c478c2d450aa1db98aa9359625a7d
Gitweb: http://www.syslinux.org/commit/b681bd70ac5c478c2d450aa1db98aa9359625a7d
Author: Frediano Ziglio <frediano.ziglio at citrix.com>
AuthorDate: Fri, 8 Feb 2013 12:58:34 +0000
Committer: Matt Fleming <matt.fleming at intel.com>
CommitDate: Mon, 11 Feb 2013 12:35:12 +0000
4k_sector: Save some bytes adding a function to set bx before read_sector
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>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
mbr/gptmbr.S | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/mbr/gptmbr.S b/mbr/gptmbr.S
index ef2235d..b9c0777 100644
--- a/mbr/gptmbr.S
+++ b/mbr/gptmbr.S
@@ -118,14 +118,11 @@ 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
the sector size is 512. */
- /* Note: phdr == 6(%bp) */
movw (80+6)(%bp),%cx /* NumberOfPartitionEntries */
movw (84+6)(%bp),%ax /* SizeOfPartitionEntry */
pushw %ax
@@ -215,8 +212,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 +234,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.
More information about the Syslinux-commits
mailing list