Author: fireball
Date: Thu Jul 24 07:18:26 2008
New Revision: 34737
URL:
http://svn.reactos.org/svn/reactos?rev=34737&view=rev
Log:
- MiGetLastKernelAddress was totally broken on x86 and always returned the highest
available physical page, thus the PFN database always end up at the address 0x80000000 and
higher (just before the kernel). And when PFN database's size was bigger than usual
(e.g. 1Gb of RAM and more), the PFN database zeroed out the kernel. This logic was
introduced by 32640 commit.
- Fix the logic so it really gives the last kernel address, as function name suggests. If
you want to change the logic of the function, then rename it accordingly.
See issue #3507 for more details.
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 [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Thu Jul 24 07:18:26 2008
@@ -342,19 +342,22 @@
PLIST_ENTRY NextEntry;
PMEMORY_ALLOCATION_DESCRIPTOR Md;
ULONG_PTR LastKrnlPhysAddr = 0;
-
+
for (NextEntry = KeLoaderBlock->MemoryDescriptorListHead.Flink;
NextEntry != &KeLoaderBlock->MemoryDescriptorListHead;
NextEntry = NextEntry->Flink)
{
Md = CONTAINING_RECORD(NextEntry, MEMORY_ALLOCATION_DESCRIPTOR, ListEntry);
- if (Md->MemoryType != LoaderFree)
+
+ if (Md->MemoryType != LoaderFree &&
+ Md->MemoryType != LoaderFirmwareTemporary &&
+ Md->MemoryType != LoaderSpecialMemory)
{
if (Md->BasePage+Md->PageCount > LastKrnlPhysAddr)
- LastKrnlPhysAddr = Md->BasePage+Md->PageCount;
+ LastKrnlPhysAddr = Md->BasePage+Md->PageCount;
}
}
-
+
/* Convert to a physical address */
return LastKrnlPhysAddr << PAGE_SHIFT;
}