aboutsummaryrefslogtreecommitdiffstats
path: root/memdisk
diff options
context:
space:
mode:
authorShao Miller <shao.miller@yrdsb.edu.on.ca>2009-03-08 23:54:43 -0400
committerH. Peter Anvin <hpa@zytor.com>2009-03-08 22:53:22 -0700
commit1e5b612846943b32152cd4b639cef894b6f81e22 (patch)
tree230dc97538bb109866f54973b929ac59179013e1 /memdisk
parent9c8898254752a8d29331ab838bb9794904a3f707 (diff)
downloadsyslinux.git-1e5b612846943b32152cd4b639cef894b6f81e22.tar.gz
syslinux.git-1e5b612846943b32152cd4b639cef894b6f81e22.tar.xz
syslinux.git-1e5b612846943b32152cd4b639cef894b6f81e22.zip
memdisk varieties: Allow for multiple memdisk installable hooks
This patch "sets the stage" for the memdisk kernel to include different "installables": versions of the memdisk hooks. This patch splits the case of the EDD-compiled hook from the non-EDD-compiled hook. Both are available inside the kernel, and the kernel chooses which one to install based on the command-line. It's possible that other, slightly modified versions of the memdisk hook could be useful to have...
Diffstat (limited to 'memdisk')
-rw-r--r--memdisk/Makefile14
-rw-r--r--memdisk/memdisk.inc (renamed from memdisk/memdisk.asm)2
-rw-r--r--memdisk/memdisk_chs.asm1
-rw-r--r--memdisk/memdisk_edd.asm2
-rw-r--r--memdisk/setup.c33
5 files changed, 32 insertions, 20 deletions
diff --git a/memdisk/Makefile b/memdisk/Makefile
index 37767310..54b08ba3 100644
--- a/memdisk/Makefile
+++ b/memdisk/Makefile
@@ -20,7 +20,7 @@ LDFLAGS = $(GCCOPT) -g
INCLUDE = -I$(topdir)/com32/include
NASM = nasm
NASMOPT = -O9999
-NFLAGS = -dDATE='"$(DATE)"' -dWITH_EDD
+NFLAGS = -dDATE='"$(DATE)"'
NINCLUDE =
SRCS = $(wildcard *.asm *.c *.h)
@@ -38,11 +38,11 @@ endif
# Important: init.o16 must be first!!
OBJS16 = init.o16 init32.o
OBJS32 = start32.o setup.o msetup.o e820func.o conio.o memcpy.o memset.o \
- unzip.o memdisk.o
+ unzip.o memdisk_chs.o memdisk_edd.o
CSRC = setup.c msetup.c e820func.c conio.c unzip.c
SSRC = start32.S memcpy.S memset.S
-NASMSRC = memdisk.asm memdisk16.asm
+NASMSRC = memdisk_chs.asm memdisk_edd.asm memdisk16.asm
all: memdisk # e820test
@@ -56,7 +56,7 @@ clean: tidy
spotless: clean
rm -f memdisk .depend
-%.o: %.asm
+memdisk16.o: memdisk16.asm
$(NASM) $(NASMOPT) $(NFLAGS) $(NINCLUDE) -f elf -l $*.lst -o $@ $<
%.o: %.s
@@ -92,6 +92,9 @@ spotless: clean
%.bin: %.asm
$(NASM) -f bin $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $<
+memdisk_%.o: memdisk_%.bin
+ $(LD) -r -b binary -o $@ $<
+
memdisk16.elf: $(OBJS16)
$(LD) -Ttext 0 -o $@ $^
@@ -107,9 +110,6 @@ memdisk: memdisk16.bin memdisk32.bin postprocess.pl
e820test: e820test.c e820func.c msetup.c
$(CC) -m32 -g -W -Wall -DTEST -o $@ $^
-memdisk.o: memdisk.bin
- $(LD) -r -b binary -o $@ $<
-
.depend:
rm -f .depend
for csrc in *.c ; do $(CC) $(INCLUDE) $(CFLAGS) -MM $$csrc >> .depend ; done
diff --git a/memdisk/memdisk.asm b/memdisk/memdisk.inc
index 0d489614..2b5b4e06 100644
--- a/memdisk/memdisk.asm
+++ b/memdisk/memdisk.inc
@@ -1,7 +1,7 @@
; -*- fundamental -*- (asm-mode sucks)
; ****************************************************************************
;
-; memdisk.asm
+; memdisk.inc
;
; A program to emulate an INT 13h disk BIOS from a "disk" in extended
; memory.
diff --git a/memdisk/memdisk_chs.asm b/memdisk/memdisk_chs.asm
new file mode 100644
index 00000000..daa5c0a8
--- /dev/null
+++ b/memdisk/memdisk_chs.asm
@@ -0,0 +1 @@
+%include "memdisk.inc"
diff --git a/memdisk/memdisk_edd.asm b/memdisk/memdisk_edd.asm
new file mode 100644
index 00000000..97d3fe9a
--- /dev/null
+++ b/memdisk/memdisk_edd.asm
@@ -0,0 +1,2 @@
+%define WITH_EDD
+%include "memdisk.inc"
diff --git a/memdisk/setup.c b/memdisk/setup.c
index 7b1f4566..1cd5e116 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -22,8 +22,12 @@ const char memdisk_version[] =
const char copyright[] =
"Copyright " FIRSTYEAR "-" YEAR_STR " H. Peter Anvin";
-extern const char _binary_memdisk_bin_start[], _binary_memdisk_bin_end[];
-extern const char _binary_memdisk_bin_size[]; /* Weird, I know */
+extern const char _binary_memdisk_chs_bin_start[];
+extern const char _binary_memdisk_chs_bin_end[];
+extern const char _binary_memdisk_chs_bin_size[];
+extern const char _binary_memdisk_edd_bin_start[];
+extern const char _binary_memdisk_edd_bin_end[];
+extern const char _binary_memdisk_edd_bin_size[];
struct memdisk_header {
uint16_t int13_offs;
@@ -93,7 +97,6 @@ struct patch_area {
uint16_t dpt_ptr;
/* End of the official MemDisk_Info */
uint8_t maxint13func;
-#define MAXINT13_NOEDD 0x16
uint8_t _pad2;
uint16_t _pad3;
@@ -598,7 +601,8 @@ void *sys_bounce;
__cdecl void setup(__cdecl syscall_t cs_syscall, void *cs_bounce)
{
- unsigned int bin_size = (int) &_binary_memdisk_bin_size;
+ unsigned int bin_size;
+ char *memdisk_hook;
struct memdisk_header *hptr;
struct patch_area *pptr;
uint16_t driverseg;
@@ -610,7 +614,7 @@ __cdecl void setup(__cdecl syscall_t cs_syscall, void *cs_bounce)
com32sys_t regs;
uint32_t ramdisk_image, ramdisk_size;
int bios_drives;
- int do_edd = -1; /* -1 = default, 0 = no, 1 = yes */
+ int do_edd = 1; /* 0 = no, 1 = yes, default is yes */
int no_bpt; /* No valid BPT presented */
/* Set up global variables */
@@ -649,13 +653,22 @@ __cdecl void setup(__cdecl syscall_t cs_syscall, void *cs_bounce)
else
do_edd = (geometry->driveno & 0x80) ? 1 : 0;
+ /* Choose the appropriate installable memdisk hook */
+ if (do_edd) {
+ bin_size = (int) &_binary_memdisk_edd_bin_size;
+ memdisk_hook = (char *) &_binary_memdisk_edd_bin_start;
+ } else {
+ bin_size = (int) &_binary_memdisk_chs_bin_size;
+ memdisk_hook = (char *) &_binary_memdisk_chs_bin_start;
+ }
+
/* Reserve the ramdisk memory */
insertrange(ramdisk_image, ramdisk_size, 2, 1);
parse_mem(); /* Recompute variables */
/* Figure out where it needs to go */
- hptr = (struct memdisk_header *) &_binary_memdisk_bin_start;
- pptr = (struct patch_area *)(_binary_memdisk_bin_start + hptr->patch_offs);
+ hptr = (struct memdisk_header *) memdisk_hook;
+ pptr = (struct patch_area *)(memdisk_hook + hptr->patch_offs);
dosmem_k = rdz_16(BIOS_BASEMEM);
pptr->olddosmem = dosmem_k;
@@ -726,10 +739,6 @@ __cdecl void setup(__cdecl syscall_t cs_syscall, void *cs_bounce)
}
puts(" access to high memory\n");
- /* pptr->maxint13func defaults to EDD enabled, if compiled in */
- if (!do_edd)
- pptr->maxint13func = MAXINT13_NOEDD;
-
/* Set up a drive parameter table */
if ( geometry->driveno & 0x80 ) {
/* Hard disk */
@@ -898,7 +907,7 @@ __cdecl void setup(__cdecl syscall_t cs_syscall, void *cs_bounce)
hptr = (struct memdisk_header *)dpp;
/* Actually copy to low memory */
- dpp = mempcpy(dpp, &_binary_memdisk_bin_start, bin_size);
+ dpp = mempcpy(dpp, memdisk_hook, bin_size);
dpp = mempcpy(dpp, ranges, (nranges+1)*sizeof(ranges[0]));
dpp = mempcpy(dpp, shdr->cmdline, cmdlinelen+1);
}