diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-06-07 14:44:30 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-06-07 14:44:30 -0700 |
commit | f6665369b2ccf30bbb334b7ff20ebaac07c10a3e (patch) | |
tree | d3e2db484a01620ed5ef01ca73cdc2edf23c4400 | |
parent | 3c017ec01c02cb4b7e7bae2c93c5e3d8c878592d (diff) | |
download | syslinux.git-f6665369b2ccf30bbb334b7ff20ebaac07c10a3e.tar.gz syslinux.git-f6665369b2ccf30bbb334b7ff20ebaac07c10a3e.tar.xz syslinux.git-f6665369b2ccf30bbb334b7ff20ebaac07c10a3e.zip |
memdisk: don't hard-code 0:7C00 as the entry point
Make it possible for the setup code to override SS:SP and CS:IP.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | memdisk/memdisk16.asm | 8 | ||||
-rw-r--r-- | memdisk/setup.c | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/memdisk/memdisk16.asm b/memdisk/memdisk16.asm index 4f0659bb..b21c8b80 100644 --- a/memdisk/memdisk16.asm +++ b/memdisk/memdisk16.asm @@ -78,6 +78,8 @@ ramdisk_max dd 0xffffffff ; Highest allowed ramdisk address ; b_esdi dd 0 ; ES:DI for boot sector invocation b_edx dd 0 ; EDX for boot sector invocation +b_sssp dd 0 ; SS:SP on boot sector invocation +b_csip dd 0 ; CS:IP on boot sector invocation section .rodata memdisk_version: @@ -153,9 +155,9 @@ copy_cmdline: mov ds,si ; Make all the segments consistent mov fs,si mov gs,si - mov ss,si - mov esp,0x7C00 ; Good place for SP to start out - call 0:0x7C00 + lss sp,[cs:b_sssp] + movzx esp,sp + call far [cs:b_csip] int 18h ; A far return -> INT 18h ; diff --git a/memdisk/setup.c b/memdisk/setup.c index 82ab23eb..35ff54c4 100644 --- a/memdisk/setup.c +++ b/memdisk/setup.c @@ -151,6 +151,8 @@ struct setup_header { uint32_t initrd_addr_max; uint32_t esdi; uint32_t edx; + uint32_t sssp; + uint32_t csip; }; struct setup_header *shdr; @@ -1086,5 +1088,7 @@ __cdecl void setup(__cdecl syscall_t cs_syscall, void *cs_bounce, void *base) /* On return the assembly code will jump to the boot vector */ shdr->esdi = pnp_install_check(); - shdr->edx = geometry->driveno; + shdr->edx = geometry->driveno; + shdr->sssp = 0x7c00; + shdr->csip = 0x7c00; } |