mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 02:49:28 +02:00
* fix floating point signal and exception handling, for linux/i386, test tfpu2 regression
git-svn-id: trunk@8152 -
This commit is contained in:
parent
8f27e64080
commit
68dbca040e
@ -16,22 +16,6 @@
|
|||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
|
|
||||||
|
|
||||||
const
|
|
||||||
FPU_All = $7f;
|
|
||||||
|
|
||||||
function GetFPUState(const SigContext : TSigContext) : longint;
|
|
||||||
begin
|
|
||||||
if assigned(SigContext.fpstate) then
|
|
||||||
GetfpuState:=SigContext.fpstate^.sw;
|
|
||||||
{$ifdef SYSTEM_DEBUG}
|
|
||||||
writeln('xx:',sigcontext.en_tw,' ',sigcontext.en_cw);
|
|
||||||
{$endif SYSTEM_DEBUG}
|
|
||||||
{$ifdef SYSTEM_DEBUG}
|
|
||||||
Writeln(stderr,'FpuState = ',GetFpuState);
|
|
||||||
{$endif SYSTEM_DEBUG}
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; UContext: Pucontext);cdecl;
|
procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; UContext: Pucontext);cdecl;
|
||||||
var
|
var
|
||||||
res,fpustate : word;
|
res,fpustate : word;
|
||||||
@ -43,24 +27,28 @@ begin
|
|||||||
{ this is not allways necessary but I don't know yet
|
{ this is not allways necessary but I don't know yet
|
||||||
how to tell if it is or not PM }
|
how to tell if it is or not PM }
|
||||||
res:=200;
|
res:=200;
|
||||||
fpustate:=GetFPUState(UContext^.uc_mcontext);
|
if assigned(ucontext^.uc_mcontext.fpstate) then
|
||||||
if (FpuState and FPU_All) <> 0 then
|
|
||||||
begin
|
begin
|
||||||
{ first check the more precise options }
|
FpuState:=ucontext^.uc_mcontext.fpstate^.sw;
|
||||||
if (FpuState and FPU_DivisionByZero)<>0 then
|
if (FpuState and FPU_ExceptionMask) <> 0 then
|
||||||
res:=200
|
begin
|
||||||
else if (FpuState and (FPU_StackOverflow or FPU_StackUnderflow or FPU_Invalid))<>0 Then
|
{ first check the more precise options }
|
||||||
res:=207
|
if (FpuState and FPU_DivisionByZero)<>0 then
|
||||||
else if (FpuState and FPU_Overflow)<>0 then
|
res:=200
|
||||||
res:=205
|
else if (FpuState and (FPU_StackOverflow or FPU_StackUnderflow or FPU_Invalid))<>0 Then
|
||||||
else if (FpuState and FPU_Underflow)<>0 then
|
res:=207
|
||||||
res:=206
|
else if (FpuState and FPU_Overflow)<>0 then
|
||||||
else if (FpuState and FPU_Denormal)<>0 then
|
res:=205
|
||||||
res:=216
|
else if (FpuState and FPU_Underflow)<>0 then
|
||||||
else
|
res:=206
|
||||||
res:=207; {'Coprocessor Error'}
|
else if (FpuState and FPU_Denormal)<>0 then
|
||||||
|
res:=216
|
||||||
|
else
|
||||||
|
res:=207; {'Coprocessor Error'}
|
||||||
|
end;
|
||||||
|
with ucontext^.uc_mcontext.fpstate^ do
|
||||||
|
sw:=sw and not FPU_ExceptionMask;
|
||||||
end;
|
end;
|
||||||
sysResetFPU;
|
|
||||||
end;
|
end;
|
||||||
SIGBUS:
|
SIGBUS:
|
||||||
res:=214;
|
res:=214;
|
||||||
|
Loading…
Reference in New Issue
Block a user