https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4d4e4bb68a74fec7a38e0…
commit 4d4e4bb68a74fec7a38e0abd6bacb140cde1211f
Author: Amine Khaldi <amine.khaldi(a)reactos.org>
AuthorDate: Mon Dec 25 20:13:50 2017 +0100
[NTOS] Deduplicate MiSynchronizeSystemPde(). #179
---
ntoskrnl/mm/ARM3/miarm.h | 23 +++++++++++++++++++++++
ntoskrnl/mm/ARM3/pagfault.c | 21 ---------------------
ntoskrnl/mm/i386/page.c | 22 ----------------------
3 files changed, 23 insertions(+), 43 deletions(-)
diff --git a/ntoskrnl/mm/ARM3/miarm.h b/ntoskrnl/mm/ARM3/miarm.h
index c1d81807f6..b68d680210 100644
--- a/ntoskrnl/mm/ARM3/miarm.h
+++ b/ntoskrnl/mm/ARM3/miarm.h
@@ -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 */
diff --git a/ntoskrnl/mm/ARM3/pagfault.c b/ntoskrnl/mm/ARM3/pagfault.c
index 2e962edd92..1e70cc07b9 100644
--- a/ntoskrnl/mm/ARM3/pagfault.c
+++ b/ntoskrnl/mm/ARM3/pagfault.c
@@ -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)
diff --git a/ntoskrnl/mm/i386/page.c b/ntoskrnl/mm/i386/page.c
index b371c12200..4ed0ebc29f 100644
--- a/ntoskrnl/mm/i386/page.c
+++ b/ntoskrnl/mm/i386/page.c
@@ -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,