Author: tkreuzer
Date: Sun May 10 19:35:00 2015
New Revision: 67632
URL:
http://svn.reactos.org/svn/reactos?rev=67632&view=rev
Log:
[NTOSKRNL]
- Fix MMPTE vs MMPDE usage
- Use MiPteToPde instead of MiAddressToPte
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c
trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c
trunk/reactos/ntoskrnl/mm/ARM3/pool.c
trunk/reactos/ntoskrnl/mm/ARM3/section.c
trunk/reactos/ntoskrnl/mm/ARM3/session.c
trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?r…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Sun May 10 19:35:00 2015
@@ -459,7 +459,7 @@
SIZE_T CommittedPages;
PVOID PagedPoolStart;
PVOID PagedPoolEnd;
- PMMPTE PagedPoolBasePde;
+ PMMPDE PagedPoolBasePde;
ULONG Color;
LONG ResidentProcessCount;
ULONG SessionPoolAllocationFailures[4];
@@ -479,9 +479,9 @@
PDRIVER_UNLOAD Win32KDriverUnload;
POOL_DESCRIPTOR PagedPool;
#if defined (_M_AMD64)
- MMPTE PageDirectory;
+ MMPDE PageDirectory;
#else
- PMMPTE PageTables;
+ PMMPDE PageTables;
#endif
#if defined (_M_AMD64)
PMMPTE SpecialPoolFirstPte;
@@ -1887,7 +1887,7 @@
NTAPI
MiInitializeAndChargePfn(
OUT PPFN_NUMBER PageFrameIndex,
- IN PMMPTE PointerPde,
+ IN PMMPDE PointerPde,
IN PFN_NUMBER ContainingPageFrame,
IN BOOLEAN SessionAllocation
);
@@ -1904,7 +1904,7 @@
NTAPI
MiInitializePfnForOtherProcess(
IN PFN_NUMBER PageFrameIndex,
- IN PMMPTE PointerPte,
+ IN PVOID PteAddress,
IN PFN_NUMBER PteFrame
);
@@ -2210,7 +2210,7 @@
VOID
NTAPI
MiMakePdeExistAndMakeValid(
- IN PMMPTE PointerPde,
+ IN PMMPDE PointerPde,
IN PEPROCESS TargetProcess,
IN KIRQL OldIrql
);
Modified: trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pagfault.…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] Sun May 10 19:35:00 2015
@@ -336,7 +336,7 @@
MiCheckPdeForSessionSpace(IN PVOID Address)
{
MMPTE TempPde;
- PMMPTE PointerPde;
+ PMMPDE PointerPde;
PVOID SessionAddress;
ULONG Index;
@@ -1959,7 +1959,7 @@
}
/* Write a demand-zero PDE */
- MI_WRITE_INVALID_PTE(PointerPde, DemandZeroPde);
+ MI_WRITE_INVALID_PDE(PointerPde, DemandZeroPde);
/* Dispatch the fault */
Status = MiDispatchFault(TRUE,
@@ -2087,7 +2087,12 @@
if (PointerPde == MiAddressToPde(PTE_BASE))
{
/* Then it's really a demand-zero PDE (on behalf of user-mode) */
+#ifdef _M_ARM
+ _WARN("This is probably completely broken!");
+ MI_WRITE_INVALID_PDE((PMMPDE)PointerPte, DemandZeroPde);
+#else
MI_WRITE_INVALID_PTE(PointerPte, DemandZeroPde);
+#endif
}
else
{
Modified: trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c [iso-8859-1] Sun May 10 19:35:00 2015
@@ -1083,15 +1083,15 @@
NTSTATUS
NTAPI
MiInitializeAndChargePfn(OUT PPFN_NUMBER PageFrameIndex,
- IN PMMPTE PointerPde,
+ IN PMMPDE PointerPde,
IN PFN_NUMBER ContainingPageFrame,
IN BOOLEAN SessionAllocation)
{
- MMPTE TempPte;
+ MMPDE TempPde;
KIRQL OldIrql;
/* Use either a global or local PDE */
- TempPte = SessionAllocation ? ValidKernelPdeLocal : ValidKernelPde;
+ TempPde = SessionAllocation ? ValidKernelPdeLocal : ValidKernelPde;
/* Lock the PFN database */
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
@@ -1106,8 +1106,8 @@
/* Grab a zero page and set the PFN, then make it valid */
*PageFrameIndex = MiRemoveZeroPage(MI_GET_NEXT_COLOR());
- TempPte.u.Hard.PageFrameNumber = *PageFrameIndex;
- MI_WRITE_VALID_PTE(PointerPde, TempPte);
+ TempPde.u.Hard.PageFrameNumber = *PageFrameIndex;
+ MI_WRITE_VALID_PDE(PointerPde, TempPde);
/* Initialize the PFN */
MiInitializePfnForOtherProcess(*PageFrameIndex,
@@ -1270,14 +1270,14 @@
VOID
NTAPI
MiInitializePfnForOtherProcess(IN PFN_NUMBER PageFrameIndex,
- IN PMMPTE PointerPte,
+ IN PVOID PteAddress,
IN PFN_NUMBER PteFrame)
{
PMMPFN Pfn1;
/* Setup the PTE */
Pfn1 = MI_PFN_ELEMENT(PageFrameIndex);
- Pfn1->PteAddress = PointerPte;
+ Pfn1->PteAddress = PteAddress;
/* Make this a software PTE */
MI_MAKE_SOFTWARE_PTE(&Pfn1->OriginalPte, MM_READWRITE);
Modified: trunk/reactos/ntoskrnl/mm/ARM3/pool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pool.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pool.c [iso-8859-1] Sun May 10 19:35:00 2015
@@ -507,7 +507,7 @@
//
// We can only support this much then
//
- PointerPde = MiAddressToPte(MmPagedPoolInfo.LastPteForPagedPool);
+ PointerPde = MiPteToPde(MmPagedPoolInfo.LastPteForPagedPool);
PageTableCount = (PFN_COUNT)(PointerPde + 1 -
MmPagedPoolInfo.NextPdeForPagedPoolExpansion);
ASSERT(PageTableCount < i);
@@ -1277,7 +1277,8 @@
NTAPI
MiInitializeSessionPool(VOID)
{
- PMMPTE PointerPde, PointerPte, LastPte, LastPde;
+ PMMPTE PointerPte, LastPte;
+ PMMPDE PointerPde, LastPde;
PFN_NUMBER PageFrameIndex, PdeCount;
PPOOL_DESCRIPTOR PoolDescriptor;
PMM_SESSION_SPACE SessionGlobal;
Modified: trunk/reactos/ntoskrnl/mm/ARM3/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/section.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] Sun May 10 19:35:00 2015
@@ -937,8 +937,8 @@
{
KIRQL OldIrql;
ULONG Color, Index;
- PMMPTE StartPde, EndPde;
- MMPTE TempPte = ValidKernelPdeLocal;
+ PMMPDE StartPde, EndPde;
+ MMPDE TempPde = ValidKernelPdeLocal;
PMMPFN Pfn1;
PFN_NUMBER PageCount = 0, ActualPages = 0, PageFrameNumber;
@@ -976,7 +976,7 @@
_WARN("MiSessionCommitPageTables halfplemented for amd64")
DBG_UNREFERENCED_LOCAL_VARIABLE(OldIrql);
DBG_UNREFERENCED_LOCAL_VARIABLE(Color);
- DBG_UNREFERENCED_LOCAL_VARIABLE(TempPte);
+ DBG_UNREFERENCED_LOCAL_VARIABLE(TempPde);
DBG_UNREFERENCED_LOCAL_VARIABLE(Pfn1);
DBG_UNREFERENCED_LOCAL_VARIABLE(PageFrameNumber);
ASSERT(FALSE);
@@ -996,12 +996,12 @@
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
Color = (++MmSessionSpace->Color) & MmSecondaryColorMask;
PageFrameNumber = MiRemoveZeroPage(Color);
- TempPte.u.Hard.PageFrameNumber = PageFrameNumber;
- MI_WRITE_VALID_PTE(StartPde, TempPte);
+ TempPde.u.Hard.PageFrameNumber = PageFrameNumber;
+ MI_WRITE_VALID_PDE(StartPde, TempPde);
/* Write the page table in session space structure */
ASSERT(MmSessionSpace->PageTables[Index].u.Long == 0);
- MmSessionSpace->PageTables[Index] = TempPte;
+ MmSessionSpace->PageTables[Index] = TempPde;
/* Initialize the PFN */
MiInitializePfnForOtherProcess(PageFrameNumber,
@@ -2053,7 +2053,7 @@
//
if ((((ULONG_PTR)PointerPte) & (SYSTEM_PD_SIZE - 1)) == 0)
{
- PointerPde = MiAddressToPte(PointerPte);
+ PointerPde = MiPteToPde(PointerPte);
MiMakePdeExistAndMakeValid(PointerPde, Process, MM_NOIRQL);
}
@@ -2157,7 +2157,7 @@
Pfn1 = MiGetPfnEntry(PFN_FROM_PTE(&PteContents));
/* Get the PTE */
- PointerPde = MiAddressToPte(PointerPte);
+ PointerPde = MiPteToPde(PointerPte);
/* Lock the PFN database and make sure this isn't a mapped file */
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
Modified: trunk/reactos/ntoskrnl/mm/ARM3/session.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/session.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/session.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/session.c [iso-8859-1] Sun May 10 19:35:00 2015
@@ -480,8 +480,10 @@
MiSessionInitializeWorkingSetList(VOID)
{
KIRQL OldIrql;
- PMMPTE PointerPte, PointerPde;
+ PMMPTE PointerPte;
+ PMMPDE PointerPde;
MMPTE TempPte;
+ MMPDE TempPde;
ULONG Color, Index;
PFN_NUMBER PageFrameIndex;
PMM_SESSION_SPACE SessionGlobal;
@@ -501,7 +503,9 @@
if (PointerPde->u.Hard.Valid == 1)
{
/* Nope, we'll have to do it */
+#ifndef _M_ARM
ASSERT(PointerPde->u.Hard.Global == 0);
+#endif
AllocatedPageTable = FALSE;
}
else
@@ -536,14 +540,14 @@
}
/* Write a valid PDE for it */
- TempPte.u.Long = ValidKernelPdeLocal.u.Long;
- TempPte.u.Hard.PageFrameNumber = PageFrameIndex;
- MI_WRITE_VALID_PTE(PointerPde, TempPte);
+ TempPde.u.Long = ValidKernelPdeLocal.u.Long;
+ TempPde.u.Hard.PageFrameNumber = PageFrameIndex;
+ MI_WRITE_VALID_PDE(PointerPde, TempPde);
/* Add this into the list */
Index = ((ULONG_PTR)WorkingSetList - (ULONG_PTR)MmSessionBase) >> 22;
#ifndef _M_AMD64
- MmSessionSpace->PageTables[Index] = TempPte;
+ MmSessionSpace->PageTables[Index] = TempPde;
#endif
/* Initialize the page directory page, and now zero the working set list itself
*/
MiInitializePfnForOtherProcess(PageFrameIndex,
@@ -614,10 +618,11 @@
PEPROCESS Process = PsGetCurrentProcess();
ULONG NewFlags, Flags, Size, i, Color;
KIRQL OldIrql;
- PMMPTE PointerPte, PageTables, SessionPte;
- PMMPDE PointerPde;
+ PMMPTE PointerPte, SessionPte;
+ PMMPDE PointerPde, PageTables;
PMM_SESSION_SPACE SessionGlobal;
MMPTE TempPte;
+ MMPDE TempPde;
NTSTATUS Status;
BOOLEAN Result;
PFN_NUMBER SessionPageDirIndex;
@@ -725,13 +730,13 @@
}
/* Fill the PTE out */
- TempPte.u.Long = ValidKernelPdeLocal.u.Long;
- TempPte.u.Hard.PageFrameNumber = SessionPageDirIndex;
+ TempPde.u.Long = ValidKernelPdeLocal.u.Long;
+ TempPde.u.Hard.PageFrameNumber = SessionPageDirIndex;
/* Setup, allocate, fill out the MmSessionSpace PTE */
PointerPde = MiAddressToPde(MmSessionSpace);
ASSERT(PointerPde->u.Long == 0);
- MI_WRITE_VALID_PTE(PointerPde, TempPte);
+ MI_WRITE_VALID_PDE(PointerPde, TempPde);
MiInitializePfnForOtherProcess(SessionPageDirIndex,
PointerPde,
SessionPageDirIndex);
Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/virtual.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] Sun May 10 19:35:00 2015
@@ -45,7 +45,8 @@
IN PMMVAD Vad,
IN PEPROCESS Process)
{
- PMMPTE PointerPte, LastPte, PointerPde;
+ PMMPTE PointerPte, LastPte;
+ PMMPDE PointerPde;
ULONG CommittedPages;
/* Compute starting and ending PTE and PDE addresses */
@@ -60,7 +61,7 @@
CommittedPages = (ULONG)BYTES_TO_PAGES(EndingAddress - StartingAddress);
/* Is the PDE demand-zero? */
- PointerPde = MiAddressToPte(PointerPte);
+ PointerPde = MiPteToPde(PointerPte);
if (PointerPde->u.Long != 0)
{
/* It is not. Is it valid? */
@@ -86,7 +87,7 @@
if (MiIsPteOnPdeBoundary(PointerPte))
{
/* Is this PDE demand zero? */
- PointerPde = MiAddressToPte(PointerPte);
+ PointerPde = MiPteToPde(PointerPte);
if (PointerPde->u.Long != 0)
{
/* It isn't -- is it valid? */
@@ -132,7 +133,7 @@
CommittedPages = 0;
/* Is the PDE demand-zero? */
- PointerPde = MiAddressToPte(PointerPte);
+ PointerPde = MiPteToPde(PointerPte);
if (PointerPde->u.Long != 0)
{
/* It isn't -- is it invalid? */
@@ -158,7 +159,7 @@
if (MiIsPteOnPdeBoundary(PointerPte))
{
/* Is this new PDE demand-zero? */
- PointerPde = MiAddressToPte(PointerPte);
+ PointerPde = MiPteToPde(PointerPte);
if (PointerPde->u.Long != 0)
{
/* It isn't. Is it valid? */
@@ -1978,7 +1979,8 @@
IN PMMVAD Vad,
IN PEPROCESS Process)
{
- PMMPTE PointerPte, LastPte, PointerPde;
+ PMMPTE PointerPte, LastPte;
+ PMMPDE PointerPde;
BOOLEAN OnBoundary = TRUE;
PAGED_CODE();
@@ -2098,7 +2100,8 @@
PMMVAD Vad;
PMMSUPPORT AddressSpace;
ULONG_PTR StartingAddress, EndingAddress;
- PMMPTE PointerPde, PointerPte, LastPte;
+ PMMPTE PointerPte, LastPte;
+ PMMPDE PointerPde;
MMPTE PteContents;
PMMPFN Pfn1;
ULONG ProtectionMask, OldProtect;
@@ -2273,7 +2276,7 @@
/* Check if we've crossed a PDE boundary and make the new PDE valid too
*/
if (MiIsPteOnPdeBoundary(PointerPte))
{
- PointerPde = MiAddressToPte(PointerPte);
+ PointerPde = MiPteToPde(PointerPte);
MiMakePdeExistAndMakeValid(PointerPde, Process, MM_NOIRQL);
}
@@ -2366,7 +2369,7 @@
VOID
NTAPI
-MiMakePdeExistAndMakeValid(IN PMMPTE PointerPde,
+MiMakePdeExistAndMakeValid(IN PMMPDE PointerPde,
IN PEPROCESS TargetProcess,
IN KIRQL OldIrql)
{
@@ -2502,7 +2505,8 @@
IN PEPROCESS Process,
IN PMMVAD Vad)
{
- PMMPTE PointerPde, PointerPte, CommitPte = NULL;
+ PMMPTE PointerPte, CommitPte = NULL;
+ PMMPDE PointerPde;
ULONG CommitReduction = 0;
PMMPTE ValidPteList[256];
ULONG PteCount = 0;
@@ -4316,7 +4320,8 @@
ULONG ProtectionMask, QuotaCharge = 0, QuotaFree = 0;
BOOLEAN Attached = FALSE, ChangeProtection = FALSE;
MMPTE TempPte;
- PMMPTE PointerPte, PointerPde, LastPte;
+ PMMPTE PointerPte, LastPte;
+ PMMPDE PointerPde;
TABLE_SEARCH_RESULT Result;
PAGED_CODE();
@@ -4891,7 +4896,7 @@
//
// Get the PDE and now make it valid too
//
- PointerPde = MiAddressToPte(PointerPte);
+ PointerPde = MiPteToPde(PointerPte);
MiMakePdeExistAndMakeValid(PointerPde, Process, MM_NOIRQL);
}