فهرست منبع

+ psigcontex alias for psigcontextrec
+ psiginfo alias for psiginfo_t
* changed arguments to sigactionhandler procvar type from var parameters
into pointers
-> all compatible to the way it's done for Linux -> fpcdaemon compiles

git-svn-id: trunk@6283 -

Jonas Maebe 18 سال پیش
والد
کامیت
ccb9e7bb1b

+ 1 - 0
rtl/darwin/i386/sig_cpu.inc

@@ -609,6 +609,7 @@
       fs: i386_float_state_t;
       fs: i386_float_state_t;
     end;
     end;
 
 
+   psigcontext = ^sigcontextrec;
    psigcontextrec = ^sigcontextrec;
    psigcontextrec = ^sigcontextrec;
    sigcontextrec = record
    sigcontextrec = record
      sc_onstack: cint;
      sc_onstack: cint;

+ 3 - 3
rtl/darwin/i386/sighnd.inc

@@ -13,7 +13,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 }
 }
 
 
-procedure SignalToRunerror(Sig: cint; var info : tsiginfo_t;Var SigContext:SigContextRec); cdecl;
+procedure SignalToRunerror(Sig: cint; info : psiginfo; SigContext:PSigContext); cdecl;
 
 
 var
 var
   res : word;
   res : word;
@@ -23,7 +23,7 @@ begin
   case sig of
   case sig of
     SIGFPE :
     SIGFPE :
       begin
       begin
-        Case Info.si_code Of
+        Case Info^.si_code Of
           FPE_INTDIV,             { integer divide by zero -NOTIMP on Mac OS X 10.4.7 }
           FPE_INTDIV,             { integer divide by zero -NOTIMP on Mac OS X 10.4.7 }
           FPE_FLTDIV : Res:=200;  { floating point divide by zero }
           FPE_FLTDIV : Res:=200;  { floating point divide by zero }
           FPE_FLTOVF : Res:=205;  { floating point overflow }
           FPE_FLTOVF : Res:=205;  { floating point overflow }
@@ -51,6 +51,6 @@ begin
   {$endif }
   {$endif }
 
 
   if (res <> 0) then
   if (res <> 0) then
-    HandleErrorAddrFrame(res,pointer(sigcontext.ts.eip),pointer(sigcontext.ts.ebp));
+    HandleErrorAddrFrame(res,pointer(sigcontext^.ts.eip),pointer(sigcontext^.ts.ebp));
 end;
 end;
 
 

+ 1 - 0
rtl/darwin/powerpc/sig_cpu.inc

@@ -255,6 +255,7 @@
         vs: ppc_vector_state_t;
         vs: ppc_vector_state_t;
      end;
      end;
 
 
+     psigcontext = ^sigcontextrec;
      psigcontextrec = ^sigcontextrec;
      psigcontextrec = ^sigcontextrec;
      sigcontextrec = record
      sigcontextrec = record
         uc_onstack : cint;
         uc_onstack : cint;

+ 9 - 9
rtl/darwin/powerpc/sighnd.inc

@@ -13,7 +13,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 }
 }
 
 
-procedure SignalToRunerror(Sig: cint; var info : tsiginfo_t;Var SigContext:SigContextRec); cdecl;
+procedure SignalToRunerror(Sig: cint; info : PSigInfo; SigContext:PSigContext); cdecl;
 
 
 var
 var
   res : word;
   res : word;
@@ -23,7 +23,7 @@ begin
   case sig of
   case sig of
     SIGFPE :
     SIGFPE :
       begin
       begin
-        Case Info.si_code Of
+        Case Info^.si_code Of
           FPE_FLTDIV,
           FPE_FLTDIV,
           FPE_INTDIV : Res:=200;  { floating point divide by zero }
           FPE_INTDIV : Res:=200;  { floating point divide by zero }
           FPE_FLTOVF : Res:=205;  { floating point overflow }
           FPE_FLTOVF : Res:=205;  { floating point overflow }
@@ -36,9 +36,9 @@ begin
         { FPU exceptions are completely disabled by the kernel if one occurred, it  }
         { FPU exceptions are completely disabled by the kernel if one occurred, it  }
         { seems this is necessary to be able to return to user mode. They can be    }
         { seems this is necessary to be able to return to user mode. They can be    }
         { enabled by executing a sigreturn, however then the exception is triggered }
         { enabled by executing a sigreturn, however then the exception is triggered }
-        { triggered again immediately if we don't turn off the "exception occurred" }
-        { flags in fpscr                                                            }
-        SigContext.uc_mcontext^.fs.fpscr := SigContext.uc_mcontext^.fs.fpscr and not($fffe0700);
+        { again immediately if we don't turn off the "exception occurred" flags     }
+        { in fpscr                                                                  }
+        SigContext^.uc_mcontext^.fs.fpscr := SigContext^.uc_mcontext^.fs.fpscr and not($fffe0700);
       end;
       end;
     SIGILL,
     SIGILL,
     SIGBUS,
     SIGBUS,
@@ -52,10 +52,10 @@ begin
   { return to trampoline }
   { return to trampoline }
   if res <> 0 then
   if res <> 0 then
     begin
     begin
-      SigContext.uc_mcontext^.ss.r3 := res;
-      SigContext.uc_mcontext^.ss.r4 := SigContext.uc_mcontext^.ss.srr0;
-      SigContext.uc_mcontext^.ss.r5 := SigContext.uc_mcontext^.ss.r1;
-      pointer(SigContext.uc_mcontext^.ss.srr0) := @HandleErrorAddrFrame;
+      SigContext^.uc_mcontext^.ss.r3 := res;
+      SigContext^.uc_mcontext^.ss.r4 := SigContext^.uc_mcontext^.ss.srr0;
+      SigContext^.uc_mcontext^.ss.r5 := SigContext^.uc_mcontext^.ss.r1;
+      pointer(SigContext^.uc_mcontext^.ss.srr0) := @HandleErrorAddrFrame;
     end;
     end;
 end;
 end;
 
 

+ 3 - 2
rtl/darwin/signal.inc

@@ -189,7 +189,8 @@
     PSignalHandler  = ^SignalHandler;
     PSignalHandler  = ^SignalHandler;
     SignalRestorer  = Procedure;cdecl;
     SignalRestorer  = Procedure;cdecl;
     PSignalRestorer = ^SignalRestorer;
     PSignalRestorer = ^SignalRestorer;
-    SigActionHandler = procedure (Sig: cint; var info : tsiginfo_t;Var SigContext:SigContextRec); cdecl;
+    PSigInfo        = ^TSigInfo_t;
+    SigActionHandler = procedure (Sig: cint; info : psiginfo; SigContext:PSigContext); cdecl;
 
 
 
 
     SigActionRec = packed record
     SigActionRec = packed record
@@ -202,7 +203,7 @@
       Sa_Mask: sigset_t;
       Sa_Mask: sigset_t;
       Sa_Flags: cint;
       Sa_Flags: cint;
    end;
    end;
-   PSigActionRec = ^SigActionRec;
+    PSigActionRec = ^SigActionRec;
 
 
   {
   {
      Flags for sigprocmask:
      Flags for sigprocmask:

+ 3 - 27
rtl/freebsd/i386/sighnd.inc

@@ -13,7 +13,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 }
 }
 
 
-procedure SignalToRunerror(Sig: cint; var info : tsiginfo_t;Var SigContext:SigContextRec); cdecl;
+procedure SignalToRunerror(Sig: cint; info : psiginfo;  SigContext:PSigContext); cdecl;
 
 
 var
 var
   res : word;
   res : word;
@@ -23,7 +23,7 @@ begin
   case sig of
   case sig of
     SIGFPE :
     SIGFPE :
           begin
           begin
-            Case Info.si_code Of
+            Case Info^.si_code Of
                 FPE_INTDIV : Res:=200;  {integer divide fault. Div0?}
                 FPE_INTDIV : Res:=200;  {integer divide fault. Div0?}
                 FPE_FLTOVF : Res:=205;  {Overflow trap}
                 FPE_FLTOVF : Res:=205;  {Overflow trap}
                 FPE_FLTUND : Res:=206;  {Stack over/underflow}
                 FPE_FLTUND : Res:=206;  {Stack over/underflow}
@@ -46,33 +46,9 @@ begin
   if res<>0 then
   if res<>0 then
    begin
    begin
 {$ifdef cpui386}
 {$ifdef cpui386}
-  HandleErrorAddrFrame(res,Pointer(SigContext.sc_eip),pointer(SigContext.sc_ebp));
+  HandleErrorAddrFrame(res,Pointer(SigContext^.sc_eip),pointer(SigContext^.sc_ebp));
 {$else}
 {$else}
      HandleError(res);
      HandleError(res);
 {$endif}
 {$endif}
    end;
    end;
 end;
 end;
-{
-procedure SignalToRunerror(signo: cint); cdecl;
-var
-  res : word;
-begin
-    res:=0;
-
-    if signo = SIGFPE then
-     begin
-        res := 200;
-     end
-    else
-    if (signo = SIGILL) or (signo = SIGBUS) or (signo = SIGSEGV) then
-      begin
-        res := 216;
-      end;
-  { give runtime error at the position where the signal was raised }
-  if res<>0 then
-   begin
-     HandleError(res);
-   end;
-end;
-}
-

+ 3 - 2
rtl/freebsd/signal.inc

@@ -78,6 +78,7 @@ const
 
 
 type sigset_t = array[0..3] of Longint;
 type sigset_t = array[0..3] of Longint;
 
 
+    psigcontext = ^sigcontextrec;
     PSigContextRec = ^SigContextRec;
     PSigContextRec = ^SigContextRec;
     SigContextRec = record
     SigContextRec = record
        sc_mask      : sigset_t;          { signal mask to restore }
        sc_mask      : sigset_t;          { signal mask to restore }
@@ -130,6 +131,7 @@ type sigset_t = array[0..3] of Longint;
             End;
             End;
 
 
 
 
+  PSigInfo   = ^SigInfo_t;
   PSigInfo_t = ^SigInfo_t;
   PSigInfo_t = ^SigInfo_t;
   SigInfo_t = record
   SigInfo_t = record
                 si_signo,                       { signal number }
                 si_signo,                       { signal number }
@@ -150,7 +152,6 @@ type sigset_t = array[0..3] of Longint;
                 __spare         : array[0..6] of Longint; { gimme some slack }
                 __spare         : array[0..6] of Longint; { gimme some slack }
                 end;
                 end;
   TSigInfo = SigInfo_t;
   TSigInfo = SigInfo_t;
-  PSigInfo = PSigInfo_t;
   TSigInfo_t = TSigInfo;
   TSigInfo_t = TSigInfo;
 
 
 
 
@@ -160,7 +161,7 @@ type sigset_t = array[0..3] of Longint;
   PSignalHandler  = ^SignalHandler;
   PSignalHandler  = ^SignalHandler;
   SignalRestorer  = Procedure;cdecl;
   SignalRestorer  = Procedure;cdecl;
   PSignalRestorer = ^SignalRestorer;
   PSignalRestorer = ^SignalRestorer;
-  sigActionHandler = procedure(Sig: Longint; var sininfo:tsiginfo_t;var SigContext: SigContextRec);cdecl;
+  sigActionHandler = procedure(Sig: Longint; sininfo:psiginfo; SigContext: PSigContext);cdecl;
 
 
   TSigset=sigset_t;
   TSigset=sigset_t;
   sigset=tsigset;
   sigset=tsigset;