page_clear.S 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. Copyright 2003 Richard Curnow, SuperH (UK) Ltd.
  3. This file is subject to the terms and conditions of the GNU General Public
  4. License. See the file "COPYING" in the main directory of this archive
  5. for more details.
  6. Tight version of memset for the case of just clearing a page. It turns out
  7. that having the alloco's spaced out slightly due to the increment/branch
  8. pair causes them to contend less for access to the cache. Similarly,
  9. keeping the stores apart from the allocos causes less contention. => Do two
  10. separate loops. Do multiple stores per loop to amortise the
  11. increment/branch cost a little.
  12. Parameters:
  13. r2 : source effective address (start of page)
  14. Always clears 4096 bytes.
  15. Note : alloco guarded by synco to avoid TAKum03020 erratum
  16. */
  17. .section .text..SHmedia32,"ax"
  18. .little
  19. .balign 8
  20. .global sh64_page_clear
  21. sh64_page_clear:
  22. pta/l 1f, tr1
  23. pta/l 2f, tr2
  24. ptabs/l r18, tr0
  25. movi 4096, r7
  26. add r2, r7, r7
  27. add r2, r63, r6
  28. 1:
  29. alloco r6, 0
  30. synco ! TAKum03020
  31. addi r6, 32, r6
  32. bgt/l r7, r6, tr1
  33. add r2, r63, r6
  34. 2:
  35. st.q r6, 0, r63
  36. st.q r6, 8, r63
  37. st.q r6, 16, r63
  38. st.q r6, 24, r63
  39. addi r6, 32, r6
  40. bgt/l r7, r6, tr2
  41. blink tr0, r63