From ef4fd448b5dc65bec12580a645fc202789b157f7 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 23 Jun 2010 13:55:44 +0000 Subject: [PATCH] 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37231 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/vm.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index bbd912c1e6..a3842d561d 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -1124,18 +1124,22 @@ vm_create_anonymous_area(team_id team, const char *name, addr_t size, 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;