|
@@ -81,33 +81,26 @@ procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigCon
|
|
|
res:=207
|
|
|
else
|
|
|
res:=207; {'Coprocessor Error'}
|
|
|
-
|
|
|
- { exceptions are handled, clear all flags
|
|
|
- as we return from SignalToRunerrer, we have to clear the exception flags in the context }
|
|
|
- if assigned(SigContext^.fpstate) then
|
|
|
- SigContext^.fpstate^.swd:=SigContext^.fpstate^.swd and not($37ff);
|
|
|
- end;
|
|
|
- MMState:=getMMState(SigContext^);
|
|
|
- if (MMState and MM_ExceptionMask)<>0 then
|
|
|
+ end
|
|
|
+ else
|
|
|
begin
|
|
|
- { first check the more precise options }
|
|
|
- if (MMState and MM_DivisionByZero)<>0 then
|
|
|
- res:=208
|
|
|
- else if (MMState and MM_Invalid)<>0 Then
|
|
|
- res:=207
|
|
|
- else if (MMState and MM_Overflow)<>0 then
|
|
|
- res:=205
|
|
|
- else if (MMState and MM_Underflow)<>0 then
|
|
|
- res:=206
|
|
|
- else if (MMState and MM_Denormal)<>0 then
|
|
|
- res:=206
|
|
|
- else
|
|
|
- res:=207; {'Coprocessor Error'}
|
|
|
-
|
|
|
- { exceptions are handled, clear all flags
|
|
|
- as we return from SignalToRunerrer, we have to clear the exception flags in the context }
|
|
|
- if assigned(SigContext^.fpstate) then
|
|
|
- SigContext^.fpstate^.mxcsr:=SigContext^.fpstate^.mxcsr and not(MM_ExceptionMask);
|
|
|
+ MMState:=getMMState(SigContext^);
|
|
|
+ if (MMState and MM_ExceptionMask)<>0 then
|
|
|
+ begin
|
|
|
+ { first check the more precise options }
|
|
|
+ if (MMState and MM_DivisionByZero)<>0 then
|
|
|
+ res:=208
|
|
|
+ else if (MMState and MM_Invalid)<>0 Then
|
|
|
+ res:=207
|
|
|
+ else if (MMState and MM_Overflow)<>0 then
|
|
|
+ res:=205
|
|
|
+ else if (MMState and MM_Underflow)<>0 then
|
|
|
+ res:=206
|
|
|
+ else if (MMState and MM_Denormal)<>0 then
|
|
|
+ res:=206
|
|
|
+ else
|
|
|
+ res:=207; {'Coprocessor Error'}
|
|
|
+ end;
|
|
|
end;
|
|
|
if assigned(SigContext^.fpstate) then
|
|
|
with SigContext^.fpstate^ do
|
|
@@ -115,12 +108,16 @@ procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigCon
|
|
|
{$ifdef SYSTEM_DEBUG}
|
|
|
Writeln(stderr,'fpstate^.swd = ',swd);
|
|
|
{$endif SYSTEM_DEBUG}
|
|
|
- { acutally, I am not sure if we should really touch the controll word }
|
|
|
+ { actually, I am not sure if we should really touch the controll word }
|
|
|
cwd:=Default8087CW;
|
|
|
{ found by trial and error that setting to 0 means empty }
|
|
|
twd:=$0;
|
|
|
{ clear top }
|
|
|
swd:=swd and not($3700);
|
|
|
+ { exceptions are handled, clear all flags
|
|
|
+ as we return from SignalToRunerrer, we have to clear the exception flags in the context }
|
|
|
+ mxcsr:=mxcsr and not(MM_ExceptionMask);
|
|
|
+ swd:=swd and not($37ff);
|
|
|
end;
|
|
|
end;
|
|
|
end;
|