Author: ros-arm-bringup
Date: Thu Feb 14 23:30:31 2008
New Revision: 32364
URL: http://svn.reactos.org/svn/reactos?rev=32364&view=rev
Log:
One would expect that a function called "MmIsUsablePage" would return whether a not a page is usable. In other words, we are making sure that the page is free/available, so that we may make use of it. Apparently not so -- MmIsUsable page returned if a page was NOT usable, but was instead "already used". The caller's wish was to ensure he was correctly using a used page, not to check if he could start using a usable page. This would just be an annoying gramatical/logic error (but makes "sense" in the way it's used), if it weren't for the fact that MmIsUsablePage also returned TRUE for BIOS pages (which meant, "yes, you are correctly using/overwriting memory we spent time ensuring to mark as reserved/BIOS").
Renamed the function to MmIsPageInUse, and only return TRUE if the page is in use. Like the name says.
Modified:
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/mm/freelist.c
trunk/reactos/ntoskrnl/mm/i386/page.c
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h Thu Feb 14 23:30:31 2008
@@ -1145,7 +1145,7 @@
BOOLEAN
NTAPI
-MmIsUsablePage(PFN_TYPE Page);
+MmIsPageInUse(PFN_TYPE Page);
VOID
NTAPI
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 Thu Feb 14 23:30:31 2008
@@ -640,23 +640,17 @@
BOOLEAN
NTAPI
-MmIsUsablePage(PFN_TYPE Pfn)
-{
-
- DPRINT("MmIsUsablePage(PhysicalAddress %x)\n", Pfn << PAGE_SHIFT);
+MmIsPageInUse(PFN_TYPE Pfn)
+{
+
+ DPRINT("MmIsPageInUse(PhysicalAddress %x)\n", Pfn << PAGE_SHIFT);
if (Pfn == 0 || Pfn >= MmPageArraySize)
{
KEBUGCHECK(0);
}
-
- if (MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_USED &&
- MmPageArray[Pfn].Flags.Type != MM_PHYSICAL_PAGE_BIOS)
- {
- return(FALSE);
- }
-
- return(TRUE);
+
+ return (MmPageArray[Pfn].Flags.Type == MM_PHYSICAL_PAGE_USED);
}
VOID
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/page.c (original)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c Thu Feb 14 23:30:31 2008
@@ -1941,18 +1941,10 @@
for (i = 0; i < PageCount; i++)
{
- if (!MmIsUsablePage(Pages[i]))
- {
- /* Is this an attempt to map KUSER_SHARED_DATA? */
- if ((Address == (PVOID)0x7FFE0000) && (PageCount == 1) && (Pages[0] == 2))
- {
- // allow
- }
- else
- {
- DPRINT1("Page at address %x not usable\n", PFN_TO_PTE(Pages[i]));
- KEBUGCHECK(0);
- }
+ if (!MmIsPageInUse(Pages[i]))
+ {
+ DPRINT1("Page at address %x not in use\n", PFN_TO_PTE(Pages[i]));
+ KEBUGCHECK(0);
}
}
Author: ros-arm-bringup
Date: Thu Feb 14 23:20:44 2008
New Revision: 32362
URL: http://svn.reactos.org/svn/reactos?rev=32362&view=rev
Log:
Fix a couple of off-by-one bugs we recently introduced -- PFNs are one of the only indexes which are actually 0-based, so you really want to loop from 0 to the last page, inclusive (unlike most loops where you would stop *before* the last element index).
Modified:
trunk/reactos/ntoskrnl/mm/freelist.c
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 Thu Feb 14 23:20:44 2008
@@ -354,7 +354,7 @@
KernelPageEnd = LastPhysKernelAddress / PAGE_SIZE;
/* Loop every page on the system */
- for (i = 0; i < MmPageArraySize; i++)
+ for (i = 0; i <= MmPageArraySize; i++)
{
/* Check if it's part of RAM */
if (MiIsPfnRam(BIOSMemoryMap, AddressRangeCount, i))
@@ -417,7 +417,7 @@
MmPageArray[i].MapCount = 1;
MmStats.NrSystemPages++;
}
- else if (i > (MiFreeDescriptor->BasePage + MiFreeDescriptor->PageCount - 1))
+ else if (i >= (MiFreeDescriptor->BasePage + MiFreeDescriptor->PageCount))
{
/* These are pages we allocated above to hold the PFN DB */
MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED;
Author: ros-arm-bringup
Date: Thu Feb 14 21:33:38 2008
New Revision: 32359
URL: http://svn.reactos.org/svn/reactos?rev=32359&view=rev
Log:
We were looping the memory descriptors in order to find the number of pages that are available to the system, that is to say, your RAM, minus pages that the BIOS said belong to it. This part is good. Next up, we were creating the page array for these pages, up to the highest entry, which we called, the number of pages on the system. This is the problem. Suppose we had 1000 pages somewhere in low memory that were used by the BIOS, we'd now call the total pages RAM - 1000 (correct). However, we'd also set the highest page array entry to RAM - 1000, which is wrong, because esssentially this eats up 10MB of memory, since the top 10MB (which are FREE, usable memory) are never entered into the database. So really, what we want to do is differentiate the TOTAL amount of usable RAM, versus the HIGHEST page that is usable (which is actually what should be the highest entry in the page array). This will reclaim the lost RAM ReactOS has been eating up all these days. But it gets better: eventually, someone noticed ReactOS was eating memory, and added 1MB more to the "total", making the highest entry "1mb higher". This ...kind of... fixes the problem above by giving you one more MB, but what if ReactOS was only eating up 150KB, as was more the case? Then ReactOS would believe that the other 850KB of memory are "Free physical memory", when actually, they're pages that don't even exist. Wow!
Fixed these bugs.
Modified:
trunk/reactos/ntoskrnl/mm/freelist.c
trunk/reactos/ntoskrnl/mm/mminit.c
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 Thu Feb 14 21:33:38 2008
@@ -290,7 +290,7 @@
ULONG i;
ULONG Reserved;
NTSTATUS Status;
- PFN_TYPE LastPage, Pfn;
+ PFN_TYPE LastPage, Pfn = 0;
ULONG PdeStart = PsGetCurrentProcess()->Pcb.DirectoryTableBase.LowPart;
ULONG PdePageStart, PdePageEnd;
ULONG VideoPageStart, VideoPageEnd;
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 Thu Feb 14 21:33:38 2008
@@ -49,7 +49,7 @@
PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
PVOID MiNonPagedPoolStart;
ULONG MiNonPagedPoolLength;
-ULONG MmNumberOfPhysicalPages;
+ULONG MmNumberOfPhysicalPages, MmHighestPhysicalPage, MmLowestPhysicalPage;
extern KMUTANT MmSystemLoadLock;
BOOLEAN MiDbgEnableMdDump =
#ifdef _ARM_
@@ -201,13 +201,12 @@
MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
}
-ULONG
+VOID
NTAPI
MiCountFreePagesInLoaderBlock(PLOADER_PARAMETER_BLOCK LoaderBlock)
{
PLIST_ENTRY NextEntry;
PMEMORY_ALLOCATION_DESCRIPTOR Md;
- ULONG TotalPages = 0;
for (NextEntry = KeLoaderBlock->MemoryDescriptorListHead.Flink;
NextEntry != &KeLoaderBlock->MemoryDescriptorListHead;
@@ -215,19 +214,51 @@
{
Md = CONTAINING_RECORD(NextEntry, MEMORY_ALLOCATION_DESCRIPTOR, ListEntry);
- if (Md->MemoryType == LoaderBad ||
- Md->MemoryType == LoaderFirmwarePermanent ||
- Md->MemoryType == LoaderSpecialMemory ||
- Md->MemoryType == LoaderBBTMemory)
+ /* Skip invisible memory */
+ if ((Md->MemoryType != LoaderFirmwarePermanent) &&
+ (Md->MemoryType != LoaderSpecialMemory) &&
+ (Md->MemoryType != LoaderHALCachedMemory) &&
+ (Md->MemoryType != LoaderBBTMemory))
{
- /* Don't count these blocks */
- continue;
+ /* Check if BURNMEM was used */
+ if (Md->MemoryType != LoaderBad)
+ {
+ /* Count this in the total of pages */
+ MmNumberOfPhysicalPages += Md->PageCount;
+ }
+
+ /* Check if this is the new lowest page */
+ if (Md->BasePage < MmLowestPhysicalPage)
+ {
+ /* Update the lowest page */
+ MmLowestPhysicalPage = Md->BasePage;
+ }
+
+ /* Check if this is the new highest page */
+ if ((Md->BasePage + Md->PageCount) > MmHighestPhysicalPage)
+ {
+ /* Update the highest page */
+ MmHighestPhysicalPage = Md->BasePage + Md->PageCount - 1;
+ }
}
-
- TotalPages += Md->PageCount;
- }
-
- return TotalPages;
+ }
+}
+
+VOID
+NTAPI
+MiDbgDumpBiosMap(IN PADDRESS_RANGE BIOSMemoryMap,
+ IN ULONG AddressRangeCount)
+{
+ ULONG i;
+
+ DPRINT1("Base\t\tLength\t\tType\n");
+ for (i = 0; i < AddressRangeCount; i++)
+ {
+ DPRINT1("%08lX\t%08lX\t%d\n",
+ BIOSMemoryMap[i].BaseAddrLow,
+ BIOSMemoryMap[i].LengthLow,
+ BIOSMemoryMap[i].Type);
+ }
}
VOID
@@ -269,8 +300,7 @@
Md->MemoryType == LoaderHalCode)
{
if (Md->BasePage+Md->PageCount > LastKrnlPhysAddr)
- LastKrnlPhysAddr = Md->BasePage+Md->PageCount;
-
+ LastKrnlPhysAddr = Md->BasePage+Md->PageCount;
}
}
@@ -293,6 +323,7 @@
/* Dump memory descriptors */
if (MiDbgEnableMdDump) MiDbgDumpMemoryDescriptors();
+ if (MiDbgEnableMdDump) MiDbgDumpBiosMap(BIOSMemoryMap, AddressRangeCount);
/* Set the page directory */
PsGetCurrentProcess()->Pcb.DirectoryTableBase.LowPart = (ULONG)MmGetPageDirectory();
@@ -322,19 +353,9 @@
RtlZeroMemory(&MmStats, sizeof(MmStats));
/* Count RAM */
- MmStats.NrTotalPages = MiCountFreePagesInLoaderBlock(KeLoaderBlock);
- MmNumberOfPhysicalPages = MmStats.NrTotalPages;
- if (!MmStats.NrTotalPages)
- {
- DbgPrint("Memory not detected, default to 8 MB\n");
- MmStats.NrTotalPages = 2048;
- }
- else
- {
- /* HACK: add 1MB for standard memory (not extended). Why? */
- DbgPrint("Used memory %dKb\n", (MmStats.NrTotalPages * PAGE_SIZE) / 1024);
- MmStats.NrTotalPages += 256;
- }
+ MiCountFreePagesInLoaderBlock(KeLoaderBlock);
+ MmStats.NrTotalPages = MmNumberOfPhysicalPages;
+ DbgPrint("Used memory %dKb\n", (MmStats.NrTotalPages * PAGE_SIZE) / 1024);
/* Initialize the kernel address space */
MmInitializeKernelAddressSpace();
@@ -343,7 +364,7 @@
/* Initialize the page list */
LastKernelAddress = (ULONG_PTR)MmInitializePageList(FirstKrnlPhysAddr,
LastKrnlPhysAddr,
- MmStats.NrTotalPages,
+ MmHighestPhysicalPage,
PAGE_ROUND_UP(LastKernelAddress),
BIOSMemoryMap,
AddressRangeCount);
Author: ros-arm-bringup
Date: Thu Feb 14 19:40:32 2008
New Revision: 32357
URL: http://svn.reactos.org/svn/reactos?rev=32357&view=rev
Log:
Don't loop the page array list THREE times to set it up, ONCE is plenty enough!
Remove the incomprehensible PFN allocation being done for the pages holding the page list array. We now: 1) Find the highest usable RAM page 2) Allocate the PTEs to hold the array from that point on and lower.
Don't do expensive divisions for every single page on the system being looped! Precompute the values ONCE.
Don't set the reference count for the KPCR and KUSER_SHARED_DATA to 0, these are LIVE pages!
Removed the hack which pre-initializes the balancer -- this isn't needed anymore since the initial PTEs are allocated always from RAM now.
Add some comments about the assumptions being made in this code regarding all PCs having the same kind of memory maps.
Modified:
trunk/reactos/ntoskrnl/mm/freelist.c
trunk/reactos/ntoskrnl/mm/mminit.c
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 Thu Feb 14 19:40:32 2008
@@ -290,55 +290,40 @@
ULONG i;
ULONG Reserved;
NTSTATUS Status;
- PFN_TYPE LastPage;
- PFN_TYPE FirstUninitializedPage;
+ PFN_TYPE LastPage, Pfn;
ULONG PdeStart = PsGetCurrentProcess()->Pcb.DirectoryTableBase.LowPart;
+ /* Initialize the page lists */
KeInitializeSpinLock(&PageListLock);
InitializeListHead(&UserPageListHead);
InitializeListHead(&FreeUnzeroedPageListHead);
InitializeListHead(&FreeZeroedPageListHead);
- LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress);
- LastPhysKernelAddress = (ULONG_PTR)PAGE_ROUND_UP(LastPhysKernelAddress);
-
+ /* Set the size and start of the PFN Database */
MmPageArraySize = MemorySizeInPages;
MmPageArray = (PHYSICAL_PAGE *)LastKernelAddress;
-
Reserved = PAGE_ROUND_UP((MmPageArraySize * sizeof(PHYSICAL_PAGE))) / PAGE_SIZE;
+
+ /* Update the last kernel address pointers */
LastKernelAddress = ((ULONG_PTR)LastKernelAddress + (Reserved * PAGE_SIZE));
LastPhysKernelAddress = (ULONG_PTR)LastPhysKernelAddress + (Reserved * PAGE_SIZE);
- /* Preinitialize the Balancer because we need some pages for pte's */
- MmInitializeBalancer(MemorySizeInPages, 0);
-
- FirstUninitializedPage = (ULONG_PTR)LastPhysKernelAddress / PAGE_SIZE;
+ /* Find the highest usable page */
LastPage = MmPageArraySize;
+ while (TRUE) if (MiIsPfnRam(BIOSMemoryMap, AddressRangeCount, --LastPage)) break;
+
+ /* Loop every page required to hold the PFN database */
for (i = 0; i < Reserved; i++)
{
PVOID Address = (char*)MmPageArray + (i * PAGE_SIZE);
- ULONG j, start, end;
-
+
+ /* Check if FreeLDR has already allocated it for us */
if (!MmIsPagePresent(NULL, Address))
{
- PFN_TYPE Pfn;
- Pfn = 0;
- while (Pfn == 0 && LastPage > FirstUninitializedPage)
- {
- /* Allocate the page from the upper end of the RAM */
- if (MiIsPfnRam(BIOSMemoryMap, AddressRangeCount, --LastPage))
- {
- Pfn = LastPage;
- }
- }
- if (Pfn == 0)
- {
- Pfn = MmAllocPage(MC_NPPOOL, 0);
- if (Pfn == 0)
- {
- KEBUGCHECK(0);
- }
- }
+ /* Use one of our highest usable pages */
+ Pfn = LastPage--;
+
+ /* Set the PFN */
Status = MmCreateVirtualMappingForKernel(Address,
PAGE_READWRITE,
&Pfn,
@@ -351,24 +336,45 @@
}
else
{
- /* Setting the page protection is necessary to set the global bit on IA32 */
+ /* Setting the page protection is necessary to set the global bit */
MmSetPageProtect(NULL, Address, PAGE_READWRITE);
}
+ }
+
+ /* Now loop every PFN database page again */
+ for (i = 0; i < Reserved; i++)
+ {
+ PVOID Address = (char*)MmPageArray + (i * PAGE_SIZE);
+ ULONG j, start, end;
+ ULONG PdePageStart, PdePageEnd;
+ ULONG VideoPageStart, VideoPageEnd;
+ ULONG KernelPageStart, KernelPageEnd;
+ /* Clear the page array entry */
memset(Address, 0, PAGE_SIZE);
+ /* Do the next page'ss worth of entries */
start = ((ULONG_PTR)Address - (ULONG_PTR)MmPageArray) / sizeof(PHYSICAL_PAGE);
end = ((ULONG_PTR)Address - (ULONG_PTR)MmPageArray + PAGE_SIZE) / sizeof(PHYSICAL_PAGE);
- for (j = start; j < end && j < LastPage; j++)
+ /* We'll be applying a bunch of hacks -- precompute some static values */
+ PdePageStart = PdeStart / PAGE_SIZE;
+ PdePageEnd = MmFreeLdrPageDirectoryEnd / PAGE_SIZE;
+ VideoPageStart = 0xA0000 / PAGE_SIZE;
+ VideoPageEnd = 0x100000 / PAGE_SIZE;
+ KernelPageStart = FirstPhysKernelAddress / PAGE_SIZE;
+ KernelPageEnd = LastPhysKernelAddress / PAGE_SIZE;
+
+ /* Loop each page in this chunk */
+ for (j = start; j < end; j++)
{
+ /* Check if it's part of RAM */
if (MiIsPfnRam(BIOSMemoryMap, AddressRangeCount, j))
{
+ /* Apply assumptions that all computers are built the same way */
if (j == 0)
{
- /*
- * Page zero is reserved for the IVT
- */
+ /* Page 0 is reserved for the IVT */
MmPageArray[0].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
MmPageArray[0].Flags.Consumer = MC_NPPOOL;
MmPageArray[0].Flags.Zero = 0;
@@ -377,58 +383,73 @@
}
else if (j == 1)
{
-
- /*
- * Page one is reserved for the initial KPCR
- */
+ /* Page 1 is reserved for the PCR */
MmPageArray[1].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
MmPageArray[1].Flags.Consumer = MC_NPPOOL;
MmPageArray[1].Flags.Zero = 0;
- MmPageArray[1].ReferenceCount = 0;
+ MmPageArray[1].ReferenceCount = 1;
MmStats.NrReservedPages++;
}
else if (j == 2)
{
- /*
- * Page two is reserved for the KUSER_SHARED_DATA
- */
+ /* Page 2 is reserved for the KUSER_SHARED_DATA */
MmPageArray[2].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
MmPageArray[2].Flags.Consumer = MC_NPPOOL;
MmPageArray[2].Flags.Zero = 0;
- MmPageArray[2].ReferenceCount = 0;
+ MmPageArray[2].ReferenceCount = 1;
MmStats.NrReservedPages++;
}
- /* Protect the Page Directory. This will be changed in r3 */
- else if (j >= (PdeStart / PAGE_SIZE) && j < (MmFreeLdrPageDirectoryEnd / PAGE_SIZE))
+ else if ((j >= PdePageStart) && (j < PdePageEnd))
{
+ /* These pages contain the initial FreeLDR PDEs */
MmPageArray[j].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
MmPageArray[j].Flags.Zero = 0;
MmPageArray[j].Flags.Consumer = MC_NPPOOL;
MmPageArray[j].ReferenceCount = 1;
MmStats.NrReservedPages++;
}
- else if (j >= 0xa0000 / PAGE_SIZE && j < 0x100000 / PAGE_SIZE)
+ else if ((j >= VideoPageStart) && (j < VideoPageEnd))
{
+ /*
+ * These pages are usually for the Video ROM BIOS.
+ * Supposedly anyway. We'll simply ignore the fact that
+ * many systems have this area somewhere else entirely
+ * (which we'll assume to be "free" a couple of lines below)
+ */
MmPageArray[j].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
MmPageArray[j].Flags.Zero = 0;
MmPageArray[j].Flags.Consumer = MC_NPPOOL;
MmPageArray[j].ReferenceCount = 1;
MmStats.NrReservedPages++;
}
- else if (j >= (ULONG)FirstPhysKernelAddress/PAGE_SIZE &&
- j < (ULONG)LastPhysKernelAddress/PAGE_SIZE)
+ else if ((j >= KernelPageStart) && (j < KernelPageEnd))
{
+ /* These are pages beloning to the kernel */
MmPageArray[j].Flags.Type = MM_PHYSICAL_PAGE_USED;
MmPageArray[j].Flags.Zero = 0;
MmPageArray[j].Flags.Consumer = MC_NPPOOL;
- /* Reference count 2, because we're having ReferenceCount track
- MapCount as well. */
+ MmPageArray[j].ReferenceCount = 2;
+ MmPageArray[j].MapCount = 1;
+ MmStats.NrSystemPages++;
+ }
+ else if (j > LastPage)
+ {
+ /* These are pages we allocated above to hold the PFN DB */
+ MmPageArray[j].Flags.Type = MM_PHYSICAL_PAGE_USED;
+ MmPageArray[j].Flags.Zero = 0;
+ MmPageArray[j].Flags.Consumer = MC_NPPOOL;
MmPageArray[j].ReferenceCount = 2;
MmPageArray[j].MapCount = 1;
MmStats.NrSystemPages++;
}
else
{
+ /*
+ * These are supposedly free pages.
+ * By the way, not all of them are, some contain vital
+ * FreeLDR data, but since we choose to ignore the Memory
+ * Descriptor List, why bother, right?
+ */
MmPageArray[j].Flags.Type = MM_PHYSICAL_PAGE_FREE;
MmPageArray[j].Flags.Zero = 0;
MmPageArray[j].ReferenceCount = 0;
@@ -440,36 +461,13 @@
}
else
{
+ /* These are pages reserved by the BIOS/ROMs */
MmPageArray[j].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
MmPageArray[j].Flags.Consumer = MC_NPPOOL;
MmPageArray[j].Flags.Zero = 0;
MmPageArray[j].ReferenceCount = 0;
MmStats.NrReservedPages++;
}
- }
- FirstUninitializedPage = j;
-
- }
-
- /* Add the pages from the upper end to the list */
- for (i = LastPage; i < MmPageArraySize; i++)
- {
- if (MiIsPfnRam(BIOSMemoryMap, AddressRangeCount, i))
- {
- MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED;
- MmPageArray[i].Flags.Zero = 0;
- MmPageArray[i].Flags.Consumer = MC_NPPOOL;
- MmPageArray[i].ReferenceCount = 2;
- MmPageArray[i].MapCount = 1;
- MmStats.NrSystemPages++;
- }
- else
- {
- MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
- MmPageArray[i].Flags.Consumer = MC_NPPOOL;
- MmPageArray[i].Flags.Zero = 0;
- MmPageArray[i].ReferenceCount = 0;
- MmStats.NrReservedPages++;
}
}
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 Thu Feb 14 19:40:32 2008
@@ -307,7 +307,7 @@
FirstKrnlPhysAddr = (ULONG_PTR)LdrEntry->DllBase - KSEG0_BASE;
/* Get the last kernel address */
- LastKrnlPhysAddr = MiGetLastKernelAddress();
+ LastKrnlPhysAddr = PAGE_ROUND_UP(MiGetLastKernelAddress());
LastKernelAddress = LastKrnlPhysAddr | KSEG0_BASE;
/* Set memory limits */