VOGONS


First post, by tigrou

User metadata
Rank Newbie
Rank
Newbie

Let's say I have a physical DOS PC with 1 MB of RAM installed and CPU runs in 16-bit real mode.

The first 640KB (conventional memory) can be used by programs (minus DOS internals stuff and TSRs).
AFAIK this part is directly mapped to the 0-640 KB region of physical RAM.

The 640KB-1MB region (UMA) is mapped to VGA, peripheral cards, ROMS, BIOS, ....
What about the 640KB-1MB region in the physical RAM stick ? Is it lost (not usable ? )

Or can it be used ? (eg : through EMS/XMS).

I have notified that DOSBox automatically disable EMS if memsize=1. I don't know if it's a limitation of DOSBox or if it also happen on a physical machine.

Reply 2 of 14, by tigrou

User metadata
Rank Newbie
Rank
Newbie

If I start DOSBox with memsize = 2 (2MB of ram) this is what I got with "mem" command :

632 Kb free of conventional memory
63 Kb free upper memory in 1 blocks (largest UMB 63 Kb)
832 Kb free of extended memory
832 Kb free of expanded memory

Lets sum it (I have rounded conventional memory and upper memory blocks values) :
640 + 64 + 832 + 128 (I know DOSBox allocate 128KB with EMS for VCPI) = 1664 KB
2048 - 1664 = 384 KB missing (which is exact same size as the UMA region)

So it does not seems to allow to use memory left in UMA. That region seems to be "lost".
Or maybe memsize = 2 in DOSBox is not exactly the same as a real PC with 2MB of RAM installed.

Reply 3 of 14, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie

You got to be familiar with the distinction between "address space" and "memory".
0KB-640KB is an address space filled with memory, 640KB-1MB is filled with I/O, some type of I/O may contain its own memory such as the VGA which has its own frame buffer. EMS is memory behind I/O and can only be accessible when they are mapped into address space, called Page Frame. This is the standard IBM PC design that DOS was based upon.

tigrou wrote on 2020-05-06, 18:41:

What about the 640KB-1MB region in the physical RAM stick ? Is it lost (not usable ? )

It depends on what systems you are referring to. On standard 286 without specialty core logic that support EMS/ROM shadowing, the 384KB memory is mapped at start of 1MB. 286 with specialty core logic can map the 384KB as EMS or use some of it for ROM shadowing and the remaining mapped at start of 1MB.

On 486 and later, 640KB-1MB address space always has memory but disabled for ranges that used by I/O. Some early 486 chipsets support remapping 256KB (the memory under address space 0xC0000-0xFFFFF) to address space above 1MB. Memory under address space 0xA0000-0xBFFFF cannot be remapped because it is used now used by CPU System Management Mode (SMM). Later chipsets, especially with PCI, no longer bother to remap memory. It was OK to lose 128KB-256KB on system with 8MB or more memory. It is lost unless otherwise used by UMBPCI or similar utilities to provide UMBs for DOS. UMBs from 386 memory managers such as 386MAX and QEMM386 do no use that memory.

Reply 4 of 14, by root42

User metadata
Rank Oldbie
Rank
Oldbie

I have a 286 board that let's you remap the 384 KiB to above 1MiB as extended memory.

And remember: in the early days many computers came with individual DIP chip RAM. No 30 pin SIPP/SIMM or PS/2 SIMM sticks. So many boards actually came with only 512KiB or 640KiB equipped, since DOS couldn't access more. And on those boards which could take 1MiB or more, you could often remap the "missing" memory to extended memory.

Furthermore my 386 board has the option to shadow BIOS into this upper memory RAM. Because the ROMs and EPROMs used for storing the BIOS are much slower than the RAM chips, copying the ROM contents upon bootup can lead to higher performance when BIOS functions are accessed. This might be important for DOS, but again not so much for Windows, running in protected mode.

The concept of UMBs arrived with DOS 5.0, so around 1991 - or even earlier with DR DOS 5 in 1990. So there were a couple of years, until the arrival of Windows 95 where the UMBs actually really mattered.

YouTube and Bonus
80486DX@33 MHz, 16 MiB RAM, Tseng ET4000 1 MiB, SnarkBarker & GUSar Lite, PC MIDI Card+X2+SC55+MT32, OSSC

Reply 5 of 14, by kolderman

User metadata
Rank Oldbie
Rank
Oldbie

> What about the 640KB-1MB region in the physical RAM stick ? Is it lost (not usable ? )

Yes, it is lost physically. The memory controller does not map any address to those physical regions of ram.

Logically however, if the CPU is in protected mode, or virtual mode, the logical addresses between 640k and 1mb can be mapped to other physical locations above 1mb. This is how EMM386 works and the the thing doing the mapping is the MMU inside 386 or greater CPUs.

Reply 6 of 14, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie
root42 wrote on 2020-05-06, 22:13:

I have a 286 board that let's you remap the 384 KiB to above 1MiB as extended memory.

This was the norm for 286, otherwise the salesman could not explain where the hell the rest of 384KB had gone! 😁 In fact, it was a specialty for 286 that possessed the capability of *NOT* remapping 384KiB at start of 1MiB. The memory would have been much more useful as EMS in the days of 8088 software or UMBs with the arrival of DR-DOS/DOS 5.0.

Reply 7 of 14, by tigrou

User metadata
Rank Newbie
Rank
Newbie

Thanks all for replies. @kolderman : what you said does not seems to match with others. You are probably talking about later computers (like 486 and more).
I guess DOSBox do not care about remapping that area as well since the total amount of free memory is usually not an issue in DOSBox (unlike old computers).

Reply 8 of 14, by kolderman

User metadata
Rank Oldbie
Rank
Oldbie
tigrou wrote on 2020-05-06, 22:48:

Thanks all for replies. @kolderman : what you said does not seems to match with others. You are probably talking about later computers (like 486 and more).
I guess DOSBox do not care about remapping that area as well since the total amount of free memory is usually not an issue in DOSBox (unlike old computers).

No it does, I suspect this is all just a bit beyond your understanding of how computers work.

Reply 9 of 14, by tigrou

User metadata
Rank Newbie
Rank
Newbie
kolderman wrote on 2020-05-06, 22:54:

No it does, I suspect this is all just a bit beyond your understanding of how computers work.

I am a programmer since 20+ years . I have a good knowledge in digital electronics, so I think I have enough background to be able to understand that what I am asking here.

kolderman wrote on 2020-05-06, 22:18:

Yes, it is lost physically. The memory controller does not map any address to those physical regions of ram.

Unless I miss something you are saying to me that region is lost, while others said it can be remapped at start of 1MB as EMS (and thus accessed through UMA).

Reply 10 of 14, by kolderman

User metadata
Rank Oldbie
Rank
Oldbie

LED's and resistors are not the same as CPU architecture.

And you specifically asked about the physical ram, here it is again:

> What about the 640KB-1MB region in the physical RAM stick ? Is it lost (not usable ? )

The answer is yes, in most cases, that physical RAM is not addressable (some special BIOSes may allow it for certain uses).

The logical region between 640k and 1MB (separate from the physical RAM) can be dealt with in a number of ways:

- in 286 and earlier, it may be mapped to RAM boards. This is a physical mapping that requires the motherboard and bios to allow it, and might be configured with dip switches.
- some 286s might map areas of it to areas above 1mb.
- in both cases above, EMS (if supported) may be used in addition to not only map upper memory blocks to actual memory, but to allow bank switching so that UMA can be directed to point at different part of memory. In that way, that UMA might only be 64kb is size, but allow access to many MBs of memory via the EMS protocol.
- on 386's and above (which come with virtual memory in protected/virtual mode), both UMAs and EMS can be *emulated* using the MMU in the cpu. This can be used to map a UMA to extended memory, and also provide EMS frames. EMM386 has options to register UMAs with or without EMS.

Reply 11 of 14, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie

@kolderman I think you were making a confusion between "address space" and "memory". Bringing in 386 MMU into the discussion did not help because the point to discuss was physical address space or physical memory. What the OP asked was essentially what happened to the physical memory underneath the physical address space of 640KB-1MB. So the answer was it was either lost or remapped. The 386 MMU does not make use of the lost physical memory underneath the address space 640KB-1MB, it simply creates V86 virtual machines. In V86 virtual machine, address space becomes "virtual". Both 0KB-640KB and 640KB-1MB region may not be mapped exactly as "physical" address space.

Reply 12 of 14, by tigrou

User metadata
Rank Newbie
Rank
Newbie
kolderman wrote on 2020-05-06, 23:32:

LED's and resistors are not the same as CPU architecture.

Digital electronic is about flipflops, registers, muxers, decoders, buses, adders, ... in other words how a CPU works.
I have implemented a simple 4 bit microcontroller in verilog last year, that is enough to have an idea about how CPU works in general

Reply 13 of 14, by kolderman

User metadata
Rank Oldbie
Rank
Oldbie
kjliew wrote on 2020-05-07, 00:37:

@kolderman I think you were making a confusion between "address space" and "memory". Bringing in 386 MMU into the discussion did not help because the point to discuss was physical address space or physical memory. What the OP asked was essentially what happened to the physical memory underneath the physical address space of 640KB-1MB. So the answer was it was either lost or remapped. The 386 MMU does not make use of the lost physical memory underneath the address space 640KB-1MB, it simply creates V86 virtual machines. In V86 virtual machine, address space becomes "virtual". Both 0KB-640KB and 640KB-1MB region may not be mapped exactly as "physical" address space.

No you sound confused. He literally asked about the physical memory in the ram sticks, again:

> What about the 640KB-1MB region in the physical RAM stick ? Is it lost (not usable ? )

And as I answered, it is usually not mapped or made available for use.

I mentioned the 386 MMU because it is the essence of how EMM386 works which is useful to understand how this logical region is made available via other means. And the MMU definitely does *not* "create V86 virtual machines". It is enabled when the CPU is put in virtual/protected mode though.

Reply 14 of 14, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie

From Intel literature, the V86 mode of 386 implements the concept of multiple 8086 virtual machines each with its own isolated 1MB address space. We can argue day and night what defines a virtual machine, the features of 386 presenting itself as multiple 8086 for legacy software, to certain extent is a virtual machine. A virtual machine is not necessarily entirely in software. Today, Intel VT and AMD-V create an entire x86/x86-64 architecture virtual machines in hardware, pretty much the same way how V86 did for 8086, just much, much more complicated.