Memory map high base

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
itportal
Posts: 18
Joined: Tue May 18, 2010 1:34 am

Memory map high base

Post 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?
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: Memory map high base

Post by Griwes »

It means you need to use PAE paging or long mode paging to access it.

I call this "RTFM" kind of question.
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Memory map high base

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: Memory map high base

Post by Griwes »

Huh, I didn't know about PSE-36, I stand corrected.
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: Memory map high base

Post 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)
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Memory map high base

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Memory map high base

Post 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.
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Memory map high base

Post 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.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: Memory map high base

Post 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?
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Memory map high base

Post 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).
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
Post Reply