Page 1 of 1
Higher half vs Lower half
Posted: Mon Jun 04, 2012 8:38 am
by IanSeyler
In BareMetal OS all memory is identity mapped 1:1 and also mapped again to the higher half. In x86 some memory is used for memory-mapped devices like video cards, some network cards, the APIC, etc.. Is it possible to use all memory in the system as real memory instead of losing some of it to devices?
For example writing to 0xB8000 goes to the video memory. If I write to 0xFFFF8000000B8000 does it also go to video memory? What happens if I read from 0xFFFF8000000B8000?
I guess what I am looking for is the possibility of mapping all physical RAM to the higher half and leaving the lower half for memory-mapped devices. Is this possible on x86?
Thanks,
Ian
Re: Higher half vs Lower half
Posted: Mon Jun 04, 2012 8:47 am
by Combuster
Paging works on device addresses as well as RAM. if you mapped B8000-BFFFF to some higher half address it works just as reading and writing to B8000 physical.
If you want all RAM in the higherhalf you just need to select all usable ram from the entire physical address space and map it somewhere in there.
Or am I missing something?
Re: Higher half vs Lower half
Posted: Mon Jun 04, 2012 10:23 am
by linguofreak
ReturnInfinity wrote:In BareMetal OS all memory is identity mapped 1:1 and also mapped again to the higher half. In x86 some memory is used for memory-mapped devices like video cards, some network cards, the APIC, etc.. Is it possible to use all memory in the system as real memory instead of losing some of it to devices?
You don't lose any "real memory" to devices. Some addresses have memory attached to them, some addresses have devices, but all the "real memory" on the system has an address. There's not any memory, as far as I know, that doesn't have an address because the address it would be mapped to is used by a device.
Re: Higher half vs Lower half
Posted: Mon Jun 04, 2012 11:05 am
by Combuster
There is often about 160k RAM of wasted unavailable memory at C8000-EFFFF, but you need a chipset-specific driver to get it. And you have to be careful as it might as well be actually used for additional PnP ROMs and larger BIOSes.
Re: Higher half vs Lower half
Posted: Wed Jun 06, 2012 4:26 am
by bluemoon
ReturnInfinity wrote:In BareMetal OS all memory is identity mapped 1:1 and also mapped again to the higher half. In x86 some memory is used for memory-mapped devices like video cards, some network cards, the APIC, etc.. Is it possible to use all memory in the system as real memory instead of losing some of it to devices?
For example writing to 0xB8000 goes to the video memory. If I write to 0xFFFF8000000B8000 does it also go to video memory? What happens if I read from 0xFFFF8000000B8000?
Yes if the higher half mapping is a clone on identity mapped lower half. Reading from such memory resolve to video memory.
ReturnInfinity wrote:
I guess what I am looking for is the possibility of mapping all physical RAM to the higher half and leaving the lower half for memory-mapped devices. Is this possible on x86?
Sure, but that wouldn't be identity mapped. You can map usual memory to the address 0xFFFF8000000B8000(That's the idea of paging).