Browse Source

Merged revisions 7553-7554 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r7553 | florian | 2007-06-02 21:26:06 +0200 (Sat, 02 Jun 2007) | 1 line

* tried to fix SSE OS support detection
........
r7554 | jonas | 2007-06-02 21:58:18 +0200 (Sat, 02 Jun 2007) | 2 lines

* fixed sse detection

........

git-svn-id: branches/fixes_2_2@7593 -

Jonas Maebe 18 years ago
parent
commit
a2004eb7ee
3 changed files with 35 additions and 34 deletions
  1. 1 1
      rtl/i386/i386.inc
  2. 32 31
      rtl/linux/i386/sighnd.inc
  3. 2 2
      rtl/win32/system.pp

+ 1 - 1
rtl/i386/i386.inc

@@ -1221,7 +1221,7 @@ procedure fpc_cpucodeinit;
       { 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
+      movaps %xmm7, %xmm6
     end;
     sse_check:=false;
     has_sse_support:=sse_support;

+ 32 - 31
rtl/linux/i386/sighnd.inc

@@ -39,41 +39,42 @@ begin
   res:=0;
   case sig of
     SIGFPE :
+      begin
+        { this is not allways necessary but I don't know yet
+          how to tell if it is or not PM }
+        res:=200;
+        fpustate:=GetFPUState(UContext^.uc_mcontext);
+        if (FpuState and FPU_All) <> 0 then
           begin
-    { this is not allways necessary but I don't know yet
-      how to tell if it is or not PM }
-          res:=200;
-          fpustate:=GetFPUState(UContext^.uc_mcontext);
-          if (FpuState and FPU_All) <> 0 then
-            begin
-              { first check the more precise options }
-              if (FpuState and FPU_DivisionByZero)<>0 then
-                res:=200
-              else if (FpuState and (FPU_StackOverflow or FPU_StackUnderflow or FPU_Invalid))<>0 Then
-                res:=207
-              else if (FpuState and FPU_Overflow)<>0 then
-                res:=205
-              else if (FpuState and FPU_Underflow)<>0 then
-                res:=206
-              else if (FpuState and FPU_Denormal)<>0 then
-                res:=216
-              else
-                res:=207;  {'Coprocessor Error'}
-            end;
-            sysResetFPU;
-        end;
+            { first check the more precise options }
+            if (FpuState and FPU_DivisionByZero)<>0 then
+              res:=200
+            else if (FpuState and (FPU_StackOverflow or FPU_StackUnderflow or FPU_Invalid))<>0 Then
+              res:=207
+            else if (FpuState and FPU_Overflow)<>0 then
+              res:=205
+            else if (FpuState and FPU_Underflow)<>0 then
+              res:=206
+            else if (FpuState and FPU_Denormal)<>0 then
+              res:=216
+            else
+              res:=207;  {'Coprocessor Error'}
+          end;
+        sysResetFPU;
+      end;
     SIGBUS:
-        res:=214;
+      res:=214;
     SIGILL:
-        if sse_check then
-          begin
-            os_supports_sse:=false;
-            res:=0;
-          end
-        else
-          res:=216;
-    SIGSEGV :
+      if sse_check then
+        begin
+          os_supports_sse:=false;
+          res:=0;
+          inc(ucontext^.uc_mcontext.eip,3);
+        end
+      else
         res:=216;
+    SIGSEGV :
+      res:=216;
   end;
   reenable_signal(sig);
 { give runtime error at the position where the signal was raised }

+ 2 - 2
rtl/win32/system.pp

@@ -801,8 +801,8 @@ function syswin32_i386_exception_handler(excep : PExceptionPointers) : Longint;s
           if sse_check then
             begin
               os_supports_sse:=false;
-              { skip the offending movq xmm0,xmm0 instruction }
-              inc(excep^.ContextRecord^.Eip,4);
+              { skip the offending movaps %xmm7, %xmm6 instruction }
+              inc(excep^.ContextRecord^.Eip,3);
               excep^.ExceptionRecord^.ExceptionCode := 0;
               res:=EXCEPTION_CONTINUE_EXECUTION;
             end