Author: ion
Date: Thu Oct 5 20:38:58 2006
New Revision: 24414
URL:
http://svn.reactos.org/svn/reactos?rev=24414&view=rev
Log:
- Remove SMSS's code for signaling the "init" event.
- Make ExpInitNls responsible for NLS initialization in Phase 0 as well, to clean up the
code in ExpInitailizeExecutive a bit.
- Initialize the system time/clock in Phase 1, not in Phase 0.
- Do HAL Phase1 initialization as the first step in Phase 1 initialization, then
initialize the system clock (since the HAL's RTC is now configured).
- Do Ob Phase 1 init in Phase 1 initialization, not in phase 0.
- Do Ke Phase 1 init after HAL, Ob and Ex phase 1 inits.
- Initialize NLS for Phase 1 after Ke Phase 1, instead of much later.
Modified:
trunk/reactos/base/system/smss/init.c
trunk/reactos/ntoskrnl/ex/init.c
trunk/reactos/ntoskrnl/include/internal/ke.h
trunk/reactos/ntoskrnl/ke/krnlinit.c
Modified: trunk/reactos/base/system/smss/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/smss/init.c?re…
==============================================================================
--- trunk/reactos/base/system/smss/init.c (original)
+++ trunk/reactos/base/system/smss/init.c Thu Oct 5 20:38:58 2006
@@ -31,43 +31,6 @@
/* FUNCTIONS ****************************************************************/
-static NTSTATUS
-SmpSignalInitEvent(VOID)
-{
- NTSTATUS Status = STATUS_SUCCESS;
- OBJECT_ATTRIBUTES ObjectAttributes = {0};
- UNICODE_STRING EventName ={0};
- HANDLE ReactOSInitEvent = (HANDLE) 0;
-
- RtlInitUnicodeString (& EventName, L"\\ReactOSInitDone");
- InitializeObjectAttributes(&ObjectAttributes,
- & EventName,
- 0,
- 0,
- NULL);
- Status = NtOpenEvent(&ReactOSInitEvent,
- EVENT_ALL_ACCESS,
- &ObjectAttributes);
- if (NT_SUCCESS(Status))
- {
- LARGE_INTEGER Timeout;
- /* This will cause the boot screen image to go away (if displayed) */
- NtPulseEvent(ReactOSInitEvent, NULL);
-
- /* Wait for the display mode to be changed (if in graphics mode) */
- Timeout.QuadPart = -50000000LL; /* 5 second timeout */
- NtWaitForSingleObject(ReactOSInitEvent, FALSE, &Timeout);
-
- NtClose(ReactOSInitEvent);
- }
- else
- {
- /* We don't really care if this fails */
- DPRINT1("SM: Failed to open ReactOS init notification event\n");
- }
- return Status;
-}
-
typedef NTSTATUS (* SM_INIT_ROUTINE)(VOID);
struct {
@@ -88,8 +51,7 @@
{TRUE, SmInitializeRegistry, "initialize the registry"},
{FALSE, SmUpdateEnvironment, "update environment variables"},
{TRUE, SmInitializeClientManagement, "initialize client management"},
- {TRUE, SmLoadSubsystems, "load subsystems"},
- {FALSE, SmpSignalInitEvent, "open ReactOS init notification
event"},
+ {TRUE, SmLoadSubsystems, "load subsystems"}
};
NTSTATUS
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 20:38:58 2006
@@ -48,7 +48,7 @@
VOID
NTAPI
-ExpInitNls(VOID)
+ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
LARGE_INTEGER SectionSize;
NTSTATUS Status;
@@ -56,6 +56,61 @@
PVOID SectionBase = NULL;
ULONG ViewSize = 0;
LARGE_INTEGER SectionOffset = {{0}};
+ PLIST_ENTRY ListHead, NextEntry;
+ PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
+
+ /* Check if this is boot-time phase 0 initialization */
+ if (!ExpInitializationPhase)
+ {
+ /* Loop the memory descriptors */
+ ListHead = &LoaderBlock->MemoryDescriptorListHead;
+ NextEntry = ListHead->Flink;
+ while (NextEntry != ListHead)
+ {
+ /* Get the current block */
+ MdBlock = CONTAINING_RECORD(NextEntry,
+ MEMORY_ALLOCATION_DESCRIPTOR,
+ ListEntry);
+
+ /* Check if this is an NLS block */
+ if (MdBlock->MemoryType == LoaderNlsData)
+ {
+ /* Increase the table size */
+ ExpNlsTableSize += MdBlock->PageCount * PAGE_SIZE;
+ }
+
+ /* Go to the next block */
+ NextEntry = MdBlock->ListEntry.Flink;
+ }
+
+ /*
+ * In NT, the memory blocks are contiguous, but in ReactOS they aren't,
+ * so unless someone fixes FreeLdr, we'll have to use this icky hack.
+ */
+ ExpNlsTableSize += 2 * PAGE_SIZE; // BIAS FOR FREELDR. HACK!
+
+ /* Allocate the a new buffer since loader memory will be freed */
+ ExpNlsTableBase = ExAllocatePoolWithTag(NonPagedPool,
+ ExpNlsTableSize,
+ TAG('R', 't',
'l', 'i'));
+ if (!ExpNlsTableBase) KeBugCheck(PHASE0_INITIALIZATION_FAILED);
+
+ /* Copy the codepage data in its new location. */
+ RtlMoveMemory(ExpNlsTableBase,
+ LoaderBlock->NlsData->AnsiCodePageData,
+ ExpNlsTableSize);
+
+ /* Initialize and reset the NLS TAbles */
+ RtlInitNlsTables((PVOID)((ULONG_PTR)ExpNlsTableBase +
+ ExpAnsiCodePageDataOffset),
+ (PVOID)((ULONG_PTR)ExpNlsTableBase +
+ ExpOemCodePageDataOffset),
+ (PVOID)((ULONG_PTR)ExpNlsTableBase +
+ ExpUnicodeCaseTableDataOffset),
+ &ExpNlsTableInfo);
+ RtlResetRtlTranslations(&ExpNlsTableInfo);
+ return;
+ }
/* Set the section size */
SectionSize.QuadPart = ExpNlsTableSize;
@@ -619,8 +674,6 @@
CHAR Buffer[256];
ANSI_STRING AnsiPath;
NTSTATUS Status;
- PLIST_ENTRY NextEntry, ListHead;
- PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
/* Validate Loader */
if (!ExpIsLoaderValid(LoaderBlock))
@@ -731,9 +784,6 @@
/* Setup bugcheck messages */
KiInitializeBugCheck();
- /* Setup system time */
- KiInitializeSystemClock();
-
/* Initialize the executive at phase 0 */
if (!ExInitSystem()) KEBUGCHECK(PHASE0_INITIALIZATION_FAILED);
@@ -744,53 +794,8 @@
SharedUserData->Reserved1 = (ULONG_PTR)MmHighestUserAddress;
SharedUserData->Reserved3 = (ULONG_PTR)MmSystemRangeStart;
- /* Loop the memory descriptors */
- ListHead = &LoaderBlock->MemoryDescriptorListHead;
- NextEntry = ListHead->Flink;
- while (NextEntry != ListHead)
- {
- /* Get the current block */
- MdBlock = CONTAINING_RECORD(NextEntry,
- MEMORY_ALLOCATION_DESCRIPTOR,
- ListEntry);
-
- /* Check if this is an NLS block */
- if (MdBlock->MemoryType == LoaderNlsData)
- {
- /* Increase the table size */
- ExpNlsTableSize += MdBlock->PageCount * PAGE_SIZE;
- }
-
- /* Go to the next block */
- NextEntry = MdBlock->ListEntry.Flink;
- }
-
- /*
- * In NT, the memory blocks are contiguous, but in ReactOS they are not,
- * so unless someone fixes FreeLdr, we'll have to use this icky hack.
- */
- ExpNlsTableSize += 2 * PAGE_SIZE; // BIAS FOR FREELDR. HACK!
-
- /* Allocate the NLS buffer in the pool since loader memory will be freed */
- ExpNlsTableBase = ExAllocatePoolWithTag(NonPagedPool,
- ExpNlsTableSize,
- TAG('R', 't', 'l',
'i'));
- if (!ExpNlsTableBase) KeBugCheck(PHASE0_INITIALIZATION_FAILED);
-
- /* Copy the codepage data in its new location. */
- RtlMoveMemory(ExpNlsTableBase,
- LoaderBlock->NlsData->AnsiCodePageData,
- ExpNlsTableSize);
-
- /* Initialize and reset the NLS TAbles */
- RtlInitNlsTables((PVOID)((ULONG_PTR)ExpNlsTableBase +
- ExpAnsiCodePageDataOffset),
- (PVOID)((ULONG_PTR)ExpNlsTableBase +
- ExpOemCodePageDataOffset),
- (PVOID)((ULONG_PTR)ExpNlsTableBase +
- ExpUnicodeCaseTableDataOffset),
- &ExpNlsTableInfo);
- RtlResetRtlTranslations(&ExpNlsTableInfo);
+ /* Make a copy of the NLS Tables */
+ ExpInitNls(LoaderBlock);
/* Initialize the Handle Table */
ExpInitializeHandleTables();
@@ -822,9 +827,6 @@
/* Set up Region Maps, Sections and the Paging File */
MmInit2();
-
- /* Call OB initialization again */
- if (!ObInit()) KEBUGCHECK(OBJECT_INITIALIZATION_FAILED);
/* Initialize the Process Manager */
if (!PsInitSystem()) KEBUGCHECK(PROCESS_INITIALIZATION_FAILED);
@@ -864,17 +866,26 @@
/* Set us at maximum priority */
KeSetPriorityThread(KeGetCurrentThread(), HIGH_PRIORITY);
- /* Initialize the later stages of the kernel */
- KeInitSystem();
+ /* Do Phase 1 HAL Initialization */
+ HalInitSystem(1, KeLoaderBlock);
+
+ /* Setup system time */
+ KiInitializeSystemClock();
/* Initialize all processors */
HalAllProcessorsStarted();
- /* Do Phase 1 HAL Initialization */
- HalInitSystem(1, KeLoaderBlock);
+ /* Call OB initialization again */
+ if (!ObInit()) KEBUGCHECK(OBJECT1_INITIALIZATION_FAILED);
/* Initialize Basic System Objects and Worker Threads */
- ExInitSystem();
+ if (!ExInitSystem()) KEBUGCHECK(PHASE1_INITIALIZATION_FAILED);
+
+ /* Initialize the later stages of the kernel */
+ if (!KeInitSystem()) KEBUGCHECK(PHASE1_INITIALIZATION_FAILED);
+
+ /* Create NLS section */
+ ExpInitNls(KeLoaderBlock);
/* Call KD Providers at Phase 1 */
KdInitSystem(1, KeLoaderBlock);
@@ -888,7 +899,7 @@
/* Initialize the Registry (Hives are NOT yet loaded!) */
CmInitializeRegistry();
- /* Unmap Low memory, initialize the Page Zeroing and the Balancer Thread */
+ /* Unmap Low memory, and initialize the MPW and Balancer Thread */
MmInit3();
/* Initialize Cache Views */
@@ -911,9 +922,6 @@
/* Call KD Providers at Phase 2 */
KdInitSystem(2, KeLoaderBlock);
-
- /* Create NLS section */
- ExpInitNls();
/* Initialize LPC */
LpcpInitSystem();
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 20:38:58 2006
@@ -626,7 +626,7 @@
/* INITIALIZATION FUNCTIONS *************************************************/
-VOID
+BOOLEAN
NTAPI
KeInitSystem(VOID);
Modified: trunk/reactos/ntoskrnl/ke/krnlinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/krnlinit.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/krnlinit.c (original)
+++ trunk/reactos/ntoskrnl/ke/krnlinit.c Thu Oct 5 20:38:58 2006
@@ -273,7 +273,7 @@
}
}
-VOID
+BOOLEAN
NTAPI
KeInitSystem(VOID)
{
@@ -286,5 +286,6 @@
/* Initialize non-portable parts of the kernel */
KiInitMachineDependent();
-}
-
+ return TRUE;
+}
+