Author: tfaber
Date: Fri Sep 30 15:58:23 2016
New Revision: 72869
URL:
http://svn.reactos.org/svn/reactos?rev=72869&view=rev
Log:
[NTOS:MM]
- Get rid of MiNonPagedSystemSize, which is misleading because MmNumberOfSystemPtes can
change throughout the startup process, thus invalidating this size variable
- Correctly reserve the system PTE space and nonpaged pool expansion space in
MiInitSystemMemoryAreas
Should fix the remaining "Bad PTE" bug checks when running out of kernel address
space.
CORE-11533 #resolve
CORE-11160 CORE-10611 CORE-11926 CORE-11873 CORE-11554 #comment This should be fixed with
r72869, please retest.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c
trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
trunk/reactos/ntoskrnl/mm/ARM3/mminit.c
trunk/reactos/ntoskrnl/mm/amd64/init.c
trunk/reactos/ntoskrnl/mm/mminit.c
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] Fri Sep 30 15:58:23 2016
@@ -245,6 +245,7 @@
PMMPTE StartPde, EndPde, PointerPte, LastPte;
MMPTE TempPde, TempPte;
PVOID NonPagedPoolExpansionVa;
+ SIZE_T NonPagedSystemSize;
KIRQL OldIrql;
PMMPFN Pfn1;
ULONG Flags;
@@ -298,9 +299,9 @@
// nonpaged pool expansion (above) and the system PTEs. Note that it is
// then aligned to a PDE boundary (4MB).
//
- MiNonPagedSystemSize = (MmNumberOfSystemPtes + 1) * PAGE_SIZE;
+ NonPagedSystemSize = (MmNumberOfSystemPtes + 1) * PAGE_SIZE;
MmNonPagedSystemStart = (PVOID)((ULONG_PTR)MmNonPagedPoolStart -
- MiNonPagedSystemSize);
+ NonPagedSystemSize);
MmNonPagedSystemStart = (PVOID)((ULONG_PTR)MmNonPagedSystemStart &
~(PDE_MAPPED_VA - 1));
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] Fri Sep 30 15:58:23 2016
@@ -527,7 +527,6 @@
extern PFN_NUMBER MmMaximumNonPagedPoolInPages;
extern PFN_NUMBER MmSizeOfPagedPoolInPages;
extern PVOID MmNonPagedSystemStart;
-extern SIZE_T MiNonPagedSystemSize;
extern PVOID MmNonPagedPoolStart;
extern PVOID MmNonPagedPoolExpansionStart;
extern PVOID MmNonPagedPoolEnd;
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] Fri Sep 30 15:58:23 2016
@@ -94,7 +94,6 @@
//
http://www.ditii.com/2007/09/28/windows-memory-management-x86-virtual-addre…
//
PVOID MmNonPagedSystemStart;
-SIZE_T MiNonPagedSystemSize;
PVOID MmNonPagedPoolStart;
PVOID MmNonPagedPoolExpansionStart;
PVOID MmNonPagedPoolEnd = MI_NONPAGED_POOL_END;
Modified: trunk/reactos/ntoskrnl/mm/amd64/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/amd64/init.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/amd64/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/amd64/init.c [iso-8859-1] Fri Sep 30 15:58:23 2016
@@ -370,14 +370,15 @@
MiBuildSystemPteSpace(VOID)
{
PMMPTE PointerPte;
-
- /* Use the default numer of system PTEs */
+ SIZE_T NonPagedSystemSize;
+
+ /* Use the default number of system PTEs */
MmNumberOfSystemPtes = MI_NUMBER_SYSTEM_PTES;
- MiNonPagedSystemSize = (MmNumberOfSystemPtes + 1) * PAGE_SIZE;
+ NonPagedSystemSize = (MmNumberOfSystemPtes + 1) * PAGE_SIZE;
/* Put system PTEs at the start of the system VA space */
MiSystemPteSpaceStart = MmNonPagedSystemStart;
- MiSystemPteSpaceEnd = (PUCHAR)MiSystemPteSpaceStart + MiNonPagedSystemSize;
+ MiSystemPteSpaceEnd = (PUCHAR)MiSystemPteSpaceStart + NonPagedSystemSize;
/* Map the PPEs and PDEs for the system PTEs */
MiMapPPEs(MiSystemPteSpaceStart, MiSystemPteSpaceEnd);
Modified: trunk/reactos/ntoskrnl/mm/mminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=7…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Fri Sep 30 15:58:23 2016
@@ -88,8 +88,11 @@
// ReactOS requires a memory area to keep the initial NP area off-bounds
MiCreateArm3StaticMemoryArea(MmNonPagedPoolStart, MmSizeOfNonPagedPoolInBytes,
FALSE);
- // System NP
- MiCreateArm3StaticMemoryArea(MmNonPagedSystemStart, MiNonPagedSystemSize, FALSE);
+ // System PTE space
+ MiCreateArm3StaticMemoryArea(MmNonPagedSystemStart, (MmNumberOfSystemPtes + 1) *
PAGE_SIZE, FALSE);
+
+ // Nonpaged pool expansion space
+ MiCreateArm3StaticMemoryArea(MmNonPagedPoolExpansionStart,
(ULONG_PTR)MmNonPagedPoolEnd - (ULONG_PTR)MmNonPagedPoolExpansionStart, FALSE);
// System view space
MiCreateArm3StaticMemoryArea(MiSystemViewStart, MmSystemViewSize, FALSE);