memcpy.S 422 B

1234567891011121314151617181920212223242526272829303132
  1. /* Copyright 2002 Andi Kleen */
  2. #include <asm/cpufeature.h>
  3. /*
  4. * memcpy - Copy a memory block.
  5. *
  6. * Input:
  7. * rdi destination
  8. * rsi source
  9. * rdx count
  10. *
  11. * Output:
  12. * rax original destination
  13. *
  14. * TODO: check best memcpy for PSC
  15. */
  16. .globl __memcpy
  17. .globl memcpy
  18. .p2align 4
  19. __memcpy:
  20. memcpy:
  21. movq %rdi,%rax
  22. movl %edx,%ecx
  23. shrl $3,%ecx
  24. andl $7,%edx
  25. rep
  26. movsq
  27. movl %edx,%ecx
  28. rep
  29. movsb
  30. ret