mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 17:48:01 +02:00
Try to correctly handle m68k exceptions bits inside SetExceptionMask function
git-svn-id: trunk@43893 -
This commit is contained in:
parent
be301a3aed
commit
d8298c9f14
@ -88,9 +88,14 @@ end;
|
||||
function SetExceptionMask(const Mask: TFPUExceptionMask): TFPUExceptionMask;
|
||||
const
|
||||
FPCToFPUExceptionFlags: array[TFPUException] of DWord =
|
||||
( FPU68K_EXCEPT_OPERR, 0, FPU68K_EXCEPT_DZ, FPU68K_EXCEPT_OVFL, FPU68K_EXCEPT_UNFL, FPU68K_EXCEPT_INEX2 );
|
||||
( {exInvalidOp,} FPU68K_EXCEPT_OPERR or FPU68K_EXCEPT_SNAN or FPU68K_EXCEPT_BSUN,
|
||||
{exDenormalized,} 0,
|
||||
{exZeroDivide,} FPU68K_EXCEPT_DZ,
|
||||
{exOverflow,} FPU68K_EXCEPT_OVFL,
|
||||
{exUnderflow,} FPU68K_EXCEPT_UNFL,
|
||||
{exPrecision} FPU68K_EXCEPT_INEX1 or FPU68K_EXCEPT_INEX2 );
|
||||
FPUToFPCExceptionFlags: array[0..7] of TFPUExceptionMask =
|
||||
( [], [exPrecision], [exZeroDivide], [exUnderflow], [exOverflow], [exInvalidOp], [], [] );
|
||||
( [exPrecision], [exPrecision], [exZeroDivide], [exUnderflow], [exOverflow], [exInvalidOp], [exInvalidOp], [exInvalidOp] );
|
||||
var
|
||||
oldMode, Mode: DWord;
|
||||
e: TFPUException;
|
||||
@ -104,10 +109,13 @@ begin
|
||||
result:=result+FPUToFPCExceptionFlags[i];
|
||||
|
||||
mode:=0;
|
||||
for e in Mask do
|
||||
mode:=mode or FPCToFPUExceptionFlags[e];
|
||||
{ The bits set inside FPCR register are the enabled exceptions,
|
||||
not the masked exceptions, thus we need to invert list }
|
||||
for e:=low(TFPUException) to high(TFPUException) do
|
||||
if not (e in Mask) then
|
||||
mode:=mode or FPCToFPUExceptionFlags[e];
|
||||
|
||||
SetFPCR((GetFPCR and not FPU68K_EXCEPT_MASK) or (mode shl FPU68K_EXCEPT_MASK_SHIFT));
|
||||
SetFPCR((GetFPCR and not FPU68K_EXCEPT_MASK) or (mode and FPU68K_EXCEPT_MASK));
|
||||
softfloat_exception_mask:=mask;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user