Page 1 of 1
Memory map high base
Posted: Wed Sep 26, 2012 6:00 am
by itportal
Hello forum,
I am printing the memory map (int 0x15, eax=0xE820) of a newer laptop with 4GB of ram memory and the last entry in the table is:
Code: Select all
base - length - type
0x00000001 0x00000000 - 0x00000000 0x40000000 - 1
Does this mean I cannot address this region with 32-bit addressing? Or is it possible only with PAE in 32-bit mode?
Re: Memory map high base
Posted: Wed Sep 26, 2012 6:22 am
by Griwes
It means you need to use PAE paging or long mode paging to access it.
I call this "RTFM" kind of question.
Re: Memory map high base
Posted: Wed Sep 26, 2012 6:48 am
by Combuster
The question "Can PAE do this" is definitely worth an RTFM because it means you never bothered to look up what it actually does.
Unlike Griwes suggests, the options are not limited to Long mode or PAE. There also exists a thing called PSE36, but it's mostly a hack around bad design and leads to the dark side.
Re: Memory map high base
Posted: Wed Sep 26, 2012 7:00 am
by Griwes
Huh, I didn't know about PSE-36, I stand corrected.
Re: Memory map high base
Posted: Wed Sep 26, 2012 2:23 pm
by JAAman
pitfall wrote:
I obviously think PAE is easier to implement and faster than this ugly thing designed for pentium oldies...
ironically, PAE (introduced with P6 (Pentium Pro), ~1994)is actually much older than PSE-36 (introduced with Pentium3 extensions to P6, ~1999)
Re: Memory map high base
Posted: Thu Sep 27, 2012 3:44 am
by Combuster
but some good programmers like rdos
You got to be kidding me. He's nothing but a code monkey that thinks that repeating a story often enough makes it true (read: someone else's error). For fun, go look up the unencrypted bank transfer incident.
At any rate, PSE-36 was added for all those people that tied themselves to the railway track called legacy as a shabby excuse not to clean up their stuff and use PAE paging when needed.
Re: Memory map high base
Posted: Thu Sep 27, 2012 9:34 am
by bluemoon
pitfall wrote:Segmentation IS useful when used smartly (bootloader instant relocation when switching to higher-half with paging enabled etc...), PSE-36 is just a weird thing which never has been widely use in system development...
This is misleading. While you can do it with segmentation, there are other methods to reach the same goal that are just as useful; IMO some methods even better than segmentation - like it or not, the manufacture is depreciating it.
Re: Memory map high base
Posted: Thu Sep 27, 2012 11:05 am
by xenos
pitfall wrote:Segmentation IS useful when used smartly (bootloader instant relocation when switching to higher-half with paging enabled etc...)
It depends on how much you actually need to do in your bootloader before enabling paging that needs to be aware of higher half addresses. For example, my kernel is loaded by GRUB and the first thing that is executed is some assembly stub that sets up the page tables and enables paging after only 20 instructions. Only 6 of these instructions are aware of higher half addresses. I wouldn't want to use segmentation for that...
http://xenos.svn.sourceforge.net/viewvc ... iew=markup
Of course, if you want to do more than that before enabling paging, segmentation
may be useful.
Re: Memory map high base
Posted: Thu Sep 27, 2012 11:31 am
by Kazinsal
pitfall wrote:But why the hell has PSE-36 been released ?
Because PSE-36 doesn't change page table hierarchy, and thus caters to programmers who hate migrating to new stuff, no matter what the benefit is. It's kind of like people who still use Windows 98 because "it works just fine". Unfortunately for the people who designed PSE-36, everyone was nice and comfortable using PAE so the design seems to have been more or less ignored.
Combuster wrote:For fun, go look up the unencrypted bank transfer incident.
I'd like to get a hold of one of those uncrackable CompactFlash cards.
Also, I wonder if he ever expected someone to break open one of those terminals and do a memory dump with an ICE... or is that impossible under RDOS too?
Re: Memory map high base
Posted: Thu Sep 27, 2012 11:39 pm
by xenos
pitfall wrote:My point is that my loader actually does a lot of things in higher half addresses, as it creates the entire environment before running the microkernel in flat address-space. I clearly separated things, so that my kernel remains clean, and all bootstrap code goes in a separate module.
Actually my design is quite similar. I have a separation between an initial stage that sets up the execution environment and the actual microkernel. However, the initial stage is also located in higher address space and runs after paging is enabled (except for the 20 instructions that create the page tables). It is unmapped after doing its duties.
My loader was designed like a "subkernel", and now that it's done, I really don't see the point of rewriting it without segmentation, while I'm starting the x86-64 branch...
Of course, if you already have some working bootloader, it's always less effort to keep it this way
Coming back a bit closer to the original subject: In fact I never user PAE or PSE-36 in my kernel. The 32 bit version cannot handle physical memory above the 4GB mark and simply ignores it (but the 64 bit version can of course use it).