Browse Source

* arm startup code fixed
* made some generic math code more readable

florian 21 years ago
parent
commit
2e80f0de5f
2 changed files with 25 additions and 21 deletions
  1. 12 17
      rtl/inc/genmath.inc
  2. 13 4
      rtl/linux/arm/prt0.as

+ 12 - 17
rtl/inc/genmath.inc

@@ -134,7 +134,6 @@ End;
       aExp, shiftCount: smallint;
       aSig0, aSig1, absZ, aSigExtra: longint;
       z: longint;
-      label invalid;
    Begin
      aSig1 := extractFloat64Frac1( a );
      aSig0 := extractFloat64Frac0( a );
@@ -143,22 +142,18 @@ End;
      shiftCount := aExp - $413;
      if ( 0 <= shiftCount ) then
      Begin
-         if ( $41E < aExp ) then
-         Begin
-             if ( ( aExp = $7FF ) AND  (( aSig0 OR  aSig1 )<>0) ) then
-                aSign := 0;
-             goto invalid;
-         End;
-         shortShift64Left(
-             aSig0 OR  $00100000, aSig1, shiftCount, absZ, aSigExtra );
+        if (aExp=$7FF)  and ((aSig0 or aSig1)<>0) then
+          HandleError(207);
+        shortShift64Left(
+          aSig0 OR  $00100000, aSig1, shiftCount, absZ, aSigExtra );
      End
      else
      Begin
          if ( aExp < $3FF ) then
-         Begin
+           begin
              float64_to_int32_round_to_zero := 0;
              exit;
-         End;
+           end;
          aSig0 := aSig0 or $00100000;
          aSigExtra := ( aSig0 shl ( shiftCount and 31 ) ) OR  aSig1;
          absZ := aSig0 shr ( - shiftCount );
@@ -168,11 +163,7 @@ End;
      else
        z:=absZ;
      if ((aSign<>0) xor (z<0)) AND  (z<>0) then
-     Begin
-  invalid:
-        HandleError(207);
-        exit;
-    End;
+       HandleError(207);
     float64_to_int32_round_to_zero := z;
    End;
 
@@ -1189,7 +1180,11 @@ function fpc_int64_to_double(i : int64): double; compilerproc;
 
 {
   $Log$
-  Revision 1.21  2004-02-04 14:15:57  florian
+  Revision 1.22  2004-03-11 22:39:53  florian
+    * arm startup code fixed
+    * made some generic math code more readable
+
+  Revision 1.21  2004/02/04 14:15:57  florian
     * fixed generic system.int(...)
 
   Revision 1.20  2004/01/24 18:15:58  florian

+ 13 - 4
rtl/linux/arm/prt0.as

@@ -60,13 +60,18 @@ _start:
 	ldr ip,=U_SYSTEM_ENVP
 
 	str sp,[a3]
-        str a2,[ip]
+    str a2,[ip]
 
 	/* Let the libc call main and exit with its return code.  */
 	bl PASCALMAIN
 
-	/* should never get here....*/
-	/* bl abort */
+	.globl  _haltproc
+    .type   _haltproc,#function
+_haltproc:
+	ldr		r0,=U_SYSTEM_EXITCODE
+	ldrb	r0,[r0]
+	swi		0x900001
+	b		_haltproc
 	
 	/* Define a symbol for the first piece of initialized data.  */
 	.data
@@ -96,7 +101,11 @@ __data_start:
 
 /*
   $Log$
-  Revision 1.2  2004-01-20 18:32:46  florian
+  Revision 1.3  2004-03-11 22:39:53  florian
+    * arm startup code fixed
+    * made some generic math code more readable
+
+  Revision 1.2  2004/01/20 18:32:46  florian
     * fixed sigill problem when running in gdb
 
   Revision 1.1  2003/08/27 13:07:07  florian