From 2855e1f08f13131e27499e01dbe8d9b4adf2eceb Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sun, 1 Oct 2006 19:43:18 +0000 Subject: [PATCH] - Do MmInit1 in KiInitializeKernel so we can access SharedUserData from it (we'll need to setup the CPU Features there). - Cleanup some external/prototype mess and put them nicely into headers. svn path=/trunk/; revision=24351 --- reactos/ntoskrnl/ex/init.c | 64 ++------------------------ reactos/ntoskrnl/include/internal/ke.h | 6 +++ reactos/ntoskrnl/include/internal/ps.h | 6 +++ reactos/ntoskrnl/ke/clock.c | 1 - reactos/ntoskrnl/ke/i386/kiinit.c | 12 ++++- 5 files changed, 28 insertions(+), 61 deletions(-) diff --git a/reactos/ntoskrnl/ex/init.c b/reactos/ntoskrnl/ex/init.c index e48b6581727..1ee785e56a4 100644 --- a/reactos/ntoskrnl/ex/init.c +++ b/reactos/ntoskrnl/ex/init.c @@ -24,35 +24,18 @@ ULONG NtOSCSDVersion = BUILD_OSCSDVERSION(4, 0); ULONG NtBuildNumber = KERNEL_VERSION_BUILD; ULONG NtGlobalFlag = 0; -ULONG InitSafeBootMode = 0; /* KB83764 */ - extern ULONG MmCoreDumpType; -extern CHAR KiTimerSystemAuditing; -extern PVOID Ki386InitialStackArray[MAXIMUM_PROCESSORS]; -extern ADDRESS_RANGE KeMemoryMap[64]; -extern ULONG KeMemoryMapRangeCount; -extern ULONG_PTR FirstKrnlPhysAddr; -extern ULONG_PTR LastKrnlPhysAddr; -extern ULONG_PTR LastKernelAddress; extern LOADER_MODULE KeLoaderModules[64]; extern ULONG KeLoaderModuleCount; extern PRTL_MESSAGE_RESOURCE_DATA KiBugCodeMessages; - BOOLEAN NoGuiBoot = FALSE; -static BOOLEAN BootLog = FALSE; -static ULONG MaxMem = 0; static BOOLEAN ForceAcpiDisable = FALSE; -BOOLEAN -NTAPI -PspInitPhase0( - VOID -); - /* Init flags and settings */ ULONG ExpInitializationPhase; BOOLEAN ExpInTextModeSetup; BOOLEAN IoRemoteBootClient; +ULONG InitSafeBootMode; /* Boot NLS information */ PVOID ExpNlsTableBase; @@ -251,9 +234,7 @@ InitSystemSharedUserPage (PCSZ ParameterLine) __inline VOID STDCALL -ParseCommandLine(PULONG MaxMem, - PBOOLEAN NoGuiBoot, - PBOOLEAN BootLog, +ParseCommandLine(PBOOLEAN NoGuiBoot, PBOOLEAN ForceAcpiDisable) { PCHAR p1, p2; @@ -262,26 +243,7 @@ ParseCommandLine(PULONG MaxMem, while(*p1 && (p2 = strchr(p1, '/'))) { p2++; - if (!_strnicmp(p2, "MAXMEM", 6)) { - - p2 += 6; - while (isspace(*p2)) p2++; - - if (*p2 == '=') { - - p2++; - - while(isspace(*p2)) p2++; - - if (isdigit(*p2)) { - while (isdigit(*p2)) { - *MaxMem = *MaxMem * 10 + *p2 - '0'; - p2++; - } - break; - } - } - } else if (!_strnicmp(p2, "NOGUIBOOT", 9)) { + if (!_strnicmp(p2, "NOGUIBOOT", 9)) { p2 += 9; *NoGuiBoot = TRUE; @@ -301,10 +263,6 @@ ParseCommandLine(PULONG MaxMem, MmCoreDumpType = MM_CORE_DUMP_TYPE_NONE; } } - } else if (!_strnicmp(p2, "BOOTLOG", 7)) { - - p2 += 7; - *BootLog = TRUE; } else if (!_strnicmp(p2, "NOACPI", 6)) { p2 += 6; @@ -514,19 +472,8 @@ ExpInitializeExecutive(IN ULONG Cpu, { PNLS_DATA_BLOCK NlsData; - /* Initialize Kernel Memory Address Space */ - MmInit1(FirstKrnlPhysAddr, - LastKrnlPhysAddr, - LastKernelAddress, - (PADDRESS_RANGE)&KeMemoryMap, - KeMemoryMapRangeCount, - MaxMem > 8 ? MaxMem : 4096); - - /* Sets up the Text Sections of the Kernel and HAL for debugging */ - LdrInit1(); - /* Parse Command Line Settings */ - ParseCommandLine(&MaxMem, &NoGuiBoot, &BootLog, &ForceAcpiDisable); + ParseCommandLine(&NoGuiBoot, &ForceAcpiDisable); /* FIXME: Deprecate soon */ ParseAndCacheLoadedModules(); @@ -726,7 +673,7 @@ ExPhase2Init(PVOID Context) DbgBreakPoint(); /* Setup Drivers and Root Device Node */ - IoInit2(BootLog); + IoInit2(FALSE); /* Display the boot screen image if not disabled */ if (!NoGuiBoot) InbvEnableBootDriver(TRUE); @@ -826,7 +773,6 @@ ExPhase2Init(PVOID Context) } /* Enable the Clock, close remaining handles */ - KiTimerSystemAuditing = 1; ZwClose(ThreadHandle); ZwClose(ProcessHandle); diff --git a/reactos/ntoskrnl/include/internal/ke.h b/reactos/ntoskrnl/include/internal/ke.h index bde53e3aa71..d901f374913 100644 --- a/reactos/ntoskrnl/include/internal/ke.h +++ b/reactos/ntoskrnl/include/internal/ke.h @@ -67,6 +67,12 @@ struct _KPCR; struct _KPRCB; struct _KEXCEPTION_FRAME; +extern ADDRESS_RANGE KeMemoryMap[64]; +extern ULONG KeMemoryMapRangeCount; +extern ULONG_PTR FirstKrnlPhysAddr; +extern ULONG_PTR LastKrnlPhysAddr; +extern ULONG_PTR LastKernelAddress; + extern PVOID KeUserApcDispatcher; extern PVOID KeUserCallbackDispatcher; extern PVOID KeUserExceptionDispatcher; diff --git a/reactos/ntoskrnl/include/internal/ps.h b/reactos/ntoskrnl/include/internal/ps.h index 60d3acfed36..e62e472242d 100644 --- a/reactos/ntoskrnl/include/internal/ps.h +++ b/reactos/ntoskrnl/include/internal/ps.h @@ -79,6 +79,12 @@ PspShutdownProcessManager( VOID ); +BOOLEAN +NTAPI +PspInitPhase0( + VOID +); + // // Utility Routines // diff --git a/reactos/ntoskrnl/ke/clock.c b/reactos/ntoskrnl/ke/clock.c index 2bca7c9f630..e294543a093 100644 --- a/reactos/ntoskrnl/ke/clock.c +++ b/reactos/ntoskrnl/ke/clock.c @@ -35,7 +35,6 @@ LARGE_INTEGER SystemBootTime = (LARGE_INTEGER)0LL; LARGE_INTEGER SystemBootTime = { 0 }; #endif -CHAR KiTimerSystemAuditing = 0; KDPC KiExpireTimerDpc; BOOLEAN KiClockSetupComplete = FALSE; diff --git a/reactos/ntoskrnl/ke/i386/kiinit.c b/reactos/ntoskrnl/ke/i386/kiinit.c index dba13f77e54..8e4f8112349 100644 --- a/reactos/ntoskrnl/ke/i386/kiinit.c +++ b/reactos/ntoskrnl/ke/i386/kiinit.c @@ -11,7 +11,6 @@ #include #define NDEBUG #include -#include /* GLOBALS *******************************************************************/ @@ -164,6 +163,17 @@ KiInitializeKernel(IN PKPROCESS InitProcess, DPRINT1("SMP Boot support not yet present\n"); } + /* Initialize Kernel Memory Address Space */ + MmInit1(FirstKrnlPhysAddr, + LastKrnlPhysAddr, + LastKernelAddress, + (PADDRESS_RANGE)&KeMemoryMap, + KeMemoryMapRangeCount, + 4096); + + /* Sets up the Text Sections of the Kernel and HAL for debugging */ + LdrInit1(); + /* Setup the Idle Thread */ KeInitializeThread(InitProcess, InitThread,