Alexandre Julliard : ntdll: Save FPU context for all exceptions.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Apr 3 14:46:17 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: a1f0f3917441ad7e787e9d778f4ca9b82211f9d8
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=a1f0f3917441ad7e787e9d778f4ca9b82211f9d8
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Apr 3 21:39:33 2006 +0200
ntdll: Save FPU context for all exceptions.
---
dlls/ntdll/signal_i386.c | 48 +++++++++++++++++++++++++---------------------
1 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index a9f2589..d957cd3 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -704,27 +704,6 @@ inline static void *init_handler( const
/***********************************************************************
- * save_fpu
- *
- * Set the FPU context from a sigcontext.
- */
-inline static void save_fpu( CONTEXT *context, const SIGCONTEXT *sigcontext )
-{
- context->ContextFlags |= CONTEXT86_FLOATING_POINT;
-#ifdef FPU_sig
- if (FPU_sig(sigcontext))
- {
- context->FloatSave = *FPU_sig(sigcontext);
- return;
- }
-#endif /* FPU_sig */
-#ifdef __GNUC__
- __asm__ __volatile__( "fnsave %0; fwait" : "=m" (context->FloatSave) );
-#endif /* __GNUC__ */
-}
-
-
-/***********************************************************************
* restore_fpu
*
* Restore the FPU context to a sigcontext.
@@ -773,6 +752,21 @@ inline static void save_context( CONTEXT
context->Dr3 = regs->dr3;
context->Dr6 = regs->dr6;
context->Dr7 = regs->dr7;
+
+#ifdef FPU_sig
+ if (FPU_sig(sigcontext))
+ {
+ context->ContextFlags |= CONTEXT_FLOATING_POINT;
+ context->FloatSave = *FPU_sig(sigcontext);
+ }
+ else
+#endif
+ {
+#ifdef __GNUC__
+ context->ContextFlags |= CONTEXT_FLOATING_POINT;
+ __asm__ __volatile__( "fnsave %0; fwait" : "=m" (context->FloatSave) );
+#endif
+ }
}
@@ -815,6 +809,17 @@ inline static void restore_context( cons
#else
wine_set_fs( context->SegFs );
#endif
+
+#ifdef FPU_sig
+ if (FPU_sig(sigcontext))
+ {
+ *FPU_sig(sigcontext) = context->FloatSave;
+ }
+ else
+#endif
+ {
+ restore_fpu( context );
+ }
}
@@ -1278,7 +1283,6 @@ static HANDLER_DEF(fpe_handler)
CONTEXT *context;
context = get_exception_context( rec );
- save_fpu( context, HANDLER_CONTEXT );
switch(get_trap_code(HANDLER_CONTEXT))
{
More information about the wine-cvs
mailing list