https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5032a40d33a4edc9cdf7ac...
commit 5032a40d33a4edc9cdf7acad08b8eb2d928c9793 Author: Thomas Faber thomas.faber@reactos.org AuthorDate: Sun Mar 8 20:05:02 2020 +0100 Commit: Thomas Faber thomas.faber@reactos.org CommitDate: Mon Apr 6 11:16:34 2020 +0200
[NTOS:MM] In MmArmInitSystem, perform self-tests after per-arch initialization.
Mm(Non)PagedPoolStart won't be initialized otherwise, making the tests pretty pointless. --- ntoskrnl/mm/ARM3/mminit.c | 68 +++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/ntoskrnl/mm/ARM3/mminit.c b/ntoskrnl/mm/ARM3/mminit.c index d72e7186193..bcccc0c5a5e 100644 --- a/ntoskrnl/mm/ARM3/mminit.c +++ b/ntoskrnl/mm/ARM3/mminit.c @@ -2123,40 +2123,6 @@ MmArmInitSystem(IN ULONG Phase, /* Set the based section highest address */ MmHighSectionBase = (PVOID)((ULONG_PTR)MmHighestUserAddress - 0x800000);
-#if DBG - /* The subection PTE format depends on things being 8-byte aligned */ - ASSERT((sizeof(CONTROL_AREA) % 8) == 0); - ASSERT((sizeof(SUBSECTION) % 8) == 0); - - /* Prototype PTEs are assumed to be in paged pool, so check if the math works */ - PointerPte = (PMMPTE)MmPagedPoolStart; - MI_MAKE_PROTOTYPE_PTE(&TempPte, PointerPte); - TestPte = MiProtoPteToPte(&TempPte); - ASSERT(PointerPte == TestPte); - - /* Try the last nonpaged pool address */ - PointerPte = (PMMPTE)MI_NONPAGED_POOL_END; - MI_MAKE_PROTOTYPE_PTE(&TempPte, PointerPte); - TestPte = MiProtoPteToPte(&TempPte); - ASSERT(PointerPte == TestPte); - - /* Try a bunch of random addresses near the end of the address space */ - PointerPte = (PMMPTE)((ULONG_PTR)MI_HIGHEST_SYSTEM_ADDRESS - 0x37FFF); - for (j = 0; j < 20; j += 1) - { - MI_MAKE_PROTOTYPE_PTE(&TempPte, PointerPte); - TestPte = MiProtoPteToPte(&TempPte); - ASSERT(PointerPte == TestPte); - PointerPte++; - } - - /* Subsection PTEs are always in nonpaged pool, pick a random address to try */ - PointerPte = (PMMPTE)((ULONG_PTR)MmNonPagedPoolStart + (MmSizeOfNonPagedPoolInBytes / 2)); - MI_MAKE_SUBSECTION_PTE(&TempPte, PointerPte); - TestPte = MiSubsectionPteToSubsection(&TempPte); - ASSERT(PointerPte == TestPte); -#endif - /* Loop all 8 standby lists */ for (i = 0; i < 8; i++) { @@ -2331,6 +2297,40 @@ MmArmInitSystem(IN ULONG Phase, /* Initialize the platform-specific parts */ MiInitMachineDependent(LoaderBlock);
+#if DBG + /* The subection PTE format depends on things being 8-byte aligned */ + ASSERT((sizeof(CONTROL_AREA) % 8) == 0); + ASSERT((sizeof(SUBSECTION) % 8) == 0); + + /* Prototype PTEs are assumed to be in paged pool, so check if the math works */ + PointerPte = (PMMPTE)MmPagedPoolStart; + MI_MAKE_PROTOTYPE_PTE(&TempPte, PointerPte); + TestPte = MiProtoPteToPte(&TempPte); + ASSERT(PointerPte == TestPte); + + /* Try the last nonpaged pool address */ + PointerPte = (PMMPTE)MI_NONPAGED_POOL_END; + MI_MAKE_PROTOTYPE_PTE(&TempPte, PointerPte); + TestPte = MiProtoPteToPte(&TempPte); + ASSERT(PointerPte == TestPte); + + /* Try a bunch of random addresses near the end of the address space */ + PointerPte = (PMMPTE)((ULONG_PTR)MI_HIGHEST_SYSTEM_ADDRESS - 0x37FFF); + for (j = 0; j < 20; j += 1) + { + MI_MAKE_PROTOTYPE_PTE(&TempPte, PointerPte); + TestPte = MiProtoPteToPte(&TempPte); + ASSERT(PointerPte == TestPte); + PointerPte++; + } + + /* Subsection PTEs are always in nonpaged pool, pick a random address to try */ + PointerPte = (PMMPTE)((ULONG_PTR)MmNonPagedPoolStart + (MmSizeOfNonPagedPoolInBytes / 2)); + MI_MAKE_SUBSECTION_PTE(&TempPte, PointerPte); + TestPte = MiSubsectionPteToSubsection(&TempPte); + ASSERT(PointerPte == TestPte); +#endif + // // Build the physical memory block //