It looks like MSDOS 6 wants the UMB area to be read-only in order for it to use it. FreeDOS doesn't care, but it always maps a page from high mem when it does use the area. So, add an option to control whether unused UMB ram is marked read-only and default it to read-only as that seems to be more compatible.
This also fixes an off-by-one bug in the shadow range checking code.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/Kconfig | 12 ++++++++++++ src/shadow.c | 8 +++++--- 2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/Kconfig b/src/Kconfig index 5e2db8b..3a4d580 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -362,6 +362,18 @@ menu "BIOS interfaces" default n help Disable A20 on 16bit boot. + + config WRITABLE_UPPERMEMORY + depends on QEMU + bool "Make unused UMB memory read/writeable." + default n + help + When selected, the "Upper Memory Block" area + (0x90000-0xa0000) that is not used for option roms will be + made writable. This allows the ram to be directly + modified by programs. However, some old DOS high memory + managers may require the UMB region to be read-only. + endmenu
menu "BIOS Tables" diff --git a/src/shadow.c b/src/shadow.c index 967eb8e..242f220 100644 --- a/src/shadow.c +++ b/src/shadow.c @@ -80,13 +80,15 @@ make_bios_readonly_intel(u16 bdf, u32 pam0) wbinvd();
// Write protect roms from 0xc0000-0xf0000 - u32 romend = rom_get_last(), romtop = rom_get_max(); + u32 romlast = BUILD_BIOS_ADDR, rommax = rom_get_max(); + if (CONFIG_WRITABLE_UPPERMEMORY) + romlast = rom_get_last(); int i; for (i=0; i<6; i++) { u32 mem = BUILD_ROM_START + i * 32*1024; u32 pam = pam0 + 1 + i; - if (romend <= mem + 16*1024 || romtop <= mem + 32*1024) { - if (romend > mem && romtop > mem + 16*1024) + if (romlast < mem + 16*1024 || rommax < mem + 32*1024) { + if (romlast >= mem && rommax >= mem + 16*1024) pci_config_writeb(bdf, pam, 0x31); break; }