make the initial kernel_stack large enough to have enough space for the
fx savings area
Modified: trunk/reactos/ntoskrnl/ke/i386/main_asm.S
Modified: trunk/reactos/ntoskrnl/ke/i386/thread.c
Modified: trunk/reactos/ntoskrnl/ke/main.c
_____
Modified: trunk/reactos/ntoskrnl/ke/i386/main_asm.S
--- trunk/reactos/ntoskrnl/ke/i386/main_asm.S 2006-01-14 19:45:50 UTC
(rev 20863)
+++ trunk/reactos/ntoskrnl/ke/i386/main_asm.S 2006-01-14 20:36:01 UTC
(rev 20864)
@@ -35,7 +35,7 @@
.m1:
/* Load the initial kernel stack */
lea _kernel_stack, %eax
- add $0x1000, %eax
+ add $0x2000, %eax
and $0xFFFFE000, %eax
add $(0x3000 - SIZEOF_FX_SAVE_AREA), %eax
movl %eax, %esp
_____
Modified: trunk/reactos/ntoskrnl/ke/i386/thread.c
--- trunk/reactos/ntoskrnl/ke/i386/thread.c 2006-01-14 19:45:50 UTC
(rev 20863)
+++ trunk/reactos/ntoskrnl/ke/i386/thread.c 2006-01-14 20:36:01 UTC
(rev 20864)
@@ -122,10 +122,12 @@
PKKINIT_FRAME InitFrame;
InitFrame = (PKKINIT_FRAME)((ULONG_PTR)Thread->InitialStack -
sizeof(KKINIT_FRAME));
DPRINT("Setting up a kernel thread with the Frame at: %x\n",
InitFrame);
-
+extern ULONG kernel_stack[];
/* Setup the Fx Area */
FxSaveArea = &InitFrame->FxSaveArea;
+ DbgPrint("->a Ldr: %d kernel_stack:0%p r0x%p InitialStack: %p
Initframe: %p-%p FxSav: %p-%p\n", KeLoaderBlock.ModsCount,
&kernel_stack, PAGE_ROUND_UP(&kernel_stack), Thread->InitialStack,
InitFrame, (ULONG_PTR)InitFrame + sizeof(KKINIT_FRAME), FxSaveArea,
(ULONG_PTR)FxSaveArea + sizeof(FX_SAVE_AREA));
RtlZeroMemory(FxSaveArea, sizeof(FX_SAVE_AREA));
+ DbgPrint("->b Ldr: %d kernel_stack:0%p r0x%p InitialStack: %p
Initframe: %p-%p FxSav: %p-%p\n", KeLoaderBlock.ModsCount,
&kernel_stack, PAGE_ROUND_UP(&kernel_stack), Thread->InitialStack,
InitFrame, (ULONG_PTR)InitFrame + sizeof(KKINIT_FRAME), FxSaveArea,
(ULONG_PTR)FxSaveArea + sizeof(FX_SAVE_AREA));
Thread->NpxState = NPX_STATE_INVALID;
/* Setup the Stack for KiThreadStartup and Context Switching */
_____
Modified: trunk/reactos/ntoskrnl/ke/main.c
--- trunk/reactos/ntoskrnl/ke/main.c 2006-01-14 19:45:50 UTC (rev
20863)
+++ trunk/reactos/ntoskrnl/ke/main.c 2006-01-14 20:36:01 UTC (rev
20864)
@@ -48,9 +48,9 @@
ULONG KeLargestCacheLine = 0x40; /* FIXME: Arch-specific */
-/* We allocate 4 pages, but we only use 3. The 4th is to guarantee page
alignment */
-ULONG kernel_stack[4096];
-ULONG double_trap_stack[4096];
+/* We allocate 5 pages, but we only use 4. The 5th is to guarantee page
alignment */
+ULONG kernel_stack[5120];
+ULONG double_trap_stack[5120];
/* These point to the aligned 3 pages */
ULONG init_stack;
@@ -155,10 +155,11 @@
PIMAGE_OPTIONAL_HEADER OptHead;
CHAR* s;
- /* Set up the Stacks (Initial Kernel Stack and Double Trap Stack)*/
- trap_stack = PAGE_ROUND_UP(&double_trap_stack);
+ /* Set up the Stacks (Initial Kernel Stack and Double Trap Stack)
+ and save a page for the fx savings area */
+ trap_stack = PAGE_ROUND_UP(&double_trap_stack) + PAGE_SIZE;
trap_stack_top = trap_stack + 3 * PAGE_SIZE;
- init_stack = PAGE_ROUND_UP(&kernel_stack);
+ init_stack = PAGE_ROUND_UP(&kernel_stack) + PAGE_SIZE;
init_stack_top = init_stack + 3 * PAGE_SIZE;
/* Copy the Loader Block Data locally since Low-Memory will be
wiped */
Show replies by date