#endif
/* These variables define the system cache address space */
-PVOID MmSystemCacheStart;
+PVOID MmSystemCacheStart = (PVOID)MI_SYSTEM_CACHE_START;
PVOID MmSystemCacheEnd;
+ULONG MmSizeOfSystemCacheInPages;
MMSUPPORT MmSystemCacheWs;
//
ULONG MmCritsectTimeoutSeconds = 150; // NT value: 720 * 60 * 60; (30 days)
LARGE_INTEGER MmCriticalSectionTimeout;
+//
+// Throttling limits for Cc (in pages)
+// Above top, we don't throttle
+// Above bottom, we throttle depending on the amount of modified pages
+// Otherwise, we throttle!
+//
+ULONG MmThrottleTop;
+ULONG MmThrottleBottom;
+
/* PRIVATE FUNCTIONS **********************************************************/
VOID
TempPte.u.Hard.PageFrameNumber = MmSystemPageDirectory[0];
MI_WRITE_VALID_PTE(PointerPte, TempPte);
#endif
+
+#ifdef _M_IX86
//
// Let's get back to paged pool work: size it up.
// By default, it should be twice as big as nonpaged pool.
MmSizeOfPagedPoolInBytes = (ULONG_PTR)MmNonPagedSystemStart -
(ULONG_PTR)MmPagedPoolStart;
}
+#endif // _M_IX86
//
// Get the size in pages and make sure paged pool is at least 32MB.
MmSizeOfPagedPoolInBytes = Size * PAGE_SIZE * 1024;
MmSizeOfPagedPoolInPages = MmSizeOfPagedPoolInBytes >> PAGE_SHIFT;
+#ifdef _M_IX86
//
// Let's be really sure this doesn't overflow into nonpaged system VA
//
ASSERT((MmSizeOfPagedPoolInBytes + (ULONG_PTR)MmPagedPoolStart) <=
(ULONG_PTR)MmNonPagedSystemStart);
+#endif // _M_IX86
//
// This is where paged pool ends
MiLowNonPagedPoolEvent = &MiTempEvent;
MiHighNonPagedPoolEvent = &MiTempEvent;
+ //
+ // Default throttling limits for Cc
+ // May be ajusted later on depending on system type
+ //
+ MmThrottleTop = 450;
+ MmThrottleBottom = 127;
+
//
// Define the basic user vs. kernel address space separation
//
ASSERT(PointerPte == TestPte);
/* Try a bunch of random addresses near the end of the address space */
- PointerPte = (PMMPTE)0xFFFC8000;
+ PointerPte = (PMMPTE)((ULONG_PTR)MI_HIGHEST_SYSTEM_ADDRESS - 0x37FFF);
for (j = 0; j < 20; j += 1)
{
MI_MAKE_PROTOTYPE_PTE(&TempPte, PointerPte);
}
/* Subsection PTEs are always in nonpaged pool, pick a random address to try */
- PointerPte = (PMMPTE)0xFFAACBB8;
+ PointerPte = (PMMPTE)((ULONG_PTR)MmNonPagedPoolStart + (MmSizeOfNonPagedPoolInBytes / 2));
MI_MAKE_SUBSECTION_PTE(&TempPte, PointerPte);
TestPte = MiSubsectionPteToSubsection(&TempPte);
ASSERT(PointerPte == TestPte);
/* Set Windows NT Workstation product type */
SharedUserData->NtProductType = NtProductWinNt;
MmProductType = 0;
+
+ /* For this product, we wait till the last moment to throttle */
+ MmThrottleTop = 250;
+ MmThrottleBottom = 30;
}
else
{
/* Set the product type, and make the system more aggressive with low memory */
MmProductType = 1;
MmMinimumFreePages = 81;
+
+ /* We will throttle earlier to preserve memory */
+ MmThrottleTop = 450;
+ MmThrottleBottom = 80;
}
/* Update working set tuning parameters */
return FALSE;
}
+ /* Define limits for system cache */
+#ifdef _M_AMD64
+ MmSizeOfSystemCacheInPages = (MI_SYSTEM_CACHE_END - MI_SYSTEM_CACHE_START) / PAGE_SIZE;
+#else
+ MmSizeOfSystemCacheInPages = ((ULONG_PTR)MI_PAGED_POOL_START - (ULONG_PTR)MI_SYSTEM_CACHE_START) / PAGE_SIZE;
+#endif
+ MmSystemCacheEnd = (PVOID)((ULONG_PTR)MmSystemCacheStart + (MmSizeOfSystemCacheInPages * PAGE_SIZE) - 1);
+
/* Initialize the system cache */
//MiInitializeSystemCache(MmSystemCacheWsMinimum, MmAvailablePages);