Author: ros-arm-bringup
Date: Sun Jun 21 09:33:48 2009
New Revision: 41508
URL:
http://svn.reactos.org/svn/reactos?rev=41508&view=rev
Log:
- Define a new consumer: MC_SYSTEM:
- Right now, it is only used for allocating new page tables for kernel-mode mappings.
- This consumer's pages are never zeroed automatically (this is a more endemic
ReactOS problem -- kernel pages are zeroed when they shouldn't be).
- New page tables, however, should indeed be zeroed, so now they are zeroed manually
with RtlZeroMemory.
- The page zero function is not called anymore, and a useless zero-space hyperspace
mapping is thus saved each time this happens.
- Because of this, zero-space hyperspace mappings are required much later in the
Memory Manager's initialization steps than before.
Modified:
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/mm/freelist.c
trunk/reactos/ntoskrnl/mm/i386/page.c
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Sun Jun 21 09:33:48 2009
@@ -102,7 +102,8 @@
#define MC_USER (1)
#define MC_PPOOL (2)
#define MC_NPPOOL (3)
-#define MC_MAXIMUM (4)
+#define MC_SYSTEM (4)
+#define MC_MAXIMUM (5)
#define PAGED_POOL_MASK 1
#define MUST_SUCCEED_POOL_MASK 2
Modified: trunk/reactos/ntoskrnl/mm/freelist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/freelist.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] Sun Jun 21 09:33:48 2009
@@ -777,7 +777,7 @@
KeReleaseQueuedSpinLock(LockQueuePfnLock, oldIrql);
PfnOffset = PageDescriptor - MmPfnDatabase;
- if (NeedClear)
+ if ((NeedClear) && (Consumer != MC_SYSTEM))
{
MiZeroPage(PfnOffset);
}
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Sun Jun 21 09:33:48 2009
@@ -310,7 +310,7 @@
{
return NULL;
}
- Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
+ Status = MmRequestPageMemoryConsumer(MC_SYSTEM, FALSE, &Pfn);
if (!NT_SUCCESS(Status) || Pfn == 0)
{
KeBugCheck(MEMORY_MANAGEMENT);
@@ -322,8 +322,11 @@
}
if(0 !=
InterlockedCompareExchangePte(&MmGlobalKernelPageDirectory[PdeOffset], Entry, 0))
{
- MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn);
+ MmReleasePageMemoryConsumer(MC_SYSTEM, Pfn);
}
+ InterlockedExchangePte(PageDir, MmGlobalKernelPageDirectory[PdeOffset]);
+ RtlZeroMemory(MiPteToAddress(PageDir), PAGE_SIZE);
+ return (PULONG)MiAddressToPte(Address);
}
InterlockedExchangePte(PageDir, MmGlobalKernelPageDirectory[PdeOffset]);
}