Author: ion
Date: Mon Mar 19 22:43:50 2007
New Revision: 26141
URL: http://svn.reactos.org/svn/reactos?rev=26141&view=rev
Log:
- Don't use the stack in FASTCALL_PROLOG. It messes up NPX checks (this is a bug, it shouldn't happen... related to DPC stack bug.)
- Zero out the trap/npx frame for new user-mode threads.
- Use KeI386FxsrPresent and not KEI386XMMIPresent when setting up the context for a new thread.
Modified:
trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S
trunk/reactos/ntoskrnl/ke/i386/thrdini.c
Modified: trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S Mon Mar 19 22:43:50 2007
@@ -700,8 +700,10 @@
//
.macro FASTCALL_PROLOG Label EndLabel
/* Set FS to PCR */
- push KGDT_R0_PCR
- pop fs
+ //push KGDT_R0_PCR
+ //pop fs
+ mov ecx, KGDT_R0_PCR
+ mov fs, cx
/* Set user selector */
mov ecx, KGDT_R3_DATA | RPL_MASK
Modified: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/ctxswitch…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S (original)
+++ trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S Mon Mar 19 22:43:50 2007
@@ -364,11 +364,13 @@
jnz WmiTrace
AfterTrace:
+#ifdef CONFIG_SMP
#ifdef DBG
/* Assert that we're on the right CPU */
mov cl, [esi+KTHREAD_NEXT_PROCESSOR]
cmp cl, [ebx+KPCR_PROCESSOR_NUMBER]
jnz WrongCpu
+#endif
#endif
/* Get CR0 and save it */
Modified: trunk/reactos/ntoskrnl/ke/i386/thrdini.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/thrdini.c…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/thrdini.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/thrdini.c Mon Mar 19 22:43:50 2007
@@ -73,6 +73,10 @@
RtlCopyMemory(&LocalContext, ContextPointer, sizeof(CONTEXT));
Context = &LocalContext;
ContextFlags = CONTEXT_CONTROL;
+
+ /* Zero out the trap frame and save area */
+ RtlZeroMemory(&InitFrame->TrapFrame,
+ KTRAP_FRAME_LENGTH + sizeof(FX_SAVE_AREA));
/* Setup the Fx Area */
FxSaveArea = &InitFrame->FxSaveArea;
@@ -114,7 +118,7 @@
FxSaveArea->NpxSavedCpu = 0;
/* Now set the context flags depending on XMM support */
- ContextFlags |= (KeI386XMMIPresent) ? CONTEXT_EXTENDED_REGISTERS :
+ ContextFlags |= (KeI386FxsrPresent) ? CONTEXT_EXTENDED_REGISTERS :
CONTEXT_FLOATING_POINT;
/* Set the Thread's NPX State */
@@ -154,7 +158,7 @@
TrapFrame->PreviousPreviousMode = UserMode;
/* Terminate the Exception Handler List */
- TrapFrame->ExceptionList = (PVOID)0xFFFFFFFF;
+ TrapFrame->ExceptionList = EXCEPTION_CHAIN_END;
/* Setup the Stack for KiThreadStartup and Context Switching */
StartFrame = &InitFrame->StartFrame;