+ 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 -
This commit is contained in:
Jonas Maebe 2007-02-01 12:09:33 +00:00
parent f842eb854a
commit ccb9e7bb1b
7 changed files with 23 additions and 43 deletions

View File

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

View File

@ -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;

View File

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

View File

@ -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;

View File

@ -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:

View File

@ -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;
}

View File

@ -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;