浏览代码

* re-enable fpu exceptions in signal handler, they're turned off by the
kernel

Jonas Maebe 21 年之前
父节点
当前提交
fd1ae67764
共有 1 个文件被更改,包括 21 次插入4 次删除
  1. 21 4
      rtl/linux/powerpc/sighnd.inc

+ 21 - 4
rtl/linux/powerpc/sighnd.inc

@@ -20,14 +20,27 @@
 procedure SignalToRunerror(Sig: longint; SigContext: PSigContextRec); cdecl;
 procedure SignalToRunerror(Sig: longint; SigContext: PSigContextRec); cdecl;
 
 
 var
 var
-  res,fpustate : word;
+  res : word;
+{  fpustate: longint; }
 begin
 begin
   res:=0;
   res:=0;
+  { exception flags are turned off by kernel }
+  fpc_enable_ppc_fpu_exceptions;
   case sig of
   case sig of
     SIGFPE :
     SIGFPE :
         begin
         begin
-          { don't know how to find the different causes, maybe via xer? }
-          res := 207;
+{
+         fpscr is cleared by the kernel -> can't find out cause :(
+          fpustate := fpc_get_ppc_fpscr;
+          if (fpustate and ppc_fpu_underflow) <> 0 then
+            res := 206
+          else if (fpustate and ppc_fpu_overflow) <> 0 then
+            res := 205
+          else if (fpustate and ppc_fpu_divbyzero) <> 0 then
+            res := 200
+          else
+}
+            res := 207;
         end;
         end;
     SIGILL,
     SIGILL,
     SIGBUS,
     SIGBUS,
@@ -41,7 +54,11 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2004-01-01 16:28:16  jonas
+  Revision 1.4  2004-01-02 17:57:16  jonas
+    * re-enable fpu exceptions in signal handler, they're turned off by the
+      kernel
+
+  Revision 1.3  2004/01/01 16:28:16  jonas
     * fixed signal handling
     * fixed signal handling
 
 
   Revision 1.2  2003/11/21 00:40:06  florian
   Revision 1.2  2003/11/21 00:40:06  florian