aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrediano Ziglio <frediano.ziglio@citrix.com>2013-02-08 12:58:34 +0000
committerMatt Fleming <matt.fleming@intel.com>2013-02-11 12:35:12 +0000
commitb681bd70ac5c478c2d450aa1db98aa9359625a7d (patch)
tree5e9d4b48c87854fc6ccd8781aa63fa95a47bed73
parent71a16643953b812d7054784c3f7f0f03cf116264 (diff)
downloadsyslinux-b681bd70ac5c478c2d450aa1db98aa9359625a7d.tar.gz
syslinux-b681bd70ac5c478c2d450aa1db98aa9359625a7d.tar.xz
syslinux-b681bd70ac5c478c2d450aa1db98aa9359625a7d.zip
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@citrix.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--mbr/gptmbr.S13
1 files changed, 7 insertions, 6 deletions
diff --git a/mbr/gptmbr.S b/mbr/gptmbr.S
index ef2235db..b9c0777c 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.