Browse Source

* implemented SysResetFPU for arm-wince.
* set softfloat_exception_mask in SetExceptionMask for ARM.

git-svn-id: trunk@6035 -

yury 18 years ago
parent
commit
458abdef3e
3 changed files with 17 additions and 5 deletions
  1. 14 0
      rtl/arm/arm.inc
  2. 2 0
      rtl/arm/mathu.inc
  3. 1 5
      rtl/wince/system.pp

+ 14 - 0
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
 ****************************************************************************}

+ 2 - 0
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;
 
 

+ 1 - 5
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