mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
- Do MmInit1 much earlier in the boot phase (right at the beginning of ExpInitalizeExecutive). This gives us access to things like SharedUserData, which NT has since NTLDR. Will try moving it up even higher.
- Also move some ROS-specific/Freeldr hacks on top of the file so they'll be easier to remove later when needed. - Fix a bug in ExInitPoolLookasidePointers which was making us overwrite low-memory. - Initialize NLS tables during Phase 0, so that the associated APIs can work earlier. - Bugcheck if HAL Phase 0 initialization failed, and force interrupts enabled after the HAL is ready. svn path=/trunk/; revision=24348
This commit is contained in:
parent
9f40202dfc
commit
71e329a125
|
@ -49,10 +49,17 @@ PspInitPhase0(
|
|||
VOID
|
||||
);
|
||||
|
||||
/* Init flags and settings */
|
||||
ULONG ExpInitializationPhase;
|
||||
BOOLEAN ExpInTextModeSetup;
|
||||
BOOLEAN IoRemoteBootClient;
|
||||
|
||||
/* Boot NLS information */
|
||||
PVOID ExpNlsTableBase;
|
||||
ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset;
|
||||
ULONG ExpUnicodeCaseTableDataOffset;
|
||||
NLSTABLEINFO ExpNlsTableInfo;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static
|
||||
|
@ -241,53 +248,6 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
|
|||
}
|
||||
}
|
||||
|
||||
__inline
|
||||
VOID
|
||||
STDCALL
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__inline
|
||||
VOID
|
||||
STDCALL
|
||||
|
@ -354,7 +314,53 @@ ParseCommandLine(PULONG MaxMem,
|
|||
p1 = p2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
INIT_FUNCTION
|
||||
ExpDisplayNotice(VOID)
|
||||
|
@ -506,6 +512,25 @@ NTAPI
|
|||
ExpInitializeExecutive(IN ULONG Cpu,
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
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);
|
||||
|
||||
/* FIXME: Deprecate soon */
|
||||
ParseAndCacheLoadedModules();
|
||||
|
||||
/* Validate Loader */
|
||||
if (!ExpIsLoaderValid(LoaderBlock))
|
||||
{
|
||||
|
@ -558,32 +583,38 @@ ExpInitializeExecutive(IN ULONG Cpu,
|
|||
/* Set phase to 0 */
|
||||
ExpInitializationPhase = 0;
|
||||
|
||||
/* Initialize HAL */
|
||||
HalInitSystem (0, KeLoaderBlock);
|
||||
/* Setup NLS Base and offsets */
|
||||
NlsData = LoaderBlock->NlsData;
|
||||
ExpNlsTableBase = NlsData->AnsiCodePageData;
|
||||
ExpAnsiCodePageDataOffset = 0;
|
||||
ExpOemCodePageDataOffset = ((ULONG_PTR)NlsData->OemCodePageData -
|
||||
(ULONG_PTR)NlsData->AnsiCodePageData);
|
||||
ExpUnicodeCaseTableDataOffset = ((ULONG_PTR)NlsData->UnicodeCodePageData -
|
||||
(ULONG_PTR)NlsData->AnsiCodePageData);
|
||||
|
||||
/* Sets up the Text Sections of the Kernel and HAL for debugging */
|
||||
LdrInit1();
|
||||
/* Initialize the NLS Tables */
|
||||
RtlInitNlsTables((PVOID)((ULONG_PTR)ExpNlsTableBase +
|
||||
ExpAnsiCodePageDataOffset),
|
||||
(PVOID)((ULONG_PTR)ExpNlsTableBase +
|
||||
ExpOemCodePageDataOffset),
|
||||
(PVOID)((ULONG_PTR)ExpNlsTableBase +
|
||||
ExpUnicodeCaseTableDataOffset),
|
||||
&ExpNlsTableInfo);
|
||||
RtlResetRtlTranslations(&ExpNlsTableInfo);
|
||||
|
||||
/* Now initialize the HAL */
|
||||
if (!HalInitSystem(ExpInitializationPhase, LoaderBlock))
|
||||
{
|
||||
/* HAL failed to initialize, bugcheck */
|
||||
KeBugCheck(HAL_INITIALIZATION_FAILED);
|
||||
}
|
||||
|
||||
/* Make sure interrupts are active now */
|
||||
_enable();
|
||||
|
||||
/* Setup bugcheck messages */
|
||||
KiInitializeBugCheck();
|
||||
|
||||
/* Sets up the VDM Data */
|
||||
NtEarlyInitVdm();
|
||||
|
||||
/* Parse Command Line Settings */
|
||||
ParseCommandLine(&MaxMem, &NoGuiBoot, &BootLog, &ForceAcpiDisable);
|
||||
|
||||
/* Initialize Kernel Memory Address Space */
|
||||
MmInit1(FirstKrnlPhysAddr,
|
||||
LastKrnlPhysAddr,
|
||||
LastKernelAddress,
|
||||
(PADDRESS_RANGE)&KeMemoryMap,
|
||||
KeMemoryMapRangeCount,
|
||||
MaxMem > 8 ? MaxMem : 4096);
|
||||
|
||||
/* Parse the Loaded Modules (by FreeLoader) and cache the ones we'll need */
|
||||
ParseAndCacheLoadedModules();
|
||||
|
||||
/* Setup system time */
|
||||
KiInitializeSystemClock();
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ LIST_ENTRY ExpNonPagedLookasideListHead;
|
|||
KSPIN_LOCK ExpNonPagedLookasideListLock;
|
||||
LIST_ENTRY ExpPagedLookasideListHead;
|
||||
KSPIN_LOCK ExpPagedLookasideListLock;
|
||||
PNPAGED_LOOKASIDE_LIST ExpSmallNPagedPoolLookasideLists;
|
||||
PPAGED_LOOKASIDE_LIST ExpSmallPagedPoolLookasideLists;
|
||||
NPAGED_LOOKASIDE_LIST ExpSmallNPagedPoolLookasideLists[MAXIMUM_PROCESSORS];
|
||||
PAGED_LOOKASIDE_LIST ExpSmallPagedPoolLookasideLists[MAXIMUM_PROCESSORS];
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
|
|
@ -431,6 +431,9 @@ KiRosPrepareForSystemStartup(IN ULONG Dummy,
|
|||
(PVOID)DriverBase,
|
||||
&DriverSize);
|
||||
|
||||
/* Sets up the VDM Data */
|
||||
NtEarlyInitVdm();
|
||||
|
||||
/* Convert the loader block */
|
||||
KiRosFrldrLpbToNtLpb(&KeRosLoaderBlock, &NtLoaderBlock);
|
||||
|
||||
|
|
|
@ -64,9 +64,6 @@ RtlpInitNls(VOID)
|
|||
RtlpImportUnicodeCasemap((PUSHORT)BaseAddress,
|
||||
CachedModules[UnicodeCasemap]->ModEnd - BaseAddress);
|
||||
|
||||
/* Create initial NLS tables */
|
||||
RtlpCreateInitialNlsTables();
|
||||
|
||||
/* Create the NLS section */
|
||||
RtlpCreateNlsSection();
|
||||
}
|
||||
|
@ -103,29 +100,6 @@ RtlpImportUnicodeCasemap(PUSHORT TableBase,
|
|||
NlsUnicodeCasemapTableSize = Size;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
INIT_FUNCTION
|
||||
RtlpCreateInitialNlsTables(VOID)
|
||||
{
|
||||
NLSTABLEINFO NlsTable;
|
||||
|
||||
if (NlsAnsiCodePageTable == NULL || NlsAnsiCodePageTableSize == 0 ||
|
||||
NlsOemCodePageTable == NULL || NlsOemCodePageTableSize == 0 ||
|
||||
NlsUnicodeCasemapTable == NULL || NlsUnicodeCasemapTableSize == 0)
|
||||
{
|
||||
KEBUGCHECKEX (0x32, STATUS_UNSUCCESSFUL, 1, 0, 0);
|
||||
}
|
||||
|
||||
RtlInitNlsTables (NlsAnsiCodePageTable,
|
||||
NlsOemCodePageTable,
|
||||
NlsUnicodeCasemapTable,
|
||||
&NlsTable);
|
||||
|
||||
RtlResetRtlTranslations (&NlsTable);
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
INIT_FUNCTION
|
||||
|
|
Loading…
Reference in a new issue