Is it fair to expect PAE to be present on the system?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
User avatar
blobmiester
Member
Member
Posts: 45
Joined: Fri Jul 16, 2010 9:49 am

Re: Is it fair to expect PAE to be present on the system?

Post by blobmiester »

Combuster wrote:Pentium 2 does not support NX. Many P4s don't either, and the P4s who do are likely to have long mode as well (if there is a XD-LM feature gap at all, Wikipedia is not explicit about it). I suggest you check your facts again.
You're right about the Pentium 2 not supporting NX. I should have been clearer. My Pentium 4 does support NX but even through my Pentium 2 doesn't -- it does support PAE. It's nice to have a (mostly) uniform paging interface. Note that i still chose to write for x86 for the time being.
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Is it fair to expect PAE to be present on the system?

Post by Owen »

I believe that all CPUs which support NX also support Long Mode. The converse is not true (<-- And a good way to cause exceptions from setting illegal bits!).

If there are any CPUs which do NX but not LM, it will be oddities like the 32-bit only Atoms.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Is it fair to expect PAE to be present on the system?

Post by Brendan »

Hi,
Owen wrote:I believe that all CPUs which support NX also support Long Mode. The converse is not true (<-- And a good way to cause exceptions from setting illegal bits!).

If there are any CPUs which do NX but not LM, it will be oddities like the 32-bit only Atoms.
Intel did release some "32-bit only" Pentium 4 (Prescott) CPUs that don't support long mode but do support NX.

You're also right about Atom CPUs - all of the "32 bit only" Atom variants support NX (which includes some Atom CPUs that Intel only released last year). Ironically, NX is the only real reason to use PAE on these Atom CPUs, as they only support 32-bit physical addresses (and not 36-bit physical addresses, like people might be tempted to assume).

Of course PAE costs about twice as much RAM for page tables, etc; and the cost of TLB misses is worse (because there's more levels of paging structures); so you wouldn't want to use it without a good reason. This gives something like this:

Code: Select all

if( CPU_supports_long_mode() ) return USE_LONG_MODE;
if( CPU_supports_PAE() ) {
    if( usable_RAM_above_4GiB() ) return USE_PAE;
    if( CPU_supports_NX() ) {
        /* Is it worth the extra RAM and TLB miss overheads? */
    }
}
return USE_LEGACY_PAGING;
Of course you'd also want to allow the end-user to override this; so that (for e.g.) an OS developer can test a 32-bit kernel on a 64-bit system.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Is it fair to expect PAE to be present on the system?

Post by Owen »

PAE doesn't add any more levels of paging structures (As far as lookup time is concerned, anyway); the whole PDPT is loaded into a hidden register when CR3 is loaded
Post Reply