summaryrefslogtreecommitdiff
path: root/com32/lib/syslinux/shuffle.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-02-12 16:47:39 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-02-12 16:47:39 -0800
commitfc38cbecfcdb8237f22e8def62bced022260b035 (patch)
treeec79fe5a5b9fe1fb75e52d86344a99acf9625e43 /com32/lib/syslinux/shuffle.c
parent34baf2cd22bc9fad670d987aa84199f92a55f30a (diff)
downloadsyslinux-fc38cbecfcdb8237f22e8def62bced022260b035.tar.gz
Query the shuffle descriptor set size and use it
Query the maximum number of shuffle descriptors, and use that number as the descriptor block size.
Diffstat (limited to 'com32/lib/syslinux/shuffle.c')
-rw-r--r--com32/lib/syslinux/shuffle.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/com32/lib/syslinux/shuffle.c b/com32/lib/syslinux/shuffle.c
index dcb8d310..bb020a15 100644
--- a/com32/lib/syslinux/shuffle.c
+++ b/com32/lib/syslinux/shuffle.c
@@ -39,6 +39,7 @@
#include <com32.h>
#include <minmax.h>
#include <syslinux/movebits.h>
+#include <klibc/compiler.h>
#ifndef DEBUG
# define DEBUG 0
@@ -54,8 +55,20 @@ struct shuffle_descriptor {
uint32_t dst, src, len;
};
+static int desc_block_size;
+
+static void __constructor __syslinux_get_desc_block_size(void)
+{
+ static com32sys_t reg;
+
+ reg.eax.w[0] = 0x0011;
+ __intcall(0x22, &reg, &reg);
+
+ desc_block_size = (reg.eflags.l & EFLAGS_CF) ? 256 : reg.ecx.w[0];
+}
+
/* Allocate descriptor memory in these chunks */
-#define DESC_BLOCK_SIZE 256
+#define DESC_BLOCK_SIZE desc_block_size
int syslinux_prepare_shuffle(struct syslinux_movelist *fraglist,
struct syslinux_memmap *memmap)