瀏覽代碼

* save edi,esi,ebx

peter 22 年之前
父節點
當前提交
cba9b5206d
共有 7 個文件被更改,包括 339 次插入131 次删除
  1. 91 32
      rtl/i386/i386.inc
  2. 9 6
      rtl/i386/math.inc
  3. 105 31
      rtl/i386/set.inc
  4. 94 23
      rtl/i386/strings.inc
  5. 11 4
      rtl/i386/stringss.inc
  6. 9 2
      rtl/i386/strlen.inc
  7. 20 33
      rtl/i386/typinfo.inc

+ 91 - 32
rtl/i386/i386.inc

@@ -23,7 +23,11 @@
 
 {$define FPC_SYSTEM_HAS_MOVE}
 procedure Move(const source;var dest;count:longint);assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl    dest,%edi
         movl    source,%esi
         movl    %edi,%eax
@@ -88,15 +92,17 @@ asm
         movsb
         cld
 .LMoveEnd:
-end ['EAX','EBX','ECX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 
 
 {$define FPC_SYSTEM_HAS_FILLCHAR}
-Procedure FillChar(var x;count:longint;value:byte);
-{ alias seems to be nowhere used? (JM)
-   [public,alias: 'FPC_FILLCHAR']; }
-assembler;
+Procedure FillChar(var x;count:longint;value:byte);assembler;
+var
+  saveedi : longint;
 asm
+        movl    %edi,saveedi
         cld
         movl    x,%edi
         movb    value,%al
@@ -127,12 +133,16 @@ asm
         rep
         stosb
 .LFillEnd:
+        movl    saveedi,%edi
 end;
 
 
 {$define FPC_SYSTEM_HAS_FILLWORD}
 procedure fillword(var x;count : longint;value : word);assembler;
+var
+  saveedi : longint;
 asm
+        movl    %edi,saveedi
         movl    x,%edi
         movl    count,%ecx
 { check for zero or negative count }
@@ -152,12 +162,16 @@ asm
         rep
         stosw
 .LFillWordEnd:
-end ['EAX','ECX','EDX','EDI'];
+        movl    saveedi,%edi
+end;
 
 
 {$define FPC_SYSTEM_HAS_FILLDWORD}
 procedure filldword(var x;count : longint;value : dword);assembler;
+var
+  saveedi : longint;
 asm
+        movl    %edi,saveedi
         movl    x,%edi
         movl    count,%ecx
 { check for zero or negative count }
@@ -168,84 +182,101 @@ asm
         rep
         stosl
 .LFillDWordEnd:
-end ['EAX','ECX','EDX','EDI'];
+        movl    saveedi,%edi
+end;
 
 
 {$define FPC_SYSTEM_HAS_INDEXBYTE}
 function IndexByte(Const buf;len:longint;b:byte):longint; assembler;
+var
+  saveedi : longint;
 asm
+        movl    %edi,saveedi
         xorl    %eax,%eax
         movl    Len,%ecx       // Load len
         movl    Buf,%edi       // Load String
         testl   %ecx,%ecx
         jz      .Lready
         cld
-        movl    %ecx,%ebx      // Copy for easy manipulation
+        movl    %ecx,%edx      // Copy for easy manipulation
         movb    b,%al
         repne
         scasb
         jne     .Lcharposnotfound
         incl    %ecx
-        subl    %ecx,%ebx
-        movl    %ebx,%eax
+        subl    %ecx,%edx
+        movl    %edx,%eax
         jmp     .Lready
 .Lcharposnotfound:
         movl    $-1,%eax
 .Lready:
-end ['EAX','EBX','ECX','EDI'];
+        movl    saveedi,%edi
+end;
 
 
 {$define FPC_SYSTEM_HAS_INDEXWORD}
 function Indexword(Const buf;len:longint;b:word):longint; assembler;
+var
+  saveedi : longint;
 asm
+        movl    %edi,saveedi
         xorl    %eax,%eax
         movl    Len,%ecx       // Load len
         movl    Buf,%edi       // Load String
         testl   %ecx,%ecx
         jz      .Lready
         cld
-        movl    %ecx,%ebx      // Copy for easy manipulation
+        movl    %ecx,%edx      // Copy for easy manipulation
         movw    b,%ax
         repne
         scasw
         jne     .Lcharposnotfound
         incl    %ecx
-        subl    %ecx,%ebx
-        movl    %ebx,%eax
+        subl    %ecx,%edx
+        movl    %edx,%eax
         jmp     .Lready
 .Lcharposnotfound:
         movl    $-1,%eax
 .Lready:
-end ['EAX','EBX','ECX','EDI'];
+        movl    saveedi,%edi
+end;
 
 
 {$define FPC_SYSTEM_HAS_INDEXDWORD}
 function IndexDWord(Const buf;len:longint;b:DWord):longint; assembler;
+var
+  saveedi : longint;
 asm
+        movl    %edi,saveedi
         xorl    %eax,%eax
         movl    Len,%ecx       // Load len
         movl    Buf,%edi       // Load String
         testl   %ecx,%ecx
         jz      .Lready
         cld
-        movl    %ecx,%ebx      // Copy for easy manipulation
+        movl    %ecx,%edx      // Copy for easy manipulation
         movl    b,%eax
         repne
         scasl
         jne     .Lcharposnotfound
         incl    %ecx
-        subl    %ecx,%ebx
-        movl    %ebx,%eax
+        subl    %ecx,%edx
+        movl    %edx,%eax
         jmp     .Lready
 .Lcharposnotfound:
         movl    $-1,%eax
 .Lready:
-end ['EAX','EBX','ECX','EDI'];
+        movl    saveedi,%edi
+end;
 
 
 {$define FPC_SYSTEM_HAS_COMPAREBYTE}
 function CompareByte(Const buf1,buf2;len:longint):longint; assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         cld
         movl    len,%eax
         movl    buf2,%esi       { Load params}
@@ -282,13 +313,20 @@ asm
         movzbl  -1(%edi),%eax      // Compare failing (or equal) position
         subl    %ecx,%eax
 .LCmpbyteExit:
-end ['ECX','EAX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 
 
 
 {$define FPC_SYSTEM_HAS_COMPAREWORD}
 function CompareWord(Const buf1,buf2;len:longint):longint; assembler;
+var
+  saveesi,saveedi,saveebx : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
+        movl    %ebx,saveebx
         cld
         movl    len,%eax
         movl    buf2,%esi       { Load params}
@@ -335,12 +373,20 @@ asm
         movzwl  -2(%edi),%eax    // Compare failing (or equal) position
         subl    %ecx,%eax        // calculate end result.
 .LCmpwordExit:
-end ['EBX','EDX','ECX','EAX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+        movl    saveebx,%ebx
+end;
 
 
 {$define FPC_SYSTEM_HAS_COMPAREDWORD}
 function CompareDWord(Const buf1,buf2;len:longint):longint; assembler;
+var
+  saveesi,saveedi,saveebx : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
+        movl    %ebx,saveebx
         cld
         movl    len,%eax
         movl    buf2,%esi       { Load params}
@@ -385,12 +431,19 @@ asm
         movzwl  -4(%edi),%eax    // Compare failing (or equal) position
         subl    %ecx,%eax        // calculate end result.
 .LCmpDwordExit:
-end ['EBX','EDX','ECX','EAX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+        movl    saveebx,%ebx
+end;
 
 
 {$define FPC_SYSTEM_HAS_INDEXCHAR0}
 function IndexChar0(Const buf;len:longint;b:Char):longint; assembler;
+var
+  saveesi,saveebx : longint;
 asm
+        movl    %esi,saveesi
+        movl    %ebx,saveebx
 // Can't use scasb, or will have to do it twice, think this
 //   is faster for small "len"
         movl    Buf,%esi        // Load address
@@ -414,7 +467,9 @@ asm
         movl    $-1,%ecx        // Not found return -1
 .LFound:
         movl    %ecx,%eax
-end['EAX','EBX','ECX','EDX','ESI'];
+        movl    saveesi,%esi
+        movl    saveebx,%ebx
+end;
 
 
 {****************************************************************************
@@ -1200,35 +1255,36 @@ end;
 function declocked(var l : longint) : boolean;assembler;
 
   asm
-     movl       l,%edi
+     movl       l,%eax
      { this check should be done because a lock takes a lot }
      { of time!                                             }
      cmpb       $0,IsMultithread
      jz         .Ldeclockednolock
      lock
-     decl       (%edi)
+     decl       (%eax)
      jmp        .Ldeclockedend
 .Ldeclockednolock:
-     decl       (%edi);
+     decl       (%eax);
 .Ldeclockedend:
      setzb      %al
-  end ['EDI','EAX'];
+  end;
+
 {$define FPC_SYSTEM_HAS_INCLOCKED}
 procedure inclocked(var l : longint);assembler;
 
   asm
-     movl       l,%edi
+     movl       l,%eax
      { this check should be done because a lock takes a lot }
      { of time!                                             }
      cmpb       $0,IsMultithread
      jz         .Linclockednolock
      lock
-     incl       (%edi)
+     incl       (%eax)
      jmp        .Linclockedend
 .Linclockednolock:
-     incl       (%edi)
+     incl       (%eax)
 .Linclockedend:
-  end ['EDI'];
+  end;
 
 {****************************************************************************
                                   FPU
@@ -1257,7 +1313,10 @@ end;
 
 {
   $Log$
-  Revision 1.45  2003-06-01 14:50:17  jonas
+  Revision 1.46  2003-09-08 18:21:37  peter
+    * save edi,esi,ebx
+
+  Revision 1.45  2003/06/01 14:50:17  jonas
     * fpc_shortstr_append_shortstr has to use high(s1) instead of 255 as
       maxlen
     + ppc version of fpc_shortstr_append_shortstr

+ 9 - 6
rtl/i386/math.inc

@@ -106,7 +106,7 @@
             fstp %st(1)
             fclex
             fldcw -4(%ebp)
-      end ['ECX'];
+      end;
 
 
     {$define FPC_SYSTEM_HAS_INT}
@@ -124,7 +124,7 @@
             frndint
             fclex
             fldcw -4(%ebp)
-      end ['ECX'];
+      end;
 
 
 
@@ -147,13 +147,13 @@
             movl res,%eax
             movl res+4,%edx
             fldcw oldcw
-      end ['EAX','ECX','EDX'];
+      end;
 
 
     {$define FPC_SYSTEM_HAS_ROUND}
 {$ifdef hascompilerproc}
     function round(d : extended) : int64;[internconst:in_const_round, external name 'FPC_ROUND'];
-    
+
     function fpc_round(d : extended) : int64;assembler;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
 {$else}
     function round(d : extended) : int64;assembler;[internconst:in_const_round];
@@ -173,7 +173,7 @@
             movl res,%eax
             movl res+4,%edx
             fldcw oldcw
-      end ['EAX','EDX'];
+      end;
 
 
     {$define FPC_SYSTEM_HAS_POWER}
@@ -198,7 +198,10 @@
 
 {
   $Log$
-  Revision 1.14  2003-04-23 21:28:21  peter
+  Revision 1.15  2003-09-08 18:21:37  peter
+    * save edi,esi,ebx
+
+  Revision 1.14  2003/04/23 21:28:21  peter
     * fpc_round added, needed for int64 currency
 
   Revision 1.13  2003/02/05 19:53:17  carl

+ 105 - 31
rtl/i386/set.inc

@@ -20,7 +20,10 @@ function fpc_set_load_small(l: fpc_small_set): fpc_normal_set;assembler;[public,
 {
   load a normal set p from a smallset l
 }
+var
+  saveedi : longint;
 asm
+        movl    %edi,saveedi
         movl    __RESULT,%edi
         movl    l,%eax
         stosl
@@ -28,7 +31,8 @@ asm
         movl    $7,%ecx
         rep
         stosl
-end ['EAX','ECX','EDI'];
+        movl    saveedi,%edi
+end;
 
 {$define FPC_SYSTEM_HAS_FPC_SET_CREATE_ELEMENT}
 
@@ -36,11 +40,14 @@ function fpc_set_create_element(b : byte): fpc_normal_set;assembler;[public,alia
 {
   create a new set in p from an element b
 }
+var
+  saveedi : longint;
 asm
 {$ifndef hascompilerproc}
         pushl   %eax
         pushl   %ecx
 {$endif not hascompilerproc}
+        movl    %edi,saveedi
         movl    __RESULT,%edi
         xorl    %eax,%eax
         movl    $8,%ecx
@@ -49,11 +56,12 @@ asm
         leal    -32(%edi),%eax
         movzbl  b,%edi
         btsl    %edi,(%eax)
+        movl    saveedi,%edi
 {$ifndef hascompilerproc}
         popl    %ecx
         popl    %eax
 {$endif hascompilerproc}
-end ['EAX','ECX','EDI'];
+end;
 
 
 {$define FPC_SYSTEM_HAS_FPC_SET_SET_BYTE}
@@ -62,16 +70,22 @@ function fpc_set_set_byte(const source: fpc_normal_set; b : byte): fpc_normal_se
 {
   add the element b to the set pointed by source
 }
+var
+  saveesi,saveedi : longint;
 asm
-       movl $8,%ecx
-       movl source,%esi
-       movl __RESULT,%edi
-       rep
-       movsl
-       leal    -32(%edi),%eax
-       movzbl  b,%edi
-       btsl    %edi,(%eax)
-end ['EAX','ECX','ESI','EDI'];
+        movl    %edi,saveedi
+        movl    %esi,saveesi
+        movl    $8,%ecx
+        movl    source,%esi
+        movl    __RESULT,%edi
+        rep
+        movsl
+        leal    -32(%edi),%eax
+        movzbl  b,%edi
+        btsl    %edi,(%eax)
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 {$else hascompilerproc}
 function fpc_set_set_byte(b : byte): fpc_normal_set;assembler;[public,alias:'FPC_SET_SET_BYTE'];
 {
@@ -98,16 +112,22 @@ function fpc_set_unset_byte(const source: fpc_normal_set; b : byte): fpc_normal_
 {
   add the element b to the set pointed by source
 }
+var
+  saveesi,saveedi : longint;
 asm
-       movl $8,%ecx
-       movl source,%esi
-       movl __RESULT,%edi
-       rep
-       movsl
-       leal    -32(%edi),%eax
-       movzbl  b,%edi
-       btrl    %edi,(%eax)
-end ['EAX','ECX','ESI','EDI'];
+        movl    %edi,saveedi
+        movl    %esi,saveesi
+        movl    $8,%ecx
+        movl    source,%esi
+        movl    __RESULT,%edi
+        rep
+        movsl
+        leal    -32(%edi),%eax
+        movzbl  b,%edi
+        btrl    %edi,(%eax)
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 {$else hascompilerproc}
 function fpc_set_unset_byte(b : byte): fpc_normal_set;assembler;[public,alias:'FPC_SET_UNSET_BYTE']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {
@@ -136,7 +156,12 @@ function fpc_set_set_range(const orgset: fpc_normal_set; l,h : byte): fpc_normal
 {
   adds the range [l..h] to the set pointed to by p
 }
+var
+  saveesi,saveedi,saveebx : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
+        movl    %ebx,saveebx
         movzbl l,%eax               // lowest bit to be set in eax
         movzbl h,%ebx               // highest in ebx
         movl   $8,%ecx              // we have to copy 32 bytes
@@ -179,6 +204,9 @@ asm
         andl   %edx,%ebx            // combine both bitmasks
         orl    %ebx,(%edi)          // store to set
 .Lset_range_done:
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+        movl    saveebx,%ebx
 end;
 
 {$else hascompilerproc}
@@ -235,11 +263,17 @@ function fpc_set_in_byte(const p: fpc_normal_set; b: byte): boolean; assembler;
   tests if the element b is in the set p the carryflag is set if it present
 }
 asm
+{$ifdef hascompilerproc}
+       movl   p,%edx
+       movzbl b,%eax
+       btl %eax,(%edx)
+{$else hascompilerproc}
        pushl %eax
        movl   p,%edi
        movzbl b,%eax
        btl %eax,(%edi)
        popl %eax
+{$endif hascompilerproc}
 end;
 
 
@@ -253,9 +287,13 @@ procedure fpc_set_add_sets(set1,set2,dest : pointer);assembler;[public,alias:'FP
 {
   adds set1 and set2 into set dest
 }
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
       movl set1,%esi
-      movl set2,%ebx
+      movl set2,%edx
 {$ifdef hascompilerproc}
       movl __RESULT,%edi
 {$else hascompilerproc}
@@ -264,11 +302,13 @@ asm
       movl $8,%ecx
    .LMADDSETS1:
       lodsl
-      orl (%ebx),%eax
+      orl (%edx),%eax
       stosl
-      addl $4,%ebx
+      addl $4,%edx
       decl %ecx
       jnz .LMADDSETS1
+        movl    saveedi,%edi
+        movl    saveesi,%esi
 end;
 
 
@@ -282,9 +322,13 @@ procedure fpc_set_mul_sets(set1,set2,dest:pointer);assembler;[public,alias:'FPC_
 {
   multiplies (takes common elements of) set1 and set2 result put in dest
 }
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
       movl set1,%esi
-      movl set2,%ebx
+      movl set2,%edx
 {$ifdef hascompilerproc}
       movl __RESULT,%edi
 {$else hascompilerproc}
@@ -293,11 +337,13 @@ asm
       movl $8,%ecx
   .LMMULSETS1:
       lodsl
-      andl (%ebx),%eax
+      andl (%edx),%eax
       stosl
-      addl $4,%ebx
+      addl $4,%edx
       decl %ecx
       jnz .LMMULSETS1
+        movl    saveedi,%edi
+        movl    saveesi,%esi
 end;
 
 
@@ -311,7 +357,12 @@ procedure fpc_set_sub_sets(set1,set2,dest:pointer);assembler;[public,alias:'FPC_
 {
   computes the diff from set1 to set2 result in dest
 }
+var
+  saveesi,saveedi,saveebx : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
+        movl    %ebx,saveebx
         movl set1,%esi
         movl set2,%ebx
 {$ifdef hascompilerproc}
@@ -329,6 +380,9 @@ asm
         addl $4,%ebx
         decl %ecx
         jnz .LMSUBSETS1
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+        movl    saveebx,%ebx
 end;
 
 
@@ -342,9 +396,13 @@ procedure fpc_set_symdif_sets(set1,set2,dest:pointer);assembler;[public,alias:'F
 {
    computes the symetric diff from set1 to set2 result in dest
 }
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl set1,%esi
-        movl set2,%ebx
+        movl set2,%edx
 {$ifdef hascompilerproc}
       movl __RESULT,%edi
 {$else hascompilerproc}
@@ -353,12 +411,13 @@ asm
         movl $8,%ecx
     .LMSYMDIFSETS1:
         lodsl
-        movl (%ebx),%edx
-        xorl %edx,%eax
+        xorl (%edx),%eax
         stosl
-        addl $4,%ebx
+        addl $4,%edx
         decl %ecx
         jnz .LMSYMDIFSETS1
+        movl    saveedi,%edi
+        movl    saveesi,%esi
 end;
 
 
@@ -368,7 +427,11 @@ function fpc_set_comp_sets(const set1,set2: fpc_normal_set): boolean;assembler;[
 {
   compares set1 and set2 zeroflag is set if they are equal
 }
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl set1,%esi
         movl set2,%edi
         movl $8,%ecx
@@ -387,6 +450,8 @@ asm
 {$ifdef hascompilerproc}
         seteb %al
 {$endif hascompilerproc}
+        movl    saveedi,%edi
+        movl    saveesi,%esi
 end;
 
 
@@ -396,7 +461,11 @@ function fpc_set_contains_sets(const set1,set2: fpc_normal_set): boolean;assembl
 {
   on exit, zero flag is set if set1 <= set2 (set2 contains set1)
 }
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl set1,%esi
         movl set2,%edi
         movl $8,%ecx
@@ -416,6 +485,8 @@ asm
 {$ifdef hascompilerproc}
         seteb %al
 {$endif hascompilerproc}
+        movl    saveedi,%edi
+        movl    saveesi,%esi
 end;
 
 
@@ -582,7 +653,10 @@ end;
 
 {
   $Log$
-  Revision 1.10  2003-05-26 19:36:46  peter
+  Revision 1.11  2003-09-08 18:21:37  peter
+    * save edi,esi,ebx
+
+  Revision 1.10  2003/05/26 19:36:46  peter
     * fpc_shortstr_concat is now the same for all targets
     * fpc_shortstr_append_shortstr added for optimized code generation
 

+ 94 - 23
rtl/i386/strings.inc

@@ -19,7 +19,11 @@
 
 {$define FPC_UNIT_HAS_STRCOPY}
 function strcopy(dest,source : pchar) : pchar;assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl    source,%edi
         testl   %edi,%edi
         jz      .LStrCopyDone
@@ -72,12 +76,18 @@ asm
         movb    %al,(%edi)
 .LStrCopyDone:
         movl    dest,%eax
-end ['EAX','EDX','ECX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 
 
 {$define FPC_UNIT_HAS_STRECOPY}
 function strecopy(dest,source : pchar) : pchar;assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         cld
         movl    source,%edi
         movl    $0xffffffff,%ecx
@@ -98,12 +108,18 @@ asm
         movl    dest,%eax
         decl    %edi
         movl    %edi,%eax
-end ['EAX','ECX','ESI','EDI'];
+        movl    %edi,saveedi
+        movl    %esi,saveesi
+end;
 
 
 {$define FPC_UNIT_HAS_STRLCOPY}
 function strlcopy(dest,source : pchar;maxlen : longint) : pchar;assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl    source,%esi
         movl    maxlen,%ecx
         movl    dest,%edi
@@ -123,7 +139,9 @@ asm
         stosb                   // add a #0
 .LSTRLCOPY3:
         movl    dest,%eax
-end ['EAX','ECX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 
 
 {$define FPC_UNIT_HAS_STRLEN}
@@ -133,7 +151,10 @@ function strlen(p : pchar) : longint;assembler;
 
 {$define FPC_UNIT_HAS_STREND}
 function strend(p : pchar) : pchar;assembler;
+var
+  saveedi : longint;
 asm
+        movl    %edi,saveedi
         cld
         xorl    %eax,%eax
         movl    p,%edi
@@ -146,13 +167,18 @@ asm
         movl    %edi,%eax
         decl    %eax
 .LStrEndNil:
-end ['EDI','ECX','EAX'];
+        movl    saveedi,%edi
+end;
 
 
 
 {$define FPC_UNIT_HAS_STRCOMP}
 function strcomp(str1,str2 : pchar) : longint;assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl    str2,%edi
         movl    $0xffffffff,%ecx
         cld
@@ -167,13 +193,19 @@ asm
         movb    -1(%esi),%al
         movzbl  -1(%edi),%ecx
         subl    %ecx,%eax
-end ['EAX','ECX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 
 
 
 {$define FPC_UNIT_HAS_STRLCOMP}
 function strlcomp(str1,str2 : pchar;l : longint) : longint;assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl    str2,%edi
         movl    $0xffffffff,%ecx
         cld
@@ -192,13 +224,19 @@ asm
         movb    -1(%esi),%al
         movzbl  -1(%edi),%ecx
         subl    %ecx,%eax
-end ['EAX','ECX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 
 
 
 {$define FPC_UNIT_HAS_STRICOMP}
 function stricomp(str1,str2 : pchar) : longint;assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl    str2,%edi
         movl    $0xffffffff,%ecx
         cld
@@ -213,29 +251,35 @@ asm
         cmpsb
         jz      .LSTRICOMP3     // If last reached then exit
         movzbl  -1(%esi),%eax
-        movzbl  -1(%edi),%ebx
+        movzbl  -1(%edi),%edx
         cmpb    $97,%al
         jb      .LSTRICOMP1
         cmpb    $122,%al
         ja      .LSTRICOMP1
         subb    $0x20,%al
 .LSTRICOMP1:
-        cmpb    $97,%bl
+        cmpb    $97,%dl
         jb      .LSTRICOMP4
-        cmpb    $122,%bl
+        cmpb    $122,%dl
         ja      .LSTRICOMP4
-        subb    $0x20,%bl
+        subb    $0x20,%dl
 .LSTRICOMP4:
-        subl    %ebx,%eax
+        subl    %edx,%eax
         jz      .LSTRICOMP2     // If still equal, compare again
 .LSTRICOMP3:
-end ['EAX','EBX','ECX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 
 
 
 {$define FPC_UNIT_HAS_STRLICOMP}
 function strlicomp(str1,str2 : pchar;l : longint) : longint;assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl    str2,%edi
         movl    $0xffffffff,%ecx
         cld
@@ -254,29 +298,35 @@ asm
         cmpsb
         jz      .LSTRLICOMP3    // If last reached, exit
         movzbl  -1(%esi),%eax
-        movzbl  -1(%edi),%ebx
+        movzbl  -1(%edi),%edx
         cmpb    $97,%al
         jb      .LSTRLICOMP1
         cmpb    $122,%al
         ja      .LSTRLICOMP1
         subb    $0x20,%al
 .LSTRLICOMP1:
-        cmpb    $97,%bl
+        cmpb    $97,%dl
         jb      .LSTRLICOMP4
-        cmpb    $122,%bl
+        cmpb    $122,%dl
         ja      .LSTRLICOMP4
-        subb    $0x20,%bl
+        subb    $0x20,%dl
 .LSTRLICOMP4:
-        subl    %ebx,%eax
+        subl    %edx,%eax
         jz      .LSTRLICOMP2
 .LSTRLICOMP3:
-end ['EAX','EBX','ECX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 
 
 
 {$define FPC_UNIT_HAS_STRSCAN}
 function strscan(p : pchar;c : char) : pchar;assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl    p,%eax
         xorl    %ecx,%ecx
         testl   %eax,%eax
@@ -390,12 +440,17 @@ asm
 .LSTRSCANNOTFOUND:
         xorl    %eax,%eax
 .LSTRSCAN:
-end ['EAX','ECX','ESI','EDI','EDX'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 
 
 {$define FPC_UNIT_HAS_STRRSCAN}
 function strrscan(p : pchar;c : char) : pchar;assembler;
+var
+  saveedi : longint;
 asm
+        movl    %edi,saveedi
         xorl    %eax,%eax
         movl    p,%edi
         orl     %edi,%edi
@@ -419,12 +474,17 @@ asm
         movl    %edi,%eax
         incl    %eax
 .LSTRRSCAN:
-end ['EAX','ECX','EDI'];
+        movl    saveedi,%edi
+end;
 
 
 {$define FPC_UNIT_HAS_STRUPPER}
 function strupper(p : pchar) : pchar;assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %edi,saveedi
+        movl    %esi,saveesi
         movl    p,%esi
         orl     %esi,%esi
         jz      .LStrUpperNil
@@ -442,12 +502,18 @@ asm
         jnz     .LSTRUPPER1
 .LStrUpperNil:
         movl    p,%eax
-end ['EAX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 
 
 {$define FPC_UNIT_HAS_STRLOWER}
 function strlower(p : pchar) : pchar;assembler;
+var
+  saveesi,saveedi : longint;
 asm
+        movl    %esi,saveesi
+        movl    %edi,saveedi
         movl    p,%esi
         orl     %esi,%esi
         jz      .LStrLowerNil
@@ -465,11 +531,16 @@ asm
         jnz     .LSTRLOWER1
 .LStrLowerNil:
         movl    p,%eax
-end ['EAX','ESI','EDI'];
+        movl    saveedi,%edi
+        movl    saveesi,%esi
+end;
 
 {
   $Log$
-  Revision 1.8  2003-04-30 16:36:39  florian
+  Revision 1.9  2003-09-08 18:21:37  peter
+    * save edi,esi,ebx
+
+  Revision 1.8  2003/04/30 16:36:39  florian
     + support for generic pchar routines added
     + some basic rtl stuff for x86-64 added
 

+ 11 - 4
rtl/i386/stringss.inc

@@ -22,8 +22,11 @@ function strpas(p : pchar) : string;
 
 {$define FPC_UNIT_HAS_STRPCOPY}
 function strpcopy(d : pchar;const s : string) : pchar;assembler;
+var
+  saveesi,saveedi : longint;
 asm
-        pushl   %esi            // Save ESI
+	movl	%edi,saveedi
+	movl    %esi,saveesi
         cld
         movl    s,%esi          // Load Source adress
         movl    d,%edi          // load destination address
@@ -33,12 +36,16 @@ asm
         movsb
         movb    $0,(%edi)
         movl    d,%eax       // return value to EAX
-        popl    %esi
-end ['EDI','EAX','ECX'];
+	movl	saveedi,%edi
+	movl    saveesi,%esi
+end;
 
 {
   $Log$
-  Revision 1.8  2003-07-07 20:22:05  peter
+  Revision 1.9  2003-09-08 18:21:37  peter
+    * save edi,esi,ebx
+
+  Revision 1.8  2003/07/07 20:22:05  peter
     * generic string routines added
 
   Revision 1.7  2002/09/07 16:01:19  peter

+ 9 - 2
rtl/i386/strlen.inc

@@ -14,7 +14,10 @@
 
  **********************************************************************}
 
+var
+  saveedi : longint;
 asm
+	movl	%edi,saveedi
         movl    p,%edi
         movl    $0xffffffff,%ecx
         xorl    %eax,%eax
@@ -23,12 +26,16 @@ asm
         scasb
         movl    $0xfffffffe,%eax
         subl    %ecx,%eax
-end ['EDI','ECX','EAX'];
+	movl	saveedi,%edi
+end;
 
 
 {
   $Log$
-  Revision 1.3  2002-09-07 16:01:19  peter
+  Revision 1.4  2003-09-08 18:21:37  peter
+    * save edi,esi,ebx
+
+  Revision 1.3  2002/09/07 16:01:19  peter
     * old logs removed and tabs fixed
 
 }

+ 20 - 33
rtl/i386/typinfo.inc

@@ -24,8 +24,6 @@
 
 Function CallIntegerFunc(s: Pointer; Address: Pointer; Index, IValue: LongInt): Int64; assembler;
   asm
-     movl S,%esi
-     movl Address,%edi
      // ? Indexed Function
      movl Index,%eax
      testl %eax,%eax
@@ -33,17 +31,15 @@ Function CallIntegerFunc(s: Pointer; Address: Pointer; Index, IValue: LongInt):
      movl IValue,%eax
      pushl %eax
   .LINoPush:
-     push %esi
+     push s
      // reset EDX for routines that return only EAX
      xorl %edx,%edx
-     call %edi
+     call Address
      // now the result is in EDX:EAX
   end;
 
 Function CallIntegerProc(s : Pointer;Address : Pointer;Value : Integer; INdex,IValue : Longint) : Integer;assembler;
   asm
-     movl S,%esi
-     movl Address,%edi
      // Push value to set
      movl Value,%eax
      pushl %eax
@@ -54,15 +50,13 @@ Function CallIntegerProc(s : Pointer;Address : Pointer;Value : Integer; INdex,IV
      movl IValue,%eax
      pushl %eax
   .LIPNoPush:
-     pushl %esi
-     call %edi
+     pushl s
+     call Address
   end;
 
 Function CallSingleFunc(s : Pointer; Address : Pointer;
   Index, IValue : Longint) : Single; assembler;
   asm
-     movl S,%esi
-     movl Address,%edi
      // ? Indexed Function
      movl Index,%eax
      testl %eax,%eax
@@ -70,16 +64,14 @@ Function CallSingleFunc(s : Pointer; Address : Pointer;
      movl IValue,%eax
      pushl %eax
   .LINoPush:
-     push %esi
-     call %edi
+     pushl s
+     call Address
      //
   end;
 
 Function CallDoubleFunc(s : Pointer; Address : Pointer;
   Index, IValue : Longint) : Double; assembler;
   asm
-     movl S,%esi
-     movl Address,%edi
      // ? Indexed Function
      movl Index,%eax
      testl %eax,%eax
@@ -87,15 +79,13 @@ Function CallDoubleFunc(s : Pointer; Address : Pointer;
      movl IValue,%eax
      pushl %eax
   .LINoPush:
-     push %esi
-     call %edi
+     pushl s
+     call Address
      //
   end;
 
 Function CallExtendedFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint) : Extended;assembler;
   asm
-     movl S,%esi
-     movl Address,%edi
      // ? Indexed Function
      movl Index,%eax
      testl %eax,%eax
@@ -103,15 +93,13 @@ Function CallExtendedFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint)
      movl IValue,%eax
      pushl %eax
   .LINoPush:
-     push %esi
-     call %edi
+     pushl s
+     call Address
      //
   end;
 
 Function CallBooleanFunc(s : Pointer;Address : Pointer; Index,IValue : Longint) : Boolean;assembler;
   asm
-     movl S,%esi
-     movl Address,%edi
      // ? Indexed Function
      movl Index,%eax
      testl %eax,%eax
@@ -119,8 +107,8 @@ Function CallBooleanFunc(s : Pointer;Address : Pointer; Index,IValue : Longint)
      movl IValue,%eax
      pushl %eax
   .LBNoPush:
-     push %esi
-     call %edi
+     pushl s
+     call Address
   end;
 
 // Assembler Functions can't have short stringreturn values.
@@ -130,8 +118,6 @@ Function CallBooleanFunc(s : Pointer;Address : Pointer; Index,IValue : Longint)
 Procedure CallSStringFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint;
                         Var Res: Shortstring);assembler;
   asm
-     movl S,%esi
-     movl Address,%edi
      // ? Indexed Function
      movl Index,%eax
      testl %eax,%eax
@@ -141,14 +127,12 @@ Procedure CallSStringFunc(s : Pointer;Address : Pointer; INdex,IValue : Longint;
      // the result is stored in an invisible parameter
      pushl Res
   .LSSNoPush:
-     push %esi
-     call %edi
+     pushl s
+     call Address
   end;
 
 Procedure CallSStringProc(s : Pointer;Address : Pointer;Const Value : ShortString; INdex,IVAlue : Longint);assembler;
   asm
-     movl S,%esi
-     movl Address,%edi
      // Push value to set
      movl Value,%eax
      pushl %eax
@@ -161,13 +145,16 @@ Procedure CallSStringProc(s : Pointer;Address : Pointer;Const Value : ShortStrin
      pushl %eax
   .LSSPNoPush:
      // BUG 2 (push)
-     pushl %esi
-     call %edi
+     pushl s
+     call Address
   end;
 
 {
   $Log$
-  Revision 1.5  2003-03-29 16:55:56  michael
+  Revision 1.6  2003-09-08 18:21:37  peter
+    * save edi,esi,ebx
+
+  Revision 1.5  2003/03/29 16:55:56  michael
   + Patch from Mattias Gaertner for single typeinfo
 
   Revision 1.4  2002/09/07 16:01:19  peter