* Fixed Linux FPU exception mapping for x86_64 and MIPS, might be still incomplete, but at least operations yielding NaNs no longer produce EAccessViolation.

git-svn-id: trunk@27194 -
This commit is contained in:
sergei 2014-03-20 01:59:06 +00:00
parent 47a7b117fd
commit 7ba4e67564
2 changed files with 7 additions and 11 deletions

View File

@ -31,19 +31,15 @@ begin
case siginfo^.si_code of
FPE_INTDIV:
res:=200;
res:=200; // maps to EDivByZero
FPE_INTOVF:
res:=215;
FPE_FLTDIV:
res:=200;
res:=208; // maps to EZeroDivide
FPE_FLTOVF:
res:=205;
FPE_FLTUND:
res:=206;
FPE_FLTRES,
FPE_FLTINV,
FPE_FLTSUB:
res:=216;
else
res:=207;
end;

View File

@ -22,9 +22,11 @@ const
function GetFPUState(const SigContext : TSigContext) : word;
begin
if assigned(SigContext.fpstate) then
GetfpuState:=SigContext.fpstate^.swd;
GetfpuState:=SigContext.fpstate^.swd
else
GetFPUState:=0;
{$ifdef SYSTEM_DEBUG}
writeln('xx:',sigcontext.en_tw,' ',sigcontext.en_cw);
writeln('xx:',sigcontext.twd,' ',sigcontext.cwd);
{$endif SYSTEM_DEBUG}
{$ifdef SYSTEM_DEBUG}
Writeln(stderr,'FpuState = ',result);
@ -55,10 +57,8 @@ procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigCon
res:=206
else if (FpuState and FPU_Denormal)<>0 then
res:=216
else if (FpuState and (FPU_StackOverflow or FPU_StackUnderflow))<>0 Then
else if (FpuState and (FPU_StackOverflow or FPU_StackUnderflow or FPU_Invalid))<>0 Then
res:=207
else if (FpuState and FPU_Invalid)<>0 then
res:=216
else
res:=207; {'Coprocessor Error'}
end;