From edcfbdfdfcdcc62a46c8d4be50434486b0f6c0f7 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Thu, 2 Feb 2012 15:52:05 +0000 Subject: 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 --- com32/lib/syslinux/shuffle.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'com32/lib/syslinux/shuffle.c') 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.eax.w[0] = 0x0023; + __intcall(0x22, ®, ®); - 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 -- cgit v1.2.1