From ccb9e7bb1b1adb91afd484af7007d835fcb81368 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 1 Feb 2007 12:09:33 +0000 Subject: [PATCH] + 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 - --- rtl/darwin/i386/sig_cpu.inc | 1 + rtl/darwin/i386/sighnd.inc | 6 +++--- rtl/darwin/powerpc/sig_cpu.inc | 1 + rtl/darwin/powerpc/sighnd.inc | 18 +++++++++--------- rtl/darwin/signal.inc | 5 +++-- rtl/freebsd/i386/sighnd.inc | 30 +++--------------------------- rtl/freebsd/signal.inc | 5 +++-- 7 files changed, 23 insertions(+), 43 deletions(-) diff --git a/rtl/darwin/i386/sig_cpu.inc b/rtl/darwin/i386/sig_cpu.inc index a495f129ef..679346e015 100644 --- a/rtl/darwin/i386/sig_cpu.inc +++ b/rtl/darwin/i386/sig_cpu.inc @@ -609,6 +609,7 @@ fs: i386_float_state_t; end; + psigcontext = ^sigcontextrec; psigcontextrec = ^sigcontextrec; sigcontextrec = record sc_onstack: cint; diff --git a/rtl/darwin/i386/sighnd.inc b/rtl/darwin/i386/sighnd.inc index b038007225..df7597d929 100644 --- a/rtl/darwin/i386/sighnd.inc +++ b/rtl/darwin/i386/sighnd.inc @@ -13,7 +13,7 @@ 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 res : word; @@ -23,7 +23,7 @@ begin case sig of SIGFPE : 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_FLTDIV : Res:=200; { floating point divide by zero } FPE_FLTOVF : Res:=205; { floating point overflow } @@ -51,6 +51,6 @@ begin {$endif } 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; diff --git a/rtl/darwin/powerpc/sig_cpu.inc b/rtl/darwin/powerpc/sig_cpu.inc index 2b766fa50a..be4590a47c 100644 --- a/rtl/darwin/powerpc/sig_cpu.inc +++ b/rtl/darwin/powerpc/sig_cpu.inc @@ -255,6 +255,7 @@ vs: ppc_vector_state_t; end; + psigcontext = ^sigcontextrec; psigcontextrec = ^sigcontextrec; sigcontextrec = record uc_onstack : cint; diff --git a/rtl/darwin/powerpc/sighnd.inc b/rtl/darwin/powerpc/sighnd.inc index 2650dac79b..aa09a930af 100644 --- a/rtl/darwin/powerpc/sighnd.inc +++ b/rtl/darwin/powerpc/sighnd.inc @@ -13,7 +13,7 @@ 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 res : word; @@ -23,7 +23,7 @@ begin case sig of SIGFPE : begin - Case Info.si_code Of + Case Info^.si_code Of FPE_FLTDIV, FPE_INTDIV : Res:=200; { floating point divide by zero } FPE_FLTOVF : Res:=205; { floating point overflow } @@ -36,9 +36,9 @@ begin { 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 } { 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; SIGILL, SIGBUS, @@ -52,10 +52,10 @@ begin { return to trampoline } if res <> 0 then 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; diff --git a/rtl/darwin/signal.inc b/rtl/darwin/signal.inc index 56a48c2fbd..a9fc504db3 100644 --- a/rtl/darwin/signal.inc +++ b/rtl/darwin/signal.inc @@ -189,7 +189,8 @@ PSignalHandler = ^SignalHandler; SignalRestorer = Procedure;cdecl; 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 @@ -202,7 +203,7 @@ Sa_Mask: sigset_t; Sa_Flags: cint; end; - PSigActionRec = ^SigActionRec; + PSigActionRec = ^SigActionRec; { Flags for sigprocmask: diff --git a/rtl/freebsd/i386/sighnd.inc b/rtl/freebsd/i386/sighnd.inc index b89feef05f..53ac433f3e 100644 --- a/rtl/freebsd/i386/sighnd.inc +++ b/rtl/freebsd/i386/sighnd.inc @@ -13,7 +13,7 @@ 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 res : word; @@ -23,7 +23,7 @@ begin case sig of SIGFPE : begin - Case Info.si_code Of + Case Info^.si_code Of FPE_INTDIV : Res:=200; {integer divide fault. Div0?} FPE_FLTOVF : Res:=205; {Overflow trap} FPE_FLTUND : Res:=206; {Stack over/underflow} @@ -46,33 +46,9 @@ begin if res<>0 then begin {$ifdef cpui386} - HandleErrorAddrFrame(res,Pointer(SigContext.sc_eip),pointer(SigContext.sc_ebp)); + HandleErrorAddrFrame(res,Pointer(SigContext^.sc_eip),pointer(SigContext^.sc_ebp)); {$else} HandleError(res); {$endif} 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; -} - diff --git a/rtl/freebsd/signal.inc b/rtl/freebsd/signal.inc index 79f7259e89..a978ea5f04 100644 --- a/rtl/freebsd/signal.inc +++ b/rtl/freebsd/signal.inc @@ -78,6 +78,7 @@ const type sigset_t = array[0..3] of Longint; + psigcontext = ^sigcontextrec; PSigContextRec = ^SigContextRec; SigContextRec = record sc_mask : sigset_t; { signal mask to restore } @@ -130,6 +131,7 @@ type sigset_t = array[0..3] of Longint; End; + PSigInfo = ^SigInfo_t; PSigInfo_t = ^SigInfo_t; SigInfo_t = record 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 } end; TSigInfo = SigInfo_t; - PSigInfo = PSigInfo_t; TSigInfo_t = TSigInfo; @@ -160,7 +161,7 @@ type sigset_t = array[0..3] of Longint; PSignalHandler = ^SignalHandler; SignalRestorer = Procedure;cdecl; 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; sigset=tsigset;