Stop lying that the PCR, KUSER_SHARED_DATA, and PDEs are "BIOS" pages, they're USED pages.

Stop initializing fields to 0 if we've already cleared the entire array!
Stop setting arbitrary values for MapCount and ReferenceCount -- both the KPCR, KUSER_SHARED_DATA and PDE are mapped!
Stop saying Video ROM has a reference count, it's the same as BIOS memory, except the MiIsPfnRam function doesn't detect it and we have a hack for it.

svn path=/trunk/; revision=32361
This commit is contained in:
ReactOS Portable Systems Group 2008-02-14 20:03:33 +00:00
parent b4a63ba74a
commit ee3729d613

View file

@ -363,37 +363,37 @@ MmInitializePageList(IN ULONG_PTR FirstPhysKernelAddress,
if (i == 0) if (i == 0)
{ {
/* Page 0 is reserved for the IVT */ /* Page 0 is reserved for the IVT */
MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_BIOS; MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED;
MmPageArray[i].Flags.Consumer = MC_NPPOOL; MmPageArray[i].Flags.Consumer = MC_NPPOOL;
MmPageArray[i].Flags.Zero = 0; MmPageArray[i].ReferenceCount = 2;
MmPageArray[i].ReferenceCount = 0; MmPageArray[i].MapCount = 1;
MmStats.NrReservedPages++; MmStats.NrReservedPages++;
} }
else if (i == 1) else if (i == 1)
{ {
/* Page 1 is reserved for the PCR */ /* Page 1 is reserved for the PCR */
MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_BIOS; MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED;
MmPageArray[i].Flags.Consumer = MC_NPPOOL; MmPageArray[i].Flags.Consumer = MC_NPPOOL;
MmPageArray[i].Flags.Zero = 0; MmPageArray[i].ReferenceCount = 2;
MmPageArray[i].ReferenceCount = 1; MmPageArray[i].MapCount = 1;
MmStats.NrReservedPages++; MmStats.NrReservedPages++;
} }
else if (i == 2) else if (i == 2)
{ {
/* Page 2 is reserved for the KUSER_SHARED_DATA */ /* Page 2 is reserved for the KUSER_SHARED_DATA */
MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_BIOS; MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED;
MmPageArray[i].Flags.Consumer = MC_NPPOOL; MmPageArray[i].Flags.Consumer = MC_NPPOOL;
MmPageArray[i].Flags.Zero = 0; MmPageArray[i].ReferenceCount = 2;
MmPageArray[i].ReferenceCount = 1; MmPageArray[i].MapCount = 1;
MmStats.NrReservedPages++; MmStats.NrReservedPages++;
} }
else if ((i >= PdePageStart) && (i < PdePageEnd)) else if ((i >= PdePageStart) && (i < PdePageEnd))
{ {
/* These pages contain the initial FreeLDR PDEs */ /* These pages contain the initial FreeLDR PDEs */
MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_BIOS; MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED;
MmPageArray[i].Flags.Zero = 0;
MmPageArray[i].Flags.Consumer = MC_NPPOOL; MmPageArray[i].Flags.Consumer = MC_NPPOOL;
MmPageArray[i].ReferenceCount = 1; MmPageArray[i].ReferenceCount = 2;
MmPageArray[i].MapCount = 1;
MmStats.NrReservedPages++; MmStats.NrReservedPages++;
} }
else if ((i >= VideoPageStart) && (i < VideoPageEnd)) else if ((i >= VideoPageStart) && (i < VideoPageEnd))
@ -405,16 +405,13 @@ MmInitializePageList(IN ULONG_PTR FirstPhysKernelAddress,
* (which we'll assume to be "free" a couple of lines below) * (which we'll assume to be "free" a couple of lines below)
*/ */
MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_BIOS; MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
MmPageArray[i].Flags.Zero = 0;
MmPageArray[i].Flags.Consumer = MC_NPPOOL; MmPageArray[i].Flags.Consumer = MC_NPPOOL;
MmPageArray[i].ReferenceCount = 1;
MmStats.NrReservedPages++; MmStats.NrReservedPages++;
} }
else if ((i >= KernelPageStart) && (i < KernelPageEnd)) else if ((i >= KernelPageStart) && (i < KernelPageEnd))
{ {
/* These are pages beloning to the kernel */ /* These are pages beloning to the kernel */
MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED; MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED;
MmPageArray[i].Flags.Zero = 0;
MmPageArray[i].Flags.Consumer = MC_NPPOOL; MmPageArray[i].Flags.Consumer = MC_NPPOOL;
MmPageArray[i].ReferenceCount = 2; MmPageArray[i].ReferenceCount = 2;
MmPageArray[i].MapCount = 1; MmPageArray[i].MapCount = 1;
@ -424,7 +421,6 @@ MmInitializePageList(IN ULONG_PTR FirstPhysKernelAddress,
{ {
/* These are pages we allocated above to hold the PFN DB */ /* These are pages we allocated above to hold the PFN DB */
MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED; MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_USED;
MmPageArray[i].Flags.Zero = 0;
MmPageArray[i].Flags.Consumer = MC_NPPOOL; MmPageArray[i].Flags.Consumer = MC_NPPOOL;
MmPageArray[i].ReferenceCount = 2; MmPageArray[i].ReferenceCount = 2;
MmPageArray[i].MapCount = 1; MmPageArray[i].MapCount = 1;
@ -439,8 +435,6 @@ MmInitializePageList(IN ULONG_PTR FirstPhysKernelAddress,
* Descriptor List, why bother, right? * Descriptor List, why bother, right?
*/ */
MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_FREE; MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_FREE;
MmPageArray[i].Flags.Zero = 0;
MmPageArray[i].ReferenceCount = 0;
InsertTailList(&FreeUnzeroedPageListHead, InsertTailList(&FreeUnzeroedPageListHead,
&MmPageArray[i].ListEntry); &MmPageArray[i].ListEntry);
UnzeroedPageCount++; UnzeroedPageCount++;
@ -452,8 +446,6 @@ MmInitializePageList(IN ULONG_PTR FirstPhysKernelAddress,
/* These are pages reserved by the BIOS/ROMs */ /* These are pages reserved by the BIOS/ROMs */
MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_BIOS; MmPageArray[i].Flags.Type = MM_PHYSICAL_PAGE_BIOS;
MmPageArray[i].Flags.Consumer = MC_NPPOOL; MmPageArray[i].Flags.Consumer = MC_NPPOOL;
MmPageArray[i].Flags.Zero = 0;
MmPageArray[i].ReferenceCount = 0;
MmStats.NrReservedPages++; MmStats.NrReservedPages++;
} }
} }