[syslinux:master] shuffler: Actually get the shuffler size sanely

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Fri Feb 28 15:42:04 PST 2014


Commit-ID:  e01e93b0f29b6dc9e363d91175ef3f7ecb40f8bf
Gitweb:     http://www.syslinux.org/commit/e01e93b0f29b6dc9e363d91175ef3f7ecb40f8bf
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Thu, 27 Feb 2014 21:44:06 -0800
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Thu, 27 Feb 2014 21:45:44 -0800

shuffler: Actually get the shuffler size sanely

Actually get the shuffler size sanely.  At least for now, we are BIOS
only, so stub out the functions on EFI (they shouldn't even be
compiled for EFI; this stuff should be moved into some kind of
BIOS-only directory.)

Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>

---
 com32/lib/syslinux/movebits.c |  2 +-
 com32/lib/syslinux/shuffle.c  | 19 +++++++------------
 core/include/core.h           |  8 +++++++-
 core/shuffler.c               |  8 ++++++++
 efi/main.c                    |  1 -
 5 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/com32/lib/syslinux/movebits.c b/com32/lib/syslinux/movebits.c
index 6355401..24cb74e 100644
--- a/com32/lib/syslinux/movebits.c
+++ b/com32/lib/syslinux/movebits.c
@@ -681,7 +681,7 @@ int main(int argc, char *argv[])
 	return 1;
     } else {
 	dprintf("Final move list:\n");
-	syslinux_dump_movelist(stdout, moves);
+	syslinux_dump_movelist(moves);
 	return 0;
     }
 }
diff --git a/com32/lib/syslinux/shuffle.c b/com32/lib/syslinux/shuffle.c
index ce85a5c..dcc4afa 100644
--- a/com32/lib/syslinux/shuffle.c
+++ b/com32/lib/syslinux/shuffle.c
@@ -48,16 +48,6 @@ struct shuffle_descriptor {
     uint32_t dst, src, len;
 };
 
-static int shuffler_size;
-
-static void __syslinux_get_shuffer_size(void)
-{
-    if (!shuffler_size) {
-	/* +15 padding is to guarantee alignment */
-	shuffler_size = __bcopyxx_len + 15;
-    }
-}
-
 /*
  * Allocate descriptor memory in these chunks; if this is large we may
  * waste memory, if it is small we may get slow convergence.
@@ -80,6 +70,11 @@ int syslinux_do_shuffle(struct syslinux_movelist *fraglist,
     int nmoves, nzero;
     com32sys_t ireg;
 
+#ifndef __FIRMWARE_BIOS__
+    errno = ENOSYS;
+    return -1;			/* Not supported at this time*/
+#endif
+
     descaddr = 0;
     dp = dbuf = NULL;
 
@@ -116,14 +111,14 @@ 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
 	   descriptor, plus the shuffler safe area. */
 	addr_t descmem = desc_blocks *
 	    sizeof(struct shuffle_descriptor) * DESC_BLOCK_SIZE
-	    + sizeof(struct shuffle_descriptor) + shuffler_size;
+	    + sizeof(struct shuffle_descriptor)
+	    + syslinux_shuffler_size();
 
 	descaddr = (desczone + descfree - descmem) & ~3;
 
diff --git a/core/include/core.h b/core/include/core.h
index 1fd283e..f45c024 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -26,7 +26,13 @@ extern char cmd_line[];
 extern char ConfigFile[];
 extern char syslinux_banner[];
 extern char copyright_str[];
-extern unsigned int __bcopyxx_len;
+
+extern const size_t __syslinux_shuffler_size;
+
+static inline size_t syslinux_shuffler_size(void)
+{
+    return __syslinux_shuffler_size;
+}
 
 /*
  * Mark symbols that are only used by BIOS as __weak until we can move
diff --git a/core/shuffler.c b/core/shuffler.c
new file mode 100644
index 0000000..eca1b4a
--- /dev/null
+++ b/core/shuffler.c
@@ -0,0 +1,8 @@
+#include "core.h"
+
+#ifdef __FIRMWARE_BIOS__
+
+extern const char __bcopyxx_len[]; /* Linker script absolute symbol */
+const size_t __syslinux_shuffler_size = (size_t)__bcopyxx_len;
+
+#endif /* __FIRMWARE_BIOS__ */
diff --git a/efi/main.c b/efi/main.c
index 94878f9..7c3b86b 100644
--- a/efi/main.c
+++ b/efi/main.c
@@ -166,7 +166,6 @@ void pxenv(void)
 uint16_t BIOS_fbm = 1;
 far_ptr_t InitStack;
 far_ptr_t PXEEntry;
-__export unsigned int __bcopyxx_len = 0;
 
 void gpxe_unload(void)
 {


More information about the Syslinux-commits mailing list