aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-02-02 15:52:05 +0000
committerMatt Fleming <matt.fleming@intel.com>2012-02-02 16:11:32 +0000
commitedcfbdfdfcdcc62a46c8d4be50434486b0f6c0f7 (patch)
treebf58dc8774cb77b23bbb4de4561ef0f656b3943c
parent941c77f996f6548a4522c03155b6f40cbce04777 (diff)
downloadsyslinux-edcfbdfdfcdcc62a46c8d4be50434486b0f6c0f7.tar.gz
syslinux-edcfbdfdfcdcc62a46c8d4be50434486b0f6c0f7.tar.xz
syslinux-edcfbdfdfcdcc62a46c8d4be50434486b0f6c0f7.zip
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@intel.com>
-rw-r--r--com32/lib/syslinux/shuffle.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/com32/lib/syslinux/shuffle.c b/com32/lib/syslinux/shuffle.c
index 54a7e651..3f300a6c 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