aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-04-11 10:46:38 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-04-11 10:46:38 -0700
commit51c43d5e58b0f88a2392102015c089109307fa9b (patch)
tree059e8925ccb5410145c1c823f6a8f8d956ef3002 /com32
parent55de9cbffb0377dec13860a4aeb7a66e4c2b500e (diff)
parent3b80c2699cde4e159bc9af15308c480acf2c836d (diff)
downloadsyslinux.git-51c43d5e58b0f88a2392102015c089109307fa9b.tar.gz
syslinux.git-51c43d5e58b0f88a2392102015c089109307fa9b.tar.xz
syslinux.git-51c43d5e58b0f88a2392102015c089109307fa9b.zip
Merge branch 'master' into for-erwan
Conflicts: com32/hdt/Makefile
Diffstat (limited to 'com32')
-rw-r--r--com32/LICENCE1
-rw-r--r--com32/MCONFIG3
-rw-r--r--com32/cmenu/Makefile1
-rw-r--r--com32/gdbstub/Makefile2
-rw-r--r--com32/hdt/Makefile78
-rw-r--r--com32/hdt/hdt-common.c1
-rw-r--r--com32/include/com32.h28
-rw-r--r--com32/include/syslinux/advconst.h2
-rw-r--r--com32/include/syslinux/align.h47
-rw-r--r--com32/include/syslinux/config.h1
-rw-r--r--com32/include/syslinux/keyboard.h2
-rw-r--r--com32/include/syslinux/memscan.h38
-rw-r--r--com32/include/syslinux/movebits.h9
-rw-r--r--com32/lib/Makefile2
-rw-r--r--com32/lib/free.c36
-rw-r--r--com32/lib/malloc.c49
-rw-r--r--com32/lib/malloc.h2
-rw-r--r--com32/lib/sys/ansicon_write.c1
-rw-r--r--com32/lib/sys/argv.c8
-rw-r--r--com32/lib/sys/entry.S2
-rw-r--r--com32/lib/sys/vesacon_write.c1
-rw-r--r--com32/lib/syslinux/dsinfo.c1
-rw-r--r--com32/lib/syslinux/keyboard.c4
-rw-r--r--com32/lib/syslinux/load_linux.c79
-rw-r--r--com32/lib/syslinux/memmap.c127
-rw-r--r--com32/lib/syslinux/memscan.c162
-rw-r--r--com32/lib/syslinux/setadv.c16
-rw-r--r--com32/lib/syslinux/shuffle.c137
-rw-r--r--com32/lib/syslinux/shuffle_pm.c45
-rw-r--r--com32/lib/syslinux/shuffle_rm.c79
-rw-r--r--com32/lib/syslinux/zonelist.c31
-rw-r--r--com32/menu/Makefile2
-rw-r--r--com32/menu/menu.h1
-rw-r--r--com32/menu/menumain.c9
-rw-r--r--com32/menu/readconfig.c25
-rw-r--r--com32/modules/Makefile3
-rw-r--r--com32/modules/chain.c77
-rw-r--r--com32/modules/kbdmap.c2
-rw-r--r--com32/rosh/Makefile2
39 files changed, 759 insertions, 357 deletions
diff --git a/com32/LICENCE b/com32/LICENCE
index 8934e8fb..7eec7862 100644
--- a/com32/LICENCE
+++ b/com32/LICENCE
@@ -3,6 +3,7 @@ libcom32 and libutil are licensed under the MIT license:
## -----------------------------------------------------------------------
##
## Copyright 2004-2009 H. Peter Anvin - All Rights Reserved
+## Portions Copyright 2009 Intel Corporation; author: H. Peter Anvin
##
## Permission is hereby granted, free of charge, to any person
## obtaining a copy of this software and associated documentation
diff --git a/com32/MCONFIG b/com32/MCONFIG
index d1af9455..641111ab 100644
--- a/com32/MCONFIG
+++ b/com32/MCONFIG
@@ -1,6 +1,7 @@
## -*- makefile -*- -------------------------------------------------------
##
-## Copyright 2008 H. Peter Anvin - All Rights Reserved
+## Copyright 2008-2009 H. Peter Anvin - All Rights Reserved
+## Copyright 2009 Intel Corporation; author: H. Peter Anvin
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile
index 010fa122..db896e52 100644
--- a/com32/cmenu/Makefile
+++ b/com32/cmenu/Makefile
@@ -1,6 +1,7 @@
## -----------------------------------------------------------------------
##
## Copyright 2001-2009 H. Peter Anvin - All Rights Reserved
+## Copyright 2009 Intel Corporation; author: H. Peter Anvin
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
diff --git a/com32/gdbstub/Makefile b/com32/gdbstub/Makefile
index 2c9171e5..5513876b 100644
--- a/com32/gdbstub/Makefile
+++ b/com32/gdbstub/Makefile
@@ -42,7 +42,7 @@ spotless: clean
rm -f *.lss *.c32 *.com
rm -f *~ \#*
-install: all
+install:
mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
install -m 644 $(MODULES) $(INSTALLROOT)$(AUXDIR)
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index 20f89d6e..8f8cae21 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -1,81 +1,47 @@
## -----------------------------------------------------------------------
##
## Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
+## Copyright 2009 Intel Corporation; author: H. Peter Anvin
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
-## Boston MA 02111-1307, USA; either version 2 of the License, or
+## the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+## Boston MA 02110-1301, USA; either version 2 of the License, or
## (at your option) any later version; incorporated herein by reference.
##
## -----------------------------------------------------------------------
##
-## samples for syslinux users
+## Hardware Detection Tool
##
topdir = ../..
-include $(topdir)/MCONFIG.embedded
+include ../MCONFIG
-MODULES = hdt.c32
+LIBS = ../cmenu/libmenu/libmenu.a ../libutil/libutil_com.a \
+ ../lib/libcom32.a $(LIBGCC)
+CFLAGS += -I$(com32)/cmenu/libmenu
-INCLUDES = -I$(com32)/include -I$(com32)/cmenu/libmenu -I$(com32)/gplinclude\
- -I$(com32)/libutil/include
+MODULES = hdt.c32
+TESTFILES =
-LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
-LIB = liboldcom32.a
+OBJS = $(patsubst %.c,%.o,$(wildcard *.c))
-com32 = $(topdir)/com32
-LIBS = $(LIB) $(com32)/cmenu/libmenu/libmenu.a \
- $(com32)/gpllib/libcom32gpl.a \
- $(com32)/libutil/libutil_com.a $(com32)/lib/libcom32.a \
- $(LIBGCC)
+all: $(MODULES) $(TESTFILES)
-LDFLAGS = -m elf_i386 -T $(com32)/lib/com32.ld
-
-all: $(MODULES) $(LIB)
-
-.PRECIOUS: %.o
-%.o: %.S
- $(CC) $(SFLAGS) -c -o $@ $<
-
-.PRECIOUS: %.o
-%.o: %.c
- @$(CC) $(CFLAGS) -std=gnu99 -D__COM32__ -c -o $@ $<
-
-.PRECIOUS: %.elf
-%.elf: c32entry.o %.o $(LIB)
- @$(LD) -Ttext 0x101000 -e _start -o $@ $^
-
-hdt.elf: hdt.o hdt-ata.o hdt-menu.o hdt-menu-pci.o hdt-menu-kernel.o \
- hdt-menu-disk.o hdt-menu-dmi.o hdt-menu-processor.o \
- hdt-menu-syslinux.o hdt-menu-about.o \
- hdt-cli.o hdt-cli-hdt.o hdt-common.o hdt-cli-pci.o hdt-cli-dmi.o \
- hdt-cli-cpu.o hdt-cli-pxe.o hdt-cli-kernel.o \
- hdt-cli-syslinux.o hdt-cli-vesa.o\
- hdt-menu-pxe.o hdt-menu-summary.o hdt-menu-vesa.o\
- lib-ansi.o\
- $(LIBS)
- @$(LD) $(LDFLAGS) -o $@ $^
-
-%.c32: %.elf
- @$(OBJCOPY) -O binary $< $@
-
-%.com: %.asm
- @$(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $<
-
-$(LIB):
- @rm -f $@
- @$(AR) cq $@ $^
- @$(RANLIB) $@
+hdt.elf : $(OBJS) $(LIBS) $(C_LIBS)
+ $(LD) $(LDFLAGS) -o $@ $^
tidy dist:
- @rm -f *.o *.a *.lst *.elf
-
-install: all
+ rm -f *.o *.lo *.a *.lst *.elf .*.d *.tmp
-# Don't specify *.com since mdiskchk.com can't be built using Linux tools
clean: tidy
- @rm -f *.o *.c32 *.c~ *.h~ Makefile~
+ rm -f *.lnx
spotless: clean
+ rm -f *.lss *.c32 *.com
+ rm -f *~ \#*
+
+install:
+
+-include .*.d
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index 1386a771..d02533ce 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -102,6 +102,7 @@ void init_hardware(struct s_hardware *hardware)
memset(hardware->pciids_path, 0, sizeof hardware->pciids_path);
memset(hardware->modules_pcimap_path, 0,
sizeof hardware->modules_pcimap_path);
+ memset(hardware->memtest_label, 0, sizeof hardware->memtest_label);
strcat(hardware->pciids_path, "pci.ids");
strcat(hardware->modules_pcimap_path, "modules.pcimap");
strcat(hardware->memtest_label, "memtest");
diff --git a/com32/include/com32.h b/com32/include/com32.h
index 8be87211..44cd5732 100644
--- a/com32/include/com32.h
+++ b/com32/include/com32.h
@@ -1,6 +1,29 @@
/* ----------------------------------------------------------------------- *
- * Not Copyright 2002-2008 H. Peter Anvin
- * This file is in the public domain.
+ *
+ * Copyright 2002-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
* ----------------------------------------------------------------------- */
/*
@@ -75,6 +98,7 @@ extern struct com32_sys_args {
uint32_t cs_bounce_size;
void __cdecl (*cs_farcall)(uint32_t, const com32sys_t *, com32sys_t *);
int __cdecl (*cs_cfarcall)(uint32_t, const void *, uint32_t);
+ uint32_t cs_memsize;
} __com32;
/*
diff --git a/com32/include/syslinux/advconst.h b/com32/include/syslinux/advconst.h
index 1e1ec73e..b7c775fd 100644
--- a/com32/include/syslinux/advconst.h
+++ b/com32/include/syslinux/advconst.h
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -39,5 +40,6 @@
#define ADV_END 0
#define ADV_BOOTONCE 1
+#define ADV_MENUSAVE 2
#endif /* _SYSLINUX_ADVCONST_H */
diff --git a/com32/include/syslinux/align.h b/com32/include/syslinux/align.h
new file mode 100644
index 00000000..5b01bf27
--- /dev/null
+++ b/com32/include/syslinux/align.h
@@ -0,0 +1,47 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2009 Intel Corporation; author H. Peter Anvin
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef _SYSLINUX_ALIGN_H
+#define _SYSLINUX_ALIGN_H
+
+#include <stdint.h>
+
+static inline uintptr_t __align_down(uintptr_t __p, uintptr_t __a)
+{
+ return __p & ~(__a - 1);
+}
+static inline uintptr_t __align_up(uintptr_t __p, uintptr_t __a)
+{
+ return (__p + __a - 1) & ~(__a - 1);
+}
+
+#define ALIGN_UP(p,a) ((__typeof__(p))__align_up((uintptr_t)(p), (a)))
+#define ALIGN_DOWN(p,a) ((__typeof__(p))__align_down((uintptr_t)(p), (a)))
+#define ALIGN_UP_FOR(p,t) ALIGN_UP(p,sizeof(t))
+#define ALIGN_DOWN_FOR(p,t) ALIGN_DOWN(p,sizeof(t))
+
+#endif /* _SYSLINUX_ALIGN_H */
diff --git a/com32/include/syslinux/config.h b/com32/include/syslinux/config.h
index ed4bf247..ade2c4b1 100644
--- a/com32/include/syslinux/config.h
+++ b/com32/include/syslinux/config.h
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/com32/include/syslinux/keyboard.h b/com32/include/syslinux/keyboard.h
index 9d4f1409..8f21ad07 100644
--- a/com32/include/syslinux/keyboard.h
+++ b/com32/include/syslinux/keyboard.h
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/com32/include/syslinux/memscan.h b/com32/include/syslinux/memscan.h
new file mode 100644
index 00000000..24c4edaf
--- /dev/null
+++ b/com32/include/syslinux/memscan.h
@@ -0,0 +1,38 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef _SYSLINUX_MEMSCAN_H
+#define _SYSLINUX_MEMSCAN_H
+
+#include <stdbool.h>
+#include <syslinux/movebits.h> /* addr_t */
+
+typedef int (*scan_memory_callback_t)(void *, addr_t, addr_t, bool);
+int syslinux_scan_memory(scan_memory_callback_t callback, void *data);
+
+#endif /* _SYSLINUX_MEMSCAN_H */
diff --git a/com32/include/syslinux/movebits.h b/com32/include/syslinux/movebits.h
index f35ef228..ff3711ee 100644
--- a/com32/include/syslinux/movebits.h
+++ b/com32/include/syslinux/movebits.h
@@ -59,8 +59,13 @@ int syslinux_add_movelist(struct syslinux_movelist **,
addr_t dst, addr_t src, addr_t len);
int syslinux_allocate_from_list(struct syslinux_movelist **freelist,
addr_t dst, addr_t len);
-int syslinux_prepare_shuffle(struct syslinux_movelist *fraglist,
- struct syslinux_memmap *memmap);
+int syslinux_do_shuffle(struct syslinux_movelist *fraglist,
+ struct syslinux_memmap *memmap,
+ addr_t entry_point, addr_t entry_type,
+ uint16_t bootflags);
+struct syslinux_memmap *
+syslinux_target_memmap(struct syslinux_movelist *fraglist,
+ struct syslinux_memmap *memmap);
/* Operatons on struct syslinux_memmap */
struct syslinux_memmap *syslinux_init_memmap(void);
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 6c137f9d..984c6dff 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -84,6 +84,8 @@ LIBOBJS = \
syslinux/ipappend.o syslinux/dsinfo.o syslinux/version.o \
syslinux/keyboard.o \
\
+ syslinux/memscan.o \
+ \
syslinux/addlist.o syslinux/freelist.o syslinux/memmap.o \
syslinux/movebits.o syslinux/shuffle.o syslinux/shuffle_pm.o \
syslinux/shuffle_rm.o syslinux/zonelist.o \
diff --git a/com32/lib/free.c b/com32/lib/free.c
index aa17080d..20044078 100644
--- a/com32/lib/free.c
+++ b/com32/lib/free.c
@@ -58,6 +58,42 @@ __free_block(struct free_arena_header *ah)
return ah;
}
+/*
+ * This is used to insert a block which is not previously on the
+ * free list. Only the a.size field of the arena header is assumed
+ * to be valid.
+ */
+void __inject_free_block(struct free_arena_header *ah)
+{
+ struct free_arena_header *nah;
+ size_t a_end = (size_t)ah + ah->a.size;
+ size_t n_end;
+
+ for (nah = __malloc_head.a.next; nah->a.type != ARENA_TYPE_HEAD;
+ nah = nah->a.next) {
+ n_end = (size_t)nah + nah->a.size;
+
+ /* Is nah entirely beyond this block? */
+ if ((size_t)nah >= a_end)
+ break;
+
+ /* Is this block entirely beyond nah? */
+ if ((size_t)ah >= n_end)
+ continue;
+
+ /* Otherwise we have some sort of overlap - reject this block */
+ return;
+ }
+
+ /* Now, nah should point to the successor block */
+ ah->a.next = nah;
+ ah->a.prev = nah->a.prev;
+ nah->a.prev = ah;
+ ah->a.prev->a.next = ah;
+
+ __free_block(ah);
+}
+
void free(void *ptr)
{
struct free_arena_header *ah;
diff --git a/com32/lib/malloc.c b/com32/lib/malloc.c
index 2f8362b4..40e88b49 100644
--- a/com32/lib/malloc.c
+++ b/com32/lib/malloc.c
@@ -5,6 +5,9 @@
*/
#include <stdlib.h>
+#include <string.h>
+#include <com32.h>
+#include <syslinux/memscan.h>
#include "init.h"
#include "malloc.h"
@@ -31,6 +34,39 @@ static inline size_t sp(void)
return sp;
}
+#define E820_MEM_MAX 0xfff00000 /* 4 GB - 1 MB */
+
+static int consider_memory_area(void *dummy, addr_t start,
+ addr_t len, bool valid)
+{
+ struct free_arena_header *fp;
+ addr_t end;
+
+ (void)dummy;
+
+ if (valid && start < E820_MEM_MAX) {
+ if (len > E820_MEM_MAX - start)
+ len = E820_MEM_MAX - start;
+
+ end = start + len;
+
+ if (end > __com32.cs_memsize) {
+ if (start <= __com32.cs_memsize) {
+ start = __com32.cs_memsize;
+ len = end - start;
+ }
+
+ if (len >= 2*sizeof(struct arena_header)) {
+ fp = (struct free_arena_header *)start;
+ fp->a.size = len;
+ __inject_free_block(fp);
+ }
+ }
+ }
+
+ return 0;
+}
+
static void __constructor init_memory_arena(void)
{
struct free_arena_header *fp;
@@ -46,14 +82,15 @@ static void __constructor init_memory_arena(void)
__stack_size = total_space - 4*sizeof(struct arena_header);
fp = (struct free_arena_header *)start;
- fp->a.type = ARENA_TYPE_FREE;
fp->a.size = total_space - __stack_size;
- /* Insert into chains */
- fp->a.next = fp->a.prev = &__malloc_head;
- fp->next_free = fp->prev_free = &__malloc_head;
- __malloc_head.a.next = __malloc_head.a.prev = fp;
- __malloc_head.next_free = __malloc_head.prev_free = fp;
+ __inject_free_block(fp);
+
+ /* Scan the memory map to look for other suitable regions */
+ if (!__com32.cs_memsize)
+ return; /* Old Syslinux core, can't do this... */
+
+ syslinux_scan_memory(consider_memory_area, NULL);
}
static void *__malloc_from_block(struct free_arena_header *fp, size_t size)
diff --git a/com32/lib/malloc.h b/com32/lib/malloc.h
index 830377d9..983a3c52 100644
--- a/com32/lib/malloc.h
+++ b/com32/lib/malloc.h
@@ -52,3 +52,5 @@ struct free_arena_header {
};
extern struct free_arena_header __malloc_head;
+void __inject_free_block(struct free_arena_header *ah);
+
diff --git a/com32/lib/sys/ansicon_write.c b/com32/lib/sys/ansicon_write.c
index 01d69da1..7bdc8cbd 100644
--- a/com32/lib/sys/ansicon_write.c
+++ b/com32/lib/sys/ansicon_write.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2004-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/com32/lib/sys/argv.c b/com32/lib/sys/argv.c
index 0d16bfe6..b405a8d7 100644
--- a/com32/lib/sys/argv.c
+++ b/com32/lib/sys/argv.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2004-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -35,8 +36,7 @@
#include <inttypes.h>
#include <stddef.h>
#include <stdio.h>
-
-#define ALIGN_UP(p,t) ((t *)(((uintptr_t)(p) + (sizeof(t)-1)) & ~(sizeof(t)-1)))
+#include <syslinux/align.h>
extern char _end[]; /* Symbol created by linker */
void *__mem_end = &_end; /* Global variable for use by malloc() */
@@ -75,7 +75,7 @@ int __parse_argv(char ***argv, const char *str)
}
/* Now create argv */
- arg = ALIGN_UP(q,char *);
+ arg = ALIGN_UP_FOR(q, char *);
*argv = arg;
*arg++ = argv0; /* argv[0] */
diff --git a/com32/lib/sys/entry.S b/com32/lib/sys/entry.S
index ed5da95f..53bf2ecb 100644
--- a/com32/lib/sys/entry.S
+++ b/com32/lib/sys/entry.S
@@ -30,7 +30,7 @@
*/
/* Number of arguments in our version of the entry structure */
-#define COM32_ARGS 6
+#define COM32_ARGS 7
.section ".init","ax"
.globl _start
diff --git a/com32/lib/sys/vesacon_write.c b/com32/lib/sys/vesacon_write.c
index 48c1ed44..7ca25ac7 100644
--- a/com32/lib/sys/vesacon_write.c
+++ b/com32/lib/sys/vesacon_write.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2004-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/com32/lib/syslinux/dsinfo.c b/com32/lib/syslinux/dsinfo.c
index b3d3b3cd..60f7e998 100644
--- a/com32/lib/syslinux/dsinfo.c
+++ b/com32/lib/syslinux/dsinfo.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2008-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/com32/lib/syslinux/keyboard.c b/com32/lib/syslinux/keyboard.c
index 2635dfb9..2b31b270 100644
--- a/com32/lib/syslinux/keyboard.c
+++ b/com32/lib/syslinux/keyboard.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -38,7 +38,7 @@ void __constructor __syslinux_get_keyboard_map(void)
__intcall(0x22, &reg, &reg);
if (!(reg.eflags.l & EFLAGS_CF)) {
__syslinux_keyboard_map.version = reg.eax.w[0];
- __syslinux_keyboard_map.length = reg.edx.w[0];
+ __syslinux_keyboard_map.length = reg.ecx.w[0];
__syslinux_keyboard_map.map = MK_PTR(reg.es, reg.ebx.w[0]);
}
}
diff --git a/com32/lib/syslinux/load_linux.c b/com32/lib/syslinux/load_linux.c
index cca2efd0..41ebcb70 100644
--- a/com32/lib/syslinux/load_linux.c
+++ b/com32/lib/syslinux/load_linux.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 H. Peter Anvin - All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -31,9 +32,11 @@
* Load a Linux kernel (Image/zImage/bzImage).
*/
+#include <stdbool.h>
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
+#include <syslinux/align.h>
#include <syslinux/linux.h>
#include <syslinux/bootrm.h>
#include <syslinux/movebits.h>
@@ -159,6 +162,7 @@ int syslinux_boot_linux(void *kernel_buf, size_t kernel_size,
struct syslinux_movelist *fraglist = NULL;
struct syslinux_memmap *mmap = NULL;
struct syslinux_memmap *amap = NULL;
+ bool ok;
cmdline_size = strlen(cmdline)+1;
@@ -189,6 +193,9 @@ int syslinux_boot_linux(void *kernel_buf, size_t kernel_size,
if (!memlimit || memlimit-1 > hdr.initrd_addr_max)
memlimit = hdr.initrd_addr_max+1; /* Zero for no limit */
+ if (hdr.version < 0x0205)
+ hdr.relocatable_kernel = 0;
+
if (hdr.version < 0x0206)
hdr.cmdline_max_len = 256;
@@ -250,7 +257,79 @@ int syslinux_boot_linux(void *kernel_buf, size_t kernel_size,
/* Place the kernel in memory */
+ /* First, find a suitable place for the protected-mode code */
+ if (syslinux_memmap_type(amap, prot_mode_base, prot_mode_size)
+ != SMT_FREE) {
+ const struct syslinux_memmap *mp;
+ if (!hdr.relocatable_kernel)
+ goto bail; /* Can't relocate - no hope */
+
+ ok = false;
+ for (mp = amap; mp; mp = mp->next) {
+ addr_t start, end;
+ start = mp->start;
+ end = mp->next->start;
+
+ if (mp->type != SMT_FREE)
+ continue;
+
+ if (end <= prot_mode_base)
+ continue; /* Only relocate upwards */
+
+ if (start <= prot_mode_base)
+ start = prot_mode_base;
+
+ start = ALIGN_UP(start, hdr.kernel_alignment);
+ if (start >= end)
+ continue;
+
+ /* The 3* here is a total fudge factor... it's supposed to
+ account for the fact that the kernel needs to be decompressed,
+ and then followed by the BSS and BRK regions. This doesn't,
+ however, account for the fact that the kernel is decompressed
+ into a whole other place, either. */
+ if (end - start >= 3*prot_mode_size) {
+ prot_mode_base = start;
+ ok = true;
+ break;
+ }
+ }
+
+ if (!ok)
+ goto bail;
+ }
+
/* Real mode code */
+ if (syslinux_memmap_type(amap, real_mode_base,
+ cmdline_offset+cmdline_size) != SMT_FREE) {
+ const struct syslinux_memmap *mp;
+
+ ok = false;
+ for (mp = amap; mp; mp = mp->next) {
+ addr_t start, end;
+ start = mp->start;
+ end = mp->next->start;
+
+ if (mp->type != SMT_FREE)
+ continue;
+
+ if (start < real_mode_base)
+ start = real_mode_base; /* Lowest address we'll use */
+ if (end > 640*1024)
+ end = 640*1024;
+
+ start = ALIGN_UP(start, 16);
+ if (start > 0x90000 || start >= end)
+ continue;
+
+ if (end - start >= cmdline_offset+cmdline_size) {
+ real_mode_base = start;
+ ok = true;
+ break;
+ }
+ }
+ }
+
if (syslinux_add_movelist(&fraglist, real_mode_base, (addr_t)kernel_buf,
real_mode_size))
goto bail;
diff --git a/com32/lib/syslinux/memmap.c b/com32/lib/syslinux/memmap.c
index 105c9473..9fdda886 100644
--- a/com32/lib/syslinux/memmap.c
+++ b/com32/lib/syslinux/memmap.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -32,131 +33,35 @@
*/
#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <inttypes.h>
-#include <setjmp.h>
-#include <string.h>
-#include <com32.h>
+#include <syslinux/memscan.h>
#include <syslinux/movebits.h>
-struct e820_entry {
- uint64_t start;
- uint64_t len;
- uint32_t type;
- uint32_t extattr;
-};
+static int syslinux_memory_map_callback(void *map, addr_t start,
+ addr_t len, bool valid)
+{
+ struct syslinux_memmap **mmap = map;
+ return syslinux_add_memmap(mmap, start, len,
+ valid ? SMT_FREE : SMT_RESERVED);
+}
struct syslinux_memmap *syslinux_memory_map(void)
{
- static com32sys_t ireg, zireg;
- com32sys_t oreg;
- struct e820_entry *e820buf = __com32.cs_bounce;
- uint64_t start, len, maxlen;
- int memfound = 0;
struct syslinux_memmap *mmap;
enum syslinux_memmap_types type;
+ int rv;
mmap = syslinux_init_memmap();
if (!mmap)
- goto bail;
+ return NULL;
- /* Use INT 12h to get DOS memory above 0x7c00 */
- __intcall(0x12, &zireg, &oreg);
- if (oreg.eax.w[0] > 31 && oreg.eax.w[0] <= 640) {
- addr_t dosmem = (oreg.eax.w[0] << 10) - 0x7c00;
- if (syslinux_add_memmap(&mmap, 0x7c00, dosmem, SMT_FREE))
- goto bail;
- }
-
- /* First try INT 15h AX=E820h */
- ireg.eax.l = 0xe820;
- ireg.edx.l = 0x534d4150;
- ireg.ebx.l = 0;
- ireg.ecx.l = sizeof(*e820buf);
- ireg.es = SEG(e820buf);
- ireg.edi.w[0] = OFFS(e820buf);
- memset(e820buf, 0, sizeof *e820buf);
- e820buf->extattr = 1;
-
- do {
- __intcall(0x15, &ireg, &oreg);
-
- if ((oreg.eflags.l & EFLAGS_CF) ||
- (oreg.eax.l != 0x534d4150) ||
- (oreg.ecx.l < 20))
- break;
-
- if (oreg.ecx.l < 24)
- e820buf->extattr = 1; /* Enabled, normal */
-
- if (!(e820buf->extattr & 1))
- continue;
-
- type = e820buf->type == 1 ? SMT_FREE : SMT_RESERVED;
- start = e820buf->start;
- len = e820buf->len;
-
- if (start < 0x100000000ULL) {
- /* Don't rely on E820 being valid for low memory. Doing so
- could mean stuff like overwriting the PXE stack even when
- using "keeppxe", etc. */
- if (start < 0x100000ULL) {
- if (len > 0x100000ULL-start)
- len -= 0x100000ULL-start;
- else
- len = 0;
- start = 0x100000ULL;
- }
-
- maxlen = 0x100000000ULL-start;
- if (len > maxlen)
- len = maxlen;
-
- if (len) {
- if (syslinux_add_memmap(&mmap, (addr_t)start, (addr_t)len, type))
- goto bail;
- memfound = 1;
- }
- }
-
- ireg.ebx.l = oreg.ebx.l;
- } while (oreg.ebx.l);
-
- if (memfound)
- return mmap;
-
- /* Next try INT 15h AX=E801h */
- ireg.eax.w[0] = 0xe801;
- __intcall(0x15, &ireg, &oreg);
-
- if (!(oreg.eflags.l & EFLAGS_CF) && oreg.ecx.w[0]) {
- if (syslinux_add_memmap(&mmap, (addr_t)1 << 20, oreg.ecx.w[0] << 10,
- SMT_FREE))
- goto bail;
-
- if (oreg.edx.w[0]) {
- if (syslinux_add_memmap(&mmap, (addr_t)16 << 20, oreg.edx.w[0] << 16,
- SMT_FREE))
- goto bail;
- }
-
- return mmap;
- }
-
- /* Finally try INT 15h AH=88h */
- ireg.eax.w[0] = 0x8800;
- if (!(oreg.eflags.l & EFLAGS_CF) && oreg.eax.w[0]) {
- if (syslinux_add_memmap(&mmap, (addr_t)1 << 20, oreg.ecx.w[0] << 10,
- SMT_FREE))
- goto bail;
+ if (syslinux_scan_memory(syslinux_memory_map_callback, &mmap)) {
+ syslinux_free_memmap(mmap);
+ return NULL;
}
return mmap;
-
- bail:
- syslinux_free_memmap(mmap);
- return NULL;
}
diff --git a/com32/lib/syslinux/memscan.c b/com32/lib/syslinux/memscan.c
new file mode 100644
index 00000000..782f6346
--- /dev/null
+++ b/com32/lib/syslinux/memscan.c
@@ -0,0 +1,162 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 H. Peter Anvin - All Rights Reserved
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * memscan.c
+ *
+ * Query the system for free memory
+ */
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+#include <com32.h>
+
+#include <syslinux/memscan.h>
+
+struct e820_entry {
+ uint64_t start;
+ uint64_t len;
+ uint32_t type;
+ uint32_t extattr;
+};
+
+int syslinux_scan_memory(scan_memory_callback_t callback, void *data)
+{
+ static com32sys_t ireg;
+ com32sys_t oreg;
+ struct e820_entry *e820buf = __com32.cs_bounce;
+ uint64_t start, len, maxlen;
+ int memfound = 0;
+ int rv;
+ addr_t dosmem;
+
+ /* Use INT 12h to get DOS memory above 0x504 */
+ __intcall(0x12, &__com32_zero_regs, &oreg);
+ dosmem = oreg.eax.w[0] << 10;
+ if (dosmem < 32*1024 || dosmem > 640*1024) {
+ /* INT 12h reports nonsense... now what? */
+ uint16_t ebda_seg = (uint16_t *)0x40e;
+ if (ebda_seg >= 0x8000 && ebda_seg < 0xa000)
+ dosmem = ebda_seg << 4;
+ else
+ dosmem = 640*1024; /* Hope for the best... */
+ }
+ dosmem = (oreg.eax.w[0] << 10) - 0x510;
+ rv = callback(data, 0x510, dosmem, true);
+ if (rv)
+ return rv;
+
+ /* First try INT 15h AX=E820h */
+ ireg.eax.l = 0xe820;
+ ireg.edx.l = 0x534d4150;
+ ireg.ebx.l = 0;
+ ireg.ecx.l = sizeof(*e820buf);
+ ireg.es = SEG(e820buf);
+ ireg.edi.w[0] = OFFS(e820buf);
+ memset(e820buf, 0, sizeof *e820buf);
+ /* Set this in case the BIOS doesn't, but doesn't change %ecx to match. */
+ e820buf->extattr = 1;
+
+ do {
+ __intcall(0x15, &ireg, &oreg);
+
+ if ((oreg.eflags.l & EFLAGS_CF) ||
+ (oreg.eax.l != 0x534d4150) ||
+ (oreg.ecx.l < 20))
+ break;
+
+ if (oreg.ecx.l < 24)
+ e820buf->extattr = 1; /* Enabled, normal */
+
+ if (!(e820buf->extattr & 1))
+ continue;
+
+ start = e820buf->start;
+ len = e820buf->len;
+
+ if (start < 0x100000000ULL) {
+ /* Don't rely on E820 being valid for low memory. Doing so
+ could mean stuff like overwriting the PXE stack even when
+ using "keeppxe", etc. */
+ if (start < 0x100000ULL) {
+ if (len > 0x100000ULL-start)
+ len -= 0x100000ULL-start;
+ else
+ len = 0;
+ start = 0x100000ULL;
+ }
+
+ maxlen = 0x100000000ULL-start;
+ if (len > maxlen)
+ len = maxlen;
+
+ if (len) {
+ rv = callback(data, (addr_t)start, (addr_t)len, e820buf->type == 1);
+ if (rv)
+ return rv;
+ memfound = 1;
+ }
+ }
+
+ ireg.ebx.l = oreg.ebx.l;
+ } while (oreg.ebx.l);
+
+ if (memfound)
+ return 0;
+
+ /* Next try INT 15h AX=E801h */
+ ireg.eax.w[0] = 0xe801;
+ __intcall(0x15, &ireg, &oreg);
+
+ if (!(oreg.eflags.l & EFLAGS_CF) && oreg.ecx.w[0]) {
+ rv = callback(data, (addr_t)1 << 20, oreg.ecx.w[0] << 10, true);
+ if (rv)
+ return rv;
+
+ if (oreg.edx.w[0]) {
+ rv = callback(data, (addr_t)16 << 20, oreg.edx.w[0] << 16, true);
+ if (rv)
+ return rv;
+ }
+
+ return 0;
+ }
+
+ /* Finally try INT 15h AH=88h */
+ ireg.eax.w[0] = 0x8800;
+ if (!(oreg.eflags.l & EFLAGS_CF) && oreg.eax.w[0]) {
+ rv = callback(data, (addr_t)1 << 20, oreg.ecx.w[0] << 10, true);
+ if (rv)
+ return rv;
+ }
+
+ return 0;
+}
diff --git a/com32/lib/syslinux/setadv.c b/com32/lib/syslinux/setadv.c
index 4af8d6e1..5993df6d 100644
--- a/com32/lib/syslinux/setadv.c
+++ b/com32/lib/syslinux/setadv.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -47,7 +48,7 @@
int syslinux_setadv(int tag, size_t size, const void *data)
{
uint8_t *p, *advtmp;
- size_t left;
+ size_t rleft, left;
if ((unsigned)tag-1 > 254) {
errno = EINVAL;
@@ -59,11 +60,11 @@ int syslinux_setadv(int tag, size_t size, const void *data)
return -1;
}
- left = syslinux_adv_size();
+ rleft = left = syslinux_adv_size();
p = advtmp = alloca(left);
memcpy(p, syslinux_adv_ptr(), left); /* Make working copy */
- while (left >= 2) {
+ while (rleft >= 2) {
uint8_t ptag = p[0];
size_t plen = p[1]+2;
@@ -73,17 +74,19 @@ int syslinux_setadv(int tag, size_t size, const void *data)
if (ptag == tag) {
/* Found our tag. Delete it. */
- if (plen >= left) {
+ if (plen >= rleft) {
/* Entire remainder is our tag */
break;
}
- memmove(p, p+plen, left-plen);
+ memmove(p, p+plen, rleft-plen);
+ rleft -= plen; /* Fewer bytes to read, but not to write */
} else {
/* Not our tag */
- if (plen > left)
+ if (plen > rleft)
break; /* Corrupt tag (overrun) - overwrite it */
left -= plen;
+ rleft -= plen;
p += plen;
}
}
@@ -100,6 +103,7 @@ int syslinux_setadv(int tag, size_t size, const void *data)
*p++ = tag;
*p++ = size;
memcpy(p, data, size);
+ p += size;
left -= size+2;
}
diff --git a/com32/lib/syslinux/shuffle.c b/com32/lib/syslinux/shuffle.c
index b891722d..196fc64a 100644
--- a/com32/lib/syslinux/shuffle.c
+++ b/com32/lib/syslinux/shuffle.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -62,33 +63,42 @@ struct shuffle_descriptor {
uint32_t dst, src, len;
};
-static int desc_block_size;
+static int shuffler_size;
-static void __constructor __syslinux_get_desc_block_size(void)
+static void __constructor __syslinux_get_shuffer_size(void)
{
static com32sys_t reg;
- reg.eax.w[0] = 0x0011;
+ reg.eax.w[0] = 0x0023;
__intcall(0x22, &reg, &reg);
- desc_block_size = (reg.eflags.l & EFLAGS_CF) ? 64 : reg.ecx.w[0];
+ shuffler_size = (reg.eflags.l & EFLAGS_CF) ? 2048 : reg.ecx.w[0];
}
-/* Allocate descriptor memory in these chunks */
-#define DESC_BLOCK_SIZE desc_block_size
+/*
+ * Allocate descriptor memory in these chunks; if this is large we may
+ * waste memory, if it is small we may get slow convergence.
+ */
+#define DESC_BLOCK_SIZE 256
-int syslinux_prepare_shuffle(struct syslinux_movelist *fraglist,
- struct syslinux_memmap *memmap)
+int syslinux_do_shuffle(struct syslinux_movelist *fraglist,
+ struct syslinux_memmap *memmap,
+ addr_t entry_point, addr_t entry_type,
+ uint16_t bootflags)
{
+ int rv = -1;
struct syslinux_movelist *moves = NULL, *mp;
struct syslinux_memmap *rxmap = NULL, *ml;
struct shuffle_descriptor *dp, *dbuf;
- int np, nb, nl, rv = -1;
+ int np;
int desc_blocks, need_blocks;
int need_ptrs;
addr_t desczone, descfree, descaddr, descoffs;
int nmoves, nzero;
- struct shuffle_descriptor primaries[2];
+ com32sys_t ireg;
+
+ descaddr = 0;
+ dp = dbuf = NULL;
/* Count the number of zero operations */
nzero = 0;
@@ -98,11 +108,15 @@ int syslinux_prepare_shuffle(struct syslinux_movelist *fraglist,
}
/* Find the largest contiguous region unused by input *and* output;
- this is where we put the move descriptor list */
+ this is where we put the move descriptor list and safe area */
rxmap = syslinux_dup_memmap(memmap);
if (!rxmap)
goto bail;
+ /* Avoid using the low 1 MB for the shuffle area -- this avoids
+ possible interference with the real mode code or stack */
+ if (syslinux_add_memmap(&rxmap, 0, 1024*1024, SMT_RESERVED))
+ goto bail;
for (mp = fraglist; mp; mp = mp->next) {
if (syslinux_add_memmap(&rxmap, mp->src, mp->len, SMT_ALLOC) ||
syslinux_add_memmap(&rxmap, mp->dst, mp->len, SMT_ALLOC))
@@ -119,10 +133,13 @@ int syslinux_prepare_shuffle(struct syslinux_movelist *fraglist,
if (!rxmap)
goto bail;
- desc_blocks = (nzero+DESC_BLOCK_SIZE-1)/(DESC_BLOCK_SIZE-1);
+ 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)*DESC_BLOCK_SIZE
+ + sizeof(struct shuffle_descriptor) + shuffler_size;
if (descfree < descmem)
goto bail; /* No memory block large enough */
@@ -143,7 +160,7 @@ int syslinux_prepare_shuffle(struct syslinux_movelist *fraglist,
for (mp = moves; mp; mp = mp->next)
nmoves++;
- need_blocks = (nmoves+nzero+DESC_BLOCK_SIZE-1)/(DESC_BLOCK_SIZE-1);
+ need_blocks = (nmoves+nzero+DESC_BLOCK_SIZE-1)/DESC_BLOCK_SIZE;
if (desc_blocks >= need_blocks)
break; /* Sufficient memory, yay */
@@ -159,7 +176,7 @@ int syslinux_prepare_shuffle(struct syslinux_movelist *fraglist,
syslinux_free_memmap(rxmap);
rxmap = NULL;
- need_ptrs = nmoves+nzero+desc_blocks-1;
+ need_ptrs = nmoves+nzero+1;
dbuf = malloc(need_ptrs*sizeof(struct shuffle_descriptor));
if (!dbuf)
goto bail;
@@ -173,71 +190,38 @@ int syslinux_prepare_shuffle(struct syslinux_movelist *fraglist,
/* Copy the move sequence into the descriptor buffer */
np = 0;
- nb = 0;
- nl = nmoves+nzero;
dp = dbuf;
for (mp = moves; mp; mp = mp->next) {
- if (nb == DESC_BLOCK_SIZE-1) {
- dp->dst = -1; /* Load new descriptors */
- dp->src = (addr_t)(dp+1) + descoffs;
- dp->len = sizeof(*dp)*min(nl, DESC_BLOCK_SIZE);
- dprintf("[ %08x %08x %08x ]\n", dp->dst, dp->src, dp->len);
- dp++; np++;
- nb = 0;
- }
-
dp->dst = mp->dst;
dp->src = mp->src;
dp->len = mp->len;
dprintf2("[ %08x %08x %08x ]\n", dp->dst, dp->src, dp->len);
- dp++; np++; nb++; nl--;
+ dp++; np++;
}
/* Copy bzero operations into the descriptor buffer */
for (ml = memmap; ml->type != SMT_END; ml = ml->next) {
if (ml->type == SMT_ZERO) {
- if (nb == DESC_BLOCK_SIZE-1) {
- dp->dst = (addr_t)-1; /* Load new descriptors */
- dp->src = (addr_t)(dp+1) + descoffs;
- dp->len = sizeof(*dp)*min(nl, DESC_BLOCK_SIZE);
- dprintf("[ %08x %08x %08x ]\n", dp->dst, dp->src, dp->len);
- dp++; np++;
- nb = 0;
- }
-
dp->dst = ml->start;
dp->src = (addr_t)-1; /* bzero region */
dp->len = ml->next->start - ml->start;
dprintf2("[ %08x %08x %08x ]\n", dp->dst, dp->src, dp->len);
- dp++; np++; nb++; nl--;
+ dp++; np++;
}
}
+ /* Finally, record the termination entry */
+ dp->dst = entry_point;
+ dp->src = entry_type;
+ dp->len = 0;
+ dp++; np++;
+
if (np != need_ptrs) {
dprintf("!!! np = %d : nmoves = %d, nzero = %d, desc_blocks = %d\n",
np, nmoves, nzero, desc_blocks);
}
- /* Set up the primary descriptors in the bounce buffer.
- The first one moves the descriptor list into its designated safe
- zone, the second one loads the first descriptor block. */
- dp = primaries;
-
- dp->dst = descaddr;
- dp->src = (addr_t)dbuf;
- dp->len = np*sizeof(*dp);
- dprintf("< %08x %08x %08x >\n", dp->dst, dp->src, dp->len);
- dp++;
-
- dp->dst = (addr_t)-1;
- dp->src = descaddr;
- dp->len = sizeof(*dp)*min(np, DESC_BLOCK_SIZE);
- dprintf("< %08x %08x %08x >\n", dp->dst, dp->src, dp->len);
- dp++;
-
- memcpy(__com32.cs_bounce, primaries, 2*sizeof(*dp));
-
- rv = 2; /* Always two primaries */
+ rv = 0;
bail:
/* This is safe only because free() doesn't use the bounce buffer!!!! */
@@ -246,5 +230,42 @@ int syslinux_prepare_shuffle(struct syslinux_movelist *fraglist,
if (rxmap)
syslinux_free_memmap(rxmap);
- return rv;
+ if (rv)
+ return rv;
+
+ /* Actually do it... */
+ memset(&ireg, 0, sizeof ireg);
+ ireg.edi.l = descaddr;
+ ireg.esi.l = (addr_t)dbuf;
+ ireg.ecx.l = (addr_t)dp-(addr_t)dbuf;
+ ireg.edx.w[0] = bootflags;
+ ireg.eax.w[0] = 0x0024;
+ __intcall(0x22, &ireg, NULL);
+
+ return -1; /* Shouldn't have returned! */
+}
+
+/*
+ * Common helper routine: takes a memory map and blots out the
+ * zones which are used in the destination of a fraglist
+ */
+struct syslinux_memmap *
+syslinux_target_memmap(struct syslinux_movelist *fraglist,
+ struct syslinux_memmap *memmap)
+{
+ struct syslinux_memmap *tmap;
+ struct syslinux_movelist *mp;
+
+ tmap = syslinux_dup_memmap(memmap);
+ if (!tmap)
+ return NULL;
+
+ for (mp = fraglist; mp; mp = mp->next) {
+ if (syslinux_add_memmap(&tmap, mp->dst, mp->len, SMT_ALLOC)) {
+ syslinux_free_memmap(tmap);
+ return NULL;
+ }
+ }
+
+ return tmap;
}
diff --git a/com32/lib/syslinux/shuffle_pm.c b/com32/lib/syslinux/shuffle_pm.c
index d19d01bb..c9bc0407 100644
--- a/com32/lib/syslinux/shuffle_pm.c
+++ b/com32/lib/syslinux/shuffle_pm.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -46,24 +47,38 @@ int syslinux_shuffle_boot_pm(struct syslinux_movelist *fraglist,
int nd;
com32sys_t ireg;
char *regbuf;
+ uint8_t handoff_code[9*5], *p;
+ const uint32_t *rp;
+ int i, rv;
+ struct syslinux_memmap *tmap;
+ addr_t regstub, stublen, safe;
- nd = syslinux_prepare_shuffle(fraglist, memmap);
- if (nd < 0)
+ tmap = syslinux_target_memmap(fraglist, memmap);
+ if (!tmap)
return -1;
- regbuf = (char *)__com32.cs_bounce + (12*nd);
- memcpy(regbuf, regs, sizeof(*regs));
+ regstub = 0x800; /* Locate anywhere above this point */
+ stublen = sizeof handoff_code;
+ rv = syslinux_memmap_find(tmap, SMT_FREE, &regstub, &stublen);
+ syslinux_free_memmap(tmap);
+ if (rv)
+ return -1;
- memset(&ireg, 0, sizeof ireg);
+ /* Build register-setting stub */
+ p = handoff_code;
+ rp = (const uint32_t *)regs;
+ for (i = 0; i < 8; i++) {
+ *p = 0xb8 + i; /* MOV gpr,imm32 */
+ *(uint32_t *)(p+1) = *rp++;
+ p += 5;
+ }
+ *p = 0xe9; /* JMP */
+ *(uint32_t *)(p+1) = regs->eip - regstub - sizeof handoff_code;
- ireg.eax.w[0] = 0x001a;
- ireg.edx.w[0] = bootflags;
- ireg.es = SEG(__com32.cs_bounce);
- ireg.edi.l = OFFS(__com32.cs_bounce);
- ireg.ecx.l = nd;
- ireg.ds = SEG(regbuf);
- ireg.esi.l = OFFS(regbuf);
- __intcall(0x22, &ireg, NULL);
+ /* Add register-setting stub to shuffle list */
+ if (syslinux_add_movelist(&fraglist, regstub, (addr_t)handoff_code,
+ sizeof handoff_code))
+ return -1;
- return -1; /* Too many descriptors? */
+ return syslinux_do_shuffle(fraglist, memmap, regstub, 1, bootflags);
}
diff --git a/com32/lib/syslinux/shuffle_rm.c b/com32/lib/syslinux/shuffle_rm.c
index e9226a82..4f424f3f 100644
--- a/com32/lib/syslinux/shuffle_rm.c
+++ b/com32/lib/syslinux/shuffle_rm.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -46,24 +47,72 @@ int syslinux_shuffle_boot_rm(struct syslinux_movelist *fraglist,
int nd;
com32sys_t ireg;
char *regbuf;
+ const struct syslinux_rm_regs_alt {
+ uint16_t seg[6];
+ uint32_t gpr[8];
+ uint32_t csip;
+ } *rp;
+ int i, rv;
+ uint8_t handoff_code[5*5+8*6+5], *p;
+ struct syslinux_memmap *tmap, *tp;
+ addr_t regstub;
- nd = syslinux_prepare_shuffle(fraglist, memmap);
- if (nd < 0)
+ tmap = syslinux_target_memmap(fraglist, memmap);
+ if (!tmap)
return -1;
- regbuf = (char *)__com32.cs_bounce + (12*nd);
- memcpy(regbuf, regs, sizeof(*regs));
+ /* Search for a good place to put the real-mode register stub.
+ We prefer to put it as high as possible in the low 640K. */
+ regstub = 0;
+ for (tp = tmap; tp->type != SMT_END; tp = tp->next) {
+ addr_t xend, xlen;
+ if (tp->start >= 640*1024)
+ continue;
+ if (tp->type != SMT_FREE)
+ continue;
+ xend = tp->next->start;
+ if (xend > 640*1024)
+ xend = 640*1024;
+ xlen = xend - tp->start;
+ if (xlen < sizeof handoff_code)
+ continue;
+ regstub = xend - sizeof handoff_code; /* Best alternative so far */
+ }
- memset(&ireg, 0, sizeof ireg);
+ syslinux_free_memmap(tmap);
- ireg.eax.w[0] = 0x001b;
- ireg.edx.w[0] = bootflags;
- ireg.es = SEG(__com32.cs_bounce);
- ireg.edi.l = OFFS(__com32.cs_bounce);
- ireg.ecx.l = nd;
- ireg.ds = SEG(regbuf);
- ireg.esi.l = OFFS(regbuf);
- __intcall(0x22, &ireg, NULL);
+ /* XXX: it might be possible to do something insane here like
+ putting the stub in the IRQ vectors... */
+ if (!regstub)
+ return -1; /* No space at all */
- return -1; /* Too many descriptors? */
+ /* Build register-setting stub */
+ p = handoff_code;
+ rp = (const struct syslinux_rm_regs_alt *)regs;
+ for (i = 0; i < 6; i++) {
+ if (i != 1) { /* Skip CS */
+ p[0] = 0xb8; /* MOV AX,imm16 */
+ *(uint16_t *)(p+1) = rp->seg[i];
+ *(uint16_t *)(p+3) = 0xc08e + (i << 11); /* MOV seg,AX */
+ p += 5;
+ }
+ }
+ for (i = 0; i < 8; i++) {
+ p[0] = 0x66; /* MOV exx,imm32 */
+ p[1] = 0xb8 + i;
+ *(uint32_t *)(p+2) = rp->gpr[i];
+ p += 6;
+ }
+ *p++ = 0xea; /* JMP FAR */
+ *(uint32_t *)p = rp->csip;
+
+ /* Add register-setting stub to shuffle list */
+ if (syslinux_add_movelist(&fraglist, regstub, (addr_t)handoff_code,
+ sizeof handoff_code))
+ return -1;
+
+ /* Convert regstub to a CS:IP entrypoint pair */
+ regstub = (SEG((void *)regstub) << 16) + OFFS((void *)regstub);
+
+ return syslinux_do_shuffle(fraglist, memmap, regstub, 0, bootflags);
}
diff --git a/com32/lib/syslinux/zonelist.c b/com32/lib/syslinux/zonelist.c
index 62b1cf3e..e3036b1a 100644
--- a/com32/lib/syslinux/zonelist.c
+++ b/com32/lib/syslinux/zonelist.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -201,6 +202,34 @@ int syslinux_memmap_largest(struct syslinux_memmap *list,
}
/*
+ * Find the first (lowest address) zone of a specific type and of
+ * a certain minimum size, with an optional starting address.
+ * The input values of start and len are used as minima.
+ */
+int syslinux_memmap_find(struct syslinux_memmap *list,
+ enum syslinux_memmap_types type,
+ addr_t *start, addr_t *len)
+{
+ addr_t min_start = *start;
+ addr_t min_len = *len;
+
+ while (list->type != SMT_END) {
+ if (list->type == type && list->next->start > min_start) {
+ addr_t xstart = min_start > list->start ? min_start : list->start;
+ addr_t xlen = list->next->start - xstart;
+ if (xlen >= min_len) {
+ *start = xstart;
+ *len = xlen;
+ return 0;
+ }
+ }
+ list = list->next;
+ }
+
+ return -1; /* Not found */
+}
+
+/*
* Free a zonelist.
*/
void syslinux_free_memmap(struct syslinux_memmap *list)
diff --git a/com32/menu/Makefile b/com32/menu/Makefile
index d6293bbd..2a032728 100644
--- a/com32/menu/Makefile
+++ b/com32/menu/Makefile
@@ -44,6 +44,6 @@ spotless: clean
rm -f *.lss *.c32 *.com
rm -f *~ \#*
-install: all
+install:
-include .*.d
diff --git a/com32/menu/menu.h b/com32/menu/menu.h
index e2ffc1bc..43f65947 100644
--- a/com32/menu/menu.h
+++ b/com32/menu/menu.h
@@ -174,6 +174,7 @@ extern struct menu *root_menu, *start_menu, *hide_menu, *menu_list;
/* These are global parameters regardless of which menu we're displaying */
extern int shiftkey;
extern int hiddenmenu;
+extern bool menusave;
extern long long totaltimeout;
void parse_configs(char **argv);
diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c
index f7af90aa..c3da97e4 100644
--- a/com32/menu/menumain.c
+++ b/com32/menu/menumain.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,6 +28,7 @@
#include <setjmp.h>
#include <limits.h>
#include <com32.h>
+#include <syslinux/adv.h>
#include "menu.h"
@@ -875,6 +877,13 @@ run_menu(void)
break;
}
}
+ if (done && !me->passwd) {
+ /* Only save a new default if we don't have a password... */
+ if (menusave && me->label) {
+ syslinux_setadv(ADV_MENUSAVE, strlen(me->label), me->label);
+ syslinux_adv_write();
+ }
+ }
break;
case KEY_UP:
diff --git a/com32/menu/readconfig.c b/com32/menu/readconfig.c
index 01dadff9..768591d9 100644
--- a/com32/menu/readconfig.c
+++ b/com32/menu/readconfig.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2004-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -11,6 +12,7 @@
* ----------------------------------------------------------------------- */
#include <stdio.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <minmax.h>
@@ -18,6 +20,7 @@
#include <inttypes.h>
#include <colortbl.h>
#include <com32.h>
+#include <syslinux/adv.h>
#include <syslinux/config.h>
#include "menu.h"
@@ -32,6 +35,7 @@ struct menu *root_menu, *start_menu, *hide_menu, *menu_list;
int shiftkey = 0; /* Only display menu if shift key pressed */
int hiddenmenu = 0;
long long totaltimeout = 0;
+bool menusave = false;
/* Keep track of global default */
static int has_ui = 0; /* DEFAULT only counts if UI is found */
@@ -667,6 +671,8 @@ static void parse_config_file(FILE *f)
}
} else if ( looking_at(p, "shiftkey") ) {
shiftkey = 1;
+ } else if ( looking_at(p, "save") ) {
+ menusave = true;
} else if ( looking_at(p, "onerror") ) {
refstr_put(m->onerror);
m->onerror = refstrdup(skipspace(p+7));
@@ -1025,6 +1031,23 @@ void parse_configs(char **argv)
}
}
+ /* If "menu save" is active, let the ADV override the global default */
+ if (menusave) {
+ size_t len;
+ const char *lbl = syslinux_getadv(ADV_MENUSAVE, &len);
+ char *lstr;
+ if (lbl && len) {
+ lstr = refstr_alloc(len);
+ memcpy(lstr, lbl, len); /* refstr_alloc() adds the final null */
+ me = find_label(lstr);
+ if (me && me->menu != hide_menu) {
+ me->menu->defentry = me->entry;
+ start_menu = me->menu;
+ }
+ refstr_put(lstr);
+ }
+ }
+
/* Final per-menu initialization, with all labels known */
for (m = menu_list; m; m = m->next) {
m->curentry = m->defentry; /* All menus start at their defaults */
diff --git a/com32/modules/Makefile b/com32/modules/Makefile
index 305ea49f..ba76268f 100644
--- a/com32/modules/Makefile
+++ b/com32/modules/Makefile
@@ -1,6 +1,7 @@
## -----------------------------------------------------------------------
##
## Copyright 2001-2009 H. Peter Anvin - All Rights Reserved
+## Copyright 2009 Intel Corporation; author: H. Peter Anvin
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -53,6 +54,6 @@ spotless: clean
rm -f *.lss *.c32 *.com
rm -f *~ \#*
-install: all
+install:
-include .*.d
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 979ede2d..ead908f2 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2003-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2003-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -446,79 +447,15 @@ static void do_boot(void *boot_sector, size_t boot_size,
return;
}
- if (loadbase < 0x7c00) {
- /* Special hack: if we are to be loaded below 0x7c00, we need to handle
- the part that goes below 0x7c00 specially, since that's where the
- shuffler lives. To deal with that, stuff the balance at the end
- of low memory and put a small copy stub there.
-
- The only tricky bit is that we need to set up registers for our
- move, and then restore them to what they should be at the end of
- the code. */
- static uint8_t copy_down_code[] = {
- 0xf3,0x66,0xa5, /* 00: rep movsd */
- 0xbe,0,0, /* 03: mov si,0 */
- 0xbf,0,0, /* 06: mov di,0 */
- 0x8e,0xde, /* 09: mov ds,si */
- 0x8e,0xc7, /* 0b: mov es,di */
- 0x66,0xb9,0,0,0,0, /* 0d: mov ecx,0 */
- 0x66,0xbe,0,0,0,0, /* 13: mov esi,0 */
- 0x66,0xbf,0,0,0,0, /* 19: mov edi,0 */
- 0xea,0,0,0,0, /* 1f: jmp 0:0 */
- /* pad out to segment boundary */
- 0x90,0x90,0x90,0x90, /* 24: ... */
- 0x90,0x90,0x90,0x90, /* 28: ... */
- 0x90,0x90,0x90,0x90, /* 2c: ... */
- };
- size_t low_size = min(boot_size, 0x7c00-loadbase);
- size_t high_size = boot_size - low_size;
- size_t low_addr = (0x7c00 + high_size + 15) & ~15;
- size_t move_addr = (low_addr + low_size + 15) & ~15;
- const size_t move_size = sizeof copy_down_code;
-
- if (move_addr+move_size >= dosmem-0x7c00)
- goto too_big;
-
- *(uint16_t *)&copy_down_code[0x04] = regs->ds;
- *(uint16_t *)&copy_down_code[0x07] = regs->es;
- *(uint32_t *)&copy_down_code[0x0f] = regs->ecx.l;
- *(uint32_t *)&copy_down_code[0x15] = regs->esi.l;
- *(uint32_t *)&copy_down_code[0x1b] = regs->edi.l;
- *(uint16_t *)&copy_down_code[0x20] = regs->ip;
- *(uint16_t *)&copy_down_code[0x22] = regs->cs;
-
- regs->ecx.l = (low_size+3) >> 2;
- regs->esi.l = 0;
- regs->edi.l = loadbase & 15;
- regs->ds = low_addr >> 4;
- regs->es = loadbase >> 4;
- regs->cs = move_addr >> 4;
- regs->ip = 0;
-
- endimage = move_addr + move_size;
-
- if (high_size)
- if (syslinux_add_movelist(&mlist, 0x7c00,
- (addr_t)boot_sector+low_size, high_size))
- goto enomem;
- if (syslinux_add_movelist(&mlist, low_addr,
- (addr_t)boot_sector, low_size))
- goto enomem;
- if (syslinux_add_movelist(&mlist, move_addr,
- (addr_t)copy_down_code, move_size))
- goto enomem;
- } else {
- /* Nothing below 0x7c00, much simpler... */
+ /* Nothing below 0x7c00, much simpler... */
- if (boot_size >= dosmem-0x7c00)
+ if (boot_size >= dosmem - loadbase)
goto too_big;
- endimage = loadbase + boot_size;
+ endimage = loadbase + boot_size;
- if (syslinux_add_movelist(&mlist, loadbase, (addr_t)boot_sector,
- boot_size))
- goto enomem;
- }
+ if (syslinux_add_movelist(&mlist, loadbase, (addr_t)boot_sector, boot_size))
+ goto enomem;
if (opt.swap && driveno != swapdrive) {
static const uint8_t swapstub_master[] = {
diff --git a/com32/modules/kbdmap.c b/com32/modules/kbdmap.c
index 866acfc2..7e36a35d 100644
--- a/com32/modules/kbdmap.c
+++ b/com32/modules/kbdmap.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/com32/rosh/Makefile b/com32/rosh/Makefile
index 30dc7d39..3895cd89 100644
--- a/com32/rosh/Makefile
+++ b/com32/rosh/Makefile
@@ -33,6 +33,6 @@ spotless: clean
rm -f *.lss *.c32 *.com
rm -f *~ \#*
-install: # Don't install samples
+install:
-include .*.d