[NTOS] Deduplicate MiSynchronizeSystemPde(). #179
authorAmine Khaldi <amine.khaldi@reactos.org>
Mon, 25 Dec 2017 19:13:50 +0000 (20:13 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Mon, 25 Dec 2017 19:14:46 +0000 (20:14 +0100)
ntoskrnl/mm/ARM3/miarm.h
ntoskrnl/mm/ARM3/pagfault.c
ntoskrnl/mm/i386/page.c

index c1d8180..b68d680 100644 (file)
@@ -2260,4 +2260,27 @@ MiRemoveZeroPageSafe(IN ULONG Color)
     return 0;
 }
 
+#if (_MI_PAGING_LEVELS == 2)
+FORCEINLINE
+BOOLEAN
+MiSynchronizeSystemPde(PMMPDE PointerPde)
+{
+    MMPDE SystemPde;
+    ULONG Index;
+
+    /* Get the Index from the PDE */
+    Index = ((ULONG_PTR)PointerPde & (SYSTEM_PD_SIZE - 1)) / sizeof(MMPTE);
+
+    /* Copy the PDE from the double-mapped system page directory */
+    SystemPde = MmSystemPagePtes[Index];
+    *PointerPde = SystemPde;
+
+    /* Make sure we re-read the PDE and PTE */
+    KeMemoryBarrierWithoutFence();
+
+    /* Return, if we had success */
+    return SystemPde.u.Hard.Valid != 0;
+}
+#endif
+
 /* EOF */
index 2e962ed..1e70cc0 100644 (file)
@@ -310,27 +310,6 @@ MiCheckVirtualAddress(IN PVOID VirtualAddress,
 }
 
 #if (_MI_PAGING_LEVELS == 2)
-FORCEINLINE
-BOOLEAN
-MiSynchronizeSystemPde(PMMPDE PointerPde)
-{
-    MMPDE SystemPde;
-    ULONG Index;
-
-    /* Get the Index from the PDE */
-    Index = ((ULONG_PTR)PointerPde & (SYSTEM_PD_SIZE - 1)) / sizeof(MMPTE);
-
-    /* Copy the PDE from the double-mapped system page directory */
-    SystemPde = MmSystemPagePtes[Index];
-    *PointerPde = SystemPde;
-
-    /* Make sure we re-read the PDE and PTE */
-    KeMemoryBarrierWithoutFence();
-
-    /* Return, if we had success */
-    return (BOOLEAN)SystemPde.u.Hard.Valid;
-}
-
 NTSTATUS
 FASTCALL
 MiCheckPdeForSessionSpace(IN PVOID Address)
index b371c12..4ed0ebc 100644 (file)
@@ -189,28 +189,6 @@ ProtectToPTE(ULONG flProtect)
     return(Attributes);
 }
 
-/* Taken from ARM3/pagfault.c */
-FORCEINLINE
-BOOLEAN
-MiSynchronizeSystemPde(PMMPDE PointerPde)
-{
-    MMPDE SystemPde;
-    ULONG Index;
-
-    /* Get the Index from the PDE */
-    Index = ((ULONG_PTR)PointerPde & (SYSTEM_PD_SIZE - 1)) / sizeof(MMPTE);
-
-    /* Copy the PDE from the double-mapped system page directory */
-    SystemPde = MmSystemPagePtes[Index];
-    *PointerPde = SystemPde;
-
-    /* Make sure we re-read the PDE and PTE */
-    KeMemoryBarrierWithoutFence();
-
-    /* Return, if we had success */
-    return SystemPde.u.Hard.Valid != 0;
-}
-
 NTSTATUS
 NTAPI
 MiDispatchFault(IN BOOLEAN StoreInstruction,