Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
  2. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  3. # This routine moves %ecx bytes from %ds:%esi to %es:%edi.  It clobbers
  4. # %eax, %ecx, %esi, %edi, and eflags.  The memory ranges must not overlap,
  5. # unless %esi >= %edi.
  6. #include <libc/asmdefs.h>
  7. #include<libc/asm.h>
  8.  
  9.         .file "djmd.s"
  10.         .text
  11. .balign 16,,7
  12.  
  13. MK_C_SYM(__dj_movedata)
  14.         cmpl    $15,%ecx
  15.         jle     small_move
  16.         jmp     mod_4_check
  17.        
  18.         # Transfer bytes until either %esi or %edi is aligned % 4
  19. align_mod_4:   
  20.         movsb
  21.         decl    %ecx
  22. mod_4_check:
  23.         testl   $3,%esi
  24.         jz big_move
  25.         testl   $3,%edi
  26.         jnz     align_mod_4
  27.  
  28. big_move:
  29.         movb    %cl,%al  # We will store leftover count in %al
  30.         shrl    $2,%ecx
  31.         andb    $3,%al
  32.         rep
  33.         movsl
  34.  
  35.         # %ecx known to be zero here, so insert the leftover count in %al
  36.         movb    %al,%cl
  37. small_move:
  38.         rep
  39.         movsb
  40.         ret
  41.