Author: bonefish Date: 2010-06-12 17:11:53 +0200 (Sat, 12 Jun 2010) New Revision: 37115 Changeset: http://dev.haiku-os.org/changeset/37115/haiku Modified: haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp Log: Use PAE only when there's memory beyond the 4G limit. Modified: haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp 2010-06-12 14:16:30 UTC (rev 37114) +++ haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp 2010-06-12 15:11:53 UTC (rev 37115) @@ -73,12 +73,28 @@ #endif #if B_HAIKU_PHYSICAL_BITS == 64 - if (x86_check_feature(IA32_FEATURE_PAE, FEATURE_COMMON) - /* TODO: && if needed */) { + bool paeAvailable = x86_check_feature(IA32_FEATURE_PAE, FEATURE_COMMON); + bool paeNeeded = false; + for (uint32 i = 0; i < args->num_physical_memory_ranges; i++) { + phys_addr_t end = args->physical_memory_range[i].start + + args->physical_memory_range[i].size; + if (end > 0x100000000LL) { + paeNeeded = true; + break; + } + } + + if (paeAvailable && paeNeeded) { + dprintf("using PAE paging\n"); gX86PagingMethod = new(&sPagingMethodBuffer) X86PagingMethodPAE; - } else + } else { + dprintf("using 32 bit paging (PAE not %s)\n", + paeNeeded ? "available" : "needed"); + gX86PagingMethod = new(&sPagingMethodBuffer) X86PagingMethod32Bit; + } +#else + gX86PagingMethod = new(&sPagingMethodBuffer) X86PagingMethod32Bit; #endif - gX86PagingMethod = new(&sPagingMethodBuffer) X86PagingMethod32Bit; return gX86PagingMethod->Init(args, _physicalPageMapper); }