From 78b58e34df4dd3ac57da14249a25c57656394f65 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Thu, 10 May 2007 16:42:24 +0000 Subject: [PATCH] - Add i386/cmhardwr.c and start implementing CmpInitializeMachineDependentConfiguration. Currently it only detects and writes the key for PAE. - Call the API from CmInitSystem1. svn path=/trunk/; revision=26675 --- reactos/ntoskrnl/cm/registry.c | 12 ++++++ reactos/ntoskrnl/config/i386/cmhardwr.c | 57 +++++++++++++++++++++++++ reactos/ntoskrnl/ntoskrnl.rbuild | 5 +++ 3 files changed, 74 insertions(+) create mode 100644 reactos/ntoskrnl/config/i386/cmhardwr.c diff --git a/reactos/ntoskrnl/cm/registry.c b/reactos/ntoskrnl/cm/registry.c index e876b2dbce9..31fa65c8d66 100644 --- a/reactos/ntoskrnl/cm/registry.c +++ b/reactos/ntoskrnl/cm/registry.c @@ -74,6 +74,10 @@ NTSTATUS NTAPI CmpCreateControlSet(IN PLOADER_PARAMETER_BLOCK LoaderBlock); +NTSTATUS +NTAPI +CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock); + static VOID STDCALL CmiHiveSyncDpcRoutine(PKDPC Dpc, PVOID DeferredContext, @@ -510,6 +514,14 @@ CmInitSystem1(VOID) KEBUGCHECKEX(CONFIG_INITIALIZATION_FAILED, 1, 12, Status, 0); } + /* Initialize machine-dependent information into the registry */ + Status = CmpInitializeMachineDependentConfiguration(KeLoaderBlock); + if (!NT_SUCCESS(Status)) + { + /* Bugcheck */ + KEBUGCHECKEX(CONFIG_INITIALIZATION_FAILED, 1, 14, Status, 0); + } + /* Initialize volatile registry settings */ Status = CmpSetSystemValues(KeLoaderBlock); if (!NT_SUCCESS(Status)) diff --git a/reactos/ntoskrnl/config/i386/cmhardwr.c b/reactos/ntoskrnl/config/i386/cmhardwr.c new file mode 100644 index 00000000000..c7db38ea319 --- /dev/null +++ b/reactos/ntoskrnl/config/i386/cmhardwr.c @@ -0,0 +1,57 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/config/i386/cmhardwr.c + * PURPOSE: Configuration Manager - Hardware-Specific Code + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include "ntoskrnl.h" +#include "../cm.h" +#define NDEBUG +#include "debug.h" + +/* FUNCTIONS *****************************************************************/ + +NTSTATUS +NTAPI +CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + UNICODE_STRING KeyName, ValueName; + OBJECT_ATTRIBUTES ObjectAttributes; + ULONG HavePae; + NTSTATUS Status; + HANDLE KeyHandle; + + RtlInitUnicodeString(&KeyName, + L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\" + L"Control\\Session Manager\\Memory Management"); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenKey(&KeyHandle, KEY_READ | KEY_WRITE, &ObjectAttributes); + if (NT_SUCCESS(Status)) + { + /* Detect if PAE is enabled */ + HavePae = SharedUserData->ProcessorFeatures[PF_PAE_ENABLED]; + + /* Set the value */ + RtlInitUnicodeString(&ValueName, L"PhysicalAddressExtension"); + NtSetValueKey(KeyHandle, + &ValueName, + 0, + REG_DWORD, + &HavePae, + sizeof(HavePae)); + + /* Close the key */ + NtClose(KeyHandle); + } + + /* All done*/ + return STATUS_SUCCESS; +} diff --git a/reactos/ntoskrnl/ntoskrnl.rbuild b/reactos/ntoskrnl/ntoskrnl.rbuild index ef592d7c616..59642596f19 100644 --- a/reactos/ntoskrnl/ntoskrnl.rbuild +++ b/reactos/ntoskrnl/ntoskrnl.rbuild @@ -84,6 +84,11 @@ view.c + + + cmhardwr.c + + cmboot.c cmcontrl.c cmdata.c