[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#788102: The code doesn't compile on kfreebsd



Mathieu Malaterre wrote:
> Thanks a lot for the update. Could you send me the actual full debdiff
> you used. Here is what I get from fall.d.o when I use your patch:
> 
> [...]
> IexMathFpu.cpp: In function 'void
> Iex_2_2::setFpExceptionHandler(Iex_2_2::FpExceptionHandler)':
> IexMathFpu.cpp:482:9: error: 'struct sigaction' has no member named
> 'sa_restorer'
>   action.sa_restorer = 0;
>          ^
> [...]

Sorry, I forgot about that part.  sa_restorer is not used on kfreebsd so
I guarded that with ifdefs.  Attached is a diff against 2.2.0-9 of what
I actually tested.

Thanks!
Regards,
-- 
Steven Chamberlain
steven@pyro.eu.org
--- a/IexMath/IexMathFpu.cpp
+++ b/IexMath/IexMathFpu.cpp
@@ -52,7 +52,7 @@
     #define debug(x)
 #endif
 
-#if defined(HAVE_UCONTEXT_H) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)) && (defined(ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT) || defined(HAVE_ASM_SIGCONTEXT_H))
+#if defined(HAVE_UCONTEXT_H) && (defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86))
 
 #include <ucontext.h>
 #include <signal.h>
@@ -264,6 +264,18 @@
     setMxcsr (ucon.uc_mcontext.fpregs->mxcsr, clearExceptions);
 }
 
+#elif defined(__FreeBSD_kernel__)
+
+#include <machine/npx.h>
+
+inline void
+restoreControlRegs (const ucontext_t & ucon, bool clearExceptions)
+{
+    struct envxmm *ex = (struct envxmm *)(ucon.uc_mcontext.mc_fpstate);
+    setCw ((ex->en_cw & cwRestoreMask) | cwRestoreVal);
+    setMxcsr (ex->en_mxcsr, clearExceptions);
+}
+
 #else
 
 //
@@ -463,8 +475,9 @@
 	sigemptyset (&action.sa_mask);
 	action.sa_flags = SA_SIGINFO | SA_NOMASK;
 	action.sa_sigaction = (void (*) (int, siginfo_t *, void *)) catchSigFpe;
+#ifndef __FreeBSD_kernel__
 	action.sa_restorer = 0;
-
+#endif
 	sigaction (SIGFPE, &action, 0);
     }
 

Attachment: signature.asc
Description: Digital signature


Reply to: