clear_page_64.S 907 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include <linux/linkage.h>
  2. #include <asm/export.h>
  3. /*
  4. * Most CPUs support enhanced REP MOVSB/STOSB instructions. It is
  5. * recommended to use this when possible and we do use them by default.
  6. * If enhanced REP MOVSB/STOSB is not available, try to use fast string.
  7. * Otherwise, use original.
  8. */
  9. /*
  10. * Zero a page.
  11. * %rdi - page
  12. */
  13. ENTRY(clear_page_rep)
  14. movl $4096/8,%ecx
  15. xorl %eax,%eax
  16. rep stosq
  17. ret
  18. ENDPROC(clear_page_rep)
  19. EXPORT_SYMBOL_GPL(clear_page_rep)
  20. ENTRY(clear_page_orig)
  21. xorl %eax,%eax
  22. movl $4096/64,%ecx
  23. .p2align 4
  24. .Lloop:
  25. decl %ecx
  26. #define PUT(x) movq %rax,x*8(%rdi)
  27. movq %rax,(%rdi)
  28. PUT(1)
  29. PUT(2)
  30. PUT(3)
  31. PUT(4)
  32. PUT(5)
  33. PUT(6)
  34. PUT(7)
  35. leaq 64(%rdi),%rdi
  36. jnz .Lloop
  37. nop
  38. ret
  39. ENDPROC(clear_page_orig)
  40. EXPORT_SYMBOL_GPL(clear_page_orig)
  41. ENTRY(clear_page_erms)
  42. movl $4096,%ecx
  43. xorl %eax,%eax
  44. rep stosb
  45. ret
  46. ENDPROC(clear_page_erms)
  47. EXPORT_SYMBOL_GPL(clear_page_erms)