Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Is there a DOS memory documentation available? (Users)

posted by mceric, Germany, 10.01.2024, 11:56

> /E enables moving of EBDA (Extended BIOS Data Area), optionally a size in
> kilobytes may be specified [xxx, in range of 48-1024]

Documentation about SWITCHES=/E:nnnn could indeed be better. The size is specified in bytes, not in kilobytes. The size has to be a multiple of 16 bytes and at least 48 bytes, so the kernel rounds up the value you specify to the next multiple of 16. Example values:


          /* allowed values: [48..1024] bytes, multiples of 16
           * e.g. AwardBIOS: 48, AMIBIOS: 1024
           * (Phoenix, MRBIOS, Unicore = ????)
           */
...
if (n >= 48 && n <= 1024) ...
            Config.ebda2move = (n + 15) & 0xfff0;


The EBDA is not code, it is data. Relevant code is in DoConfig and PreConfig2. If you do not specify /E:nnnn, the kernel will calculate the size in kilobytes based on BIOS data about EBDA segment and amount of low RAM (which is at most 640k). If you do specify /E:nnnn, it will cap the size to your specified amount of bytes, at most 1 kB, at your own risk.


unsigned ebdasize(void)
{
  unsigned ebdaseg = peek(0, EBDASEG);
  unsigned ramsize = ram_top;

  if (ramsize == peek(0, RAMSIZE))
    if (ramsize * 64 == ebdaseg && ramsize < 640 && peek(0, RAMSIZE) == ramsize)
    {
    unsigned ebdasz = peekb(ebdaseg, 0);

    /* sanity check: is there really no more than 63 KB?
     * must be at 640k (all other values never seen and are untested)
     */
    if (ebdasz <= 63 && ramsize + ebdasz == 640)
      return ebdasz * 1024U;
    }
  return 0;
}


Because EBDA is supposed to be data, the kernel can move it to other places, possibly in UMB (or HMA?) simply by copying it around and updating the EBDA segment value somewhere at 40:xx similar to updating a pointer.

If you see far less than 640k of RAM, you may have some code or data buffers at the end of your 640k. The kernel can NOT move those around. Think about MBR -based drivers for supporting harddisks larger than 504 MB or 8 GB if your BIOS is too old. Also think about viruses and maybe buffers of exotic network or disk controller ROMs.

You probably should not use the /E switch most of the time. The kernel can autodetect the size and you save less than 1 kB by manually specifying the size if the autodetected size was 1 kB. For other sizes, the kernel cannot help you. I think you can also specify size -1 or size 0 for special cases such as "autodetect" or "do not touch EBDA".

---
FreeDOS / DOSEMU2 / ...

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 49 users online (0 registered, 49 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum