[fpc-devel]problem with MOVE

Darek Mazur darekm at emadar.com
Sat Mar 20 22:06:45 CET 2004


Hi
 I have problem with function move(src,dest,count)

sometimes they erase value of SRC

if I run


     move(item^,item2^,10);
then
   value of   item (not item^) is set to 0 (nil)

Its hard to debug it for me, only thing I discover is so:

for modified procedure

--------------------------------------------
procedure MoveNN(const source;var dest;count:longint);assembler;
var
  saveesi,saveedi : longint;
asm
        movl    %edi,saveedi
        movl    %esi,saveesi
{$ifdef REGCALL}

        movl    %eax,%esi   {source}
        movl    %edx,%edi   {dest}
        movl    %ecx,%edx
{$else}
(*        movl    dest,%edi
        movl    source,%esi
        movl    count,%edx
*)        
{$endif}
{ Forward Copy }
.LFMove:
        cld
//          std

        movl    %edx,%ecx
        rep
        movsb
        jmp .LMoveEnd
{ Backward Copy }
.LBMove:
(*
*)
.LMoveEnd:
        movl    saveedi,%edi
        movl    saveesi,%esi

end;

------------------------------
bug is present 
I thing that somethis wrong is with CLD (or passing parameters) 
HINT: ITEM is set to 0 when count if >4


please help

Darek




More information about the fpc-devel mailing list