make the initial kernel_stack large enough to have enough space for the fx savings area

svn path=/trunk/; revision=20864
This commit is contained in:
Thomas Bluemel 2006-01-14 20:36:01 +00:00
parent deb66aaf9e
commit 70dcf02781
3 changed files with 11 additions and 8 deletions

View file

@ -35,7 +35,7 @@ _NtProcessStartup:
.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

View file

@ -122,10 +122,12 @@ Ke386InitThreadWithContext(PKTHREAD Thread,
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 */

View file

@ -48,9 +48,9 @@ PVOID KeRaiseUserExceptionDispatcher = NULL;
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 @@ _main(ULONG MultiBootMagic,
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 */