[syslinux:firmware] com32: Remove __constructor tag from __syslinux_get_shuffer_size()

syslinux-bot for Matt Fleming matt.fleming at intel.com
Fri Nov 9 09:06:12 PST 2012


Commit-ID:  edcfbdfdfcdcc62a46c8d4be50434486b0f6c0f7
Gitweb:     http://www.syslinux.org/commit/edcfbdfdfcdcc62a46c8d4be50434486b0f6c0f7
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Thu, 2 Feb 2012 15:52:05 +0000
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Thu, 2 Feb 2012 16:11:32 +0000

com32: Remove __constructor tag from __syslinux_get_shuffer_size()

Any functions with a __constructor tag are exected by both firmware
backends. But shuffling isn't used on EFI because we have so little
control over the memory map. So call __syslinux_get_shuffer_size()
only when needed.

Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/lib/syslinux/shuffle.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/com32/lib/syslinux/shuffle.c b/com32/lib/syslinux/shuffle.c
index 54a7e65..3f300a6 100644
--- a/com32/lib/syslinux/shuffle.c
+++ b/com32/lib/syslinux/shuffle.c
@@ -65,14 +65,16 @@ struct shuffle_descriptor {
 
 static int shuffler_size;
 
-static void __constructor __syslinux_get_shuffer_size(void)
+static void __syslinux_get_shuffer_size(void)
 {
-    static com32sys_t reg;
+    if (!shuffler_size) {
+	static com32sys_t reg;
 
-    reg.eax.w[0] = 0x0023;
-    __intcall(0x22, &reg, &reg);
+	reg.eax.w[0] = 0x0023;
+	__intcall(0x22, &reg, &reg);
 
-    shuffler_size = (reg.eflags.l & EFLAGS_CF) ? 2048 : reg.ecx.w[0];
+	shuffler_size = (reg.eflags.l & EFLAGS_CF) ? 2048 : reg.ecx.w[0];
+    }
 }
 
 /*
@@ -133,6 +135,7 @@ int syslinux_do_shuffle(struct syslinux_movelist *fraglist,
     if (!rxmap)
 	goto bail;
 
+    __syslinux_get_shuffer_size();
     desc_blocks = (nzero + DESC_BLOCK_SIZE - 1) / DESC_BLOCK_SIZE;
     for (;;) {
 	/* We want (desc_blocks) allocation blocks, plus the terminating


More information about the Syslinux-commits mailing list