From b51c0305dba8bba3638c3de702b864092820f7cb Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Sat, 27 Nov 2004 16:19:22 +0000 Subject: [PATCH] - Saved the fpu state before the actual thread switching occurs (only for smp machines). svn path=/trunk/; revision=11832 --- reactos/ntoskrnl/ke/i386/tskswitch.S | 43 ++++++++++++++++------------ 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/reactos/ntoskrnl/ke/i386/tskswitch.S b/reactos/ntoskrnl/ke/i386/tskswitch.S index a2087124b2a..ec9dbda69fc 100644 --- a/reactos/ntoskrnl/ke/i386/tskswitch.S +++ b/reactos/ntoskrnl/ke/i386/tskswitch.S @@ -59,6 +59,30 @@ _Ki386ContextSwitch: * This is a critical section for this processor. */ cli + +#ifdef MP + /* + * Get the pointer to the old thread. + */ + movl 12(%ebp), %ebx + /* + * Save FPU state if the thread has used it. + */ + movl $0, %fs:KPCR_NPX_THREAD + testb $NPX_STATE_DIRTY, KTHREAD_NPX_STATE(%ebx) + jz 3f + movl KTHREAD_INITIAL_STACK(%ebx), %eax + cmpl $0, _FxsrSupport + je 1f + fxsave -SIZEOF_FX_SAVE_AREA(%eax) + jmp 2f +1: + fnsave -SIZEOF_FX_SAVE_AREA(%eax) +2: + movb $NPX_STATE_VALID, KTHREAD_NPX_STATE(%ebx) +3: +#endif /* MP */ + /* * Get the pointer to the new thread. @@ -111,25 +135,6 @@ _Ki386ContextSwitch: */ movl 12(%ebp), %ebx -#ifdef MP - /* - * Save FPU state if the thread has used it. - */ - movl $0, %fs:KPCR_NPX_THREAD - testb $NPX_STATE_DIRTY, KTHREAD_NPX_STATE(%ebx) - jz 3f - movl KTHREAD_INITIAL_STACK(%ebx), %eax - cmpl $0, _FxsrSupport - je 1f - fxsave -SIZEOF_FX_SAVE_AREA(%eax) - jmp 2f -1: - fnsave -SIZEOF_FX_SAVE_AREA(%eax) -2: - movb $NPX_STATE_VALID, KTHREAD_NPX_STATE(%ebx) -3: -#endif /* MP */ - /* * FIXME: Save debugging state. */