mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 12:19:18 +02:00
* fixed floating point and integer exception handling on sparc/linux
This commit is contained in:
parent
c5ec202cd1
commit
49c3f3927e
@ -517,7 +517,7 @@ begin
|
|||||||
{ initialize handler }
|
{ initialize handler }
|
||||||
act.sa_handler := signalhandler(@SignalToRunError);
|
act.sa_handler := signalhandler(@SignalToRunError);
|
||||||
{$ifdef RTSIGACTION}
|
{$ifdef RTSIGACTION}
|
||||||
act.sa_flags:=4
|
act.sa_flags:=SA_SIGINFO
|
||||||
{$ifdef x86_64}
|
{$ifdef x86_64}
|
||||||
or $4000000
|
or $4000000
|
||||||
{$endif x86_64}
|
{$endif x86_64}
|
||||||
@ -589,7 +589,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.19 2004-05-31 20:25:04 peter
|
Revision 1.20 2004-08-04 19:27:09 florian
|
||||||
|
* fixed floating point and integer exception handling on sparc/linux
|
||||||
|
|
||||||
|
Revision 1.19 2004/05/31 20:25:04 peter
|
||||||
* removed warnings
|
* removed warnings
|
||||||
|
|
||||||
Revision 1.18 2004/05/16 18:51:20 peter
|
Revision 1.18 2004/05/16 18:51:20 peter
|
||||||
|
@ -21,6 +21,14 @@
|
|||||||
|
|
||||||
Const
|
Const
|
||||||
{ For sending a signal }
|
{ For sending a signal }
|
||||||
|
{$ifdef SPARC}
|
||||||
|
SA_SIGINFO = $200;
|
||||||
|
SA_NOMASK = $20;
|
||||||
|
|
||||||
|
SIG_BLOCK = 1;
|
||||||
|
SIG_UNBLOCK = 2;
|
||||||
|
SIG_SETMASK = 4;
|
||||||
|
{$else SPARC}
|
||||||
SA_NOCLDSTOP = 1;
|
SA_NOCLDSTOP = 1;
|
||||||
SA_NOCLDWAIT = 2;
|
SA_NOCLDWAIT = 2;
|
||||||
SA_SIGINFO = 4;
|
SA_SIGINFO = 4;
|
||||||
@ -34,6 +42,7 @@ Const
|
|||||||
SIG_BLOCK = 0;
|
SIG_BLOCK = 0;
|
||||||
SIG_UNBLOCK = 1;
|
SIG_UNBLOCK = 1;
|
||||||
SIG_SETMASK = 2;
|
SIG_SETMASK = 2;
|
||||||
|
{$endif SPARC}
|
||||||
|
|
||||||
SIG_DFL = 0 ;
|
SIG_DFL = 0 ;
|
||||||
SIG_IGN = 1 ;
|
SIG_IGN = 1 ;
|
||||||
@ -278,10 +287,47 @@ type
|
|||||||
SigContextRec = record
|
SigContextRec = record
|
||||||
{ dummy for now PM }
|
{ dummy for now PM }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
psiginfo = ^tsiginfo;
|
||||||
|
tsiginfo = record
|
||||||
|
si_signo : longint;
|
||||||
|
si_errno : longint;
|
||||||
|
si_code : longint;
|
||||||
|
_sifields : record
|
||||||
|
case longint of
|
||||||
|
0 : ( _pad : array[0..(SI_PAD_SIZE)-1] of longint );
|
||||||
|
1 : ( _kill : record
|
||||||
|
_pid : pid_t;
|
||||||
|
_uid : uid_t;
|
||||||
|
end );
|
||||||
|
2 : ( _timer : record
|
||||||
|
_timer1 : dword;
|
||||||
|
_timer2 : dword;
|
||||||
|
end );
|
||||||
|
3 : ( _rt : record
|
||||||
|
_pid : pid_t;
|
||||||
|
_uid : uid_t;
|
||||||
|
_sigval : pointer;
|
||||||
|
end );
|
||||||
|
4 : ( _sigchld : record
|
||||||
|
_pid : pid_t;
|
||||||
|
_uid : uid_t;
|
||||||
|
_status : longint;
|
||||||
|
_utime : clock_t;
|
||||||
|
_stime : clock_t;
|
||||||
|
end );
|
||||||
|
5 : ( _sigfault : record
|
||||||
|
_addr : pointer;
|
||||||
|
end );
|
||||||
|
6 : ( _sigpoll : record
|
||||||
|
_band : longint;
|
||||||
|
_fd : longint;
|
||||||
|
end );
|
||||||
|
end;
|
||||||
|
end;
|
||||||
{$endif cpusparc}
|
{$endif cpusparc}
|
||||||
|
|
||||||
{$ifdef cpux86_64}
|
{$ifdef cpux86_64}
|
||||||
|
|
||||||
p_fpstate = ^_fpstate;
|
p_fpstate = ^_fpstate;
|
||||||
_fpstate = packed record
|
_fpstate = packed record
|
||||||
cwd,
|
cwd,
|
||||||
@ -459,7 +505,10 @@ type
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.21 2004-05-31 09:08:14 peter
|
Revision 1.22 2004-08-04 19:27:10 florian
|
||||||
|
* fixed floating point and integer exception handling on sparc/linux
|
||||||
|
|
||||||
|
Revision 1.21 2004/05/31 09:08:14 peter
|
||||||
* added siginfo const
|
* added siginfo const
|
||||||
|
|
||||||
Revision 1.20 2004/05/27 23:15:43 peter
|
Revision 1.20 2004/05/27 23:15:43 peter
|
||||||
|
@ -16,8 +16,18 @@
|
|||||||
|
|
||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
|
|
||||||
|
const
|
||||||
|
FPE_INTDIV = 1;
|
||||||
|
FPE_INTOVF = 2;
|
||||||
|
FPE_FLTDIV = 3;
|
||||||
|
FPE_FLTOVF = 4;
|
||||||
|
FPE_FLTUND = 5;
|
||||||
|
FPE_FLTRES = 6;
|
||||||
|
FPE_FLTINV = 7;
|
||||||
|
FPE_FLTSUB = 8;
|
||||||
|
|
||||||
procedure SignalToRunerror(Sig: longint; SigContext: SigContextRec); cdecl;
|
|
||||||
|
procedure SignalToRunerror(Sig: longint; siginfo : psiginfo); cdecl;
|
||||||
|
|
||||||
var
|
var
|
||||||
res : word;
|
res : word;
|
||||||
@ -28,6 +38,24 @@ begin
|
|||||||
begin
|
begin
|
||||||
{ don't know how to find the different causes, maybe via xer? }
|
{ don't know how to find the different causes, maybe via xer? }
|
||||||
res := 207;
|
res := 207;
|
||||||
|
case siginfo^.si_code of
|
||||||
|
FPE_INTDIV:
|
||||||
|
res:=200;
|
||||||
|
FPE_INTOVF:
|
||||||
|
res:=205;
|
||||||
|
FPE_FLTDIV:
|
||||||
|
res:=200;
|
||||||
|
FPE_FLTOVF:
|
||||||
|
res:=205;
|
||||||
|
FPE_FLTUND:
|
||||||
|
res:=206;
|
||||||
|
FPE_FLTRES,
|
||||||
|
FPE_FLTINV,
|
||||||
|
FPE_FLTSUB:
|
||||||
|
res:=216;
|
||||||
|
else
|
||||||
|
res:=207;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
SIGILL,
|
SIGILL,
|
||||||
SIGBUS,
|
SIGBUS,
|
||||||
@ -42,7 +70,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.3 2004-05-31 20:25:04 peter
|
Revision 1.4 2004-08-04 19:27:10 florian
|
||||||
|
* fixed floating point and integer exception handling on sparc/linux
|
||||||
|
|
||||||
|
Revision 1.3 2004/05/31 20:25:04 peter
|
||||||
* removed warnings
|
* removed warnings
|
||||||
|
|
||||||
Revision 1.2 2003/11/06 16:28:52 peter
|
Revision 1.2 2003/11/06 16:28:52 peter
|
||||||
|
@ -18,17 +18,38 @@
|
|||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
PowerPC specific stuff
|
SPARC specific stuff
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
function get_fsr : dword;assembler;
|
||||||
|
var
|
||||||
|
fsr : dword;
|
||||||
|
asm
|
||||||
|
st %fsr,fsr
|
||||||
|
ld fsr,%i0
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure set_fsr(fsr : dword);assembler;
|
||||||
|
var
|
||||||
|
_fsr : dword;
|
||||||
|
asm
|
||||||
|
// force memory location
|
||||||
|
st fsr,_fsr
|
||||||
|
ld _fsr,%fsr
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure fpc_cpuinit;
|
procedure fpc_cpuinit;
|
||||||
begin
|
begin
|
||||||
|
{ enable div by 0 and invalid operation fpu exceptions }
|
||||||
|
set_fsr(get_fsr or $09000000);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$define FPC_SYSTEM_HAS_GET_FRAME}
|
{$define FPC_SYSTEM_HAS_GET_FRAME}
|
||||||
function get_frame:pointer;assembler;nostackframe;
|
function get_frame:pointer;assembler;nostackframe;
|
||||||
asm
|
asm
|
||||||
mov %sp,%o0
|
mov %sp,%o0
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +84,10 @@ function Sptr:Pointer;assembler;nostackframe;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.7 2004-05-30 20:03:05 florian
|
Revision 1.8 2004-08-04 19:27:10 florian
|
||||||
|
* fixed floating point and integer exception handling on sparc/linux
|
||||||
|
|
||||||
|
Revision 1.7 2004/05/30 20:03:05 florian
|
||||||
* ?
|
* ?
|
||||||
|
|
||||||
Revision 1.6 2004/05/27 23:34:37 peter
|
Revision 1.6 2004/05/27 23:34:37 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user