Ver Fonte

--- Merging r18234 into '.':
U compiler/arm/rgcpu.pas
--- Merging r18961 into '.':
U rtl/solaris/system.pp
U rtl/linux/system.pp
U compiler/sparc/ncpucnv.pas

# revisions: 18234,18961
------------------------------------------------------------------------
r18234 | florian | 2011-08-17 00:43:30 +0200 (Wed, 17 Aug 2011) | 1 line
Changed paths:
M /trunk/compiler/arm/rgcpu.pas

* patch by Jeppe Johansen to avoid corruption of frame/stack pointer by pre/post indexed operations, resolves #19679
------------------------------------------------------------------------
------------------------------------------------------------------------
r18961 | florian | 2011-09-03 21:58:32 +0200 (Sat, 03 Sep 2011) | 2 lines
Changed paths:
M /trunk/compiler/sparc/ncpucnv.pas
M /trunk/rtl/linux/system.pp
M /trunk/rtl/solaris/system.pp

* use generic first_int_to_real 64 bit values on sparc
* compile part of softfpu into the system unit as consequence of using the generic first_int_to_real
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_6@19312 -

marco há 14 anos atrás
pai
commit
5856534079
4 ficheiros alterados com 56 adições e 16 exclusões
  1. 23 0
      compiler/arm/rgcpu.pas
  2. 1 12
      compiler/sparc/ncpucnv.pas
  3. 4 4
      rtl/linux/system.pp
  4. 28 0
      rtl/solaris/system.pp

+ 23 - 0
compiler/arm/rgcpu.pas

@@ -62,6 +62,8 @@ unit rgcpu;
       procinfo;
       procinfo;
 
 
     procedure trgintcputhumb2.add_cpu_interferences(p: tai);
     procedure trgintcputhumb2.add_cpu_interferences(p: tai);
+      var
+        r : tregister;
       begin
       begin
         if p.typ=ait_instruction then
         if p.typ=ait_instruction then
           begin
           begin
@@ -95,6 +97,27 @@ unit rgcpu;
                         end;
                         end;
                     end;
                     end;
                 end;
                 end;
+              A_LDRB,
+              A_STRB,
+              A_STR,
+              A_LDR,
+              A_LDRH,
+              A_STRH,
+              A_LDRSB,
+              A_LDRSH,
+              A_LDRD,
+              A_STRD:
+                { don't mix up the framepointer and stackpointer with pre/post indexed operations }
+                if (taicpu(p).oper[1]^.typ=top_ref) and
+                  (taicpu(p).oper[1]^.ref^.addressmode in [AM_PREINDEXED,AM_POSTINDEXED]) then
+                  begin
+                    add_edge(getsupreg(taicpu(p).oper[1]^.ref^.base),getsupreg(current_procinfo.framepointer));
+                    { FIXME: temp variable r is needed here to avoid Internal error 20060521 }
+                    {        while compiling the compiler. }
+                    r:=NR_STACK_POINTER_REG;
+                    if current_procinfo.framepointer<>r then
+                      add_edge(getsupreg(taicpu(p).oper[1]^.ref^.base),getsupreg(r));
+                  end;
             end;
             end;
           end;
           end;
       end;
       end;

+ 1 - 12
compiler/sparc/ncpucnv.pas

@@ -77,18 +77,7 @@ implementation
         if is_64bitint(left.resultdef) or
         if is_64bitint(left.resultdef) or
           is_currency(left.resultdef) then
           is_currency(left.resultdef) then
           begin
           begin
-            { hack to avoid double division by 10000, as it's
-              already done by typecheckpass.resultdef_int_to_real }
-            if is_currency(left.resultdef) then
-              left.resultdef := s64inttype;
-            if is_signed(left.resultdef) then
-              fname := 'fpc_int64_to_double'
-            else
-              fname := 'fpc_qword_to_double';
-            result := ccallnode.createintern(fname,ccallparanode.create(
-              left,nil));
-            left:=nil;
-            firstpass(result);
+            result:=inherited first_int_to_real;
             exit;
             exit;
           end
           end
         else
         else

+ 4 - 4
rtl/linux/system.pp

@@ -36,13 +36,13 @@ Unit System;
 function get_cmdline:Pchar; 
 function get_cmdline:Pchar; 
 property cmdline:Pchar read get_cmdline;
 property cmdline:Pchar read get_cmdline;
 
 
-{$if defined(CPUARM) or defined(CPUM68K)}
+{$if defined(CPUARM) or defined(CPUM68K) or defined(CPUSPARC)}
 
 
 {$define fpc_softfpu_interface}
 {$define fpc_softfpu_interface}
 {$i softfpu.pp}
 {$i softfpu.pp}
 {$undef fpc_softfpu_interface}
 {$undef fpc_softfpu_interface}
 
 
-{$endif defined(CPUARM) or defined(CPUM68K)}
+{$endif defined(CPUARM) or defined(CPUM68K) or defined(CPUSPARC)}
 
 
 {*****************************************************************************}
 {*****************************************************************************}
                                  implementation
                                  implementation
@@ -55,7 +55,7 @@ var
 
 
 const calculated_cmdline:Pchar=nil;
 const calculated_cmdline:Pchar=nil;
 
 
-{$if defined(CPUARM) or defined(CPUM68K)}
+{$if defined(CPUARM) or defined(CPUM68K) or defined(CPUSPARC)}
 
 
 {$define fpc_softfpu_implementation}
 {$define fpc_softfpu_implementation}
 {$i softfpu.pp}
 {$i softfpu.pp}
@@ -73,7 +73,7 @@ const calculated_cmdline:Pchar=nil;
 {$define FPC_SYSTEM_HAS_extractFloat32Exp}
 {$define FPC_SYSTEM_HAS_extractFloat32Exp}
 {$define FPC_SYSTEM_HAS_extractFloat32Sign}
 {$define FPC_SYSTEM_HAS_extractFloat32Sign}
 
 
-{$endif defined(CPUARM) or defined(CPUM68K)}
+{$endif defined(CPUARM) or defined(CPUM68K) or defined(CPUSPARC)}
 
 
 {$I system.inc}
 {$I system.inc}
 
 

+ 28 - 0
rtl/solaris/system.pp

@@ -28,9 +28,37 @@ var argc:longint;
     argv:PPchar;
     argv:PPchar;
     envp:PPchar;
     envp:PPchar;
 
 
+{$if defined(CPUARM) or defined(CPUM68K) or defined(CPUSPARC)}
+
+{$define fpc_softfpu_interface}
+{$i softfpu.pp}
+{$undef fpc_softfpu_interface}
+
+{$endif defined(CPUARM) or defined(CPUM68K) or defined(CPUSPARC)}
 
 
 implementation
 implementation
 
 
+
+{$if defined(CPUARM) or defined(CPUM68K) or defined(CPUSPARC)}
+
+{$define fpc_softfpu_implementation}
+{$i softfpu.pp}
+{$undef fpc_softfpu_implementation}
+
+{ we get these functions and types from the softfpu code }
+{$define FPC_SYSTEM_HAS_float64}
+{$define FPC_SYSTEM_HAS_float32}
+{$define FPC_SYSTEM_HAS_flag}
+{$define FPC_SYSTEM_HAS_extractFloat64Frac0}
+{$define FPC_SYSTEM_HAS_extractFloat64Frac1}
+{$define FPC_SYSTEM_HAS_extractFloat64Exp}
+{$define FPC_SYSTEM_HAS_extractFloat64Sign}
+{$define FPC_SYSTEM_HAS_ExtractFloat32Frac}
+{$define FPC_SYSTEM_HAS_extractFloat32Exp}
+{$define FPC_SYSTEM_HAS_extractFloat32Sign}
+
+{$endif defined(CPUARM) or defined(CPUM68K) or defined(CPUSPARC)}
+
 { OS independant parts}
 { OS independant parts}
 
 
 {$I system.inc}
 {$I system.inc}