ntdll: Save and restore FPU context if available

Petr Tesarik petr at tesarici.cz
Mon Mar 27 02:42:33 CST 2006


Hi,

this patch adds FPU state handling to the signal context handling.

Ooops, I forgot to include the patch itself. :)

ChangeLog:

* Copy FPU state to context upon signal entry
* Copy FPU state from context before signal exit
-------------- next part --------------
--- signal_i386.c	2006-03-27 10:04:00.000000000 +0200
+++ signal_i386.c.fpu	2006-03-27 10:33:18.000000000 +0200
@@ -773,6 +773,14 @@
     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);
+    }
+#endif  /* FPU_sig */
 }
 
 
@@ -785,6 +793,10 @@
 {
     struct ntdll_thread_regs * const regs = ntdll_get_thread_regs();
 
+#ifdef FPU_sig
+    if ((context->ContextFlags & CONTEXT_FLOATING_POINT) && FPU_sig(sigcontext))
+        *FPU_sig(sigcontext) = context->FloatSave;
+#endif  /* FPU_sig */
     regs->dr0 = context->Dr0;
     regs->dr1 = context->Dr1;
     regs->dr2 = context->Dr2;


More information about the wine-patches mailing list