Author: tkreuzer
Date: Sun May 10 19:35:24 2015
New Revision: 67633
URL:
http://svn.reactos.org/svn/reactos?rev=67633&view=rev
Log:
[NTOSKRNL/MM]
Add MI_MAKE_CLEAN_PAGE
Use PTE access macros for portability
Modified:
trunk/reactos/ntoskrnl/include/internal/amd64/mm.h
trunk/reactos/ntoskrnl/include/internal/arm/mm.h
trunk/reactos/ntoskrnl/include/internal/i386/mm.h
trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c
trunk/reactos/ntoskrnl/mm/ARM3/section.c
trunk/reactos/ntoskrnl/mm/ARM3/session.c
Modified: trunk/reactos/ntoskrnl/include/internal/amd64/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/amd64/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/amd64/mm.h [iso-8859-1] Sun May 10 19:35:24
2015
@@ -87,6 +87,7 @@
/* Macros for portable PTE modification */
#define MI_MAKE_LOCAL_PAGE(x) ((x)->u.Hard.Global = 0)
#define MI_MAKE_DIRTY_PAGE(x) ((x)->u.Hard.Dirty = 1)
+#define MI_MAKE_CLEAN_PAGE(x) ((x)->u.Hard.Dirty = 0)
#define MI_MAKE_ACCESSED_PAGE(x) ((x)->u.Hard.Accessed = 1)
#define MI_PAGE_DISABLE_CACHE(x) ((x)->u.Hard.CacheDisable = 1)
#define MI_PAGE_WRITE_THROUGH(x) ((x)->u.Hard.WriteThrough = 1)
Modified: trunk/reactos/ntoskrnl/include/internal/arm/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arm/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/mm.h [iso-8859-1] Sun May 10 19:35:24
2015
@@ -76,6 +76,7 @@
/* Macros for portable PTE modification */
#define MI_MAKE_LOCAL_PAGE(x) ((x)->u.Hard.NonGlobal = 1)
#define MI_MAKE_DIRTY_PAGE(x)
+#define MI_MAKE_CLEAN_PAGE(x)
#define MI_MAKE_ACCESSED_PAGE(x)
#define MI_PAGE_DISABLE_CACHE(x) ((x)->u.Hard.Cached = 0)
#define MI_PAGE_WRITE_THROUGH(x) ((x)->u.Hard.Buffered = 0)
Modified: trunk/reactos/ntoskrnl/include/internal/i386/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/mm.h [iso-8859-1] Sun May 10 19:35:24
2015
@@ -91,6 +91,7 @@
/* Macros for portable PTE modification */
#define MI_MAKE_LOCAL_PAGE(x) ((x)->u.Hard.Global = 0)
#define MI_MAKE_DIRTY_PAGE(x) ((x)->u.Hard.Dirty = 1)
+#define MI_MAKE_CLEAN_PAGE(x) ((x)->u.Hard.Dirty = 0)
#define MI_MAKE_ACCESSED_PAGE(x) ((x)->u.Hard.Accessed = 1)
#define MI_PAGE_DISABLE_CACHE(x) ((x)->u.Hard.CacheDisable = 1)
#define MI_PAGE_WRITE_THROUGH(x) ((x)->u.Hard.WriteThrough = 1)
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:24 2015
@@ -165,7 +165,8 @@
if (StoreInstruction)
{
/* Is it writable?*/
- if ((TempPte.u.Hard.Write) || (TempPte.u.Hard.CopyOnWrite))
+ if (MI_IS_PAGE_WRITEABLE(&TempPte) ||
+ MI_IS_PAGE_COPY_ON_WRITE(&TempPte))
{
/* Then there's nothing to worry about */
return STATUS_SUCCESS;
@@ -791,7 +792,7 @@
}
/* Set the dirty flag if needed */
- if (DirtyPage) TempPte.u.Hard.Dirty = TRUE;
+ if (DirtyPage) MI_MAKE_DIRTY_PAGE(&TempPte);
/* Write the PTE */
MI_WRITE_VALID_PTE(PointerPte, TempPte);
@@ -1004,16 +1005,17 @@
MiDetermineUserGlobalPteMask(PointerPte);
/* Is the PTE writeable? */
- if (((Pfn1->u3.e1.Modified) && (TempPte.u.Hard.Write)) &&
- (TempPte.u.Hard.CopyOnWrite == 0))
+ if ((Pfn1->u3.e1.Modified) &&
+ MI_IS_PAGE_WRITEABLE(&TempPte) &&
+ !MI_IS_PAGE_COPY_ON_WRITE(&TempPte))
{
/* Make it dirty */
- TempPte.u.Hard.Dirty = TRUE;
+ MI_MAKE_DIRTY_PAGE(&TempPte);
}
else
{
/* Make it clean */
- TempPte.u.Hard.Dirty = FALSE;
+ MI_MAKE_CLEAN_PAGE(&TempPte);
}
/* Write the valid PTE */
@@ -1302,19 +1304,20 @@
TempPte.u.Long = (PointerProtoPte->u.Long & ~0xFFF) |
MmProtectToPteMask[PointerProtoPte->u.Trans.Protection];
TempPte.u.Hard.Valid = 1;
- TempPte.u.Hard.Accessed = 1;
+ MI_MAKE_ACCESSED_PAGE(&TempPte);
/* Is the PTE writeable? */
- if (((Pfn1->u3.e1.Modified) && (TempPte.u.Hard.Write))
&&
- (TempPte.u.Hard.CopyOnWrite == 0))
+ if ((Pfn1->u3.e1.Modified) &&
+ MI_IS_PAGE_WRITEABLE(&TempPte) &&
+ !MI_IS_PAGE_COPY_ON_WRITE(&TempPte))
{
/* Make it dirty */
- TempPte.u.Hard.Dirty = TRUE;
+ MI_MAKE_DIRTY_PAGE(&TempPte);
}
else
{
/* Make it clean */
- TempPte.u.Hard.Dirty = FALSE;
+ MI_MAKE_CLEAN_PAGE(&TempPte);
}
/* Write the valid PTE */
@@ -1561,7 +1564,7 @@
/* Not yet implemented in ReactOS */
ASSERT(MI_IS_PAGE_LARGE(PointerPde) == FALSE);
- ASSERT(((StoreInstruction) && (PointerPte->u.Hard.CopyOnWrite)) ==
FALSE);
+ ASSERT(((StoreInstruction) && MI_IS_PAGE_COPY_ON_WRITE(PointerPte)) ==
FALSE);
/* Check if this was a write */
if (StoreInstruction)
@@ -1740,7 +1743,7 @@
Pfn1 = MI_PFN_ELEMENT(PointerPte->u.Hard.PageFrameNumber);
if (!(TempPte.u.Long & PTE_READWRITE) &&
!(Pfn1->OriginalPte.u.Soft.Protection & MM_READWRITE)
&&
- !(TempPte.u.Hard.CopyOnWrite))
+ !MI_IS_PAGE_COPY_ON_WRITE(&TempPte))
{
/* Case not yet handled */
ASSERT(!IsSessionAddress);
@@ -1757,13 +1760,13 @@
/* Check for read-only write in session space */
if ((IsSessionAddress) &&
(StoreInstruction) &&
- !(TempPte.u.Hard.Write))
+ !MI_IS_PAGE_WRITEABLE(&TempPte))
{
/* Sanity check */
ASSERT(MI_IS_SESSION_IMAGE_ADDRESS(Address));
/* Was this COW? */
- if (TempPte.u.Hard.CopyOnWrite == 0)
+ if (!MI_IS_PAGE_COPY_ON_WRITE(&TempPte))
{
/* Then this is not allowed */
KeBugCheckEx(ATTEMPTED_WRITE_TO_READONLY_MEMORY,
@@ -1993,14 +1996,14 @@
if (StoreInstruction)
{
/* Is this a copy on write PTE? */
- if (TempPte.u.Hard.CopyOnWrite)
+ if (MI_IS_PAGE_COPY_ON_WRITE(&TempPte))
{
/* Not supported yet */
ASSERT(FALSE);
}
/* Is this a read-only PTE? */
- if (!TempPte.u.Hard.Write)
+ if (!MI_IS_PAGE_WRITEABLE(&TempPte))
{
/* Return the status */
MiUnlockProcessWorkingSet(CurrentProcess, CurrentThread);
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:24 2015
@@ -2164,7 +2164,7 @@
ASSERT(((Pfn1->u3.e1.PrototypePte) &&
(Pfn1->OriginalPte.u.Soft.Prototype)) == 0);
/* Mark the page as modified accordingly */
- if (PteContents.u.Hard.Dirty)
+ if (MI_IS_PAGE_DIRTY(&PteContents))
Pfn1->u3.e1.Modified = 1;
/* Was the PDE invalid */
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:24 2015
@@ -572,7 +572,7 @@
/* Write a valid PTE for it */
TempPte.u.Long = ValidKernelPteLocal.u.Long;
- TempPte.u.Hard.Dirty = TRUE;
+ MI_MAKE_DIRTY_PAGE(&TempPte);
TempPte.u.Hard.PageFrameNumber = PageFrameIndex;
/* Initialize the working set list page */