aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-04 17:22:27 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-04 17:22:27 -0700
commit7be7457989ab10f75383d3b1e776d4db013ac405 (patch)
tree070c6d26c3ada685e7714e178f87ba7d11b0acf3
parentfb41a8cb8c851e894fb9441f3dce80b2dffa4849 (diff)
downloadsyslinux-7be7457989ab10f75383d3b1e776d4db013ac405.tar.gz
syslinux-7be7457989ab10f75383d3b1e776d4db013ac405.tar.xz
syslinux-7be7457989ab10f75383d3b1e776d4db013ac405.zip
linux.c32: cap the stack pointer to 0xfff0
Linux itself is fine with sp = 0 for a 64K segment, but perhaps other things aren't. Just to be safe, set the stack pointer to 64K-16 bytes. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/lib/syslinux/load_linux.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/com32/lib/syslinux/load_linux.c b/com32/lib/syslinux/load_linux.c
index 6380149e..82cef8be 100644
--- a/com32/lib/syslinux/load_linux.c
+++ b/com32/lib/syslinux/load_linux.c
@@ -483,7 +483,8 @@ int syslinux_boot_linux(void *kernel_buf, size_t kernel_size,
regs.es = regs.ds = regs.ss = regs.fs = regs.gs = real_mode_base >> 4;
regs.cs = (real_mode_base >> 4)+0x20;
/* regs.ip = 0; */
- regs.esp.w[0] = cmdline_offset;
+ /* Linux is OK with sp = 0 = 64K, but perhaps other things aren't... */
+ regs.esp.w[0] = min(cmdline_offset, 0xfff0);
#if DEBUG
dprintf("Final memory map:\n");