home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / CMCD0704.ISO / Software / Complet / FreeDOS / fdbootcd.iso / FREEDOS / DOCS / MOREINFO / MEMFAQ.TXT < prev    next >
Text File  |  2004-01-31  |  14KB  |  326 lines

  1.  
  2. This document combines several mails that wandered around in fd-dev
  3. (@topica.com) during October 2002. Editing done by Eric.
  4.  
  5. It's getting quite old, especially regarding the driver development advances
  6. made in the last months.
  7.  
  8. For configuration of FreeDOS's config.sys and autoexec.bat files,
  9. please have a look at config.txt 
  10. (c:\fdos, or in \freedos\packages\disk04\samcfg.zip)
  11.  
  12. *** Part one: FreeDOS memory management FAQ by Eric ***
  13.  
  14.  
  15. Hi everybody, as requested by Lyn@...:
  16. The phantastic FreeDOS memory management FAQ !
  17.  
  18.  
  19. So you want to use > 640k of RAM with your DOS? Then read on...
  20.  
  21.  
  22. If you want to load drivers and programs high, you need UMB.
  23.  
  24. If you want to load the kernel high as well (partially), you need HMA.
  25.  
  26. If your programs want XMS memory (common way to use > 1 MB of RAM for
  27.    DOS programS), you need XMS (gosh :-)).
  28.  
  29. If your programs want EMS memory, you need EMS. EMS is a "classic" way
  30.    for this: There were EMS memory boards for very old PCs, but now-
  31.    adays, you use an EMS emulator, an "emm386". Or XMS, of course.
  32.    However, some programs cannot use both (EMS and XMS) but only one of
  33.    them, so you need to offer the needed type of memory to them.
  34.  
  35. If you are running an "emm386", your DOS will run in a "task" under some
  36.    protected mode kernel implemented by emm386. This means that DOS no
  37.    longer has full control over the PC. However, it is needed to offer
  38.    EMS in an elegant way, and sometimes for UMB, too. Read below.
  39.  
  40. If you are running a program that uses protected mode, normal drivers do
  41.    not cause problems. HOWEVER, emm386 type drivers need to offer a back-
  42.    door called VCPI to allow protected mode access while emm386 is running.
  43.    If you run an emm386 without the backdoor, you cannot use protected mode.
  44.  
  45. If your program mentions something about "DOS extender" and/or "DPMI", it
  46.    is usually a program that needs protected mode. A DOS extender is some-
  47.    thing that allows protected mode programs to have easy access to normal
  48.    DOS functions (DOS does not run in protected mode, as you remember: The
  49.    "task" where DOS runs if emm386 is active is a simulation of "real mode"
  50.    (unprotected mode, so to say), kind of a virtual 8086 CPU, but with the
  51.    32bit stuff still available. However, in the "DOS task", 32bit addressing
  52.    is NOT available, and this is why our "extended friends" need to use the
  53.    VCPI backdoor to get into full protected mode. Without emm386 running,
  54.    the 32bit addressing is available "enough" for those programs to get into
  55.    protected mode without further help. By the way, DPMI is kind of a
  56.    protected mode toolkit that makes life easy for "DOS extenders". Some of
  57.    them come with a builtin DPMI program, some do not.
  58.  
  59. > Arkady adds that you CAN do 32bit addressing in v86 mode.
  60. > This is true but it only means that you can do 32bit address calculations,
  61. > data structures still have the 64k size limit issue without protected mode.
  62. > Of course you can have several 64k chunks in DOS, but in protected mode,
  63. > you can simply have one big chunk of several megabytes for your table or
  64. > other data structure...
  65.  
  66. > Arkady also mentions "unreal" or "flat real mode". However, you cannot
  67. > reach this from v86 mode. The idea is that you activate protected mode for
  68. > a moment, allocate all your RAM in a single memory chunk, and leave the
  69. > chunk size intact when jumping back to real mode. That way, your program
  70. > runs in real mode but can access all RAM. However, this is an evil hack
  71. > that exploits the status caching behaviour of the processors memory
  72. > management. Most "flat real mode" programs do not even work when VCPI
  73. > or DPMI are present. They just need plain real mode to start from.
  74.  
  75. Okay, enough confusion about terms, now about the software:
  76.  
  77.  
  78. *** XMS ***
  79.  
  80.  
  81. fdxms286: offers XMS and HMA on 286 PCs, at most 16 MB there.
  82. fdxms / himem: offer XMS and HMA on 386 PCs, up to 64 MB.
  83. fdxxms: offers XMS and HMA, up to 2 GB RAM can be used.
  84. DR DOS himem: like himem.
  85. MS DOS himem: like himem.
  86.  
  87.  
  88. *** EMS ***
  89.  
  90.  
  91. FreeDOS emm386: offers EMS and UMB, but no VCPI. Read the warning above.
  92.    This requires himem to be installed before. Incompatible to fdxxms, but
  93.    may work with fdxms, fdxms286, DR himem or MS himem. Feedback wanted.
  94.  
  95. DR DOS emm386: offers EMS and UMB, can optionally offer XMS and even DPMI.
  96.    Useful if you have a program with a DOS extender that has a broken built-
  97.    in DPMI. XMS is useful because XMS offered by DR DOS emm386 is sure to be
  98.    compatible to DR DOS emm386 :-). If you use it with FDXXMS, you MAY be
  99.    able to convince DR DOS emm386 to use > 64 MB RAM.
  100.  
  101. MS DOS emm386: Some versions run with FreeDOS, others do not. Needs some
  102.    XMS driver present, so load the XMS driver first (some are more, some
  103.    are less MS DOS emm386 compatible, your mileage may vary). Limited to
  104.    64 or 256 MB of RAM, depending on the version and the used XMS driver.
  105.    Offers EMS and UMB and VCPI. (DR DOS emm386 also offers VCPI, of course)
  106.  
  107. Some versions of MS DOS himem may allow to use > 64 MB of RAM.
  108. The FreeDOS emm386 does not allow you to access RAM > 64 MB inside the
  109. DOS task, so if you first load fdxxms on your 512 MB system and then
  110. FreeDOS emm386, fdxxms may become confused about the vanished RAM.
  111.  
  112. You may only run ONE driver per memory type (if you run DR DOS emm386,
  113. however, you may also use another XMS driver - the DR DOS emm386 will
  114. then not provide XMS but use the existing driver).
  115.  
  116.  
  117. *** UMB ***
  118.  
  119.  
  120. If you only need UMB and no EMS, you can avoid the "locked in the task"
  121. and "VCPI" problem (some old protected mode programs do not even accept
  122. VCPI but want the CPU to be theirs without needing a backdoor) by using
  123. an UMB-only driver. Those drivers reprogram your motherboard to make the
  124. RAM in the UMB area (640k ... 1 MB, excluding ROM and video RAM) accessible.
  125. So you can only use this method when your motherboard is supported by one
  126. of the UMB-only drivers. You can find a list in technote 177.
  127. The drivers are:
  128.  
  129. UMBPCI: common for 586 (Pentium) and newer chipsets. Some AMD Athlon
  130.    chipsets are - alas - not supported.
  131. HIRAM:  Classic choice for 486 and 386 systems.
  132. RDOSUMB, URAM: Alternative choices, mainly for 486 and 386 systems. One
  133.    of them allows you to use UMB if you managed to make that RAM accessible
  134.    using some external means, too. For example with the 386 NeAT chipset,
  135.    you can enable that RAM in your BIOS CMOS setup. The driver would then
  136.    be able to detect it and allow UMB to use the area.
  137.  
  138.  
  139. *** TERMS ***
  140.  
  141.  
  142. Some acronyms:
  143.  
  144. > With several corrections provided by other list members :-)
  145.  
  146. XMS -  extended memory specification
  147. EMS -  expanded memory specification
  148. DPMI - dos protected mode interface
  149. VCPI - virtual control programm interface
  150. UMB -  upper memory block (memory chunk in 640k ... 1 MB area)
  151. HMA -  high memory area (1 MB ... 1 MB + 64k area)
  152. CMOS - "Complementary Metal-Oxide Semiconductor" An energy-saving chip
  153.        technology, some 20 years ago, the CMOS RAM for the setup used
  154.        only small amounts of energy compared to the rest of the PC. The
  155.        same chip usually contains the battery powered internal clock (RTC).
  156. RTC  - Real Time Clock, what else?
  157. BIOS - Basic Input Output system (kind of an elementary operating system, or
  158.        better, a collection of drivers for keyboard, disks, and so on).
  159. RAM -  random access memory
  160. ROM -  read only memory
  161. MB  -  megabyte (1024*1024 byte, or 1000*1000 byte, depends ;-)) Computer
  162.        people normally prefer units of 1024.
  163. GB  -  gigabyte (1000 or 1024 MB)
  164. TB  -  terabyte (1000 or 1024 GB). Be warned, LBAcache maxes out at 2 TB disk
  165.        size ;-).
  166.  
  167. > RTC versus CMOS part is by Alain
  168.  
  169. Feel free to make a technote of this, and feel free to correct errors.
  170. But please do not cite the whole FAQ when doing so!
  171.  
  172. This FAQ is meant to help with "which driver should I use" questions.
  173. Most drivers can be finetuned with command line options, but usually
  174. run fine without. Read the documentation of the respective drivers for
  175. more information (Hey, having some URLs here would be nice ;-)).
  176.  
  177. Cheers, Eric
  178.  
  179.  
  180. *** BARTs PRACTICAL FAQ ***
  181.  
  182.  
  183. Some practical decision guidelines by Bart Oldeman:
  184.  
  185.  
  186. if you have only an XT (8088) there is nothing you can do, except for
  187. removing drivers, reducing BUFFERS etc. ~500000 bytes free, not more.
  188.  
  189.  
  190. if you have an AT (286) with a fair amount of memory (at least more
  191. than 640k) then you can use for CONFIG.SYS a)
  192. DOS=HIGH
  193. DEVICE=FDXMS286.SYS
  194. and use the XMS-swapping command.com. That way you have ~620000 bytes
  195. free, but all drivers you load (ctmouse, nansi, ...) are going to be
  196. in conventional RAM, thus eating from those 620000 bytes.
  197.  
  198.  
  199. if you have a 386SX or better _and_ you want to run DOS32 programs and
  200. none of your programs need EMS then you can use b)
  201. DOS=HIGH
  202. DEVICE=FDXMS.SYS (<64M)
  203. or DEVICE=FDXXMS.SYS (>64M memory)
  204. or DEVICE=HIMEM.EXE (if you feel like it)
  205. and use the XMS-swapping command.com.
  206. The situation for DOS memory is the same as for a)
  207.  
  208. > Tom adds a comparison of the amount of free memory:
  209. > DEVICE=HIMEM     available memory  631904 byte
  210. > DEVICE=FDXMS286  available memory  631712 byte  (but mem /f crashed!)
  211. > DEVICE=FDXMS     available memory  631488 byte
  212. > DEVICE=FDXXMS    available memory  631072 byte
  213.  
  214.  
  215. Now if you don't want those drivers eating away from conventional RAM
  216. then you can use c)
  217. DOS=HIGH,UMB
  218. DEVICE=HIMEM.EXE
  219. DEVICE=EMM386.EXE
  220. DEVICEHIGH=C:\BIN\NANSI.SYS
  221. ...
  222. SHELLHIGH=COMMAND.COM
  223. BUT then you cannot use DOS32 program (unless you use some other
  224. non-free EMM386-like program instead).
  225.  
  226. > Eric adds: For example you can use DR-DOS EMM386. May be limited
  227. > to 64 MB in some cases. Just run it like DEVICE=DREMM386.EXE
  228. > and it should be fine. Adding a DREMM386 PIC=ON to your autoexec.bat
  229. > will increase compatibility. Free for non-commercial use. Does not
  230. > need HIMEM (most other *emm386*.exe do need himem or fdxms or...).
  231.  
  232. > In any case, all c) variants give you EMS -and- UMB. You can tell
  233. > your favourite emm386 program not to provide EMS, this will give
  234. > you some more UMB (64k more). This "64k more hint" is by Tom:
  235. > use "DEVICE=EMM386.EXE NOEMS". Useful as only few programs need EMS.
  236. > For eaxmple this is useful with network drivers.
  237.  
  238.  
  239. The technique with UMBPCI is a variation between b) and c) and
  240. looks like this d)
  241. DOS=HIGH,UMB
  242. DEVICE=FDXMS.SYS (<64M)
  243. or DEVICE=FDXXMS.SYS (>64M memory)
  244. or DEVICE=HIMEM.EXE (if you feel like it)
  245. DEVICE=UMBPCI.SYS
  246. DEVICEHIGH=C:\BIN\NANSI.SYS
  247. ...
  248. SHELLHIGH=COMMAND.COM
  249.  
  250. > Eric adds: With UMBPCI (on 486 or older: try RDOSUMB, HIRAM or URAM
  251. > instead of UMBPCI) you have a way to have UMB but no EMS.
  252.  
  253. This only works if UMBPCI supports your motherboard chipset.
  254. In this case you have no EMS (unless you get the EMS simulator from
  255. Simtel), but you can run DOS32 programs.
  256.  
  257. > Eric adds: But remember that the EMS simulator is very slow.
  258. > Another caveat is that DMA (direct memory access) drivers may
  259. > crash when using UMBPCI memory: Only occurs with certain chipsets
  260. > and UMBPCI comes with a special driver to work around this problem
  261. > at least for disk drivers.
  262.  
  263.  
  264. In general, using the XMS-swapping FreeCOM, situation b) isn't nearly as
  265. bad as it used to be. Only if you need a few large device drivers you will
  266. get into trouble.
  267.  
  268.  
  269. *** Matthias Paul and yet another technical mail ***
  270.  
  271.  
  272. From: Matthias Paul <Matthias.Paul@post.rwth-aachen.deNOSPAM>
  273. Date: Sat, 26 Oct 2002 22:45:12 +0200
  274. Message-ID: <0.1300007563.967563791-1463792638-1035665240@topica.com>
  275. Subject: Re: [fd-dev] Memory management FAQ
  276.  
  277.  
  278. > This is only a small summary from his mail (by Eric).
  279.  
  280.  
  281. Matthias explains some technical details on the workings of XMSUMB
  282. memory (through the XMS interface, not to be confused with UMB memory
  283. which DOS can use more or less directly. "Self-LOADHIGHing" programs
  284. like SHARE or CTMOUSE sometimes use XMSUMB. MS DOS and PC DOS usually
  285. eat all XMSUMB memory and re-sell it as normal UMS memory. For DOS
  286. UMB high loading, use LOADHIGH (in autoexec) or DEVICEHIGH (in config).
  287. In general, you should let a program load itself high if it is able
  288. to do so and only use LOADHIGH/DEVICEHIGH if not.
  289.  
  290. > Arkady adds that this is not too important for you unless you
  291. > are developing a TSR yourself.
  292.  
  293.  
  294. Matthias also points out that DR-DOS HIMEM.SYS has RDOSUMB/URAM like
  295. features for several 286/386 chipsets. This will give you XMSUMB or
  296. UMB. It can even use EMS to create UMB. Not practical if you ask me:
  297. Normally, you load the XMS driver FIRST, and normally, EMS drivers
  298. provide UMB already. Matthias mentions EMMXMA of DR-DOS: This one uses
  299. PS/2 XMA memory extension cards to offer EMS. DR-DOS HIMEM.SYS can also
  300. - like RDOSUMB/URAM - detect existing RAM in the UMB area and turn it
  301. into UMB/XMSUMB. Useful if you can enable some RAM though your CMOS
  302. setup. I remember I could do this with a NeAT 386SX chipset...
  303.  
  304.  
  305. Further, Matthias tells us then DR-DOS HIMEM offers XMS 2.0, while
  306. DR-DOS EMM386 has builtion (!) XMS 3.0, as well as partial EMS 4.0
  307. (only 4 pages mapped at a time, but not limited to some frame area).
  308. Some versions can map 60 pages (of 16k each), I understand. The EMS
  309. 4.0 specs seem to max out at 32 MB, so DR-DOS EMM386 will offer you
  310. at most that much EMS. If you use XMS or "raw memory" as well, take
  311. care that EMM386 can cause troubles when you have more than 64 MB of
  312. RAM -unless- you install an XMS manager that can do all your RAM
  313. -before- installing EMM386. You can tell EMM386 of DR-DOS to use
  314. memory areas that are meant for ROM or video RAM, to have even more
  315. UMB. Use with caution! If your ROM or graphics card does need the
  316. memory, you have a problem. The idea is that parts of your ROM are
  317. only needed at bootup time, and parts of your graphics RAM are not
  318. needed in text mode.
  319.  
  320. > Arkady adds that MS-DOS EMM386 uses a shared "memory pool" that
  321. > the user can allocate either as XMS or as EMS, depending on which
  322. > is currently needed (I mean, (amount XMS + amount EMS ) < size pool
  323. > is fine, no matter how you distribute your needs between XMS and EMS.
  324. > I think DR-DOS EMM386 can do this, too.
  325.  
  326.