Kaynağa Gözat

* detect sse properly on linux, fixes tmask*.pp in the testsuite with -Cfsse2

git-svn-id: trunk@6277 -
florian 18 yıl önce
ebeveyn
işleme
bcf65051e3
4 değiştirilmiş dosya ile 33 ekleme ve 26 silme
  1. 21 0
      rtl/i386/i386.inc
  2. 5 1
      rtl/linux/i386/sighnd.inc
  3. 7 2
      rtl/linux/system.pp
  4. 0 23
      rtl/win32/system.pp

+ 21 - 0
rtl/i386/i386.inc

@@ -19,6 +19,8 @@
 ****************************************************************************}
 var
   os_supports_sse : boolean;
+  { this variable is set to true, if currently an sse check is executed and no sig ill should be generated }
+  sse_check : boolean;
 
 {$asmmode intel}
 
@@ -1218,6 +1220,25 @@ Procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
   end;
 
 
+{ because of the brain dead sse detection on x86, this test is post poned }
+procedure fpc_cpucodeinit;
+  begin
+    os_supports_sse:=true;
+    sse_check:=true;
+    asm
+      { force an sse exception if no sse is supported, the exception handler sets
+        os_supports_sse to false then }
+      { don't change this instruction, the code above depends on its size }
+      movq %xmm0,%xmm0
+    end;
+    sse_check:=false;
+    has_sse_support:=sse_support;
+    has_mmx_support:=mmx_support;
+    SysResetFPU;
+    setup_fastmove;
+  end;
+
+
 {$ifndef darwin}
 { darwin requires that the stack is aligned to 16 bytes when calling another function }
 

+ 5 - 1
rtl/linux/i386/sighnd.inc

@@ -64,7 +64,11 @@ begin
         end;
     SIGBUS:
         res:=214;
-    SIGILL,
+    SIGILL:
+        if sse_check then
+          res:=0
+        else
+          res:=216;
     SIGSEGV :
         res:=216;
   end;

+ 7 - 2
rtl/linux/system.pp

@@ -300,16 +300,21 @@ var
   initialstkptr : Pointer;external name '__stkptr';
 begin
   SysResetFPU;
-  {$if defined(cpupowerpc)}
+{$if defined(cpupowerpc)}
   // some PPC kernels set the exception bits FE0/FE1 in the MSR to zero,
   // disabling all FPU exceptions. Enable them again.
   fpprctl(PR_SET_FPEXC, PR_FP_EXC_PRECISE);
-  {$endif}
+{$endif}
   IsConsole := TRUE;
   StackLength := CheckInitialStkLen(initialStkLen);
   StackBottom := initialstkptr - StackLength;
   { Set up signals handlers }
   InstallSignals;
+
+{$if defined(cpui386)}
+  fpc_cpucodeinit;
+{$endif cpui386}
+
   { Setup heap }
   InitHeap;
   SysInitExceptions;

+ 0 - 23
rtl/win32/system.pp

@@ -744,10 +744,6 @@ procedure JumpToHandleErrorFrame;
     end;
   end;
 
-var
-  { this variable is set to true, if currently an sse check is executed and no sig ill should be generated }
-  sse_check : boolean;
-
 function syswin32_i386_exception_handler(excep : PExceptionPointers) : Longint;stdcall;
   var
     res: longint;
@@ -897,25 +893,6 @@ end;
 
 {$endif Set_i386_Exception_handler}
 
-{ because of the brain dead sse detection on x86, this test is post poned }
-procedure fpc_cpucodeinit;
-  begin
-    os_supports_sse:=true;
-    sse_check:=true;
-    asm
-      { force an sse exception if no sse is supported, the exception handler sets
-        os_supports_sse to false then }
-      { don't change this instruction, the code above depends on its size }
-      movq %xmm0,%xmm0
-    end;
-    sse_check:=false;
-    has_sse_support:=sse_support;
-    has_mmx_support:=mmx_support;
-    SysResetFPU;
-    setup_fastmove;
-  end;
-
-
 {****************************************************************************
                       OS dependend widestrings
 ****************************************************************************}