Author: ion
Date: Thu Oct 5 06:02:27 2006
New Revision: 24409
URL:
http://svn.reactos.org/svn/reactos?rev=24409&view=rev
Log:
- Use KeLoaderBlock for registry hive loading.
- Get rid of the CACHED_MODULE array and associated structures and stop using them, get
rid of ParseAndCacheLoadedModules. Stop using KeLoadedModules and KeLoadedModuleCount
outside of freeldr.c.
- Except for MmInit1, the kernel should now be totally isolated from FreeLDR-specific
data.
Modified:
trunk/reactos/ntoskrnl/KrnlFun.c
trunk/reactos/ntoskrnl/cm/registry.c
trunk/reactos/ntoskrnl/ex/init.c
trunk/reactos/ntoskrnl/include/internal/ke.h
trunk/reactos/ntoskrnl/ke/freeldr.c
Modified: trunk/reactos/ntoskrnl/KrnlFun.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/KrnlFun.c?rev=244…
==============================================================================
--- trunk/reactos/ntoskrnl/KrnlFun.c (original)
+++ trunk/reactos/ntoskrnl/KrnlFun.c Thu Oct 5 06:02:27 2006
@@ -27,10 +27,9 @@
// Ke:
//
// - FIXES:
-// * Stop using CachedModules.
-// * Try to make MmInit1 NTLDR compatible.
// * Sanitize some context fields during conversions.
// * Figure out why the DPC stack doesn't really work.
+// * Try to make MmInit1 NTLDR compatible.
// * Add DR macro/save and VM macro/save.
// - FEATURES:
// * New optimized table-based tick-hashed timer implementation.
Modified: trunk/reactos/ntoskrnl/cm/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/registry.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/cm/registry.c (original)
+++ trunk/reactos/ntoskrnl/cm/registry.c Thu Oct 5 06:02:27 2006
@@ -136,18 +136,48 @@
CmInitHives(BOOLEAN SetupBoot)
{
PCHAR BaseAddress;
+ PLIST_ENTRY ListHead, NextEntry;
+ PMEMORY_ALLOCATION_DESCRIPTOR MdBlock = NULL;
/* Load Registry Hives. This one can be missing. */
- if (CachedModules[SystemRegistry]) {
- BaseAddress = (PCHAR)CachedModules[SystemRegistry]->ModStart;
+ BaseAddress = KeLoaderBlock->RegistryBase;
+ if (BaseAddress)
+ {
CmImportSystemHive(BaseAddress,
- CachedModules[SystemRegistry]->ModEnd -
(ULONG_PTR)BaseAddress);
- }
-
- BaseAddress = (PCHAR)CachedModules[HardwareRegistry]->ModStart;
+ KeLoaderBlock->RegistryLength);
+ }
+
+ /* Loop the memory descriptors */
+ ListHead = &KeLoaderBlock->MemoryDescriptorListHead;
+ NextEntry = ListHead->Flink;
+ while (NextEntry != ListHead)
+ {
+ /* Get the current block */
+ MdBlock = CONTAINING_RECORD(NextEntry,
+ MEMORY_ALLOCATION_DESCRIPTOR,
+ ListEntry);
+
+ /* Check if this is an registry block */
+ if (MdBlock->MemoryType == LoaderRegistryData)
+ {
+ /* Check if it's not the SYSTEM hive that we already initialized */
+ if ((MdBlock->BasePage) != ((ULONG_PTR)BaseAddress >> PAGE_SHIFT))
+ {
+ /* Hardware hive break out */
+ break;
+ }
+ }
+
+ /* Go to the next block */
+ NextEntry = MdBlock->ListEntry.Flink;
+ }
+
+ /* We need a hardware hive */
+ ASSERT(MdBlock);
+
+ BaseAddress = (PCHAR)(MdBlock->BasePage << PAGE_SHIFT);
CmImportHardwareHive(BaseAddress,
- CachedModules[HardwareRegistry]->ModEnd -
(ULONG_PTR)BaseAddress);
-
+ MdBlock->PageCount << PAGE_SHIFT);
/* Create dummy keys if no hardware hive was found */
CmImportHardwareHive (NULL, 0);
Modified: trunk/reactos/ntoskrnl/ex/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=244…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c (original)
+++ trunk/reactos/ntoskrnl/ex/init.c Thu Oct 5 06:02:27 2006
@@ -25,16 +25,13 @@
ULONG NtGlobalFlag;
ULONG ExSuiteMask;
-extern LOADER_MODULE KeLoaderModules[64];
-extern ULONG KeLoaderModuleCount;
-extern ULONG KiServiceLimit;
-BOOLEAN NoGuiBoot = FALSE;
-
/* Init flags and settings */
ULONG ExpInitializationPhase;
BOOLEAN ExpInTextModeSetup;
BOOLEAN IoRemoteBootClient;
ULONG InitSafeBootMode;
+
+BOOLEAN NoGuiBoot = FALSE;
/* NT Boot Path */
UNICODE_STRING NtSystemRoot;
@@ -291,52 +288,6 @@
DbgPrint("No system drive found!\n");
KEBUGCHECK (NO_BOOT_DEVICE);
- }
-}
-
-VOID
-FORCEINLINE
-ParseAndCacheLoadedModules(VOID)
-{
- ULONG i;
- PCHAR Name;
-
- /* Loop the Module List and get the modules we want */
- for (i = 1; i < KeLoaderModuleCount; i++)
- {
- /* Get the Name of this Module */
- if (!(Name = strrchr((PCHAR)KeLoaderModules[i].String, '\\')))
- {
- /* Save the name */
- Name = (PCHAR)KeLoaderModules[i].String;
- }
- else
- {
- /* No name, skip */
- Name++;
- }
-
- /* Now check for any of the modules we will need later */
- if (!_stricmp(Name, "ansi.nls"))
- {
- CachedModules[AnsiCodepage] = &KeLoaderModules[i];
- }
- else if (!_stricmp(Name, "oem.nls"))
- {
- CachedModules[OemCodepage] = &KeLoaderModules[i];
- }
- else if (!_stricmp(Name, "casemap.nls"))
- {
- CachedModules[UnicodeCasemap] = &KeLoaderModules[i];
- }
- else if (!_stricmp(Name, "system") || !_stricmp(Name,
"system.hiv"))
- {
- CachedModules[SystemRegistry] = &KeLoaderModules[i];
- }
- else if (!_stricmp(Name, "hardware") || !_stricmp(Name,
"hardware.hiv"))
- {
- CachedModules[HardwareRegistry] = &KeLoaderModules[i];
- }
}
}
@@ -577,9 +528,6 @@
PLIST_ENTRY NextEntry, ListHead;
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
- /* FIXME: Deprecate soon */
- ParseAndCacheLoadedModules();
-
/* Validate Loader */
if (!ExpIsLoaderValid(LoaderBlock))
{
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ke.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h Thu Oct 5 06:02:27 2006
@@ -17,18 +17,6 @@
KPROFILE_SOURCE Source;
LIST_ENTRY ListEntry;
} KPROFILE_SOURCE_OBJECT, *PKPROFILE_SOURCE_OBJECT;
-
-/* Cached modules from the loader block */
-typedef enum _CACHED_MODULE_TYPE
-{
- AnsiCodepage,
- OemCodepage,
- UnicodeCasemap,
- SystemRegistry,
- HardwareRegistry,
- MaximumCachedModuleType,
-} CACHED_MODULE_TYPE, *PCACHED_MODULE_TYPE;
-extern PLOADER_MODULE CachedModules[MaximumCachedModuleType];
typedef enum _CONNECT_TYPE
{
@@ -122,6 +110,7 @@
extern LARGE_INTEGER KiTimeIncrementReciprocal;
extern UCHAR KiTimeIncrementShiftCount;
extern ULONG KiTimeLimitIsrMicroseconds;
+extern ULONG KiServiceLimit;
extern LIST_ENTRY BugcheckCallbackListHead, BugcheckReasonCallbackListHead;
extern KSPIN_LOCK BugCheckCallbackLock;
extern KDPC KiExpireTimerDpc;
Modified: trunk/reactos/ntoskrnl/ke/freeldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/freeldr.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/freeldr.c (original)
+++ trunk/reactos/ntoskrnl/ke/freeldr.c Thu Oct 5 06:02:27 2006
@@ -18,7 +18,6 @@
LOADER_MODULE KeLoaderModules[64];
ULONG KeLoaderModuleCount;
static CHAR KeLoaderModuleStrings[64][256];
-PLOADER_MODULE CachedModules[MaximumCachedModuleType];
/* FreeLDR Memory Data */
ADDRESS_RANGE KeMemoryMap[64];
@@ -171,10 +170,6 @@
if (!(_stricmp(DriverName, "hardware")) ||
!(_stricmp(DriverName, "hardware.hiv")))
{
- /* Save registry data */
- LoaderBlock->RegistryBase = ModStart;
- LoaderBlock->RegistryLength = ModSize;
-
/* Create an MD for it */
MdEntry = &BldrMemoryDescriptors[i];
MdEntry->MemoryType = LoaderRegistryData;