mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
- Use LOADER_PARAMETER_BLOCK everywhere in ReactOS except freeldr.c
- Implemented KiRosFrldrLpbtoNtLpb to do a lightweight conversion and setup. Next patches will try to get rid of PLOADER_MODULE and use LDR_DATA_TABLE_ENTRY as well as increase bootstrap compatibility. svn path=/trunk/; revision=24305
This commit is contained in:
parent
79e7a43785
commit
8b1ba6c11a
23 changed files with 125 additions and 81 deletions
|
@ -571,7 +571,7 @@ HalRestorePalette(VOID)
|
|||
/* PRIVATE FUNCTIONS ********************************************************/
|
||||
|
||||
VOID FASTCALL
|
||||
HalInitializeDisplay (PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
/*
|
||||
* FUNCTION: Initalize the display
|
||||
* ARGUMENTS:
|
||||
|
|
|
@ -38,7 +38,7 @@ HalInitSystem (ULONG BootPhase,
|
|||
if (BootPhase == 0)
|
||||
{
|
||||
RtlZeroMemory(&HalpHooks, sizeof(HALP_HOOKS));
|
||||
HalpInitPhase0((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock);
|
||||
HalpInitPhase0(LoaderBlock);
|
||||
}
|
||||
else if (BootPhase == 1)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ HalInitSystem (ULONG BootPhase,
|
|||
//HalpInitPhase1();
|
||||
|
||||
/* Initialize display and make the screen black */
|
||||
HalInitializeDisplay ((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock);
|
||||
HalInitializeDisplay (LoaderBlock);
|
||||
HalpInitBusHandlers();
|
||||
HalpInitDma();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ typedef struct _KD_PORT_INFORMATION
|
|||
} KD_PORT_INFORMATION, *PKD_PORT_INFORMATION;
|
||||
|
||||
/* display.c */
|
||||
VOID FASTCALL HalInitializeDisplay (struct _ROS_LOADER_PARAMETER_BLOCK *LoaderBlock);
|
||||
VOID FASTCALL HalInitializeDisplay (struct _LOADER_PARAMETER_BLOCK *LoaderBlock);
|
||||
VOID FASTCALL HalClearDisplay (UCHAR CharAttribute);
|
||||
|
||||
/* adapter.c */
|
||||
|
@ -47,7 +47,7 @@ VOID HalpInitDma (VOID);
|
|||
PVOID HalpMapPhysMemory(ULONG PhysAddr, ULONG Size);
|
||||
|
||||
/* Non-generic initialization */
|
||||
VOID HalpInitPhase0 (PROS_LOADER_PARAMETER_BLOCK LoaderBlock);
|
||||
VOID HalpInitPhase0 (PLOADER_PARAMETER_BLOCK LoaderBlock);
|
||||
VOID HalpInitPhase1(VOID);
|
||||
VOID NTAPI HalpClockInterrupt(VOID);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
VOID
|
||||
HalpInitPhase0(PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
HalpInitPhase0(PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
HalpInitPICs();
|
||||
|
||||
|
|
|
@ -974,11 +974,7 @@ typedef struct _KSERVICE_TABLE_DESCRIPTOR
|
|||
//
|
||||
// Exported Loader Parameter Block
|
||||
//
|
||||
#ifndef _REACTOS_
|
||||
extern struct _LOADER_PARAMETER_BLOCK NTSYSAPI *KeLoaderBlock;
|
||||
#else
|
||||
extern struct _ROS_LOADER_PARAMETER_BLOCK NTSYSAPI KeLoaderBlock;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Exported Hardware Data
|
||||
|
|
|
@ -44,4 +44,10 @@ typedef struct _ROS_LOADER_PARAMETER_BLOCK
|
|||
ULONG KernelBase;
|
||||
} ROS_LOADER_PARAMETER_BLOCK, *PROS_LOADER_PARAMETER_BLOCK;
|
||||
|
||||
extern LOADER_MODULE KeLoaderModules[64];
|
||||
extern ULONG KeLoaderModuleCount;
|
||||
extern ULONG MmFreeLdrMemHigher, MmFreeLdrMemLower;
|
||||
extern BOOLEAN AcpiTableDetected;
|
||||
extern ULONG MmFreeLdrPageDirectoryStart, MmFreeLdrPageDirectoryEnd;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -153,7 +153,7 @@ CmInitHives(BOOLEAN SetupBoot)
|
|||
CmImportHardwareHive (NULL, 0);
|
||||
|
||||
/* Initialize volatile registry settings */
|
||||
if (SetupBoot == FALSE) CmInit2((PCHAR)KeLoaderBlock.CommandLine);
|
||||
if (SetupBoot == FALSE) CmInit2(KeLoaderBlock->LoadOptions);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
|
|
@ -292,7 +292,7 @@ ParseAndCacheLoadedModules(VOID)
|
|||
PCHAR Name;
|
||||
|
||||
/* Loop the Module List and get the modules we want */
|
||||
for (i = 1; i < KeLoaderBlock.ModsCount; i++) {
|
||||
for (i = 1; i < KeLoaderModuleCount; i++) {
|
||||
|
||||
/* Get the Name of this Module */
|
||||
if (!(Name = strrchr((PCHAR)KeLoaderModules[i].String, '\\'))) {
|
||||
|
@ -341,7 +341,7 @@ ParseCommandLine(PULONG MaxMem,
|
|||
{
|
||||
PCHAR p1, p2;
|
||||
|
||||
p1 = (PCHAR)KeLoaderBlock.CommandLine;
|
||||
p1 = KeLoaderBlock->LoadOptions;
|
||||
while(*p1 && (p2 = strchr(p1, '/'))) {
|
||||
|
||||
p2++;
|
||||
|
@ -429,7 +429,7 @@ ExpDisplayNotice(VOID)
|
|||
sprintf(str,
|
||||
"Found %x system processor(s). [%lu MB Memory]\n",
|
||||
(int)KeNumberProcessors,
|
||||
(KeLoaderBlock.MemHigher + 1088)/ 1024);
|
||||
(MmFreeLdrMemHigher + 1088)/ 1024);
|
||||
HalDisplayString(str);
|
||||
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ ExpInitializeExecutive(VOID)
|
|||
ExecuteRuntimeAsserts();
|
||||
|
||||
/* Initialize HAL */
|
||||
HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
||||
HalInitSystem (0, KeLoaderBlock);
|
||||
|
||||
/* Sets up the Text Sections of the Kernel and HAL for debugging */
|
||||
LdrInit1();
|
||||
|
@ -586,7 +586,7 @@ ExpInitializeExecutive(VOID)
|
|||
HalAllProcessorsStarted();
|
||||
|
||||
/* Do Phase 1 HAL Initalization */
|
||||
HalInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
||||
HalInitSystem(1, KeLoaderBlock);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -614,13 +614,13 @@ ExPhase2Init(PVOID Context)
|
|||
ExpInitializeCallbacks();
|
||||
|
||||
/* Call KD Providers at Phase 1 */
|
||||
KdInitSystem(1, (PROS_LOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
||||
KdInitSystem(1, KeLoaderBlock);
|
||||
|
||||
/* Initialize I/O Objects, Filesystems, Error Logging and Shutdown */
|
||||
IoInit();
|
||||
|
||||
/* TBD */
|
||||
PoInit((PROS_LOADER_PARAMETER_BLOCK)&KeLoaderBlock, ForceAcpiDisable);
|
||||
PoInit(AcpiTableDetected, ForceAcpiDisable);
|
||||
|
||||
/* Initialize the Registry (Hives are NOT yet loaded!) */
|
||||
CmInitializeRegistry();
|
||||
|
@ -638,13 +638,13 @@ ExPhase2Init(PVOID Context)
|
|||
HalReportResourceUsage();
|
||||
|
||||
/* Clear the screen to blue */
|
||||
HalInitSystem(2, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
||||
HalInitSystem(2, KeLoaderBlock);
|
||||
|
||||
/* Display version number and copyright/warranty message */
|
||||
if (NoGuiBoot) ExpDisplayNotice();
|
||||
|
||||
/* Call KD Providers at Phase 2 */
|
||||
KdInitSystem(2, (PROS_LOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
||||
KdInitSystem(2, KeLoaderBlock);
|
||||
|
||||
/* Import and create NLS Data and Sections */
|
||||
RtlpInitNls();
|
||||
|
@ -675,7 +675,7 @@ ExPhase2Init(PVOID Context)
|
|||
PsLocateSystemDll();
|
||||
|
||||
/* Initialize shared user page. Set dos system path, dos device map, etc. */
|
||||
InitSystemSharedUserPage ((PCHAR)KeLoaderBlock.CommandLine);
|
||||
InitSystemSharedUserPage (KeLoaderBlock->LoadOptions);
|
||||
|
||||
/* Create 'ReactOSInitDone' event */
|
||||
RtlInitUnicodeString(&EventName, L"\\ReactOSInitDone");
|
||||
|
|
|
@ -978,7 +978,7 @@ xHalQueryDriveLayout(
|
|||
VOID
|
||||
FASTCALL
|
||||
xHalIoAssignDriveLetters(
|
||||
IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||
IN PSTRING NtDeviceName,
|
||||
OUT PUCHAR NtSystemPath,
|
||||
OUT PSTRING NtSystemPathString
|
||||
|
|
|
@ -661,7 +661,7 @@ Phase1Initialization(PVOID Context);
|
|||
VOID
|
||||
NTAPI
|
||||
KiSystemStartup(
|
||||
IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock
|
||||
);
|
||||
|
||||
VOID
|
||||
|
|
|
@ -59,7 +59,7 @@ typedef struct __DESCRIPTOR
|
|||
/*
|
||||
* Initalization functions (called once by main())
|
||||
*/
|
||||
VOID MmInitSystem(ULONG Phase, PROS_LOADER_PARAMETER_BLOCK LoaderBlock, ULONG LastKernelAddress);
|
||||
VOID MmInitSystem(ULONG Phase, PLOADER_PARAMETER_BLOCK LoaderBlock, ULONG LastKernelAddress);
|
||||
VOID IoInit(VOID);
|
||||
VOID IoInit2(BOOLEAN BootLog);
|
||||
VOID NTAPI IoInit3(VOID);
|
||||
|
@ -71,7 +71,7 @@ VOID CmInit2(PCHAR CommandLine);
|
|||
VOID CmShutdownRegistry(VOID);
|
||||
BOOLEAN CmImportSystemHive(PCHAR ChunkBase, ULONG ChunkSize);
|
||||
BOOLEAN CmImportHardwareHive(PCHAR ChunkBase, ULONG ChunkSize);
|
||||
VOID KdInitSystem(ULONG Reserved, PROS_LOADER_PARAMETER_BLOCK LoaderBlock);
|
||||
VOID KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock);
|
||||
|
||||
/* FIXME - RtlpCreateUnicodeString is obsolete and should be removed ASAP! */
|
||||
BOOLEAN FASTCALL
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
VOID
|
||||
NTAPI
|
||||
PoInit(
|
||||
PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
|
||||
BOOLEAN HaveAcpiTable,
|
||||
BOOLEAN ForceAcpiDisable
|
||||
);
|
||||
|
||||
|
|
|
@ -616,7 +616,7 @@ xHalpGetDiskNumberFromRDisk(ULONG RDisk, PULONG DiskNumber)
|
|||
|
||||
|
||||
VOID FASTCALL
|
||||
xHalIoAssignDriveLetters(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
|
||||
xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||
IN PSTRING NtDeviceName,
|
||||
OUT PUCHAR NtSystemPath,
|
||||
OUT PSTRING NtSystemPathString)
|
||||
|
|
|
@ -465,8 +465,6 @@ IopLoadServiceModule(
|
|||
ULONG i;
|
||||
CHAR SearchName[256];
|
||||
PCHAR ModuleName;
|
||||
PLOADER_MODULE KeLoaderModules =
|
||||
(PLOADER_MODULE)KeLoaderBlock.ModsAddr;
|
||||
|
||||
/*
|
||||
* FIXME:
|
||||
|
@ -476,7 +474,7 @@ IopLoadServiceModule(
|
|||
*/
|
||||
|
||||
_snprintf(SearchName, sizeof(SearchName), "%wZ.sys", ServiceName);
|
||||
for (i = 1; i < KeLoaderBlock.ModsCount; i++)
|
||||
for (i = 1; i < KeLoaderModuleCount; i++)
|
||||
{
|
||||
ModuleName = (PCHAR)KeLoaderModules[i].String;
|
||||
if (!_stricmp(ModuleName, SearchName))
|
||||
|
@ -940,7 +938,6 @@ IopInitializeBootDrivers(VOID)
|
|||
ULONG ModuleLoaded;
|
||||
PCHAR ModuleName;
|
||||
PCHAR Extension;
|
||||
PLOADER_MODULE KeLoaderModules = (PLOADER_MODULE)KeLoaderBlock.ModsAddr;
|
||||
ULONG i;
|
||||
UNICODE_STRING DriverName;
|
||||
NTSTATUS Status;
|
||||
|
@ -948,7 +945,7 @@ IopInitializeBootDrivers(VOID)
|
|||
DPRINT("IopInitializeBootDrivers()\n");
|
||||
|
||||
BootDriverCount = 0;
|
||||
for (i = 0; i < KeLoaderBlock.ModsCount; i++)
|
||||
for (i = 0; i < KeLoaderModuleCount; i++)
|
||||
{
|
||||
ModuleStart = KeLoaderModules[i].ModStart;
|
||||
ModuleSize = KeLoaderModules[i].ModEnd - ModuleStart;
|
||||
|
@ -988,13 +985,13 @@ IopInitializeBootDrivers(VOID)
|
|||
/*
|
||||
* Free memory for all boot files, except ntoskrnl.exe.
|
||||
*/
|
||||
for (i = 1; i < KeLoaderBlock.ModsCount; i++)
|
||||
for (i = 1; i < KeLoaderModuleCount; i++)
|
||||
{
|
||||
MiFreeBootDriverMemory((PVOID)KeLoaderModules[i].ModStart,
|
||||
KeLoaderModules[i].ModEnd - KeLoaderModules[i].ModStart);
|
||||
}
|
||||
|
||||
KeLoaderBlock.ModsCount = 0;
|
||||
KeLoaderModuleCount = 0;
|
||||
|
||||
if (BootDriverCount == 0)
|
||||
{
|
||||
|
|
|
@ -482,8 +482,8 @@ IoInit3(VOID)
|
|||
IoCreateArcNames();
|
||||
|
||||
/* Create the SystemRoot symbolic link */
|
||||
DPRINT("CommandLine: %s\n", (PCHAR)KeLoaderBlock.CommandLine);
|
||||
Status = IoCreateSystemRootLink((PCHAR)KeLoaderBlock.CommandLine);
|
||||
DPRINT("CommandLine: %s\n", KeLoaderBlock->LoadOptions);
|
||||
Status = IoCreateSystemRootLink(KeLoaderBlock->LoadOptions);
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
CPRINT("IoCreateSystemRootLink FAILED: (0x%x) - ", Status);
|
||||
KEBUGCHECK(INACCESSIBLE_BOOT_DEVICE);
|
||||
|
@ -493,7 +493,7 @@ IoInit3(VOID)
|
|||
KdbInit();
|
||||
|
||||
/* I/O is now setup for disk access, so phase 3 */
|
||||
KdInitSystem(3, (PROS_LOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
||||
KdInitSystem(3, KeLoaderBlock);
|
||||
|
||||
/* Load services for devices found by PnP manager */
|
||||
IopInitializePnpServices(IopRootDeviceNode, FALSE);
|
||||
|
@ -509,7 +509,7 @@ IoInit3(VOID)
|
|||
IopStopBootLog();
|
||||
|
||||
/* Assign drive letters */
|
||||
IoAssignDriveLetters((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock,
|
||||
IoAssignDriveLetters(KeLoaderBlock,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
|
|
@ -44,7 +44,7 @@ PKDP_INIT_ROUTINE InitRoutines[KdMax] = {KdpScreenInit,
|
|||
PCHAR
|
||||
STDCALL
|
||||
KdpGetWrapperDebugMode(PCHAR Currentp2,
|
||||
PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
PCHAR p2 = Currentp2;
|
||||
|
||||
|
@ -77,7 +77,7 @@ KdpGetWrapperDebugMode(PCHAR Currentp2,
|
|||
/* Get the KDBG Settings and enable it */
|
||||
KdDebuggerEnabled = TRUE;
|
||||
KdDebuggerNotPresent = FALSE;
|
||||
KdbpGetCommandLineSettings((PCHAR)LoaderBlock->CommandLine);
|
||||
KdbpGetCommandLineSettings(LoaderBlock->LoadOptions);
|
||||
#endif
|
||||
return p2;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ KdpCallInitRoutine(ULONG BootPhase)
|
|||
VOID
|
||||
INIT_FUNCTION
|
||||
KdInitSystem(ULONG BootPhase,
|
||||
PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
ULONG Value;
|
||||
ULONG i;
|
||||
|
@ -173,7 +173,7 @@ KdInitSystem(ULONG BootPhase,
|
|||
{
|
||||
|
||||
/* Parse the Command Line */
|
||||
p1 = (PCHAR)LoaderBlock->CommandLine;
|
||||
p1 = LoaderBlock->LoadOptions;
|
||||
while (p1 && (p2 = strchr(p1, '/')))
|
||||
{
|
||||
/* Move past the slash */
|
||||
|
|
|
@ -592,7 +592,6 @@ KdbSymProcessBootSymbols(IN PCHAR FileName)
|
|||
{
|
||||
PLDR_DATA_TABLE_ENTRY ModuleObject;
|
||||
UNICODE_STRING UnicodeString;
|
||||
PLOADER_MODULE KeLoaderModules = (PLOADER_MODULE)KeLoaderBlock.ModsAddr;
|
||||
ANSI_STRING AnsiString;
|
||||
ULONG i;
|
||||
BOOLEAN IsRaw;
|
||||
|
@ -621,14 +620,14 @@ KdbSymProcessBootSymbols(IN PCHAR FileName)
|
|||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < KeLoaderBlock.ModsCount; i++)
|
||||
for (i = 0; i < KeLoaderModuleCount; i++)
|
||||
{
|
||||
if (0 == _stricmp(FileName, (PCHAR)KeLoaderModules[i].String))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i < KeLoaderBlock.ModsCount)
|
||||
if (i < KeLoaderModuleCount)
|
||||
{
|
||||
KeLoaderModules[i].Reserved = 1;
|
||||
if (ModuleObject->PatchInformation != NULL)
|
||||
|
@ -697,7 +696,7 @@ KdbSymInit(IN PLDR_DATA_TABLE_ENTRY NtoskrnlModuleObject,
|
|||
|
||||
/* Check the command line for /LOADSYMBOLS, /NOLOADSYMBOLS,
|
||||
* /LOADSYMBOLS={YES|NO}, /NOLOADSYMBOLS={YES|NO} */
|
||||
p1 = (PCHAR) KeLoaderBlock.CommandLine;
|
||||
p1 = KeLoaderBlock->LoadOptions;
|
||||
while('\0' != *p1 && NULL != (p2 = strchr(p1, '/')))
|
||||
{
|
||||
p2++;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
/* FreeLDR Module Data */
|
||||
LOADER_MODULE KeLoaderModules[64];
|
||||
ULONG KeLoaderModuleCount;
|
||||
static CHAR KeLoaderModuleStrings[64][256];
|
||||
PLOADER_MODULE CachedModules[MaximumCachedModuleType];
|
||||
|
||||
|
@ -25,18 +26,54 @@ ULONG KeMemoryMapRangeCount;
|
|||
ULONG_PTR FirstKrnlPhysAddr;
|
||||
ULONG_PTR LastKrnlPhysAddr;
|
||||
ULONG_PTR LastKernelAddress;
|
||||
ULONG MmFreeLdrMemHigher, MmFreeLdrMemLower;
|
||||
ULONG MmFreeLdrPageDirectoryStart, MmFreeLdrPageDirectoryEnd;
|
||||
|
||||
/* FreeLDR Loader Data */
|
||||
ROS_LOADER_PARAMETER_BLOCK KeLoaderBlock;
|
||||
ROS_LOADER_PARAMETER_BLOCK KeRosLoaderBlock;
|
||||
static CHAR KeLoaderCommandLine[256];
|
||||
BOOLEAN AcpiTableDetected;
|
||||
|
||||
/* FreeLDR PE Hack Data */
|
||||
extern unsigned int _image_base__;
|
||||
ULONG_PTR KERNEL_BASE = (ULONG_PTR)&_image_base__;
|
||||
extern LDR_DATA_TABLE_ENTRY HalModuleObject;
|
||||
|
||||
/* NT Loader Data */
|
||||
LOADER_PARAMETER_BLOCK BldrLoaderBlock;
|
||||
CHAR BldrCommandLine[256];
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KiRosFrldrLpbToNtLpb(IN PROS_LOADER_PARAMETER_BLOCK RosLoaderBlock,
|
||||
IN PLOADER_PARAMETER_BLOCK *NtLoaderBlock)
|
||||
{
|
||||
PLOADER_PARAMETER_BLOCK LoaderBlock;
|
||||
|
||||
/* First get some kernel-loader globals */
|
||||
AcpiTableDetected = (RosLoaderBlock->Flags & MB_FLAGS_ACPI_TABLE) ? TRUE : FALSE;
|
||||
MmFreeLdrMemHigher = RosLoaderBlock->MemHigher;
|
||||
MmFreeLdrMemLower = RosLoaderBlock->MemLower;
|
||||
MmFreeLdrPageDirectoryStart = RosLoaderBlock->PageDirectoryStart;
|
||||
MmFreeLdrPageDirectoryEnd = RosLoaderBlock->PageDirectoryEnd;
|
||||
KeLoaderModuleCount = RosLoaderBlock->ModsCount;
|
||||
|
||||
/* Set the NT Loader block and initialize it */
|
||||
*NtLoaderBlock = LoaderBlock = &BldrLoaderBlock;
|
||||
RtlZeroMemory(LoaderBlock, sizeof(LOADER_PARAMETER_BLOCK));
|
||||
|
||||
/* Setup the list heads */
|
||||
InitializeListHead(&LoaderBlock->LoadOrderListHead);
|
||||
InitializeListHead(&LoaderBlock->MemoryDescriptorListHead);
|
||||
InitializeListHead(&LoaderBlock->BootDriverListHead);
|
||||
|
||||
/* Setup command line */
|
||||
LoaderBlock->LoadOptions = BldrCommandLine;
|
||||
strcpy(BldrCommandLine, KeLoaderCommandLine);
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KiRosPrepareForSystemStartup(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
|
@ -48,6 +85,7 @@ KiRosPrepareForSystemStartup(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
ULONG DriverSize;
|
||||
PIMAGE_NT_HEADERS NtHeader;
|
||||
PIMAGE_OPTIONAL_HEADER OptHead;
|
||||
PLOADER_PARAMETER_BLOCK NtLoaderBlock;
|
||||
CHAR* s;
|
||||
|
||||
/* Load the GDT and IDT */
|
||||
|
@ -55,27 +93,27 @@ KiRosPrepareForSystemStartup(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
Ke386SetInterruptDescriptorTable(KiIdtDescriptor);
|
||||
|
||||
/* Copy the Loader Block Data locally since Low-Memory will be wiped */
|
||||
memcpy(&KeLoaderBlock, LoaderBlock, sizeof(ROS_LOADER_PARAMETER_BLOCK));
|
||||
memcpy(&KeRosLoaderBlock, LoaderBlock, sizeof(ROS_LOADER_PARAMETER_BLOCK));
|
||||
memcpy(&KeLoaderModules[1],
|
||||
(PVOID)KeLoaderBlock.ModsAddr,
|
||||
sizeof(LOADER_MODULE) * KeLoaderBlock.ModsCount);
|
||||
KeLoaderBlock.ModsCount++;
|
||||
KeLoaderBlock.ModsAddr = (ULONG)&KeLoaderModules;
|
||||
(PVOID)KeRosLoaderBlock.ModsAddr,
|
||||
sizeof(LOADER_MODULE) * KeRosLoaderBlock.ModsCount);
|
||||
KeRosLoaderBlock.ModsCount++;
|
||||
KeRosLoaderBlock.ModsAddr = (ULONG)&KeLoaderModules;
|
||||
|
||||
/* Check for BIOS memory map */
|
||||
KeMemoryMapRangeCount = 0;
|
||||
if (KeLoaderBlock.Flags & MB_FLAGS_MMAP_INFO)
|
||||
if (KeRosLoaderBlock.Flags & MB_FLAGS_MMAP_INFO)
|
||||
{
|
||||
/* We have a memory map from the nice BIOS */
|
||||
size = *((PULONG)(KeLoaderBlock.MmapAddr - sizeof(ULONG)));
|
||||
size = *((PULONG)(KeRosLoaderBlock.MmapAddr - sizeof(ULONG)));
|
||||
i = 0;
|
||||
|
||||
/* Map it until we run out of size */
|
||||
while (i < KeLoaderBlock.MmapLength)
|
||||
while (i < KeRosLoaderBlock.MmapLength)
|
||||
{
|
||||
/* Copy into the Kernel Memory Map */
|
||||
memcpy (&KeMemoryMap[KeMemoryMapRangeCount],
|
||||
(PVOID)(KeLoaderBlock.MmapAddr + i),
|
||||
(PVOID)(KeRosLoaderBlock.MmapAddr + i),
|
||||
sizeof(ADDRESS_RANGE));
|
||||
|
||||
/* Increase Memory Map Count */
|
||||
|
@ -86,23 +124,23 @@ KiRosPrepareForSystemStartup(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
}
|
||||
|
||||
/* Save data */
|
||||
KeLoaderBlock.MmapLength = KeMemoryMapRangeCount *
|
||||
KeRosLoaderBlock.MmapLength = KeMemoryMapRangeCount *
|
||||
sizeof(ADDRESS_RANGE);
|
||||
KeLoaderBlock.MmapAddr = (ULONG)KeMemoryMap;
|
||||
KeRosLoaderBlock.MmapAddr = (ULONG)KeMemoryMap;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Nothing from BIOS */
|
||||
KeLoaderBlock.MmapLength = 0;
|
||||
KeLoaderBlock.MmapAddr = (ULONG)KeMemoryMap;
|
||||
KeRosLoaderBlock.MmapLength = 0;
|
||||
KeRosLoaderBlock.MmapAddr = (ULONG)KeMemoryMap;
|
||||
}
|
||||
|
||||
/* Save the Base Address */
|
||||
MmSystemRangeStart = (PVOID)KeLoaderBlock.KernelBase;
|
||||
MmSystemRangeStart = (PVOID)KeRosLoaderBlock.KernelBase;
|
||||
|
||||
/* Set the Command Line */
|
||||
strcpy(KeLoaderCommandLine, (PCHAR)LoaderBlock->CommandLine);
|
||||
KeLoaderBlock.CommandLine = (ULONG)KeLoaderCommandLine;
|
||||
KeRosLoaderBlock.CommandLine = (ULONG)KeLoaderCommandLine;
|
||||
|
||||
/* Write the first Module (the Kernel) */
|
||||
strcpy(KeLoaderModuleStrings[0], "ntoskrnl.exe");
|
||||
|
@ -118,7 +156,7 @@ KiRosPrepareForSystemStartup(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
PAGE_ROUND_UP((ULONG)OptHead->SizeOfImage);
|
||||
|
||||
/* Create a block for each module */
|
||||
for (i = 1; i < KeLoaderBlock.ModsCount; i++)
|
||||
for (i = 1; i < KeRosLoaderBlock.ModsCount; i++)
|
||||
{
|
||||
/* Check if we have to copy the path or not */
|
||||
if ((s = strrchr((PCHAR)KeLoaderModules[i].String, '/')) != 0)
|
||||
|
@ -147,7 +185,7 @@ KiRosPrepareForSystemStartup(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
}
|
||||
|
||||
/* Choose last module address as the final kernel address */
|
||||
LastKernelAddress = PAGE_ROUND_UP(KeLoaderModules[KeLoaderBlock.
|
||||
LastKernelAddress = PAGE_ROUND_UP(KeLoaderModules[KeRosLoaderBlock.
|
||||
ModsCount - 1].ModEnd);
|
||||
|
||||
/* Select the HAL Base */
|
||||
|
@ -196,8 +234,11 @@ KiRosPrepareForSystemStartup(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
(PVOID)DriverBase,
|
||||
&DriverSize);
|
||||
|
||||
/* Convert the loader block */
|
||||
KiRosFrldrLpbToNtLpb(&KeRosLoaderBlock, &NtLoaderBlock);
|
||||
|
||||
/* Do general System Startup */
|
||||
KiSystemStartup(LoaderBlock);
|
||||
KiSystemStartup(NtLoaderBlock);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -82,7 +82,7 @@ KiInitializeKernel(IN PKPROCESS InitProcess,
|
|||
IN PVOID IdleStack,
|
||||
IN PKPRCB Prcb,
|
||||
IN CCHAR Number,
|
||||
IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
BOOLEAN NpxPresent;
|
||||
ULONG FeatureBits;
|
||||
|
@ -229,14 +229,14 @@ KiInitializeKernel(IN PKPROCESS InitProcess,
|
|||
|
||||
VOID
|
||||
NTAPI
|
||||
KiSystemStartup(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
ULONG Cpu;
|
||||
PKIPCR Pcr = (PKIPCR)KPCR_BASE;
|
||||
PKPRCB Prcb;
|
||||
|
||||
/* Save the loader block and get the current CPU */
|
||||
//KeLoaderBlock = LoaderBlock;
|
||||
KeLoaderBlock = LoaderBlock;
|
||||
Cpu = KeNumberProcessors;
|
||||
if (!Cpu)
|
||||
{
|
||||
|
@ -281,14 +281,14 @@ AppCpuInit:
|
|||
Prcb->SetMember = 1 << Cpu;
|
||||
|
||||
/* Initialize the Processor with HAL */
|
||||
HalInitializeProcessor(Cpu, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
||||
HalInitializeProcessor(Cpu, KeLoaderBlock);
|
||||
|
||||
/* Set active processors */
|
||||
KeActiveProcessors |= Pcr->SetMember;
|
||||
KeNumberProcessors++;
|
||||
|
||||
/* Initialize the Debugger for the Boot CPU */
|
||||
if (!Cpu) KdInitSystem (0, &KeLoaderBlock);
|
||||
if (!Cpu) KdInitSystem (0, KeLoaderBlock);
|
||||
|
||||
/* Check for break-in */
|
||||
if (KdPollBreakIn()) DbgBreakPointWithStatus(1);
|
||||
|
@ -314,3 +314,4 @@ AppCpuInit:
|
|||
KiIdleLoop();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
/* ARC Loader Block */
|
||||
PLOADER_PARAMETER_BLOCK KeLoaderBlock;
|
||||
|
||||
/* PRCB Array */
|
||||
PKPRCB KiProcessorBlock[MAXIMUM_PROCESSORS];
|
||||
|
||||
|
|
|
@ -455,7 +455,7 @@ MmInitializePageList(ULONG_PTR FirstPhysKernelAddress,
|
|||
MmStats.NrReservedPages++;
|
||||
}
|
||||
/* Protect the Page Directory. This will be changed in r3 */
|
||||
else if (j >= (KeLoaderBlock.PageDirectoryStart / PAGE_SIZE) && j < (KeLoaderBlock.PageDirectoryEnd / PAGE_SIZE))
|
||||
else if (j >= (MmFreeLdrPageDirectoryStart / PAGE_SIZE) && j < (MmFreeLdrPageDirectoryEnd / PAGE_SIZE))
|
||||
{
|
||||
MmPageArray[j].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
|
||||
MmPageArray[j].Flags.Zero = 0;
|
||||
|
|
|
@ -317,15 +317,15 @@ MmInit1(ULONG_PTR FirstKrnlPhysAddr,
|
|||
last = (BIOSMemoryMap[i].BaseAddrLow + BIOSMemoryMap[i].LengthLow + PAGE_SIZE -1) / PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
if ((last - 256) * 4 > KeLoaderBlock.MemHigher)
|
||||
if ((last - 256) * 4 > MmFreeLdrMemHigher)
|
||||
{
|
||||
KeLoaderBlock.MemHigher = (last - 256) * 4;
|
||||
MmFreeLdrMemHigher = (last - 256) * 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (KeLoaderBlock.MemHigher >= (MaxMem - 1) * 1024)
|
||||
if (MmFreeLdrMemHigher >= (MaxMem - 1) * 1024)
|
||||
{
|
||||
KeLoaderBlock.MemHigher = (MaxMem - 1) * 1024;
|
||||
MmFreeLdrMemHigher = (MaxMem - 1) * 1024;
|
||||
}
|
||||
|
||||
/* Set memory limits */
|
||||
|
@ -357,7 +357,7 @@ MmInit1(ULONG_PTR FirstKrnlPhysAddr,
|
|||
/*
|
||||
* Free physical memory not used by the kernel
|
||||
*/
|
||||
MmStats.NrTotalPages = KeLoaderBlock.MemHigher/4;
|
||||
MmStats.NrTotalPages = MmFreeLdrMemHigher/4;
|
||||
if (!MmStats.NrTotalPages)
|
||||
{
|
||||
DbgPrint("Memory not detected, default to 8 MB\n");
|
||||
|
|
|
@ -176,11 +176,12 @@ PoRequestPowerIrp(
|
|||
return STATUS_PENDING;
|
||||
}
|
||||
|
||||
#undef PoSetDeviceBusy
|
||||
VOID
|
||||
STDCALL
|
||||
PoSetDeviceBusy(
|
||||
PULONG IdlePointer)
|
||||
NTAPI
|
||||
PoSetDeviceBusy(IN PULONG IdlePointer)
|
||||
{
|
||||
*IdlePointer = 0;
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -305,7 +306,7 @@ PopSetSystemPowerState(
|
|||
VOID
|
||||
INIT_FUNCTION
|
||||
NTAPI
|
||||
PoInit(PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
|
||||
PoInit(BOOLEAN HaveAcpiTable,
|
||||
BOOLEAN ForceAcpiDisable)
|
||||
{
|
||||
PVOID NotificationEntry;
|
||||
|
@ -318,7 +319,7 @@ PoInit(PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
else
|
||||
{
|
||||
/* Otherwise check the LoaderBlock's Flag */
|
||||
PopAcpiPresent = (LoaderBlock->Flags & MB_FLAGS_ACPI_TABLE) ? TRUE : FALSE;
|
||||
PopAcpiPresent = HaveAcpiTable;
|
||||
}
|
||||
|
||||
IoRegisterPlugPlayNotification(
|
||||
|
|
Loading…
Reference in a new issue