peter пре 22 година
родитељ
комит
8f8b47194a
9 измењених фајлова са 297 додато и 52 уклоњено
  1. 113 14
      rtl/i386/i386.inc
  2. 6 1
      rtl/i386/math.inc
  3. 83 13
      rtl/i386/set.inc
  4. 17 8
      rtl/i386/setjump.inc
  5. 19 3
      rtl/i386/strings.inc
  6. 11 1
      rtl/i386/stringss.inc
  7. 10 3
      rtl/i386/strlen.inc
  8. 8 1
      rtl/i386/strpas.inc
  9. 30 8
      rtl/i386/sysutilp.inc

+ 113 - 14
rtl/i386/i386.inc

@@ -34,10 +34,16 @@ var
 asm
         movl    %edi,saveedi
         movl    %esi,saveesi
+{$ifdef REGCALL}
+        movl    %eax,%esi
+        movl    %edx,%edi
+        movl    %ecx,%edx
+{$else}
         movl    dest,%edi
         movl    source,%esi
-        movl    %edi,%eax
         movl    count,%edx
+{$endif}
+        movl    %edi,%eax
 { check for zero or negative count }
         cmpl    $0,%edx
         jle     .LMoveEnd
@@ -110,9 +116,15 @@ var
 asm
         movl    %edi,saveedi
         cld
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movb    %cl,%al
+        movl    %edx,%ecx
+{$else}
         movl    x,%edi
         movb    value,%al
         movl    count,%ecx
+{$endif}
 { check for zero or negative count }
         cmpl    $0,%ecx
         jle     .LFillEnd
@@ -149,12 +161,18 @@ var
   saveedi : longint;
 asm
         movl    %edi,saveedi
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movzwl  %cx,%eax
+        movl    %edx,%ecx
+{$else}
         movl    x,%edi
         movl    count,%ecx
+        movzwl  value,%eax
+{$endif}
 { check for zero or negative count }
         cmpl    $0,%ecx
         jle     .LFillWordEnd
-        movzwl  value,%eax
         movl    %eax,%edx
         shll    $16,%eax
         orl     %edx,%eax
@@ -178,12 +196,18 @@ var
   saveedi : longint;
 asm
         movl    %edi,saveedi
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %ecx,%eax
+        movl    %edx,%ecx
+{$else}
         movl    x,%edi
         movl    count,%ecx
+        movl    value,%eax
+{$endif}
 { check for zero or negative count }
         cmpl    $0,%ecx
         jle     .LFillDWordEnd
-        movl    value,%eax
         cld
         rep
         stosl
@@ -195,17 +219,25 @@ end;
 {$define FPC_SYSTEM_HAS_INDEXBYTE}
 function IndexByte(Const buf;len:longint;b:byte):longint; assembler;
 var
-  saveedi : longint;
+  saveedi,saveebx : longint;
 asm
         movl    %edi,saveedi
-        xorl    %eax,%eax
+        movl    %ebx,saveebx
+{$ifdef REGCALL}
+        movl    %edx,%ecx       // Load len
+        movb    %cl,%bl
+        movl    %eax,%edi       // Load String
+{$else}
         movl    Len,%ecx       // Load len
         movl    Buf,%edi       // Load String
+        movb    b,%bl
+{$endif}
+        xorl    %eax,%eax
         testl   %ecx,%ecx
         jz      .Lready
         cld
         movl    %ecx,%edx      // Copy for easy manipulation
-        movb    b,%al
+        movb    %bl,%al
         repne
         scasb
         jne     .Lcharposnotfound
@@ -217,23 +249,32 @@ asm
         movl    $-1,%eax
 .Lready:
         movl    saveedi,%edi
+        movl    saveebx,%ebx
 end;
 
 
 {$define FPC_SYSTEM_HAS_INDEXWORD}
 function Indexword(Const buf;len:longint;b:word):longint; assembler;
 var
-  saveedi : longint;
+  saveedi,saveebx : longint;
 asm
         movl    %edi,saveedi
-        xorl    %eax,%eax
+        movl    %ebx,saveebx
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %cx,%bx
+        movl    %edx,%ecx
+{$else}
         movl    Len,%ecx       // Load len
         movl    Buf,%edi       // Load String
+        movw    b,%bx
+{$endif}
+        xorl    %eax,%eax
         testl   %ecx,%ecx
         jz      .Lready
         cld
         movl    %ecx,%edx      // Copy for easy manipulation
-        movw    b,%ax
+        movw    %bx,%ax
         repne
         scasw
         jne     .Lcharposnotfound
@@ -245,23 +286,32 @@ asm
         movl    $-1,%eax
 .Lready:
         movl    saveedi,%edi
+        movl    saveebx,%ebx
 end;
 
 
 {$define FPC_SYSTEM_HAS_INDEXDWORD}
 function IndexDWord(Const buf;len:longint;b:DWord):longint; assembler;
 var
-  saveedi : longint;
+  saveedi,saveebx : longint;
 asm
         movl    %edi,saveedi
-        xorl    %eax,%eax
+        movl    %ebx,saveebx
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %ecx,%ebx
+        movl    %edx,%ecx
+{$else}
         movl    Len,%ecx       // Load len
         movl    Buf,%edi       // Load String
+        movl    b,%ebx
+{$endif}
+        xorl    %eax,%eax
         testl   %ecx,%ecx
         jz      .Lready
         cld
         movl    %ecx,%edx      // Copy for easy manipulation
-        movl    b,%eax
+        movl    %ebx,%eax
         repne
         scasl
         jne     .Lcharposnotfound
@@ -273,6 +323,7 @@ asm
         movl    $-1,%eax
 .Lready:
         movl    saveedi,%edi
+        movl    saveebx,%ebx
 end;
 
 
@@ -284,9 +335,15 @@ asm
         movl    %edi,saveedi
         movl    %esi,saveesi
         cld
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %edx,%esi
+        movl    %ecx,%eax
+{$else}
         movl    len,%eax
         movl    buf2,%esi       { Load params}
         movl    buf1,%edi
+{$endif}
         testl   %eax,%eax       {We address -1(%esi), so we have to deal with len=0}
         je      .LCmpbyteExit
         cmpl    $7,%eax         {<7 not worth aligning and go through all trouble}
@@ -334,9 +391,15 @@ asm
         movl    %esi,saveesi
         movl    %ebx,saveebx
         cld
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %edx,%esi
+        movl    %ecx,%eax
+{$else}
         movl    len,%eax
         movl    buf2,%esi       { Load params}
         movl    buf1,%edi
+{$endif}
         testl   %eax,%eax       {We address -2(%esi), so we have to deal with len=0}
         je      .LCmpwordExit
         cmpl    $5,%eax         {<5 (3 bytes align + 4 bytes cmpsl = 4 words}
@@ -394,9 +457,15 @@ asm
         movl    %esi,saveesi
         movl    %ebx,saveebx
         cld
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %edx,%esi
+        movl    %ecx,%eax
+{$else}
         movl    len,%eax
         movl    buf2,%esi       { Load params}
         movl    buf1,%edi
+{$endif}
         testl   %eax,%eax       {We address -2(%esi), so we have to deal with len=0}
         je      .LCmpDwordExit
         cmpl    $3,%eax         {<3 (3 bytes align + 4 bytes cmpsl) = 2 DWords}
@@ -452,9 +521,14 @@ asm
         movl    %ebx,saveebx
 // Can't use scasb, or will have to do it twice, think this
 //   is faster for small "len"
+{$ifdef REGCALL}
+        movl    %eax,%esi        // Load address
+        movzbl  %cl,%ebx          // Load searchpattern
+{$else}
         movl    Buf,%esi        // Load address
         movl    len,%edx        // load maximal searchdistance
         movzbl  b,%ebx          // Load searchpattern
+{$endif}
         testl   %edx,%edx
         je      .LFound
         xorl    %ecx,%ecx       // zero index in Buf
@@ -1095,7 +1169,9 @@ end ['EAX'];
 {$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
 function get_caller_addr(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
 asm
+{$ifndef REGCALL}
         movl    framebp,%eax
+{$endif}
         orl     %eax,%eax
         jz      .Lg_a_null
         movl    4(%eax),%eax
@@ -1106,7 +1182,9 @@ end ['EAX'];
 {$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
 function get_caller_frame(framebp:pointer):pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
 asm
+{$ifndef REGCALL}
         movl    framebp,%eax
+{$endif}
         orl     %eax,%eax
         jz      .Lgnf_null
         movl    (%eax),%eax
@@ -1121,7 +1199,9 @@ end ['EAX'];
 {$define FPC_SYSTEM_HAS_ABS_LONGINT}
 function abs(l:longint):longint; assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_abs];
 asm
+{$ifndef REGCALL}
         movl    l,%eax
+{$endif}
         cltd
         xorl    %edx,%eax
         subl    %edx,%eax
@@ -1131,7 +1211,13 @@ end ['EAX','EDX'];
 {$define FPC_SYSTEM_HAS_ODD_LONGINT}
 function odd(l:longint):boolean;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_odd];
 asm
+{$ifdef SYSTEMINLINE}
        movl     l,%eax
+{$else}
+{$ifndef REGCALL}
+       movl     l,%eax
+{$endif}
+{$endif}
        andl     $1,%eax
        setnz    %al
 end ['EAX'];
@@ -1140,7 +1226,13 @@ end ['EAX'];
 {$define FPC_SYSTEM_HAS_SQR_LONGINT}
 function sqr(l:longint):longint;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_sqr];
 asm
-        mov     l,%eax
+{$ifdef SYSTEMINLINE}
+       movl     l,%eax
+{$else}
+{$ifndef REGCALL}
+       movl     l,%eax
+{$endif}
+{$endif}
         imull   %eax,%eax
 end ['EAX'];
 
@@ -1272,7 +1364,9 @@ end;
 function declocked(var l : longint) : boolean;assembler;
 
   asm
+{$ifndef REGCALL}
      movl       l,%eax
+{$endif}
      { this check should be done because a lock takes a lot }
      { of time!                                             }
      cmpb       $0,IsMultithread
@@ -1290,7 +1384,9 @@ function declocked(var l : longint) : boolean;assembler;
 procedure inclocked(var l : longint);assembler;
 
   asm
+{$ifndef REGCALL}
      movl       l,%eax
+{$endif}
      { this check should be done because a lock takes a lot }
      { of time!                                             }
      cmpb       $0,IsMultithread
@@ -1330,7 +1426,10 @@ end;
 
 {
   $Log$
-  Revision 1.52  2003-11-03 09:42:27  marco
+  Revision 1.53  2003-11-11 21:08:17  peter
+    * REGCALL define added
+
+  Revision 1.52  2003/11/03 09:42:27  marco
    * Peter's Cardinal<->Longint fixes patch
 
   Revision 1.51  2003/10/27 09:16:57  marco

+ 6 - 1
rtl/i386/math.inc

@@ -20,7 +20,9 @@
 
     procedure Set8087CW(cw:word);assembler;
     asm
+{$ifndef REGCALL}
       movw cw,%ax
+{$endif}
       movw %ax,default8087cw
       fnclex
       fldcw default8087cw
@@ -198,7 +200,10 @@
 
 {
   $Log$
-  Revision 1.15  2003-09-08 18:21:37  peter
+  Revision 1.16  2003-11-11 21:08:17  peter
+    * REGCALL define added
+
+  Revision 1.15  2003/09/08 18:21:37  peter
     * save edi,esi,ebx
 
   Revision 1.14  2003/04/23 21:28:21  peter

+ 83 - 13
rtl/i386/set.inc

@@ -25,7 +25,9 @@ var
 asm
         movl    %edi,saveedi
         movl    __RESULT,%edi
+{$ifndef REGCALL}
         movl    l,%eax
+{$endif}
         stosl
         xorl    %eax,%eax
         movl    $7,%ecx
@@ -48,14 +50,19 @@ asm
         pushl   %ecx
 {$endif not hascompilerproc}
         movl    %edi,saveedi
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        andl    $0xff,%edx
+{$else}
+        movzbl  b,%edx
         movl    __RESULT,%edi
+{$endif}
         xorl    %eax,%eax
         movl    $8,%ecx
         rep
         stosl
         leal    -32(%edi),%eax
-        movzbl  b,%edi
-        btsl    %edi,(%eax)
+        btsl    %edx,(%eax)
         movl    saveedi,%edi
 {$ifndef hascompilerproc}
         popl    %ecx
@@ -76,13 +83,19 @@ asm
         movl    %edi,saveedi
         movl    %esi,saveesi
         movl    $8,%ecx
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %edx,%esi
+        movzbl  %cl,%edx
+{$else}
         movl    source,%esi
+        movzbl  b,%edx
         movl    __RESULT,%edi
+{$endif}
         rep
         movsl
         leal    -32(%edi),%eax
-        movzbl  b,%edi
-        btsl    %edi,(%eax)
+        btsl    %edx,(%eax)
         movl    saveedi,%edi
         movl    saveesi,%esi
 end;
@@ -117,14 +130,20 @@ var
 asm
         movl    %edi,saveedi
         movl    %esi,saveesi
-        movl    $8,%ecx
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %edx,%esi
+        movzbl  %cl,%edx
+{$else}
         movl    source,%esi
         movl    __RESULT,%edi
+        movzbl  b,%edx
+{$endif}
+        movl    $8,%ecx
         rep
         movsl
         leal    -32(%edi),%eax
-        movzbl  b,%edi
-        btrl    %edi,(%eax)
+        btrl    %edx,(%eax)
         movl    saveedi,%edi
         movl    saveesi,%esi
 end;
@@ -162,11 +181,18 @@ asm
         movl    %edi,saveedi
         movl    %esi,saveesi
         movl    %ebx,saveebx
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %edx,%esi
+        movzbl  l,%eax               // lowest bit to be set in eax
+        movzbl  h,%ebx               // highest in ebx
+{$else}
         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
         movl   __RESULT,%edi        // target set address in edi
         movl   orgset, %esi         // source set address in esi
+{$endif}
+        movl   $8,%ecx              // we have to copy 32 bytes
         cmpl   %eax,%ebx            // high < low?
         rep                         // copy source to dest (it's possible to do the range
         movsl                       // setting and copying simultanuously of course, but
@@ -195,7 +221,7 @@ asm
         subl   $4,%ebx
         jnz    .Lset_range_loop
 .Lset_range_hi:
-        movb   h,%cl
+        movb   h,%cl                // this is ok, h is on the stack
         movl   %edx,%ebx            // save current bitmask
         andb   $31,%cl
         subb   $31,%cl              // cl := (31 - (hi and 31)) = shift count to
@@ -216,11 +242,11 @@ function fpc_set_set_range(l,h : byte): fpc_normal_set;assembler;[public,alias:'
   adds the range [l..h] to the set pointed to by p
 }
 asm
-        movzbl l,%eax              // lowest bit to be set in eax
-        movzbl h,%ebx              // highest in ebx
+        movl    __RESULT,%edi               // set address in edi
+        movzbl  l,%eax              // lowest bit to be set in eax
+        movzbl  h,%ebx              // highest in ebx
         cmpl   %eax,%ebx
         jb     .Lset_range_done
-        movl   __RESULT,%edi               // set address in edi
         movl   %eax,%ecx            // lowest also in ecx
         shrl   $3,%eax              // divide by 8 to get starting and ending byte
         shrl   $3,%ebx              // address
@@ -264,8 +290,13 @@ function fpc_set_in_byte(const p: fpc_normal_set; b: byte): boolean; assembler;
 }
 asm
 {$ifdef hascompilerproc}
+{$ifdef REGCALL}
+        xchgl %edx,%eax
+        andl $0xff,%eax
+{$else}
        movl   p,%edx
        movzbl b,%eax
+{$endif}
        btl %eax,(%edx)
 {$else hascompilerproc}
        pushl %eax
@@ -292,6 +323,11 @@ var
 asm
         movl    %edi,saveedi
         movl    %esi,saveesi
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %edx,%esi
+        movl    %ecx,%edx
+{$else}
       movl set1,%esi
       movl set2,%edx
 {$ifdef hascompilerproc}
@@ -299,6 +335,7 @@ asm
 {$else hascompilerproc}
       movl dest,%edi
 {$endif hascompilerproc}
+{$endif}
       movl $8,%ecx
    .LMADDSETS1:
       lodsl
@@ -327,6 +364,11 @@ var
 asm
         movl    %edi,saveedi
         movl    %esi,saveesi
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %edx,%esi
+        movl    %ecx,%edx
+{$else}
       movl set1,%esi
       movl set2,%edx
 {$ifdef hascompilerproc}
@@ -334,6 +376,7 @@ asm
 {$else hascompilerproc}
       movl dest,%edi
 {$endif hascompilerproc}
+{$endif}
       movl $8,%ecx
   .LMMULSETS1:
       lodsl
@@ -363,6 +406,11 @@ asm
         movl    %edi,saveedi
         movl    %esi,saveesi
         movl    %ebx,saveebx
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %edx,%esi
+        movl    %ecx,%edx
+{$else}
         movl set1,%esi
         movl set2,%ebx
 {$ifdef hascompilerproc}
@@ -370,6 +418,7 @@ asm
 {$else hascompilerproc}
       movl dest,%edi
 {$endif hascompilerproc}
+{$endif}
         movl $8,%ecx
     .LMSUBSETS1:
         lodsl
@@ -401,6 +450,11 @@ var
 asm
         movl    %edi,saveedi
         movl    %esi,saveesi
+{$ifdef REGCALL}
+        movl    %eax,%edi
+        movl    %edx,%esi
+        movl    %ecx,%edx
+{$else}
         movl set1,%esi
         movl set2,%edx
 {$ifdef hascompilerproc}
@@ -408,6 +462,7 @@ asm
 {$else hascompilerproc}
       movl dest,%edi
 {$endif hascompilerproc}
+{$endif}
         movl $8,%ecx
     .LMSYMDIFSETS1:
         lodsl
@@ -432,8 +487,13 @@ var
 asm
         movl    %edi,saveedi
         movl    %esi,saveesi
+{$ifdef REGCALL}
+        movl    %eax,%esi
+        movl    %edx,%edi
+{$else}
         movl set1,%esi
         movl set2,%edi
+{$endif}
         movl $8,%ecx
     .LMCOMPSETS1:
         movl (%esi),%eax
@@ -466,8 +526,13 @@ var
 asm
         movl    %edi,saveedi
         movl    %esi,saveesi
+{$ifdef REGCALL}
+        movl    %eax,%esi
+        movl    %edx,%edi
+{$else}
         movl set1,%esi
         movl set2,%edi
+{$endif}
         movl $8,%ecx
     .LMCONTAINSSETS1:
         movl (%esi),%eax
@@ -492,6 +557,8 @@ end;
 
 {$ifdef LARGESETS}
 
+{$error Needs to be fixed for register calling first!}
+
 procedure fpc_largeset_set_word(p : pointer;b : word);assembler;[public,alias:'FPC_LARGESET_SET_WORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {
   sets the element b in set p works for sets larger than 256 elements
@@ -653,7 +720,10 @@ end;
 
 {
   $Log$
-  Revision 1.11  2003-09-08 18:21:37  peter
+  Revision 1.12  2003-11-11 21:08:17  peter
+    * REGCALL define added
+
+  Revision 1.11  2003/09/08 18:21:37  peter
     * save edi,esi,ebx
 
   Revision 1.10  2003/05/26 19:36:46  peter

+ 17 - 8
rtl/i386/setjump.inc

@@ -16,7 +16,9 @@
 
 Function SetJmp (Var S : Jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP'];
 asm
+{$ifndef REGCALL}
   movl 8(%ebp),%eax
+{$endif}
   movl %ebx,(%eax)
   movl %esi,4(%eax)
   movl %edi,8(%eax)
@@ -33,22 +35,29 @@ end['EAX'];
 
 Procedure longJmp (Var S : Jmp_buf; value : longint); assembler;[Public, alias : 'FPC_LONGJMP'];
 asm
-  movl 8(%ebp),%ecx
+{$ifdef REGCALL}
+  xchgl %edx,%eax
+{$else}
+  movl 8(%ebp),%edx
   movl 12(%ebp),%eax
-  movl (%ecx),%ebx
-  movl 4(%ecx),%esi
-  movl 8(%ecx),%edi
-  movl 12(%ecx),%ebp
-  movl 16(%ecx),%esp
+{$endif}
+  movl (%edx),%ebx
+  movl 4(%edx),%esi
+  movl 8(%edx),%edi
+  movl 12(%edx),%ebp
+  movl 16(%edx),%esp
   // we should also clear the fpu
   // fninit no must be done elsewhere PM
   // or we should reset the control word also
-  jmp 20(%ecx)
+  jmp 20(%edx)
 end;
 
 {
   $Log$
-  Revision 1.3  2002-09-07 16:01:19  peter
+  Revision 1.4  2003-11-11 21:08:17  peter
+    * REGCALL define added
+
+  Revision 1.3  2002/09/07 16:01:19  peter
     * old logs removed and tabs fixed
 
 }

+ 19 - 3
rtl/i386/strings.inc

@@ -20,18 +20,27 @@
 {$define FPC_UNIT_HAS_STRCOPY}
 function strcopy(dest,source : pchar) : pchar;assembler;
 var
-  saveesi,saveedi : longint;
+  saveeax,saveesi,saveedi : longint;
 asm
         movl    %edi,saveedi
         movl    %esi,saveesi
+{$ifdef REGCALL}
+	movl	%eax,saveeax
+	movl	%edx,%edi
+{$else}	
         movl    source,%edi
+{$endif}	
         testl   %edi,%edi
         jz      .LStrCopyDone
         leal    3(%edi),%ecx
         andl    $-4,%ecx
-        movl    source,%esi
+        movl    %edi,%esi
         subl    %edi,%ecx
+{$ifdef REGCALL}
+	movl	%eax,%edi
+{$else}		
         movl    dest,%edi
+{$endif}	
         jz      .LStrCopyAligned
 .LStrCopyAlignLoop:
         movb    (%esi),%al
@@ -75,7 +84,11 @@ asm
 .LStrCopyByte:
         movb    %al,(%edi)
 .LStrCopyDone:
+{$ifdef REGCALL}
+	movl	saveeax,%eax
+{$else}	
         movl    dest,%eax
+{$endif}	
         movl    saveedi,%edi
         movl    saveesi,%esi
 end;
@@ -537,7 +550,10 @@ end;
 
 {
   $Log$
-  Revision 1.9  2003-09-08 18:21:37  peter
+  Revision 1.10  2003-11-11 21:08:17  peter
+    * REGCALL define added
+
+  Revision 1.9  2003/09/08 18:21:37  peter
     * save edi,esi,ebx
 
   Revision 1.8  2003/04/30 16:36:39  florian

+ 11 - 1
rtl/i386/stringss.inc

@@ -28,21 +28,31 @@ asm
 	movl	%edi,saveedi
 	movl    %esi,saveesi
         cld
+{$ifdef REGCALL}	
+        movl    %eax,%edi          // load destination address
+        movl    %edx,%esi          // Load Source adress
+{$else}	
         movl    s,%esi          // Load Source adress
         movl    d,%edi          // load destination address
+{$endif}	
         movzbl  (%esi),%ecx        // load length in ECX
         incl    %esi
         rep
         movsb
         movb    $0,(%edi)
+{$ifndef REGCALL}	
         movl    d,%eax       // return value to EAX
+{$endif}	
 	movl	saveedi,%edi
 	movl    saveesi,%esi
 end;
 
 {
   $Log$
-  Revision 1.9  2003-09-08 18:21:37  peter
+  Revision 1.10  2003-11-11 21:08:17  peter
+    * REGCALL define added
+
+  Revision 1.9  2003/09/08 18:21:37  peter
     * save edi,esi,ebx
 
   Revision 1.8  2003/07/07 20:22:05  peter

+ 10 - 3
rtl/i386/strlen.inc

@@ -17,8 +17,12 @@
 var
   saveedi : longint;
 asm
-	movl	%edi,saveedi
+        movl    %edi,saveedi
+{$ifdef REGCALL}
+        movl    %eax,%edi
+{$else}
         movl    p,%edi
+{$endif}
         movl    $0xffffffff,%ecx
         xorl    %eax,%eax
         cld
@@ -26,13 +30,16 @@ asm
         scasb
         movl    $0xfffffffe,%eax
         subl    %ecx,%eax
-	movl	saveedi,%edi
+        movl    saveedi,%edi
 end;
 
 
 {
   $Log$
-  Revision 1.4  2003-09-08 18:21:37  peter
+  Revision 1.5  2003-11-11 21:08:17  peter
+    * REGCALL define added
+
+  Revision 1.4  2003/09/08 18:21:37  peter
     * save edi,esi,ebx
 
   Revision 1.3  2002/09/07 16:01:19  peter

+ 8 - 1
rtl/i386/strpas.inc

@@ -15,7 +15,11 @@
  **********************************************************************}
 begin
 asm
+{$ifdef regcall}
+        movl    %eax,%esi
+{$else}
         movl    p,%esi
+{$endif}
         movl    $1,%ecx
         testl   %esi,%esi
         movl    %esi,%eax
@@ -92,7 +96,10 @@ end;
 
 {
   $Log$
-  Revision 1.2  2002-09-07 16:01:19  peter
+  Revision 1.3  2003-11-11 21:08:17  peter
+    * REGCALL define added
+
+  Revision 1.2  2002/09/07 16:01:19  peter
     * old logs removed and tabs fixed
 
 }

+ 30 - 8
rtl/i386/sysutilp.inc

@@ -22,44 +22,66 @@
 
 function InterLockedDecrement (var Target: integer) : Integer; assembler;
 asm
-        movl    Target, %ecx
+{$ifdef REGCALL}
+        movl    $-1,%edx
+        xchgl   %edx,%eax
+{$else}
+        movl    Target, %edx
         movl    $-1, %eax
+{$endif}
         lock
-        xaddl   %eax, (%ecx)
+        xaddl   %eax, (%edx)
         decl    %eax
 end;
 
 
 function InterLockedIncrement (var Target: integer) : Integer; assembler;
 asm
-        movl    Target, %ecx
+{$ifdef REGCALL}
+        movl    $-1,%edx
+        xchgl   %edx,%eax
+{$else}
+        movl    Target, %edx
         movl    $1, %eax
+{$endif}
         lock
-        xaddl   %eax, (%ecx)
+        xaddl   %eax, (%edx)
         incl    %eax
 end;
 
 
 function InterLockedExchange (var Target: integer;Source : integer) : Integer; assembler;
 asm
+{$ifdef REGCALL}
+        xchgl   (%eax),%edx
+        movl    %edx,%eax
+{$else}
         movl    Target,%ecx
         movl    Source,%eax
-        xchgl   %eax, (%ecx)
+        xchgl   (%ecx),%eax
+{$endif}
 end;
 
 
 function InterLockedExchangeAdd (var Target: integer;Source : integer) : Integer; assembler;
 asm
-        movl    Target,%ecx
+{$ifdef REGCALL}
+        xchgl   %eax,%edx
+{$else}
+        movl    Target,%edx
         movl    Source,%eax
+{$endif}
         lock
-        xaddl   %eax, (%ecx)
+        xaddl   %eax, (%edx)
 end;
 
 
 {
   $Log$
-  Revision 1.2  2002-09-07 16:01:19  peter
+  Revision 1.3  2003-11-11 21:08:17  peter
+    * REGCALL define added
+
+  Revision 1.2  2002/09/07 16:01:19  peter
     * old logs removed and tabs fixed
 
 }