From 647b768f543c4d275390856edcc733327d7ae30c Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 10 Dec 2013 19:07:01 +0100 Subject: [PATCH] x86: Disable PAE, if 4 GB memory limit safemode is set --- .../kernel/arch/x86/arch_vm_translation_map.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/system/kernel/arch/x86/arch_vm_translation_map.cpp b/src/system/kernel/arch/x86/arch_vm_translation_map.cpp index c9ac7a4bf1..728dbd811b 100644 --- a/src/system/kernel/arch/x86/arch_vm_translation_map.cpp +++ b/src/system/kernel/arch/x86/arch_vm_translation_map.cpp @@ -11,6 +11,7 @@ #include #include +#include #ifdef __x86_64__ # include "paging/64bit/X86PagingMethod64Bit.h" @@ -99,12 +100,17 @@ arch_vm_translation_map_init(kernel_args *args, } } - if (paeAvailable && paeNeeded) { + bool paeDisabled = get_safemode_boolean_early(args, + B_SAFEMODE_4_GB_MEMORY_LIMIT, false); + + if (paeAvailable && paeNeeded && !paeDisabled) { dprintf("using PAE paging\n"); gX86PagingMethod = new(&sPagingMethodBuffer) X86PagingMethodPAE; } else { - dprintf("using 32 bit paging (PAE not %s)\n", - paeNeeded ? "available" : "needed"); + dprintf("using 32 bit paging (PAE %s)\n", + paeNeeded + ? "not available" + : (paeDisabled ? "disabled" : "not needed")); gX86PagingMethod = new(&sPagingMethodBuffer) X86PagingMethod32Bit; } #else