Author: sir_richard
Date: Wed Feb 10 04:59:17 2010
New Revision: 45548
URL:
http://svn.reactos.org/svn/reactos?rev=45548&view=rev
Log:
[NTOS]: Allow registry configuration of large kernel stack size, with proper checks.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c
trunk/reactos/ntoskrnl/mm/ARM3/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] Wed Feb 10 04:59:17 2010
@@ -74,7 +74,29 @@
PVOID NonPagedPoolExpansionVa;
ULONG OldCount, L2Associativity;
PFN_NUMBER FreePage, FreePageCount, PagesLeft, BasePage, PageCount;
-
+
+ /* Check for kernel stack size that's too big */
+ if (MmLargeStackSize > (KERNEL_LARGE_STACK_SIZE / 1024))
+ {
+ /* Sanitize to default value */
+ MmLargeStackSize = KERNEL_LARGE_STACK_SIZE;
+ }
+ else
+ {
+ /* Take the registry setting, and convert it into bytes */
+ MmLargeStackSize *= 1024;
+
+ /* Now align it to a page boundary */
+ MmLargeStackSize = PAGE_ROUND_UP(MmLargeStackSize);
+
+ /* Sanity checks */
+ ASSERT(MmLargeStackSize <= KERNEL_LARGE_STACK_SIZE);
+ ASSERT((MmLargeStackSize & (PAGE_SIZE - 1)) == 0);
+
+ /* Make sure it's not too low */
+ if (MmLargeStackSize < KERNEL_STACK_SIZE) MmLargeStackSize =
KERNEL_STACK_SIZE;
+ }
+
//
// The large kernel stack is cutomizable, but use default value for now
//
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] Wed Feb 10 04:59:17 2010
@@ -232,7 +232,7 @@
//
// Actual (registry-configurable) size of a GUI thread's stack
//
-ULONG MmLargeStackSize;
+ULONG MmLargeStackSize = KERNEL_LARGE_STACK_SIZE;
/* PRIVATE FUNCTIONS **********************************************************/