--- erts/configure.in.orig	Wed Dec 15 00:36:27 2004
+++ erts/configure.in	Wed Jan 26 13:22:04 2005
@@ -929,9 +929,13 @@
 
 #endif
 
-#if (defined(__linux__) && (defined(__i386__) || defined(__x86_64__) || defined(__powerpc__))) || defined(__DARWIN__)
+#if (defined(__linux__) && (defined(__i386__) || defined(__x86_64__) || defined(__powerpc__))) || defined(__DARWIN__) || (defined(__FreeBSD__) && defined(__x86_64__))
 
 #include <ucontext.h>
+#if (defined(__FreeBSD__) && defined(__x86_64__))
+#include <sys/types.h>
+#include <machine/fpu.h>
+#endif
 
 static void fpe_sig_action(int sig, siginfo_t *si, void *puc)
 {
@@ -956,6 +960,11 @@
     mcontext_t mc = uc->uc_mcontext;
     mc->ss.srr0 += 4;
     mc->fs.fpscr = 0x80|0x40|0x10;
+#elif (defined(__FreeBSD__) && defined(__x86_64__))
+    mcontext_t *mc = &uc->uc_mcontext;
+    struct envxmm *ex = (struct envxmm *)mc->mc_fpstate;
+    ex->en_mxcsr = 0x1F80;
+    ex->en_sw = ~0xFF;
 #endif
     erl_fp_exception = 1;
 }
