aboutsummaryrefslogtreecommitdiffstats
path: root/com32/mboot/map.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-04-26 15:20:52 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-04-26 15:20:52 -0700
commitde782b90dbdae54602bfbe47a7fc41a135cac33f (patch)
treeea833acf86485b90f819a650ffdbca5dc4f14296 /com32/mboot/map.c
parentd7406d5c1233b28554756d533dafd1886a879073 (diff)
downloadsyslinux-de782b90dbdae54602bfbe47a7fc41a135cac33f.tar.gz
syslinux-de782b90dbdae54602bfbe47a7fc41a135cac33f.tar.xz
syslinux-de782b90dbdae54602bfbe47a7fc41a135cac33f.zip
mboot: set up a stack even though the spec doesn't require it
Set up a stack for the Multiboot OS even though it is not required by spec. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/mboot/map.c')
-rw-r--r--com32/mboot/map.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/com32/mboot/map.c b/com32/mboot/map.c
index c6290793..735cde61 100644
--- a/com32/mboot/map.c
+++ b/com32/mboot/map.c
@@ -280,7 +280,25 @@ int map_image(void *ptr, size_t len)
return -1;
}
+/*
+ * Set up a stack. This isn't actually required by the spec, but it seems
+ * like a prudent thing to do. Also, put enough zeros at the top of the
+ * stack that something that looks for an ELF invocation record will know
+ * there isn't one.
+ */
+static void mboot_map_stack(void)
+{
+ addr_t start, len;
+
+ if (syslinux_memmap_largest(amap, SMT_FREE, &start, &len) || len < 64)
+ return; /* Not much we can do, here... */
+
+ regs.esp = (start+len-32) & ~7;
+ syslinux_add_memmap(&mmap, regs.esp, 32, SMT_ZERO);
+}
+
void mboot_run(int bootflags)
{
+ mboot_map_stack();
syslinux_shuffle_boot_pm(ml, mmap, bootflags, &regs);
}