From 458abdef3ea6a64e04cdbc46dc849d341dbe951a Mon Sep 17 00:00:00 2001 From: yury Date: Wed, 17 Jan 2007 23:58:19 +0000 Subject: [PATCH] * implemented SysResetFPU for arm-wince. * set softfloat_exception_mask in SetExceptionMask for ARM. git-svn-id: trunk@6035 - --- rtl/arm/arm.inc | 14 ++++++++++++++ rtl/arm/mathu.inc | 2 ++ rtl/wince/system.pp | 6 +----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/rtl/arm/arm.inc b/rtl/arm/arm.inc index f049bb4507..3957e4a804 100644 --- a/rtl/arm/arm.inc +++ b/rtl/arm/arm.inc @@ -29,6 +29,20 @@ begin {$endif} end; +{$ifdef wince} +function _controlfp(new: DWORD; mask: DWORD): DWORD; cdecl; external 'coredll'; + +{$define FPC_SYSTEM_HAS_SYSRESETFPU} +Procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif} +begin + softfloat_exception_flags:=0; + softfloat_exception_mask:=float_flag_underflow or float_flag_inexact or float_flag_denormal; + { Enable FPU exceptions, but disable INEXACT, UNDERFLOW, DENORMAL } + { FPU precision 64 bit, rounding to nearest, affine infinity } + _controlfp($000C0003, $030F031F); +end; +{$endif wince} + {**************************************************************************** stack frame related stuff ****************************************************************************} diff --git a/rtl/arm/mathu.inc b/rtl/arm/mathu.inc index 742cd3e864..994c3c9ccb 100644 --- a/rtl/arm/mathu.inc +++ b/rtl/arm/mathu.inc @@ -126,6 +126,7 @@ begin c:=c or _EM_INEXACT; c:=_controlfp(c, _MCW_EM); Result:=ConvertExceptionMask(c); + softfloat_exception_mask:=dword(Mask); end; procedure ClearExceptions(RaisePending: Boolean =true); @@ -308,6 +309,7 @@ function SetExceptionMask(const Mask: TFPUExceptionMask): TFPUExceptionMask; cw:=cw or _FPU_MASK_PM; FPU_SetCW(cw); + softfloat_exception_mask:=dword(Mask); end; diff --git a/rtl/wince/system.pp b/rtl/wince/system.pp index 0f72365e6a..c6c527ccb9 100644 --- a/rtl/wince/system.pp +++ b/rtl/wince/system.pp @@ -1452,7 +1452,6 @@ begin xorl %eax,%eax movw %ss,%ax movl %eax,_SS - call SysResetFPU xorl %ebp,%ebp call PASCALMAIN popl %ebp @@ -1725,7 +1724,6 @@ end; function _getstdfilex(fd: integer): pointer; cdecl; external 'coredll'; function _fileno(fd: pointer): THandle; cdecl; external 'coredll'; -function _controlfp(new: DWORD; mask: DWORD): DWORD; cdecl; external 'coredll'; procedure SysInitStdIO; begin @@ -1779,11 +1777,9 @@ begin end; initialization + SysResetFPU; StackLength := CheckInitialStkLen(InitialStkLen); StackBottom := StackTop - StackLength; - { Enable FPU exceptions, but disable INEXACT, UNDERFLOW, DENORMAL } - { FPU precision 64 bit, rounding to nearest, affine infinity } - _controlfp($000C0003, $030F031F); { some misc stuff } hprevinst:=0; if not IsLibrary then