Author: bonefish Date: 2010-06-23 15:55:44 +0200 (Wed, 23 Jun 2010) New Revision: 37231 Changeset: http://dev.haiku-os.org/changeset/37231/haiku Modified: haiku/trunk/src/system/kernel/vm/vm.cpp Log: vm_create_anonymous_area(): Optimized the B_32_BIT_{FULL_LOCK,CONTIGUOUS} cases for B_HAIKU_PHYSICAL_BITS > 32 and accessible physical memory < 4 GB. Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2010-06-23 13:52:32 UTC (rev 37230) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2010-06-23 13:55:44 UTC (rev 37231) @@ -1124,18 +1124,22 @@ doReserveMemory = true; break; case B_32_BIT_FULL_LOCK: - #if B_HAIKU_PHYSICAL_BITS <= 32 + if (B_HAIKU_PHYSICAL_BITS <= 32 + || (uint64)vm_page_max_address() < (uint64)1 << 32) { wiring = B_FULL_LOCK; doReserveMemory = true; break; - #endif + } // TODO: We don't really support this mode efficiently. Just fall // through for now ... case B_32_BIT_CONTIGUOUS: #if B_HAIKU_PHYSICAL_BITS > 32 - stackPhysicalRestrictions = *physicalAddressRestrictions; - stackPhysicalRestrictions.high_address = 0x100000000LL; - physicalAddressRestrictions = &stackPhysicalRestrictions; + if (vm_page_max_address() >= (phys_addr_t)1 << 32) { + stackPhysicalRestrictions = *physicalAddressRestrictions; + stackPhysicalRestrictions.high_address + = (phys_addr_t)1 << 32; + physicalAddressRestrictions = &stackPhysicalRestrictions; + } #endif wiring = B_CONTIGUOUS; doReserveMemory = true;