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>
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");