summaryrefslogtreecommitdiff
path: root/memdisk
diff options
context:
space:
mode:
Diffstat (limited to 'memdisk')
-rw-r--r--memdisk/Makefile2
-rw-r--r--memdisk/memdisk.asm11
-rw-r--r--memdisk/memdisk.doc8
-rw-r--r--memdisk/setup.c24
4 files changed, 35 insertions, 10 deletions
diff --git a/memdisk/Makefile b/memdisk/Makefile
index 1eebe637..72234cab 100644
--- a/memdisk/Makefile
+++ b/memdisk/Makefile
@@ -17,7 +17,7 @@ gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \
M32 := $(call gcc_ok,-m32,)
ALIGN := $(call gcc_ok,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
-FREE := $(call gcc_ok,-ffreestanding,)
+FREE := $(call gcc_ok,-ffreestanding,) $(call gcc_ok,-fno-stack-protector,)
CC = gcc
CFLAGS = $(M32) $(FREE) -g -W -Wall -Wno-sign-compare \
diff --git a/memdisk/memdisk.asm b/memdisk/memdisk.asm
index 09055d8f..1d3d39de 100644
--- a/memdisk/memdisk.asm
+++ b/memdisk/memdisk.asm
@@ -6,7 +6,7 @@
; A program to emulate an INT 13h disk BIOS from a "disk" in extended
; memory.
;
-; Copyright (C) 2001-2006 H. Peter Anvin
+; Copyright (C) 2001-2007 H. Peter Anvin
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
@@ -152,8 +152,8 @@ Int13Start:
mov bp,sp ; Point BP to the entry stack frame
TRACER 'F'
; Note: AH == P_AH here
- cmp ah,Int13FuncsMax
- jae Invalid_jump
+ cmp ah,[Int13MaxFunc]
+ ja Invalid_jump
xor al,al ; AL = 0 is standard entry condition
mov di,ax
shr di,7 ; Convert AH to an offset in DI
@@ -870,7 +870,7 @@ Int13Funcs dw Reset ; 00h - RESET
%endif
Int13FuncsEnd equ $
-Int13FuncsMax equ (Int13FuncsEnd-Int13Funcs) >> 1
+Int13FuncsCnt equ (Int13FuncsEnd-Int13Funcs) >> 1
%if EDD
EDD_DPT:
@@ -933,8 +933,9 @@ OldInt15 dd 0 ; INT 15h in chain
OldDosMem dw 0 ; Old position of DOS mem end
BootLoaderID db 0 ; Boot loader ID from header
; ---- MDI structure ends here ---
- db 0, 0, 0 ; pad
+Int13MaxFunc db Int13FuncsCnt-1 ; Max INT 13h function (to disable EDD)
+ db 0, 0 ; pad
MemInt1588 dw 0 ; 1MB-65MB memory amount (1K)
Cylinders dw 0 ; Cylinder count
diff --git a/memdisk/memdisk.doc b/memdisk/memdisk.doc
index fdcc259e..759a7b27 100644
--- a/memdisk/memdisk.doc
+++ b/memdisk/memdisk.doc
@@ -89,6 +89,12 @@ d) MEMDISK normally uses the BIOS "INT 15h mover" API to access high
safeint Use INT 15h access to protected memory, but invoke
INT 15h the way it was *before* MEMDISK was loaded.
+e) MEMDISK by default supports EDD/EBIOS on hard disks, but not on
+ floppy disks. This can be controlled with the options:
+
+ edd Enable EDD/EBIOS
+ noedd Disable EDD/EBIOS
+
Some interesting things to note:
@@ -136,7 +142,7 @@ http://www.ctyme.com/rbrown.htm, for a detailed description.
The MEMDISK info structure currently contains:
- [ES:DI] word Total size of structure (currently 27 bytes)
+ [ES:DI] word Total size of structure (currently 28 bytes)
[ES:DI+2] byte MEMDISK minor version
[ES:DI+3] byte MEMDISK major version
[ES:DI+4] dword Pointer to MEMDISK data in high memory
diff --git a/memdisk/setup.c b/memdisk/setup.c
index 8c83f039..d1eabc58 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -70,8 +70,10 @@ struct patch_area {
uint16_t olddosmem;
uint8_t bootloaderid;
+ uint8_t maxint13func;
+#define MAXINT13_NOEDD 0x16
- uint8_t _pad[3];
+ uint8_t _pad[2];
uint16_t memint1588;
uint16_t cylinders;
@@ -552,6 +554,7 @@ void setup(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 */
/* Set up global variables */
syscall = cs_syscall;
@@ -579,11 +582,22 @@ void setup(syscall_t cs_syscall, void *cs_bounce)
geometry = get_disk_image_geometry(ramdisk_image, ramdisk_size);
- printf("Disk is %s %d, %u K, C/H/S = %u/%u/%u\n",
+ if (getcmditem("edd") != CMD_NOTFOUND ||
+ getcmditem("ebios") != CMD_NOTFOUND)
+ do_edd = 1;
+ else if (getcmditem("noedd") != CMD_NOTFOUND ||
+ getcmditem("noebios") != CMD_NOTFOUND ||
+ getcmditem("cbios") != CMD_NOTFOUND)
+ do_edd = 0;
+ else
+ do_edd = (geometry->driveno & 0x80) ? 1 : 0;
+
+ printf("Disk is %s %d, %u K, C/H/S = %u/%u/%u, EDD %s\n",
(geometry->driveno & 0x80) ? "hard disk" : "floppy",
geometry->driveno & 0x7f,
geometry->sectors >> 1,
- geometry->c, geometry->h, geometry->s);
+ geometry->c, geometry->h, geometry->s,
+ do_edd ? "on" : "off");
/* Reserve the ramdisk memory */
insertrange(ramdisk_image, ramdisk_size, 2);
@@ -633,6 +647,10 @@ void setup(syscall_t cs_syscall, void *cs_bounce)
pptr->configflags |= CONFIG_BIGRAW|CONFIG_RAW;
}
+ /* 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 */