summaryrefslogtreecommitdiff
path: root/rts/RtsUtils.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/RtsUtils.c')
-rw-r--r--rts/RtsUtils.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c
index 3df688f401..8ef6c0d6f2 100644
--- a/rts/RtsUtils.c
+++ b/rts/RtsUtils.c
@@ -323,3 +323,18 @@ int rts_isProfiled(void)
return 0;
#endif
}
+
+// Used for detecting a non-empty FPU stack on x86 (see #4914)
+void checkFPUStack(void)
+{
+#ifdef x86_HOST_ARCH
+ static unsigned char buf[108];
+ asm("FSAVE %0":"=m" (buf));
+
+ if(buf[8]!=255 || buf[9]!=255) {
+ errorBelch("NONEMPTY FPU Stack, TAG = %x %x\n",buf[8],buf[9]);
+ abort();
+ }
+#endif
+}
+