Memory management FAQ

Eric Auer <[email protected]>
Newsgroups gmane.os.freedos.devel
Message-ID <[email protected]>
Hi everybody, as requested by Lyn@...:
The phantastic FreeDOS memory management FAQ !

So you want to use > 640k of RAM with your DOS? Then read on...

If you want to load drivers and programs high, you need UMB.
If you want to load the kernel high as well (partially), you need HMA.
If your programs want XMS memory (common way to use > 1 MB of RAM for
   DOS programS), you need XMS (gosh :-)).
If your programs want EMS memory, you need EMS. EMS is a "classic" way
   for this: There were EMS memory boards for very old PCs, but now-
   adays, you use an EMS emulator, an "emm386". Or XMS, of course.
   However, some programs cannot use both (EMS and XMS) but only one of
   them, so you need to offer the needed type of memory to them.
If you are running an "emm386", your DOS will run in a "task" under some
   protected mode kernel implemented by emm386. This means that DOS no
   longer has full control over the PC. However, it is needed to offer
   EMS in an elegant way, and sometimes for UMB, too. Read below.
If you are running a program that uses protected mode, normal drivers do
   not cause problems. HOWEVER, emm386 type drivers need to offer a back-
   door called VCPI to allow protected mode access while emm386 is running.
   If you run an emm386 without the backdoor, you cannot use protected mode.
If your program mentions something about "DOS extender" and/or "DPMI", it
   is usually a program that needs protected mode. A DOS extender is some-
   thing that allows protected mode programs to have easy access to normal
   DOS functions (DOS does not run in protected mode, as you remember: The
   "task" where DOS runs if emm386 is active is a simulation of "real mode"
   (unprotected mode, so to say), kind of a virtual 8086 CPU, but with the
   32bit stuff still available. However, in the "DOS task", 32bit addressing
   is NOT available, and this is why our "extended friends" need to use the
   VCPI backdoor to get into full protected mode. Without emm386 running,
   the 32bit addressing is available "enough" for those programs to get into
   protected mode without further help. By the way, DPMI is kind of a
   protected mode toolkit that makes life easy for "DOS extenders". Some of
   them come with a builtin DPMI program, some do not.

Okay, enough confusion about terms, now about the software:

fdxms286: offers XMS and HMA on 286 PCs, at most 16 MB there.
fdxms / himem: offer XMS and HMA on 386 PCs, up to 64 MB.
fdxxms: offers XMS and HMA, up to 2 GB RAM can be used.
DR DOS himem: like himem.
MS DOS himem: like himem.

FreeDOS emm386: offers EMS and UMB, but no VCPI. Read the warning above.
   This requires himem to be installed before. Incompatible to fdxxms, but
   may work with fdxms, fdxms286, DR himem or MS himem. Feedback wanted.
DR DOS emm386: offers EMS and UMB, can optionally offer XMS and even DPMI.
   Useful if you have a program with a DOS extender that has a broken built-
   in DPMI. XMS is useful because XMS offered by DR DOS emm386 is sure to be
   compatible to DR DOS emm386 :-). If you use it with FDXXMS, you MAY be
   able to convince DR DOS emm386 to use > 64 MB RAM.
MS DOS emm386: Some versions run with FreeDOS, others do not. Needs some
   XMS driver present, so load the XMS driver first (some are more, some
   are less MS DOS emm386 compatible, your mileage may vary). Limited to
   64 or 256 MB of RAM, depending on the version and the used XMS driver.
   Offers EMS and UMB and VCPI. (DR DOS emm386 also offers VCPI, of course)

Some versions of MS DOS himem may allow to use > 64 MB of RAM.
The FreeDOS emm386 does not allow you to access RAM > 64 MB inside the
DOS task, so if you first load fdxxms on your 512 MB system and then
FreeDOS emm386, fdxxms may become confused about the vanished RAM.

You may only run ONE driver per memory type (if you run DR DOS emm386,
however, you may also use another XMS driver - the DR DOS emm386 will
then not provide XMS but use the existing driver).

If you only need UMB and no EMS, you can avoid the "locked in the task"
and "VCPI" problem (some old protected mode programs do not even accept
VCPI but want the CPU to be theirs without needing a backdoor) by using
an UMB-only driver. Those drivers reprogram your motherboard to make the
RAM in the UMB area (640k ... 1 MB, excluding ROM and video RAM) accessible.
So you can only use this method when your motherboard is supported by one
of the UMB-only drivers. You can find a list in technote 177.
The drivers are:

UMBPCI: common for 586 (Pentium) and newer chipsets. Some AMD Athlon
   chipsets are - alas - not supported.
HIRAM:  Classic choice for 486 and 386 systems.
RDOSUMB, URAM: Alternative choices, mainly for 486 and 386 systems. One
   of them allows you to use UMB if you managed to make that RAM accessible
   using some external means, too. For example with the 386 NeAT chipset,
   you can enable that RAM in your BIOS CMOS setup. The driver would then
   be able to detect it and allow UMB to use the area.

Some acronyms:
XMS - extended memory specification
EMS - expanded memory specification
DPMI - dos protected mode interface
VCPI - virtual control programming interface
UMB - upper memory blocks (640k ... 1 MB area)
HMA - high memory area (1 MB ... 1 MB + 64k area)
CMOS - hm... "C" metal on semiconductor :-) An energy-saving chip technology,
       at least 20 years ago, the CMOS RAM for the setup used only small
       amounts of energy compared to the rest of the PC.
BIOS - basic input output system (kind of an elementary operating system, or
       better, a collection of drivers for keyboard, disks, and so on).
RAM - random access memory
ROM - read only memory
MB  - megabyte (1024*1024 byte, or 1000*1000 byte, depends ;-))
GB  - gigabyte (1000 or 1024 MB)
TB  - terabyte (1000 or 1024 GB). Be warned, LBAcache maxes out at 2 TB disk
      size ;-).

Feel free to make a technote of this, and feel free to correct errors.
But please do not cite the whole FAQ when doing so!

This FAQ is meant to help with "which driver should I use" questions.
Most drivers can be finetuned with command line options, but usually
run fine without. Read the documentation of the respective drivers for
more information (Hey, having some URLs here would be nice ;-)).

Cheers, Eric
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.