X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FRtsUtils.c;h=8ef6c0d6f2f38dc1fb79c7e713f7e89cca40553c;hb=6cec61d14a324285dbb8ce73d4c7215f1f8d6766;hp=3df688f401bca107e2630687cdcfd8e3c4353801;hpb=ea0bfdada955e3f5de8c38b06c831f6dc64ba0f2;p=ghc-hetmet.git diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index 3df688f..8ef6c0d 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 +} +