Author: ros-arm-bringup
Date: Sun Jun 21 08:14:49 2009
New Revision: 41506
URL:
http://svn.reactos.org/svn/reactos?rev=41506&view=rev
Log:
- Get rid of MmPageArray and MmPageArraySize since these were defined as just being
ReactOS-specific clones of MmPfnDatabase and MmHighestPhysicalPage. Ergo, use the latter
in relevant places.
Modified:
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/mm/freelist.c
trunk/reactos/ntoskrnl/mm/mdlsup.c
trunk/reactos/ntoskrnl/mm/mminit.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 [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Sun Jun 21 08:14:49 2009
@@ -21,7 +21,6 @@
extern PMEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptor;
extern MEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptorOrg;
extern ULONG MmHighestPhysicalPage;
-extern PVOID MmPfnDatabase;
struct _KTRAP_FRAME;
struct _EPROCESS;
@@ -352,9 +351,7 @@
} u4;
} MMPFN, *PMMPFN;
-extern PMMPFN MmPageArray;
-extern ULONG MmPageArraySize;
-
+extern PMMPFN MmPfnDatabase;
extern MM_STATS MmStats;
typedef struct _MM_PAGEOP
@@ -1041,10 +1038,10 @@
PMMPFN Page;
/* Make sure the PFN number is valid */
- if (Pfn > MmPageArraySize) return NULL;
+ if (Pfn > MmHighestPhysicalPage) return NULL;
/* Get the entry */
- Page = &MmPageArray[Pfn];
+ Page = &MmPfnDatabase[Pfn];
/* Make sure it's valid */
ASSERT_PFN(Page);
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 [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] Sun Jun 21 08:14:49 2009
@@ -48,8 +48,8 @@
#define PHYSICAL_PAGE MMPFN
#define PPHYSICAL_PAGE PMMPFN
-PPHYSICAL_PAGE MmPageArray;
-ULONG MmPageArraySize;
+PPHYSICAL_PAGE MmPfnDatabase;
+ULONG MmHighestPhysicalPage;
/* List of pages allocated to the MC_USER Consumer */
static LIST_ENTRY UserPageListHead;
@@ -84,7 +84,7 @@
PageDescriptor = CONTAINING_RECORD(NextListEntry, PHYSICAL_PAGE, ListEntry);
ASSERT_PFN(PageDescriptor);
KeReleaseQueuedSpinLock(LockQueuePfnLock, oldIrql);
- return PageDescriptor - MmPageArray;
+ return PageDescriptor - MmPfnDatabase;
}
VOID
@@ -123,7 +123,7 @@
}
PageDescriptor = CONTAINING_RECORD(NextListEntry, PHYSICAL_PAGE, ListEntry);
KeReleaseQueuedSpinLock(LockQueuePfnLock, oldIrql);
- return PageDescriptor - MmPageArray;
+ return PageDescriptor - MmPfnDatabase;
}
VOID
@@ -152,7 +152,7 @@
oldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
- last = min(HighestAcceptableAddress.LowPart / PAGE_SIZE, MmPageArraySize - 1);
+ last = min(HighestAcceptableAddress.LowPart / PAGE_SIZE, MmHighestPhysicalPage - 1);
boundary = BoundaryAddressMultiple.LowPart / PAGE_SIZE;
for (j = 0; j < 2; j++)
@@ -204,7 +204,7 @@
PPHYSICAL_PAGE Page;
Page = MiGetPfnEntry(i);
RemoveEntryList(&Page->ListEntry);
- if (MmPageArray[i].Flags.Zero == 0)
+ if (MmPfnDatabase[i].Flags.Zero == 0)
{
UnzeroedPageCount--;
}
@@ -268,14 +268,12 @@
InitializeListHead(&FreeZeroedPageListHead);
/* Set the size and start of the PFN Database */
- MmPageArray = (PHYSICAL_PAGE *)MmPfnDatabase;
- MmPageArraySize = MmHighestPhysicalPage;
- Reserved = PAGE_ROUND_UP((MmPageArraySize * sizeof(PHYSICAL_PAGE))) / PAGE_SIZE;
+ Reserved = PAGE_ROUND_UP((MmHighestPhysicalPage * sizeof(PHYSICAL_PAGE))) /
PAGE_SIZE;
/* Loop every page required to hold the PFN database */
for (i = 0; i < Reserved; i++)
{
- PVOID Address = (char*)MmPageArray + (i * PAGE_SIZE);
+ PVOID Address = (char*)MmPfnDatabase + (i * PAGE_SIZE);
/* Check if FreeLDR has already allocated it for us */
if (!MmIsPagePresent(NULL, Address))
@@ -302,7 +300,7 @@
}
/* Clear the PFN database */
- RtlZeroMemory(MmPageArray, (MmPageArraySize + 1) * sizeof(PHYSICAL_PAGE));
+ RtlZeroMemory(MmPfnDatabase, (MmHighestPhysicalPage + 1) * sizeof(PHYSICAL_PAGE));
/* This is what a used page looks like */
RtlZeroMemory(&UsedPage, sizeof(UsedPage));
@@ -333,11 +331,11 @@
for (i = 0; i < Md->PageCount; i++)
{
/* Skip memory we ignore completely */
- if ((Md->BasePage + i) > MmPageArraySize) break;
+ if ((Md->BasePage + i) > MmHighestPhysicalPage) break;
/* These are pages reserved by the BIOS/ROMs */
- MmPageArray[Md->BasePage + i].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
- MmPageArray[Md->BasePage + i].Flags.Consumer = MC_NPPOOL;
+ MmPfnDatabase[Md->BasePage + i].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
+ MmPfnDatabase[Md->BasePage + i].Flags.Consumer = MC_NPPOOL;
MmStats.NrSystemPages++;
}
}
@@ -350,9 +348,9 @@
for (i = 0; i < Md->PageCount; i++)
{
/* Mark it as a free page */
- MmPageArray[Md->BasePage + i].Flags.Type = MM_PHYSICAL_PAGE_FREE;
+ MmPfnDatabase[Md->BasePage + i].Flags.Type = MM_PHYSICAL_PAGE_FREE;
InsertTailList(&FreeUnzeroedPageListHead,
- &MmPageArray[Md->BasePage + i].ListEntry);
+ &MmPfnDatabase[Md->BasePage + i].ListEntry);
UnzeroedPageCount++;
MmStats.NrFreePages++;
}
@@ -363,7 +361,7 @@
for (i = 0; i < Md->PageCount; i++)
{
/* Everything else is used memory */
- MmPageArray[Md->BasePage + i] = UsedPage;
+ MmPfnDatabase[Md->BasePage + i] = UsedPage;
MmStats.NrSystemPages++;
}
}
@@ -375,10 +373,10 @@
i++)
{
/* Ensure this page was not added previously */
- ASSERT(MmPageArray[i].Flags.Type == 0);
+ ASSERT(MmPfnDatabase[i].Flags.Type == 0);
/* Mark it as used kernel memory */
- MmPageArray[i] = UsedPage;
+ MmPfnDatabase[i] = UsedPage;
MmStats.NrSystemPages++;
}
@@ -421,7 +419,7 @@
KIRQL oldIrql;
PPHYSICAL_PAGE Page;
- if (Pfn <= MmPageArraySize)
+ if (Pfn <= MmHighestPhysicalPage)
{
oldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
Page = MiGetPfnEntry(Pfn);
@@ -443,7 +441,7 @@
KIRQL oldIrql;
PPHYSICAL_PAGE Page;
- if (Pfn <= MmPageArraySize)
+ if (Pfn <= MmHighestPhysicalPage)
{
oldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
Page = MiGetPfnEntry(Pfn);
@@ -497,7 +495,7 @@
DPRINT("MmReferencePageUnsafe(PysicalAddress %x)\n", Pfn <<
PAGE_SHIFT);
- if (Pfn == 0 || Pfn > MmPageArraySize)
+ if (Pfn == 0 || Pfn > MmHighestPhysicalPage)
{
return;
}
@@ -778,7 +776,7 @@
KeReleaseQueuedSpinLock(LockQueuePfnLock, oldIrql);
- PfnOffset = PageDescriptor - MmPageArray;
+ PfnOffset = PageDescriptor - MmPfnDatabase;
if (NeedClear)
{
MiZeroPage(PfnOffset);
@@ -822,16 +820,16 @@
if ((HighestAddress.u.LowPart % PAGE_SIZE) != 0)
HighestPage++;
- if (LowestPage >= MmPageArraySize)
+ if (LowestPage >= MmHighestPhysicalPage)
{
DPRINT1("MmAllocPagesSpecifyRange(): Out of memory\n");
return -1;
}
- if (HighestPage > MmPageArraySize)
- HighestPage = MmPageArraySize;
-
- oldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
- if (LowestPage == 0 && HighestPage == MmPageArraySize)
+ if (HighestPage > MmHighestPhysicalPage)
+ HighestPage = MmHighestPhysicalPage;
+
+ oldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ if (LowestPage == 0 && HighestPage == MmHighestPhysicalPage)
{
PLIST_ENTRY ListEntry;
while (NumberOfPagesFound < NumberOfPages)
@@ -876,7 +874,7 @@
MmStats.NrFreePages--;
/* Remember the page */
- pfn = PageDescriptor - MmPageArray;
+ pfn = PageDescriptor - MmPfnDatabase;
Pages[NumberOfPagesFound++] = pfn;
if(Consumer == MC_USER) MmInsertLRULastUserPage(pfn);
}
@@ -888,7 +886,7 @@
{
for (pfn = LowestPage; pfn < HighestPage; pfn++)
{
- PageDescriptor = MmPageArray + pfn;
+ PageDescriptor = MmPfnDatabase + pfn;
if (PageDescriptor->Flags.Type != MM_PHYSICAL_PAGE_FREE)
continue;
@@ -1000,7 +998,7 @@
/* We set the page to used, because MmCreateVirtualMapping failed with unused
pages */
PageDescriptor->Flags.Type = MM_PHYSICAL_PAGE_USED;
KeReleaseQueuedSpinLock(LockQueuePfnLock, oldIrql);
- Pfn = PageDescriptor - MmPageArray;
+ Pfn = PageDescriptor - MmPfnDatabase;
Status = MiZeroPageInternal(Pfn);
oldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
Modified: trunk/reactos/ntoskrnl/mm/mdlsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mdlsup.c?rev=4…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mdlsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mdlsup.c [iso-8859-1] Sun Jun 21 08:14:49 2009
@@ -26,7 +26,6 @@
RTL_BITMAP MiMdlMappingRegionAllocMap;
ULONG MiMdlMappingRegionHint;
KSPIN_LOCK MiMdlMappingRegionLock;
-extern ULONG MmPageArraySize;
/* PRIVATE FUNCTIONS **********************************************************/
@@ -418,7 +417,7 @@
/* Check if this is an MDL in I/O Space */
if (Mdl->StartVa >= MmSystemRangeStart &&
- MmGetPfnForProcess(NULL, Mdl->StartVa) >= MmPageArraySize)
+ MmGetPfnForProcess(NULL, Mdl->StartVa) >= MmHighestPhysicalPage)
{
/* Just loop each page */
for (i = 0; i < NrPages; i++)
@@ -521,7 +520,7 @@
for (j = 0; j < i; j++)
{
Page = MdlPages[j];
- if (Page < MmPageArraySize)
+ if (Page < MmHighestPhysicalPage)
{
MmUnlockPage(Page);
MmDereferencePage(Page);
@@ -532,7 +531,7 @@
}
Page = MmGetPfnForProcess(NULL, Address);
MdlPages[i] = Page;
- if (Page >= MmPageArraySize)
+ if (Page >= MmHighestPhysicalPage)
{
Mdl->MdlFlags |= MDL_IO_SPACE;
}
Modified: trunk/reactos/ntoskrnl/mm/mminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=4…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Sun Jun 21 08:14:49 2009
@@ -53,7 +53,6 @@
ULONG MmBootImageSize;
ULONG MmNumberOfPhysicalPages, MmHighestPhysicalPage, MmLowestPhysicalPage;
ULONG_PTR MiKSeg0Start, MiKSeg0End;
-PVOID MmPfnDatabase;
ULONG_PTR MmPfnDatabaseEnd;
PMEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptor;
MEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptorOrg;