Author: fireball
Date: Fri Feb 8 16:11:01 2008
New Revision: 32216
URL:
http://svn.reactos.org/svn/reactos?rev=32216&view=rev
Log:
- Implement one more hack to obtain LaskKrnlPhysAddr (not really a solution for reactos,
since ntldr allows kernel+drivers+hal to not be continuous in memory), when booting via
ntldr/winldr.
Modified:
trunk/reactos/ntoskrnl/mm/mminit.c
Modified: trunk/reactos/ntoskrnl/mm/mminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=3…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mminit.c (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c Fri Feb 8 16:11:01 2008
@@ -319,8 +319,31 @@
/* Get the addresses */
FirstKrnlPhysAddr = (ULONG_PTR)LdrEntry->DllBase - KSEG0_BASE;
-
- /* FIXME: How do we get the last address? */
+ }
+
+ /* Get the last kernel address */
+ if (!LastKrnlPhysAddr)
+ {
+ PLIST_ENTRY NextEntry;
+ PMEMORY_ALLOCATION_DESCRIPTOR Md;
+
+ for (NextEntry = KeLoaderBlock->MemoryDescriptorListHead.Flink;
+ NextEntry != &KeLoaderBlock->MemoryDescriptorListHead;
+ NextEntry = NextEntry->Flink)
+ {
+ Md = CONTAINING_RECORD(NextEntry, MEMORY_ALLOCATION_DESCRIPTOR, ListEntry);
+ if (Md->MemoryType == LoaderBootDriver ||
+ Md->MemoryType == LoaderSystemCode ||
+ Md->MemoryType == LoaderHalCode)
+ {
+ if (Md->BasePage+Md->PageCount > LastKrnlPhysAddr)
+ LastKrnlPhysAddr = Md->BasePage+Md->PageCount;
+ }
+ }
+
+ /* Convert to a physical address */
+ LastKrnlPhysAddr = LastKrnlPhysAddr << PAGE_SHIFT;
+ LastKernelAddress = LastKrnlPhysAddr | KSEG0_BASE;
}
/* Set memory limits */