Browse Source

* arm fixes to the common rtl code
* some generic math code fixed
* ...

florian 22 years ago
parent
commit
8d771df2d4

+ 108 - 2
rtl/arm/arm.inc

@@ -15,9 +15,115 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+
+
+{****************************************************************************
+                       stack frame related stuff
+****************************************************************************}
+
+{$define FPC_SYSTEM_HAS_GET_FRAME}
+function get_frame:pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+asm
+        mov    r0,fp
+end ['R0'];
+
+
+{$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
+function get_caller_addr(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+asm
+(*!!!!!!
+        movl    framebp,%eax
+        orl     %eax,%eax
+        jz      .Lg_a_null
+        movl    4(%eax),%eax
+.Lg_a_null:
+*)
+end ['R0'];
+
+
+{$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
+function get_caller_frame(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+asm
+(*!!!!!
+        movl    framebp,%eax
+        orl     %eax,%eax
+        jz      .Lgnf_null
+        movl    (%eax),%eax
+.Lgnf_null:
+*)
+end ['R0'];
+
+
+{$define FPC_SYSTEM_HAS_SPTR}
+Function Sptr : Longint;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+asm
+        mov    r0,sp
+end ['R0'];
+
+
+{
+{$define FPC_SYSTEM_HAS_FILLCHAR}
+Procedure FillChar(var x;count:longint;value:byte);assembler;
+
+* void *memset (dstpp, c, len) */
+
+asm
+	mov	a4, a1
+	cmp	a2, $8		// at least 8 bytes to do?
+	blt	.Fillchar2
+	orr	a3, a3, a3, lsl $8
+	orr	a3, a3, a3, lsl $16
+.Fillchar0:
+	tst	a4, $3		// aligned yet?
+	strneb	a3, [a4], $1
+	subne	a2, a2, $1
+	bne	.Fillchar0
+	mov	ip, a3
+.Fillchar1:
+	cmp	a2, $8		// 8 bytes still to do?
+	blt	.Fillchar2
+	stmia	a4!, {a3, ip}
+	sub	a2, a2, $8
+	cmp	a2, $8		// 8 bytes still to do?
+	blt	.Fillchar2
+	stmia	a4!, {a3, ip}
+	sub	a2, a2, $8
+	cmp	a2, $8		// 8 bytes still to do?
+	blt	.Fillchar2
+	stmia	a4!, {a3, ip}
+	sub	a2, a2, $8
+	cmp	a2, $8		// 8 bytes still to do?
+	stmgeia	a4!, {a3, ip}
+	subge	a2, a2, $8
+	bge	.Fillchar1
+.Fillchar2:
+	movs	a2, a2		// anything left?
+	RETINSTR(moveq,pc,lr)	// nope
+	rsb	a2, a2, $7
+	add	pc, pc, a2, lsl $2
+	mov	r0, r0
+	strb	a3, [a4], $1
+	strb	a3, [a4], $1
+	strb	a3, [a4], $1
+	strb	a3, [a4], $1
+	strb	a3, [a4], $1
+	strb	a3, [a4], $1
+	strb	a3, [a4], $1
+	RETINSTR(mov,pc,lr)
+end;
+
+}
+
+
+
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2003-08-21 16:41:54  florian
+  Revision 1.2  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.1  2003/08/21 16:41:54  florian
     * empty dummy files
     * empty dummy files
     + [long|set]jmp implemented
     + [long|set]jmp implemented
-}
+}

+ 14 - 2
rtl/arm/math.inc

@@ -14,9 +14,21 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+
+    {$define FPC_SYSTEM_HAS_ABS}
+    function abs(d : extended) : extended;[internproc:in_abs_extended];
+
+    {$define FPC_SYSTEM_HAS_SQR}
+    function sqr(d : extended) : extended;[internproc:in_sqr_extended];
+
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2003-08-21 16:41:54  florian
+  Revision 1.2  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.1  2003/08/21 16:41:54  florian
     * empty dummy files
     * empty dummy files
     + [long|set]jmp implemented
     + [long|set]jmp implemented
-}
+}

+ 7 - 2
rtl/arm/setjump.inc

@@ -18,7 +18,7 @@
 function setjmp(var S : jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP'];
 function setjmp(var S : jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP'];
   asm
   asm
      stmia   r0,{v1-v6, sl, fp, sp, lr}
      stmia   r0,{v1-v6, sl, fp, sp, lr}
-     {!!!! fix me ?}
+     (*!!!! fix me ?*)
   end;
   end;
 
 
 procedure longjmp(var S : jmp_buf;value : longint);assembler;[Public, alias : 'FPC_LONGJMP'];
 procedure longjmp(var S : jmp_buf;value : longint);assembler;[Public, alias : 'FPC_LONGJMP'];
@@ -32,7 +32,12 @@ procedure longjmp(var S : jmp_buf;value : longint);assembler;[Public, alias : 'F
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2003-08-21 16:41:54  florian
+  Revision 1.2  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.1  2003/08/21 16:41:54  florian
     * empty dummy files
     * empty dummy files
     + [long|set]jmp implemented
     + [long|set]jmp implemented
 }
 }

+ 50 - 6
rtl/inc/generic.inc

@@ -32,7 +32,7 @@ begin
   if count <= 0 then exit;
   if count <= 0 then exit;
   Dec(count);
   Dec(count);
   for i:=0 to count do
   for i:=0 to count do
-         bytearray(dest)[i]:=bytearray(source)[i];
+    bytearray(dest)[i]:=bytearray(source)[i];
 end;
 end;
 {$endif not FPC_SYSTEM_HAS_MOVE}
 {$endif not FPC_SYSTEM_HAS_MOVE}
 
 
@@ -568,11 +568,10 @@ begin
   move(s2[1],fpc_shortstr_concat[s1l+1],s2l);
   move(s2[1],fpc_shortstr_concat[s1l+1],s2l);
   fpc_shortstr_concat[0]:=chr(s1l+s2l);
   fpc_shortstr_concat[0]:=chr(s1l+s2l);
 end;
 end;
-
 {$endif ndef FPC_SYSTEM_HAS_FPC_SHORTSTR_CONCAT}
 {$endif ndef FPC_SYSTEM_HAS_FPC_SHORTSTR_CONCAT}
 
 
-{$ifndef FPC_SYSTEM_HAS_FPC_SHORTSTR_APPEND_SHORTSTR}
 
 
+{$ifndef FPC_SYSTEM_HAS_FPC_SHORTSTR_APPEND_SHORTSTR}
 procedure fpc_shortstr_append_shortstr(var s1:shortstring;const s2:shortstring);{$ifdef hascompilerproc} compilerproc; {$endif}
 procedure fpc_shortstr_append_shortstr(var s1:shortstring;const s2:shortstring);{$ifdef hascompilerproc} compilerproc; {$endif}
     [public,alias:'FPC_SHORTSTR_APPEND_SHORTSTR'];
     [public,alias:'FPC_SHORTSTR_APPEND_SHORTSTR'];
 var
 var
@@ -585,11 +584,10 @@ begin
   move(s2[1],s1[s1l+1],s2l);
   move(s2[1],s1[s1l+1],s2l);
   s1[0]:=chr(s1l+s2l);
   s1[0]:=chr(s1l+s2l);
 end;
 end;
-
 {$endif ndef FPC_SYSTEM_HAS_FPC_SHORTSTR_APPEND_SHORTSTR}
 {$endif ndef FPC_SYSTEM_HAS_FPC_SHORTSTR_APPEND_SHORTSTR}
 
 
-{$ifndef FPC_SYSTEM_HAS_FPC_SHORTSTR_COMPARE}
 
 
+{$ifndef FPC_SYSTEM_HAS_FPC_SHORTSTR_COMPARE}
 function fpc_shortstr_compare(const left,right:shortstring) : longint;[public,alias:'FPC_SHORTSTR_COMPARE']; {$ifdef hascompilerproc} compilerproc; {$endif}
 function fpc_shortstr_compare(const left,right:shortstring) : longint;[public,alias:'FPC_SHORTSTR_COMPARE']; {$ifdef hascompilerproc} compilerproc; {$endif}
 var
 var
    s1,s2,max,i : byte;
    s1,s2,max,i : byte;
@@ -791,6 +789,47 @@ end;
                                  Math
                                  Math
 ****************************************************************************}
 ****************************************************************************}
 
 
+{****************************************************************************
+                          Software longint/dword division
+****************************************************************************}
+{$ifdef FPC_INCLUDE_SOFTWARE_MOD_DIV}
+
+{$ifndef FPC_SYSTEM_HAS_DIV_DWORD}
+function fpc_div_dword(n,z : dword) : dword; [public,alias: 'FPC_DIV_DWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
+  begin
+    {!!!!}
+  end;
+{$endif FPC_SYSTEM_HAS_DIV_DWORD}
+
+
+{$ifndef FPC_SYSTEM_HAS_MOD_DWORD}
+function fpc_mod_dword(n,z : dword) : dword; [public,alias: 'FPC_MOD_DWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
+  begin
+    {!!!!}
+  end;
+{$endif FPC_SYSTEM_HAS_MOD_DWORD}
+
+
+{$ifndef FPC_SYSTEM_HAS_DIV_LONGINT}
+function fpc_div_longint(n,z : longint) : longint; [public,alias: 'FPC_DIV_LONGINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
+  begin
+    {!!!!}
+  end;
+{$endif FPC_SYSTEM_HAS_DIV_LONGINT}
+
+
+{$ifndef FPC_SYSTEM_HAS_MOD_LONGINT}
+function fpc_mod_longint(n,z : longint) : longint; [public,alias: 'FPC_MOD_LONGINT']; {$ifdef hascompilerproc} compilerproc; {$endif}
+  begin
+    {!!!!}
+  end;
+{$endif FPC_SYSTEM_HAS_MOD_LONGINT}
+
+{$endif FPC_INCLUDE_SOFTWARE_MOD_DIV}
+
+
+{****************************************************************************}
+
 {$ifndef FPC_SYSTEM_HAS_ABS_LONGINT}
 {$ifndef FPC_SYSTEM_HAS_ABS_LONGINT}
 function abs(l:longint):longint;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_abs];
 function abs(l:longint):longint;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_abs];
 begin
 begin
@@ -975,7 +1014,12 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.60  2003-06-01 14:50:17  jonas
+  Revision 1.61  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.60  2003/06/01 14:50:17  jonas
     * fpc_shortstr_append_shortstr has to use high(s1) instead of 255 as
     * fpc_shortstr_append_shortstr has to use high(s1) instead of 255 as
       maxlen
       maxlen
     + ppc version of fpc_shortstr_append_shortstr
     + ppc version of fpc_shortstr_append_shortstr

+ 38 - 9
rtl/inc/genmath.inc

@@ -233,7 +233,8 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
  End;
  End;
 
 
 
 
-    function trunc(d : real) : longint;[internconst:in_const_trunc];
+  {$warning FIX ME !! }
+  function trunc(d : real) : int64;[internconst:in_const_trunc];
     var
     var
      l: longint;
      l: longint;
      f32 : float32;
      f32 : float32;
@@ -321,7 +322,7 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
 {$ifndef FPC_SYSTEM_HAS_ABS}
 {$ifndef FPC_SYSTEM_HAS_ABS}
     function fpc_abs_real(d : Real) : Real; compilerproc;
     function fpc_abs_real(d : Real) : Real; compilerproc;
     begin
     begin
-       if( d < 0.0 ) then
+       if (d<0.0) then
          fpc_abs_real := -d
          fpc_abs_real := -d
       else
       else
          fpc_abs_real := d ;
          fpc_abs_real := d ;
@@ -600,9 +601,9 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
 {$ifdef hascompilerproc}
 {$ifdef hascompilerproc}
     function round(d : Real) : int64;[internconst:in_const_round, external name 'FPC_ROUND'];
     function round(d : Real) : int64;[internconst:in_const_round, external name 'FPC_ROUND'];
 
 
-    function fpc_round(d : Real) : int64;assembler;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
+    function fpc_round(d : Real) : int64;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
 {$else}
 {$else}
-    function round(d : Real) : int64;assembler;[internconst:in_const_round];
+    function round(d : Real) : int64;[internconst:in_const_round];
 {$endif hascompilerproc}
 {$endif hascompilerproc}
      var
      var
       fr: Real;
       fr: Real;
@@ -611,17 +612,17 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
        fr := Frac(d);
        fr := Frac(d);
        tr := Trunc(d);
        tr := Trunc(d);
        if fr > 0.5 then
        if fr > 0.5 then
-          Round:=Trunc(d)+1
+          result:=Trunc(d)+1
        else
        else
        if fr < 0.5 then
        if fr < 0.5 then
-          Round:=Trunc(d)
+          result:=Trunc(d)
        else { fr = 0.5 }
        else { fr = 0.5 }
           { check sign to decide ... }
           { check sign to decide ... }
           { as in Turbo Pascal...    }
           { as in Turbo Pascal...    }
           if d >= 0.0 then
           if d >= 0.0 then
-            Round := Trunc(d)+1
+            result:=Trunc(d)+1
           else
           else
-            Round := Trunc(d);
+            result:=Trunc(d);
     end;
     end;
 {$endif}
 {$endif}
 
 
@@ -1051,6 +1052,29 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
 {$endif}
 {$endif}
 
 
 
 
+{$ifdef FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE}
+
+{$ifndef FPC_SYSTEM_HAS_QWORD_TO_DOUBLE}
+function fpc_qword_to_double(q : qword): double; compilerproc;
+  begin
+     result:=dword(q and $ffffffff)+dword(q shr 32)*4294967296.0;
+  end;
+{$endif FPC_SYSTEM_HAS_INT64_TO_DOUBLE}
+
+
+{$ifndef FPC_SYSTEM_HAS_INT64_TO_DOUBLE}
+function fpc_int64_to_double(i : int64): double; compilerproc;
+  begin
+    if i<0 then
+      result:=-double(qword(-i))
+    else
+      result:=qword(i);
+  end;
+{$endif FPC_SYSTEM_HAS_INT64_TO_DOUBLE}
+
+{$endif FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE}
+
+
 {$ifdef SUPPORT_DOUBLE}
 {$ifdef SUPPORT_DOUBLE}
 {****************************************************************************
 {****************************************************************************
                     Helper routines to support old TP styled reals
                     Helper routines to support old TP styled reals
@@ -1088,7 +1112,12 @@ Function float32_to_int32_round_to_zero( a: Float32 ): longint;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.14  2003-05-24 13:39:32  jonas
+  Revision 1.15  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.14  2003/05/24 13:39:32  jonas
     * fsqrt is an optional instruction in the ppc architecture and isn't
     * fsqrt is an optional instruction in the ppc architecture and isn't
       implemented by any current ppc afaik, so use the generic sqrt routine
       implemented by any current ppc afaik, so use the generic sqrt routine
       instead (adapted so it works with compilerproc)
       instead (adapted so it works with compilerproc)

+ 44 - 1
rtl/inc/int64.inc

@@ -30,6 +30,44 @@
        end;
        end;
 {$endif ENDIAN_BIG}
 {$endif ENDIAN_BIG}
 
 
+
+{$ifdef  FPC_INCLUDE_SOFTWARE_SHIFT_INT64}
+
+{$ifndef FPC_SYSTEM_HAS_SHL_QWORD}
+    function fpc_shl_qword(value,shift : qword) : qword; [public,alias: 'FPC_SHL_QWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
+      begin
+        {!!!!}
+      end;
+{$endif FPC_SYSTEM_HAS_SHL_QWORD}
+
+
+{$ifndef FPC_SYSTEM_HAS_SHR_QWORD}
+   function fpc_shr_qword(value,shift : qword) : qword; [public,alias: 'FPC_SHR_QWORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
+      begin
+        {!!!!}
+      end;
+{$endif FPC_SYSTEM_HAS_SHR_QWORD}
+
+
+{$ifndef FPC_SYSTEM_HAS_SHL_INT64}
+    function fpc_shl_int64(value,shift : int64) : int64; [public,alias: 'FPC_SHL_INT64']; {$ifdef hascompilerproc} compilerproc; {$endif}
+      begin
+        {!!!!}
+      end;
+{$endif FPC_SYSTEM_HAS_SHL_INT64}
+
+
+{$ifndef FPC_SYSTEM_HAS_SHR_INT64}
+    function fpc_shr_int64(value,shift : int64) : int64; [public,alias: 'FPC_SHR_INT64']; {$ifdef hascompilerproc} compilerproc; {$endif}
+      begin
+        {!!!!}
+      end;
+{$endif FPC_SYSTEM_HAS_SHR_INT64}
+
+
+{$endif FPC_INCLUDE_SOFTWARE_SHIFT_INT64}
+
+
     function count_leading_zeros(q : qword) : longint;
     function count_leading_zeros(q : qword) : longint;
 
 
       var
       var
@@ -603,7 +641,12 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.20  2003-05-12 11:17:55  florian
+  Revision 1.21  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.20  2003/05/12 11:17:55  florian
     * fixed my commit, strange, it didn't give any conflicts with Jonas patch
     * fixed my commit, strange, it didn't give any conflicts with Jonas patch
 
 
   Revision 1.19  2003/05/12 11:16:21  florian
   Revision 1.19  2003/05/12 11:16:21  florian

+ 14 - 8
rtl/inc/system.inc

@@ -88,7 +88,6 @@ Procedure Rewrite(var f : TypedFile); [INTERNPROC: In_Rewrite_TypedFile];
   {$ifdef SYSPROCDEFINED}
   {$ifdef SYSPROCDEFINED}
     {$Error Can't determine processor type !}
     {$Error Can't determine processor type !}
   {$endif}
   {$endif}
-  {$define ENDIAN_LITTLE}
   {$i i386.inc}  { Case dependent, don't change }
   {$i i386.inc}  { Case dependent, don't change }
 {$endif cpui386}
 {$endif cpui386}
 
 
@@ -96,7 +95,6 @@ Procedure Rewrite(var f : TypedFile); [INTERNPROC: In_Rewrite_TypedFile];
   {$ifdef SYSPROCDEFINED}
   {$ifdef SYSPROCDEFINED}
     {$Error Can't determine processor type !}
     {$Error Can't determine processor type !}
   {$endif}
   {$endif}
-  {$define ENDIAN_BIG}
   {$i m68k.inc}  { Case dependent, don't change }
   {$i m68k.inc}  { Case dependent, don't change }
   {$define SYSPROCDEFINED}
   {$define SYSPROCDEFINED}
 {$endif cpum68k}
 {$endif cpum68k}
@@ -105,7 +103,6 @@ Procedure Rewrite(var f : TypedFile); [INTERNPROC: In_Rewrite_TypedFile];
   {$ifdef SYSPROCDEFINED}
   {$ifdef SYSPROCDEFINED}
     {$Error Can't determine processor type !}
     {$Error Can't determine processor type !}
   {$endif}
   {$endif}
-  {$define ENDIAN_LITTLE}
   {$i x86_64.inc}  { Case dependent, don't change }
   {$i x86_64.inc}  { Case dependent, don't change }
   {$define SYSPROCDEFINED}
   {$define SYSPROCDEFINED}
 {$endif cpux86_64}
 {$endif cpux86_64}
@@ -114,7 +111,6 @@ Procedure Rewrite(var f : TypedFile); [INTERNPROC: In_Rewrite_TypedFile];
   {$ifdef SYSPROCDEFINED}
   {$ifdef SYSPROCDEFINED}
     {$Error Can't determine processor type !}
     {$Error Can't determine processor type !}
   {$endif}
   {$endif}
-  {$define ENDIAN_BIG}
   {$i powerpc.inc}  { Case dependent, don't change }
   {$i powerpc.inc}  { Case dependent, don't change }
   {$define SYSPROCDEFINED}
   {$define SYSPROCDEFINED}
 {$endif cpupowerpc}
 {$endif cpupowerpc}
@@ -123,7 +119,6 @@ Procedure Rewrite(var f : TypedFile); [INTERNPROC: In_Rewrite_TypedFile];
   {$ifdef SYSPROCDEFINED}
   {$ifdef SYSPROCDEFINED}
     {$Error Can't determine processor type !}
     {$Error Can't determine processor type !}
   {$endif}
   {$endif}
-  {$define ENDIAN_BIG}
   {$i alpha.inc}  { Case dependent, don't change }
   {$i alpha.inc}  { Case dependent, don't change }
   {$define SYSPROCDEFINED}
   {$define SYSPROCDEFINED}
 {$endif cpualpha}
 {$endif cpualpha}
@@ -132,7 +127,6 @@ Procedure Rewrite(var f : TypedFile); [INTERNPROC: In_Rewrite_TypedFile];
   {$ifdef SYSPROCDEFINED}
   {$ifdef SYSPROCDEFINED}
     {$Error Can't determine processor type !}
     {$Error Can't determine processor type !}
   {$endif}
   {$endif}
-  {$define ENDIAN_LITTLE}
   {$i ia64.inc}  { Case dependent, don't change }
   {$i ia64.inc}  { Case dependent, don't change }
   {$define SYSPROCDEFINED}
   {$define SYSPROCDEFINED}
 {$endif cpuiA64}
 {$endif cpuiA64}
@@ -141,11 +135,18 @@ Procedure Rewrite(var f : TypedFile); [INTERNPROC: In_Rewrite_TypedFile];
   {$ifdef SYSPROCDEFINED}
   {$ifdef SYSPROCDEFINED}
     {$Error Can't determine processor type !}
     {$Error Can't determine processor type !}
   {$endif}
   {$endif}
-  {$define ENDIAN_BIG}
   {$i sparc.inc}  { Case dependent, don't change }
   {$i sparc.inc}  { Case dependent, don't change }
   {$define SYSPROCDEFINED}
   {$define SYSPROCDEFINED}
 {$endif cpusparc}
 {$endif cpusparc}
 
 
+{$ifdef cpuarm}
+  {$ifdef SYSPROCDEFINED}
+    {$Error Can't determine processor type !}
+  {$endif}
+  {$i arm.inc}  { Case dependent, don't change }
+  {$define SYSPROCDEFINED}
+{$endif cpuarm}
+
 procedure fillchar(var x;count : longint;value : boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
 procedure fillchar(var x;count : longint;value : boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
 begin
 begin
   fillchar(x,count,byte(value));
   fillchar(x,count,byte(value));
@@ -766,7 +767,12 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.41  2003-08-21 22:10:55  olle
+  Revision 1.42  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.41  2003/08/21 22:10:55  olle
     - removed parameter from fpc_iocheck
     - removed parameter from fpc_iocheck
     * changed processor compiler directive * to cpu*
     * changed processor compiler directive * to cpu*
 
 

+ 24 - 1
rtl/inc/systemh.inc

@@ -147,6 +147,24 @@ Type
   PComp = ^Comp;
   PComp = ^Comp;
 {$endif CPUSPARC}
 {$endif CPUSPARC}
 
 
+{$ifdef CPUARM}
+  {$define DEFAULT_DOUBLE}
+
+  {$define SUPPORT_SINGLE}
+  {$define SUPPORT_DOUBLE}
+
+  {$define FPC_INCLUDE_SOFTWARE_MOD_DIV}
+  {$define FPC_INCLUDE_SOFTWARE_SHIFT_INT64}
+  {$define FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE}
+
+  ValSInt = Longint;
+  ValUInt = Cardinal;
+  ValReal = Real;
+
+  { Comp type does not exist on fpu }
+  Comp    = int64;
+{$endif CPUARM}
+
 {$ifdef CPU64}
 {$ifdef CPU64}
   StrLenInt = Int64;
   StrLenInt = Int64;
   SizeInt = Int64;
   SizeInt = Int64;
@@ -672,7 +690,12 @@ const
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.70  2003-09-01 20:47:23  peter
+  Revision 1.71  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.70  2003/09/01 20:47:23  peter
     * pcomp added for sparc
     * pcomp added for sparc
 
 
   Revision 1.69  2003/05/01 08:05:23  florian
   Revision 1.69  2003/05/01 08:05:23  florian

+ 15 - 2
rtl/inc/variant.inc

@@ -67,6 +67,14 @@ Begin
   end;
   end;
 End;
 End;
 
 
+function fpc_variant_to_dynarray(const v : variant;typeinfo : pointer) : pointer;compilerproc;
+  begin
+  end;
+  
+function fpc_dynarray_to_variant(const v : variant;typeinfo : pointer) : pointer;compilerproc;
+  begin
+  end;
+
 { ---------------------------------------------------------------------
 { ---------------------------------------------------------------------
     Overloaded operators.
     Overloaded operators.
   ---------------------------------------------------------------------}
   ---------------------------------------------------------------------}
@@ -578,7 +586,12 @@ procedure initvariantmanager;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.12  2002-10-10 19:24:28  florian
+  Revision 1.13  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.12  2002/10/10 19:24:28  florian
     + write(ln) support for variants added
     + write(ln) support for variants added
 
 
   Revision 1.11  2002/10/09 20:13:26  florian
   Revision 1.11  2002/10/09 20:13:26  florian
@@ -602,4 +615,4 @@ procedure initvariantmanager;
   Revision 1.5  2002/09/07 15:07:46  peter
   Revision 1.5  2002/09/07 15:07:46  peter
     * old logs removed and tabs fixed
     * old logs removed and tabs fixed
 
 
-}
+}

+ 18 - 2
rtl/linux/signal.inc

@@ -19,7 +19,7 @@
 Const 			// OS specific parameters for general sigset behaviour
 Const 			// OS specific parameters for general sigset behaviour
    SIG_MAXSIG      = 1024;	// highest signal version
    SIG_MAXSIG      = 1024;	// highest signal version
    wordsinsigset   = 32;	// words in sigset_t
    wordsinsigset   = 32;	// words in sigset_t
-   ln2bitsinword   = 5;         { 32bit : ln(32)/ln(2)=5 } 
+   ln2bitsinword   = 5;         { 32bit : ln(32)/ln(2)=5 }
 
 
    ln2bitmask	   = 2 shl ln2bitsinword - 1;
    ln2bitmask	   = 2 shl ln2bitsinword - 1;
 
 
@@ -125,6 +125,7 @@ type
   end;
   end;
 {$endif cpui386}
 {$endif cpui386}
 
 
+
 {$Ifdef cpum68k}
 {$Ifdef cpum68k}
   PSigContextRec = ^SigContextRec;
   PSigContextRec = ^SigContextRec;
   SigContextRec = record
   SigContextRec = record
@@ -132,12 +133,15 @@ type
   end;
   end;
 {$endif cpum68k}
 {$endif cpum68k}
 
 
+
 {$ifdef cpupowerpc}
 {$ifdef cpupowerpc}
   PSigContextRec = ^SigContextRec;
   PSigContextRec = ^SigContextRec;
   SigContextRec = record
   SigContextRec = record
     { dummy for now PM }
     { dummy for now PM }
   end;
   end;
 {$endif cpupowerpc}
 {$endif cpupowerpc}
+
+
 {$ifdef cpusparc}
 {$ifdef cpusparc}
   PSigContextRec = ^SigContextRec;
   PSigContextRec = ^SigContextRec;
   SigContextRec = record
   SigContextRec = record
@@ -145,6 +149,13 @@ type
   end;
   end;
 {$endif cpusparc}
 {$endif cpusparc}
 
 
+
+{$ifdef cpuarm}
+  PSigContextRec = ^SigContextRec;
+  SigContextRec = record
+    { dummy for now PM }
+  end;
+{$endif cpuarm}
 (*
 (*
   PSigInfoRec = ^SigInfoRec;
   PSigInfoRec = ^SigInfoRec;
   SigInfoRec = record
   SigInfoRec = record
@@ -224,7 +235,12 @@ type
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.10  2003-08-21 22:24:52  olle
+  Revision 1.11  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.10  2003/08/21 22:24:52  olle
     - removed parameter from fpc_iocheck
     - removed parameter from fpc_iocheck
 
 
   Revision 1.9  2002/12/24 21:30:20  mazen
   Revision 1.9  2002/12/24 21:30:20  mazen

+ 28 - 0
rtl/objpas/rtlconst.pp

@@ -0,0 +1,28 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2003 by Florian Klaempfl
+    member of the Free Pascal development team
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit rtlconst;
+
+  interface
+
+  implementation
+
+end.
+{
+  $Log$
+  Revision 1.1  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+}

+ 28 - 0
rtl/objpas/sysconst.pp

@@ -0,0 +1,28 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2003 by Florian Klaempfl
+    member of the Free Pascal development team
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit sysconst;
+
+  interface
+
+  implementation
+
+end.
+{
+  $Log$
+  Revision 1.1  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+}

+ 9 - 3
rtl/powerpc/math.inc

@@ -152,7 +152,7 @@ LTruncNoAdd:
         beq    cr0,LTruncPositive
         beq    cr0,LTruncPositive
         subfic r4,r4,0
         subfic r4,r4,0
         subfze r3,r3
         subfze r3,r3
-LTruncPositive: 
+LTruncPositive:
       end;
       end;
 
 
 
 
@@ -248,7 +248,7 @@ LRoundNoAdd:
         beq    cr0,LRoundPositive
         beq    cr0,LRoundPositive
         subfic r4,r4,0
         subfic r4,r4,0
         subfze r3,r3
         subfze r3,r3
-LRoundPositive: 
+LRoundPositive:
       end;
       end;
 
 
 
 
@@ -342,6 +342,7 @@ LRoundPositive:
                          Int to real helpers
                          Int to real helpers
  ****************************************************************************}
  ****************************************************************************}
 
 
+{$define FPC_SYSTEM_HAS_INT64_TO_DOUBLE}
 function fpc_int64_to_double(i: int64): double; compilerproc;
 function fpc_int64_to_double(i: int64): double; compilerproc;
 assembler;
 assembler;
 { input: high(i) in r4, low(i) in r3 }
 { input: high(i) in r4, low(i) in r3 }
@@ -424,7 +425,12 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.27  2003-08-08 22:02:05  olle
+  Revision 1.28  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.27  2003/08/08 22:02:05  olle
     * small bugfix macos
     * small bugfix macos
 
 
   Revision 1.26  2003/06/14 12:41:08  jonas
   Revision 1.26  2003/06/14 12:41:08  jonas

+ 7 - 2
rtl/unix/sysunix.inc

@@ -804,7 +804,12 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.32  2003-08-21 22:21:00  olle
+  Revision 1.33  2003-09-03 14:09:37  florian
+    * arm fixes to the common rtl code
+    * some generic math code fixed
+    * ...
+
+  Revision 1.32  2003/08/21 22:21:00  olle
     - removed parameter from fpc_iocheck
     - removed parameter from fpc_iocheck
 
 
   Revision 1.31  2002/10/14 19:39:17  peter
   Revision 1.31  2002/10/14 19:39:17  peter
@@ -847,4 +852,4 @@ End.
   Revision 1.19  2002/03/11 19:10:33  peter
   Revision 1.19  2002/03/11 19:10:33  peter
     * Regenerated with updated fpcmake
     * Regenerated with updated fpcmake
 
 
-}
+}

+ 14 - 5
rtl/win32/Makefile.fpc

@@ -14,7 +14,7 @@ units=$(SYSTEMUNIT) systhrds objpas strings \
       sysutils typinfo math varutils variants \
       sysutils typinfo math varutils variants \
       cpu mmx charset ucomplex getopts \
       cpu mmx charset ucomplex getopts \
       wincrt winmouse winevent sockets printer dynlibs \
       wincrt winmouse winevent sockets printer dynlibs \
-      video mouse keyboard types comobj
+      video mouse keyboard types comobj dateutils rtlconst sysconst
 rsts=math varutils typinfo
 rsts=math varutils typinfo
 
 
 [require]
 [require]
@@ -92,10 +92,10 @@ SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
 
 
 wprt0$(OEXT) : $(PRT0).as
 wprt0$(OEXT) : $(PRT0).as
         $(AS) -o wprt0$(OEXT) $(PRT0).as
         $(AS) -o wprt0$(OEXT) $(PRT0).as
-        
+
 gprt0$(OEXT) : gprt0.as
 gprt0$(OEXT) : gprt0.as
         $(AS) -o gprt0$(OEXT) gprt0.as
         $(AS) -o gprt0$(OEXT) gprt0.as
-        
+
 
 
 wdllprt0$(OEXT) : wdllprt0.as
 wdllprt0$(OEXT) : wdllprt0.as
         $(AS) -o wdllprt0$(OEXT) wdllprt0.as
         $(AS) -o wdllprt0$(OEXT) wdllprt0.as
@@ -186,12 +186,21 @@ varutils$(PPUEXT) : varutils.pp $(OBJPASDIR)/cvarutil.inc \
                     objpas$(PPUEXT) $(OBJPASDIR)/varutilh.inc
                     objpas$(PPUEXT) $(OBJPASDIR)/varutilh.inc
         $(COMPILER) -I$(OBJPASDIR) varutils.pp
         $(COMPILER) -I$(OBJPASDIR) varutils.pp
 
 
-types$(PPUEXT) : $(OBJPASDIR/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
+types$(PPUEXT) : $(OBJPASDIR)/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
         $(COMPILER) $(OBJPASDIR)/types.pp
         $(COMPILER) $(OBJPASDIR)/types.pp
 
 
 comobj$(PPUEXT) : comobj.pp activex$(PPUEXT) sysutils$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) $(OBJPASDIR)/comobjh.inc $(OBJPASDIR)/comobj.inc
 comobj$(PPUEXT) : comobj.pp activex$(PPUEXT) sysutils$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) $(OBJPASDIR)/comobjh.inc $(OBJPASDIR)/comobj.inc
         $(COMPILER) -I$(OBJPASDIR) comobj.pp
         $(COMPILER) -I$(OBJPASDIR) comobj.pp
 
 
+rtlconst$(PPUEXT) : $(OBJPASDIR)/rtlconst.pp
+	$(COMPILER) $(OBJPASDIR)/rtlconst.pp
+
+sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp
+	$(COMPILER) $(OBJPASDIR)/sysconst.pp
+
+dateutils$(PPUEXT) : $(OBJPASDIR)/dateutils.pp
+	$(COMPILER) $(OBJPASDIR)/dateutils.pp
+
 #
 #
 # Other system-independent RTL Units
 # Other system-independent RTL Units
 #
 #
@@ -215,4 +224,4 @@ ucomplex$(PPUEXT) : $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 # Other system-dependent RTL Units
 # Other system-dependent RTL Units
 #
 #
 
 
-callspec$(PPUEXT) : $(INC)/callspec.pp $(SYSTEMUNIT)$(PPUEXT)
+callspec$(PPUEXT) : $(INC)/callspec.pp $(SYSTEMUNIT)$(PPUEXT)