Author: sginsberg
Date: Sun Jun 6 20:45:46 2010
New Revision: 47633
URL:
http://svn.reactos.org/svn/reactos?rev=47633&view=rev
Log:
[NTOS] Inline writing to PTEs through MI_WRITE_VALID/INVALID_PTE.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/hypermap.c
trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c
trunk/reactos/ntoskrnl/mm/ARM3/iosup.c
trunk/reactos/ntoskrnl/mm/ARM3/mdlsup.c
trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
trunk/reactos/ntoskrnl/mm/ARM3/mminit.c
trunk/reactos/ntoskrnl/mm/ARM3/ncache.c
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/procsup.c
trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/hypermap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/hypermap.…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/hypermap.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/hypermap.c [iso-8859-1] Sun Jun 6 20:45:46 2010
@@ -82,9 +82,7 @@
// Write the current PTE
//
PointerPte += Offset;
- ASSERT(PointerPte->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte = TempPte;
+ MI_WRITE_VALID_PTE(PointerPte, TempPte);
//
// Return the address
@@ -176,9 +174,7 @@
// Set the correct PTE to write to, and set its new value
//
PointerPte--;
- ASSERT(PointerPte->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte = TempPte;
+ MI_WRITE_VALID_PTE(PointerPte, TempPte);
} while (--NumberOfPages);
//
Modified: trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/i386/init…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c [iso-8859-1] Sun Jun 6 20:45:46 2010
@@ -411,16 +411,10 @@
while (StartPde <= EndPde)
{
//
- // Sanity check
- //
- ASSERT(StartPde->u.Hard.Valid == 0);
-
- //
// Get a page
//
TempPde.u.Hard.PageFrameNumber = MxGetNextPage(1);
- ASSERT(TempPde.u.Hard.Valid == 1);
- *StartPde = TempPde;
+ MI_WRITE_VALID_PTE(StartPde, TempPde);
//
// Zero out the page table
@@ -443,17 +437,11 @@
while (StartPde <= EndPde)
{
//
- // Sanity check
- //
- ASSERT(StartPde->u.Hard.Valid == 0);
-
- //
// Get a page
//
TempPde.u.Hard.PageFrameNumber = MxGetNextPage(1);
- ASSERT(TempPde.u.Hard.Valid == 1);
- *StartPde = TempPde;
-
+ MI_WRITE_VALID_PTE(StartPde, TempPde);
+
//
// Zero out the page table
//
@@ -483,9 +471,7 @@
// Use one of our contigous pages
//
TempPte.u.Hard.PageFrameNumber = PageFrameIndex++;
- ASSERT(PointerPte->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte++ = TempPte;
+ MI_WRITE_VALID_PTE(PointerPte++, TempPte);
}
//
@@ -548,9 +534,7 @@
PageFrameIndex = MiRemoveAnyPage(0);
TempPde.u.Hard.PageFrameNumber = PageFrameIndex;
TempPde.u.Hard.Global = FALSE; // Hyperspace is local!
- ASSERT(StartPde->u.Hard.Valid == 0);
- ASSERT(TempPde.u.Hard.Valid == 1);
- *StartPde = TempPde;
+ MI_WRITE_VALID_PTE(StartPde, TempPde);
/* Flush the TLB */
KeFlushCurrentTb();
Modified: trunk/reactos/ntoskrnl/mm/ARM3/iosup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/iosup.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/iosup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/iosup.c [iso-8859-1] Sun Jun 6 20:45:46 2010
@@ -172,15 +172,10 @@
do
{
//
- // Start out with nothing
- //
- ASSERT(PointerPte->u.Hard.Valid == 0);
-
- //
// Write the PFN
//
TempPte.u.Hard.PageFrameNumber = Pfn++;
- *PointerPte++ = TempPte;
+ MI_WRITE_VALID_PTE(PointerPte++, TempPte);
} while (--PageCount);
//
Modified: trunk/reactos/ntoskrnl/mm/ARM3/mdlsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/mdlsup.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/mdlsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/mdlsup.c [iso-8859-1] Sun Jun 6 20:45:46 2010
@@ -416,9 +416,8 @@
//
// Write the PTE
//
- ASSERT(PointerPte->u.Hard.Valid == 0);
TempPte.u.Hard.PageFrameNumber = *MdlPages;
- *PointerPte++ = TempPte;
+ MI_WRITE_VALID_PTE(PointerPte++, TempPte);
} while (++MdlPages < LastPage);
//
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 Jun 6 20:45:46 2010
@@ -499,6 +499,33 @@
return ((PointerPde->u.Hard.LargePage) && (PointerPde->u.Hard.Valid));
}
+//
+// Writes a valid PTE
+//
+VOID
+FORCEINLINE
+MI_WRITE_VALID_PTE(IN PMMPTE PointerPte,
+ IN MMPTE TempPte)
+{
+ /* Write the valid PTE */
+ ASSERT(PointerPte->u.Hard.Valid == 0);
+ ASSERT(TempPte.u.Hard.Valid == 1);
+ *PointerPte = TempPte;
+}
+
+//
+// Writes an invalid PTE
+//
+VOID
+FORCEINLINE
+MI_WRITE_INVALID_PTE(IN PMMPTE PointerPte,
+ IN MMPTE InvalidPte)
+{
+ /* Write the invalid PTE */
+ ASSERT(InvalidPte.u.Hard.Valid == 0);
+ *PointerPte = InvalidPte;
+}
+
NTSTATUS
NTAPI
MmArmInitSystem(
Modified: trunk/reactos/ntoskrnl/mm/ARM3/mminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/mminit.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] Sun Jun 6 20:45:46 2010
@@ -453,9 +453,8 @@
{
/* Get a page and map it */
TempPte.u.Hard.PageFrameNumber = MxGetNextPage(1);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte = TempPte;
-
+ MI_WRITE_VALID_PTE(PointerPte, TempPte);
+
/* Zero out the page */
RtlZeroMemory(MiPteToAddress(PointerPte), PAGE_SIZE);
}
@@ -614,9 +613,7 @@
/* Write out this PTE */
PagesLeft++;
- ASSERT(PointerPte->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte = TempPte;
+ MI_WRITE_VALID_PTE(PointerPte, TempPte);
/* Zero this page */
RtlZeroMemory(MiPteToAddress(PointerPte), PAGE_SIZE);
@@ -1482,9 +1479,7 @@
TempPte = ValidKernelPte;
ASSERT(PD_COUNT == 1);
TempPte.u.Hard.PageFrameNumber = MmSystemPageDirectory[0];
- ASSERT(PointerPte->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte = TempPte;
+ MI_WRITE_VALID_PTE(PointerPte, TempPte);
//
// Let's get back to paged pool work: size it up.
@@ -1555,9 +1550,7 @@
/* Allocate a page and map the first paged pool PDE */
PageFrameIndex = MiRemoveZeroPage(0);
TempPte.u.Hard.PageFrameNumber = PageFrameIndex;
- ASSERT(PointerPde->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPde = TempPte;
+ MI_WRITE_VALID_PTE(PointerPde, TempPte);
/* Initialize the PFN entry for it */
MiInitializePfnForOtherProcess(PageFrameIndex,
Modified: trunk/reactos/ntoskrnl/mm/ARM3/ncache.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/ncache.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/ncache.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/ncache.c [iso-8859-1] Sun Jun 6 20:45:46 2010
@@ -154,9 +154,7 @@
// Set the PFN in the page and write it
//
TempPte.u.Hard.PageFrameNumber = PageFrameIndex;
- ASSERT(PointerPte->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte++ = TempPte;
+ MI_WRITE_VALID_PTE(PointerPte++, TempPte);
} while (--PageCount);
//
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 Jun 6 20:45:46 2010
@@ -127,11 +127,8 @@
/* Build the PTE */
MI_MAKE_HARDWARE_PTE(&TempPte, PointerPte, PointerPte->u.Soft.Protection,
PageFrameNumber);
- ASSERT(TempPte.u.Hard.Valid == 1);
- ASSERT(PointerPte->u.Hard.Valid == 0);
- *PointerPte = TempPte;
- ASSERT(PointerPte->u.Hard.Valid == 1);
-
+ MI_WRITE_VALID_PTE(PointerPte, TempPte);
+
//
// It's all good now
//
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 Jun 6 20:45:46 2010
@@ -747,6 +747,9 @@
KIRQL OldIrql;
PFN_NUMBER PageFrameIndex;
MMPTE TempPte;
+
+ /* Sanity check that we aren't passed a valid PTE */
+ ASSERT(PointerPte->u.Hard.Valid == 0);
/* Make an empty software PTE */
MI_MAKE_SOFTWARE_PTE(&TempPte, MM_READWRITE);
@@ -767,8 +770,7 @@
PageFrameIndex = MiRemoveAnyPage(0);
/* Write the software PTE */
- ASSERT(PointerPte->u.Hard.Valid == 0);
- *PointerPte = TempPte;
+ MI_WRITE_INVALID_PTE(PointerPte, TempPte);
PointerPte->u.Soft.Protection |= Protection;
/* Initialize its PFN entry */
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 Jun 6 20:45:46 2010
@@ -344,8 +344,7 @@
MmSystemPageDirectory[(PointerPte -
(PMMPTE)PDE_BASE) / PDE_COUNT]);
/* Write the actual PTE now */
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte++ = TempPte;
+ MI_WRITE_VALID_PTE(PointerPte++, TempPte);
//
// Move on to the next expansion address
@@ -604,9 +603,7 @@
/* Write the PTE for it */
TempPte.u.Hard.PageFrameNumber = PageFrameNumber;
- ASSERT(PointerPte->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte++ = TempPte;
+ MI_WRITE_VALID_PTE(PointerPte++, TempPte);
} while (--SizeInPages > 0);
//
Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Sun Jun 6 20:45:46 2010
@@ -175,17 +175,14 @@
/* Get a page and write the current invalid PTE */
PageFrameIndex = MiRemoveAnyPage(0);
- ASSERT(InvalidPte.u.Hard.Valid == 0);
- *PointerPte = InvalidPte;
-
+ MI_WRITE_INVALID_PTE(PointerPte, InvalidPte);
+
/* Initialize the PFN entry for this page */
MiInitializePfn(PageFrameIndex, PointerPte, 1);
/* Write the valid PTE */
TempPte.u.Hard.PageFrameNumber = PageFrameIndex;
- ASSERT(PointerPte->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte = TempPte;
+ MI_WRITE_VALID_PTE(PointerPte, TempPte);
}
// Bug #4835
@@ -267,9 +264,8 @@
{
/* Get a page and write the current invalid PTE */
PageFrameIndex = MiRemoveAnyPage(0);
- ASSERT(InvalidPte.u.Hard.Valid == 0);
- *LimitPte = InvalidPte;
-
+ MI_WRITE_INVALID_PTE(LimitPte, InvalidPte);
+
/* Initialize the PFN entry for this page */
MiInitializePfn(PageFrameIndex, LimitPte, 1);
@@ -277,9 +273,7 @@
MI_MAKE_HARDWARE_PTE(&TempPte, LimitPte, MM_READWRITE, PageFrameIndex);
/* Write the valid PTE */
- ASSERT(LimitPte->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *LimitPte-- = TempPte;
+ MI_WRITE_VALID_PTE(LimitPte--, TempPte);
}
//
Modified: trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] Sun Jun 6 20:45:46 2010
@@ -173,12 +173,10 @@
{
/* Allocate a page */
TempPte.u.Hard.PageFrameNumber = MiAllocatePfn(PointerPte, MM_EXECUTE);
-
+
/* Write it */
- ASSERT(PointerPte->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte = TempPte;
-
+ MI_WRITE_VALID_PTE(PointerPte, TempPte);
+
/* Move on */
PointerPte++;
}
@@ -1451,15 +1449,13 @@
/* Copy the old data */
OldPte = *StartPte;
ASSERT(OldPte.u.Hard.Valid == 1);
-
+
/* Set page number from the loader's memory */
TempPte.u.Hard.PageFrameNumber = OldPte.u.Hard.PageFrameNumber;
-
+
/* Write it */
- ASSERT(PointerPte->u.Hard.Valid == 0);
- ASSERT(TempPte.u.Hard.Valid == 1);
- *PointerPte = TempPte;
-
+ MI_WRITE_VALID_PTE(PointerPte, TempPte);
+
/* Move on */
PointerPte++;
StartPte++;