From a456f79f9c7cd34b9e01bf217f1db35bd4b62129 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 12 Sep 2009 16:59:30 -0400 Subject: [PATCH] cpu-x86: clear the x87 stack when rewinding; fixes math.floats.env failures on Linux --- vm/cpu-x86.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vm/cpu-x86.S b/vm/cpu-x86.S index 3f2626d405..09e742bed8 100644 --- a/vm/cpu-x86.S +++ b/vm/cpu-x86.S @@ -56,6 +56,11 @@ DEF(F_FASTCALL void,c_to_factor,(CELL quot)): ret DEF(F_FASTCALL void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to)): + /* clear x87 stack, but preserve rounding mode and exception flags */ + sub $2,STACK_REG + fnstcw (STACK_REG) + fninit + fldcw (STACK_REG) /* rewind_to */ mov ARG1,STACK_REG jmp *QUOT_XT_OFFSET(ARG0)