Author: ion
Date: Sat Sep 30 07:33:50 2006
New Revision: 24305
URL:
http://svn.reactos.org/svn/reactos?rev=24305&view=rev
Log:
- 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.
Modified:
trunk/reactos/hal/halx86/generic/display.c
trunk/reactos/hal/halx86/generic/halinit.c
trunk/reactos/hal/halx86/include/halp.h
trunk/reactos/hal/halx86/up/halinit_up.c
trunk/reactos/include/ndk/ketypes.h
trunk/reactos/include/reactos/rosldr.h
trunk/reactos/ntoskrnl/cm/registry.c
trunk/reactos/ntoskrnl/ex/init.c
trunk/reactos/ntoskrnl/include/internal/io.h
trunk/reactos/ntoskrnl/include/internal/ke.h
trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h
trunk/reactos/ntoskrnl/include/internal/po.h
trunk/reactos/ntoskrnl/io/iomgr/disk.c
trunk/reactos/ntoskrnl/io/iomgr/driver.c
trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
trunk/reactos/ntoskrnl/kd/kdinit.c
trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c
trunk/reactos/ntoskrnl/ke/freeldr.c
trunk/reactos/ntoskrnl/ke/i386/kiinit.c
trunk/reactos/ntoskrnl/ke/krnlinit.c
trunk/reactos/ntoskrnl/mm/freelist.c
trunk/reactos/ntoskrnl/mm/mminit.c
trunk/reactos/ntoskrnl/po/power.c
Modified: trunk/reactos/hal/halx86/generic/display.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/display…
==============================================================================
--- trunk/reactos/hal/halx86/generic/display.c (original)
+++ trunk/reactos/hal/halx86/generic/display.c Sat Sep 30 07:33:50 2006
@@ -571,7 +571,7 @@
/* PRIVATE FUNCTIONS ********************************************************/
VOID FASTCALL
-HalInitializeDisplay (PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
+HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock)
/*
* FUNCTION: Initalize the display
* ARGUMENTS:
Modified: trunk/reactos/hal/halx86/generic/halinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/halinit…
==============================================================================
--- trunk/reactos/hal/halx86/generic/halinit.c (original)
+++ trunk/reactos/hal/halx86/generic/halinit.c Sat Sep 30 07:33:50 2006
@@ -38,7 +38,7 @@
if (BootPhase == 0)
{
RtlZeroMemory(&HalpHooks, sizeof(HALP_HOOKS));
- HalpInitPhase0((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock);
+ HalpInitPhase0(LoaderBlock);
}
else if (BootPhase == 1)
{
@@ -46,7 +46,7 @@
//HalpInitPhase1();
/* Initialize display and make the screen black */
- HalInitializeDisplay ((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock);
+ HalInitializeDisplay (LoaderBlock);
HalpInitBusHandlers();
HalpInitDma();
Modified: trunk/reactos/hal/halx86/include/halp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/halp.h?…
==============================================================================
--- trunk/reactos/hal/halx86/include/halp.h (original)
+++ trunk/reactos/hal/halx86/include/halp.h Sat Sep 30 07:33:50 2006
@@ -19,7 +19,7 @@
} 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 @@
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);
Modified: trunk/reactos/hal/halx86/up/halinit_up.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/up/halinit_up.c…
==============================================================================
--- trunk/reactos/hal/halx86/up/halinit_up.c (original)
+++ trunk/reactos/hal/halx86/up/halinit_up.c Sat Sep 30 07:33:50 2006
@@ -18,7 +18,7 @@
/* FUNCTIONS ***************************************************************/
VOID
-HalpInitPhase0(PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
+HalpInitPhase0(PLOADER_PARAMETER_BLOCK LoaderBlock)
{
HalpInitPICs();
Modified: trunk/reactos/include/ndk/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/ketypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/ketypes.h (original)
+++ trunk/reactos/include/ndk/ketypes.h Sat Sep 30 07:33:50 2006
@@ -974,11 +974,7 @@
//
// 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
Modified: trunk/reactos/include/reactos/rosldr.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/rosldr.h?r…
==============================================================================
--- trunk/reactos/include/reactos/rosldr.h (original)
+++ trunk/reactos/include/reactos/rosldr.h Sat Sep 30 07:33:50 2006
@@ -44,4 +44,10 @@
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
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 Sat Sep 30 07:33:50 2006
@@ -153,7 +153,7 @@
CmImportHardwareHive (NULL, 0);
/* Initialize volatile registry settings */
- if (SetupBoot == FALSE) CmInit2((PCHAR)KeLoaderBlock.CommandLine);
+ if (SetupBoot == FALSE) CmInit2(KeLoaderBlock->LoadOptions);
}
VOID
Modified: trunk/reactos/ntoskrnl/ex/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=243…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c (original)
+++ trunk/reactos/ntoskrnl/ex/init.c Sat Sep 30 07:33:50 2006
@@ -292,7 +292,7 @@
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 @@
{
PCHAR p1, p2;
- p1 = (PCHAR)KeLoaderBlock.CommandLine;
+ p1 = KeLoaderBlock->LoadOptions;
while(*p1 && (p2 = strchr(p1, '/'))) {
p2++;
@@ -429,7 +429,7 @@
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 @@
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 @@
HalAllProcessorsStarted();
/* Do Phase 1 HAL Initalization */
- HalInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
+ HalInitSystem(1, KeLoaderBlock);
}
VOID
@@ -614,13 +614,13 @@
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 @@
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 @@
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");
Modified: trunk/reactos/ntoskrnl/include/internal/io.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/io.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/io.h Sat Sep 30 07:33:50 2006
@@ -978,7 +978,7 @@
VOID
FASTCALL
xHalIoAssignDriveLetters(
- IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
+ IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN PSTRING NtDeviceName,
OUT PUCHAR NtSystemPath,
OUT PSTRING NtSystemPathString
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 Sat Sep 30 07:33:50 2006
@@ -661,7 +661,7 @@
VOID
NTAPI
KiSystemStartup(
- IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock
+ IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
VOID
Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h Sat Sep 30 07:33:50 2006
@@ -59,7 +59,7 @@
/*
* 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 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
Modified: trunk/reactos/ntoskrnl/include/internal/po.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/po.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/po.h Sat Sep 30 07:33:50 2006
@@ -38,7 +38,7 @@
VOID
NTAPI
PoInit(
- PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
+ BOOLEAN HaveAcpiTable,
BOOLEAN ForceAcpiDisable
);
Modified: trunk/reactos/ntoskrnl/io/iomgr/disk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/disk.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/disk.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/disk.c Sat Sep 30 07:33:50 2006
@@ -616,7 +616,7 @@
VOID FASTCALL
-xHalIoAssignDriveLetters(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
+xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN PSTRING NtDeviceName,
OUT PUCHAR NtSystemPath,
OUT PSTRING NtSystemPathString)
Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c Sat Sep 30 07:33:50 2006
@@ -465,8 +465,6 @@
ULONG i;
CHAR SearchName[256];
PCHAR ModuleName;
- PLOADER_MODULE KeLoaderModules =
- (PLOADER_MODULE)KeLoaderBlock.ModsAddr;
/*
* FIXME:
@@ -476,7 +474,7 @@
*/
_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 @@
ULONG ModuleLoaded;
PCHAR ModuleName;
PCHAR Extension;
- PLOADER_MODULE KeLoaderModules = (PLOADER_MODULE)KeLoaderBlock.ModsAddr;
ULONG i;
UNICODE_STRING DriverName;
NTSTATUS Status;
@@ -948,7 +945,7 @@
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 @@
/*
* 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)
{
Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c Sat Sep 30 07:33:50 2006
@@ -482,8 +482,8 @@
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 @@
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 @@
IopStopBootLog();
/* Assign drive letters */
- IoAssignDriveLetters((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock,
+ IoAssignDriveLetters(KeLoaderBlock,
NULL,
NULL,
NULL);
Modified: trunk/reactos/ntoskrnl/kd/kdinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/kdinit.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/kd/kdinit.c (original)
+++ trunk/reactos/ntoskrnl/kd/kdinit.c Sat Sep 30 07:33:50 2006
@@ -44,7 +44,7 @@
PCHAR
STDCALL
KdpGetWrapperDebugMode(PCHAR Currentp2,
- PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
+ PLOADER_PARAMETER_BLOCK LoaderBlock)
{
PCHAR p2 = Currentp2;
@@ -77,7 +77,7 @@
/* 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 @@
VOID
INIT_FUNCTION
KdInitSystem(ULONG BootPhase,
- PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
+ PLOADER_PARAMETER_BLOCK LoaderBlock)
{
ULONG Value;
ULONG i;
@@ -173,7 +173,7 @@
{
/* Parse the Command Line */
- p1 = (PCHAR)LoaderBlock->CommandLine;
+ p1 = LoaderBlock->LoadOptions;
while (p1 && (p2 = strchr(p1, '/')))
{
/* Move past the slash */
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_symbols.…
==============================================================================
--- trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c (original)
+++ trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c Sat Sep 30 07:33:50 2006
@@ -592,7 +592,6 @@
{
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 @@
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 @@
/* 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++;
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 Sat Sep 30 07:33:50 2006
@@ -16,6 +16,7 @@
/* FreeLDR Module Data */
LOADER_MODULE KeLoaderModules[64];
+ULONG KeLoaderModuleCount;
static CHAR KeLoaderModuleStrings[64][256];
PLOADER_MODULE CachedModules[MaximumCachedModuleType];
@@ -25,17 +26,53 @@
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
@@ -48,6 +85,7 @@
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 @@
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 @@
}
/* 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 @@
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 @@
}
/* 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 @@
(PVOID)DriverBase,
&DriverSize);
+ /* Convert the loader block */
+ KiRosFrldrLpbToNtLpb(&KeRosLoaderBlock, &NtLoaderBlock);
+
/* Do general System Startup */
- KiSystemStartup(LoaderBlock);
+ KiSystemStartup(NtLoaderBlock);
}
/* EOF */
Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kiinit.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/kiinit.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/kiinit.c Sat Sep 30 07:33:50 2006
@@ -82,7 +82,7 @@
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 @@
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 @@
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 @@
KiIdleLoop();
}
+
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 Sat Sep 30 07:33:50 2006
@@ -14,6 +14,9 @@
#include <internal/napi.h>
/* GLOBALS *******************************************************************/
+
+/* ARC Loader Block */
+PLOADER_PARAMETER_BLOCK KeLoaderBlock;
/* PRCB Array */
PKPRCB KiProcessorBlock[MAXIMUM_PROCESSORS];
Modified: trunk/reactos/ntoskrnl/mm/freelist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/freelist.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/freelist.c (original)
+++ trunk/reactos/ntoskrnl/mm/freelist.c Sat Sep 30 07:33:50 2006
@@ -455,7 +455,7 @@
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;
Modified: trunk/reactos/ntoskrnl/mm/mminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mminit.c (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c Sat Sep 30 07:33:50 2006
@@ -317,15 +317,15 @@
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)
- {
- KeLoaderBlock.MemHigher = (MaxMem - 1) * 1024;
+ if (MmFreeLdrMemHigher >= (MaxMem - 1) * 1024)
+ {
+ MmFreeLdrMemHigher = (MaxMem - 1) * 1024;
}
/* Set memory limits */
@@ -357,7 +357,7 @@
/*
* 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");
Modified: trunk/reactos/ntoskrnl/po/power.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/po/power.c?rev=24…
==============================================================================
--- trunk/reactos/ntoskrnl/po/power.c (original)
+++ trunk/reactos/ntoskrnl/po/power.c Sat Sep 30 07:33:50 2006
@@ -176,11 +176,12 @@
return STATUS_PENDING;
}
-VOID
-STDCALL
-PoSetDeviceBusy(
- PULONG IdlePointer)
-{
+#undef PoSetDeviceBusy
+VOID
+NTAPI
+PoSetDeviceBusy(IN PULONG IdlePointer)
+{
+ *IdlePointer = 0;
}
VOID
@@ -305,7 +306,7 @@
VOID
INIT_FUNCTION
NTAPI
-PoInit(PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
+PoInit(BOOLEAN HaveAcpiTable,
BOOLEAN ForceAcpiDisable)
{
PVOID NotificationEntry;
@@ -318,7 +319,7 @@
else
{
/* Otherwise check the LoaderBlock's Flag */
- PopAcpiPresent = (LoaderBlock->Flags & MB_FLAGS_ACPI_TABLE) ? TRUE : FALSE;
+ PopAcpiPresent = HaveAcpiTable;
}
IoRegisterPlugPlayNotification(