summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-06-07 14:36:07 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-06-07 14:37:30 -0700
commit3c017ec01c02cb4b7e7bae2c93c5e3d8c878592d (patch)
tree6d2be8c260c82fb792c47fa22a600571aeb51358
parent327c0dadf173e09348b967746925e995b2b6dfaf (diff)
downloadsyslinux-3c017ec01c02cb4b7e7bae2c93c5e3d8c878592d.tar.gz
memdisk: pass in the address of the real-mode code
Pass in the address of the real-mode code instead of hard-coding it in two separate places. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--memdisk/memdisk.h3
-rw-r--r--memdisk/memdisk16.asm1
-rw-r--r--memdisk/setup.c5
3 files changed, 4 insertions, 5 deletions
diff --git a/memdisk/memdisk.h b/memdisk/memdisk.h
index 1ab2c000..cf4a1e99 100644
--- a/memdisk/memdisk.h
+++ b/memdisk/memdisk.h
@@ -24,9 +24,6 @@
/* We use the com32 interface for calling 16-bit code */
#include <com32.h>
-/* The real-mode segment */
-#define LOW_SEG 0x0800
-
#define __cdecl __attribute__((cdecl,regparm(0)))
typedef void (*syscall_t) (uint8_t, com32sys_t *, com32sys_t *);
diff --git a/memdisk/memdisk16.asm b/memdisk/memdisk16.asm
index d43404e8..4f0659bb 100644
--- a/memdisk/memdisk16.asm
+++ b/memdisk/memdisk16.asm
@@ -614,6 +614,7 @@ call32_call_start:
; Now everything is set up for interrupts...
+ push dword CS_BASE ; Segment base
push dword (BOUNCE_SEG << 4) ; Bounce buffer address
push dword call32_syscall+CS_BASE ; Syscall entry point
sti ; Interrupts OK now
diff --git a/memdisk/setup.c b/memdisk/setup.c
index 7e0ebc93..82ab23eb 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -153,7 +153,7 @@ struct setup_header {
uint32_t edx;
};
-struct setup_header *const shdr = (struct setup_header *)(LOW_SEG << 4);
+struct setup_header *shdr;
/* Access to high memory */
@@ -701,7 +701,7 @@ static uint32_t pnp_install_check(void)
__cdecl syscall_t syscall;
void *sys_bounce;
-__cdecl void setup(__cdecl syscall_t cs_syscall, void *cs_bounce)
+__cdecl void setup(__cdecl syscall_t cs_syscall, void *cs_bounce, void *base)
{
unsigned int bin_size;
char *memdisk_hook;
@@ -722,6 +722,7 @@ __cdecl void setup(__cdecl syscall_t cs_syscall, void *cs_bounce)
/* Set up global variables */
syscall = cs_syscall;
sys_bounce = cs_bounce;
+ shdr = base;
/* Show signs of life */
printf("%s %s\n", memdisk_version, copyright);