From 7be7457989ab10f75383d3b1e776d4db013ac405 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 4 May 2009 17:22:27 -0700 Subject: [PATCH] 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 --- com32/lib/syslinux/load_linux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/com32/lib/syslinux/load_linux.c b/com32/lib/syslinux/load_linux.c index 6380149..82cef8b 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"); -- 2.7.4