summaryrefslogtreecommitdiff
path: root/memdisk
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-01-30 17:57:07 -0800
committerH. Peter Anvin <hpa@zytor.com>2007-01-30 17:57:07 -0800
commit4487bada1a0997294e70cd418c74a53047cf784e (patch)
treee015c26892a9474292ea95c9eb36a575cc574352 /memdisk
parent444ed7bd95a3dcd130a9f9ca06e1a85f3203ccc2 (diff)
downloadsyslinux-4487bada1a0997294e70cd418c74a53047cf784e.tar.gz
MEMDISK: Default to floppy = EDD off, hard disk = EDD on, give option
Default to having EDD off on floppies and EDD on on hard disks. Additionally, add options "edd" and "noedd" to force this choice.
Diffstat (limited to 'memdisk')
-rw-r--r--memdisk/memdisk.asm11
-rw-r--r--memdisk/memdisk.doc8
-rw-r--r--memdisk/setup.c21
3 files changed, 31 insertions, 9 deletions
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..70dc1d65 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,19 @@ 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)
+ do_edd = 1;
+ else if (getcmditem("noedd") != 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 +644,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 */