Browse Source

+ applied a fix similar to 11820 to x86-64

git-svn-id: trunk@11821 -
florian 17 years ago
parent
commit
50b63884cb
2 changed files with 18 additions and 12 deletions
  1. 2 4
      rtl/x86_64/math.inc
  2. 16 8
      rtl/x86_64/x86_64.inc

+ 2 - 4
rtl/x86_64/math.inc

@@ -61,12 +61,10 @@ FPC_ABSMASK_DOUBLE:
     
     
     procedure SetSSECSR(w : dword);
-      var
-        _w : dword;
       begin
-        _w:=w;
+        mxcsr:=w;
         asm
-          ldmxcsr _w
+          ldmxcsr w
         end;
       end;
     

+ 16 - 8
rtl/x86_64/x86_64.inc

@@ -616,15 +616,23 @@ end;
 
 {$define FPC_SYSTEM_HAS_SYSRESETFPU}
 Procedure SysResetFPU;
-begin
-  asm
-    { initialize fpu }
-    fnclex
-    fwait
+  var
+    { these locals are so we don't have to hack pic code in the assembler }
+    localmxcsr: dword;
+    localfpucw: word;
+  begin
+    localfpucw:=Default8087CW;
+    localmxcsr:=mxcsr;
+    asm
+      fninit
+      fwait
+      fldcw   localfpucw
+      ldmxcsr localmxcsr
+    end;
+    { x86-64 might use softfloat code }
+    softfloat_exception_flags:=0;
   end;
-  { x86-64 might use softfloat code }
-  softfloat_exception_flags:=0;
-end;
+
 
 {$ifndef FPC_SYSTEM_HAS_MEM_BARRIER}
 {$define FPC_SYSTEM_HAS_MEM_BARRIER}