Author: ion
Date: Sun Oct 8 04:04:03 2006
New Revision: 24436
URL:
http://svn.reactos.org/svn/reactos?rev=24436&view=rev
Log:
- In NTLDR boot, try to get the first kernel physical address from the loader entries.
- Fixup HAL's image base in the loader parameter block, since we load it at a
different place then freeldr tells us.
- We've reached a dead end in NTLDR compatibility. Out memory manager initialization
code makes some assumptions which are totally incompatible with the page table state that
NTLDR gives us.
Modified:
trunk/reactos/ntoskrnl/ke/freeldr.c
trunk/reactos/ntoskrnl/mm/freelist.c
trunk/reactos/ntoskrnl/mm/mminit.c
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 Sun Oct 8 04:04:03 2006
@@ -216,6 +216,9 @@
}
else if (!(_stricmp(DriverName, "hal.dll")))
{
+ /* The HAL actually gets loaded somewhere else */
+ ModStart = HalModuleObject.DllBase;
+
/* Create an MD for the HAL */
MdEntry = &BldrMemoryDescriptors[i];
MdEntry->MemoryType = LoaderHalCode;
@@ -294,8 +297,6 @@
ULONG HalBase;
ULONG DriverBase;
ULONG DriverSize;
- //PIMAGE_NT_HEADERS NtHeader;
- //PIMAGE_OPTIONAL_HEADER OptHead;
PLOADER_PARAMETER_BLOCK NtLoaderBlock;
CHAR* s;
PKTSS Tss;
@@ -320,7 +321,6 @@
memcpy(&KeLoaderModules[0],
(PVOID)KeRosLoaderBlock.ModsAddr,
sizeof(LOADER_MODULE) * KeRosLoaderBlock.ModsCount);
- //KeRosLoaderBlock.ModsCount++;
KeRosLoaderBlock.ModsAddr = (ULONG)&KeLoaderModules;
/* Check for BIOS memory map */
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 Sun Oct 8 04:04:03 2006
@@ -334,7 +334,7 @@
PFN_TYPE FirstUninitializedPage;
ULONG PdeStart = PsGetCurrentProcess()->Pcb.DirectoryTableBase.LowPart;
- DPRINT1("MmInitializePageList(FirstPhysKernelAddress %x, "
+ DPRINT("MmInitializePageList(FirstPhysKernelAddress %x, "
"LastPhysKernelAddress %x, "
"MemorySizeInPages %x, LastKernelAddress %x)\n",
FirstPhysKernelAddress,
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 Sun Oct 8 04:04:03 2006
@@ -300,6 +300,7 @@
ULONG i;
ULONG kernel_len;
ULONG_PTR MappingAddress;
+ PLDR_DATA_TABLE_ENTRY LdrEntry;
DPRINT("MmInit1(FirstKrnlPhysAddr, %p, LastKrnlPhysAddr %p, LastKernelAddress
%p)\n",
FirstKrnlPhysAddr,
@@ -328,8 +329,20 @@
}
/* NTLDR Hacks */
- if (!MmFreeLdrMemHigher) MmFreeLdrMemHigher = 32768;
+ if (!MmFreeLdrMemHigher) MmFreeLdrMemHigher = 65536;
if (!MmFreeLdrPageDirectoryEnd) MmFreeLdrPageDirectoryEnd = 0x40000;
+ if (!FirstKrnlPhysAddr)
+ {
+ /* Get the kernel entry */
+ LdrEntry = CONTAINING_RECORD(KeLoaderBlock->LoadOrderListHead.Flink,
+ LDR_DATA_TABLE_ENTRY,
+ InLoadOrderLinks);
+
+ /* Get the addresses */
+ FirstKrnlPhysAddr = (ULONG_PTR)LdrEntry->DllBase - KSEG0_BASE;
+
+ /* FIXME: How do we get the last address? */
+ }
if (MmFreeLdrMemHigher >= (MaxMem - 1) * 1024)
{
@@ -398,10 +411,6 @@
AddressRangeCount);
kernel_len = LastKrnlPhysAddr - FirstKrnlPhysAddr;
- //extern LOADER_MODULE KeLoaderModules[];
- //DPRINT1("Module one: %p %p\n", KeLoaderModules[0].ModStart,
KeLoaderModules[0].ModEnd);
- //while (TRUE);
-
/*
* Unmap low memory
*/