From: Hartmut Birr Date: Sat, 30 Jul 2005 18:55:25 +0000 (+0000) Subject: Check if the cpu supports the pae mode. X-Git-Tag: ReactOS-0.2.8~1437 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=2316f9549895dfd2d58bc6ee7e85d578fcde0606;ds=sidebyside Check if the cpu supports the pae mode. svn path=/trunk/; revision=16899 --- diff --git a/reactos/boot/freeldr/freeldr/reactos/loader.c b/reactos/boot/freeldr/freeldr/reactos/loader.c index 44cb02b8860..76be0c36d20 100644 --- a/reactos/boot/freeldr/freeldr/reactos/loader.c +++ b/reactos/boot/freeldr/freeldr/reactos/loader.c @@ -20,6 +20,7 @@ */ #include +#include <../arch/i386/hardware.h> #include #define NDEBUG @@ -279,32 +280,42 @@ VOID FASTCALL FrLdrGetPaeMode(VOID) { - PCHAR p; + BOOLEAN PaeModeSupported; + PaeModeSupported = FALSE; PaeModeEnabled = FALSE; - /* Read Command Line */ - p = (PCHAR)LoaderBlock.CommandLine; - while ((p = strchr(p, '/')) != NULL) { + if (CpuidSupported() & 1) + { + ULONG eax, ebx, ecx, FeatureBits; + GetCpuid(1, &eax, &ebx, &ecx, &FeatureBits); + if (FeatureBits & X86_FEATURE_PAE) + { + PaeModeSupported = TRUE; + } + } - p++; - /* Find "PAE" */ - if (!strnicmp(p, "PAE", 3)) { + if (PaeModeSupported) + { + PCHAR p; - /* Make sure there's nothing following it */ - if (p[3] == ' ' || p[3] == 0) { + /* Read Command Line */ + p = (PCHAR)LoaderBlock.CommandLine; + while ((p = strchr(p, '/')) != NULL) { - /* Use Pae */ - PaeModeEnabled = TRUE; - break; - } - } - } - if (PaeModeEnabled) - { - /* FIXME: - * Check if the cpu is pae capable - */ + p++; + /* Find "PAE" */ + if (!strnicmp(p, "PAE", 3)) { + + /* Make sure there's nothing following it */ + if (p[3] == ' ' || p[3] == 0) { + + /* Use Pae */ + PaeModeEnabled = TRUE; + break; + } + } + } } }