copypage_64.S 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Copyright (C) 2008 Mark Nelson, IBM Corp.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #include <asm/page.h>
  10. #include <asm/processor.h>
  11. #include <asm/ppc_asm.h>
  12. #include <asm/asm-offsets.h>
  13. #include <asm/export.h>
  14. .section ".toc","aw"
  15. PPC64_CACHES:
  16. .tc ppc64_caches[TC],ppc64_caches
  17. .section ".text"
  18. _GLOBAL_TOC(copy_page)
  19. BEGIN_FTR_SECTION
  20. lis r5,PAGE_SIZE@h
  21. FTR_SECTION_ELSE
  22. #ifdef CONFIG_PPC_BOOK3S_64
  23. b copypage_power7
  24. #endif
  25. ALT_FTR_SECTION_END_IFCLR(CPU_FTR_VMX_COPY)
  26. ori r5,r5,PAGE_SIZE@l
  27. BEGIN_FTR_SECTION
  28. ld r10,PPC64_CACHES@toc(r2)
  29. lwz r11,DCACHEL1LOGBLOCKSIZE(r10) /* log2 of cache block size */
  30. lwz r12,DCACHEL1BLOCKSIZE(r10) /* get cache block size */
  31. li r9,0
  32. srd r8,r5,r11
  33. mtctr r8
  34. .Lsetup:
  35. dcbt r9,r4
  36. dcbz r9,r3
  37. add r9,r9,r12
  38. bdnz .Lsetup
  39. END_FTR_SECTION_IFSET(CPU_FTR_CP_USE_DCBTZ)
  40. addi r3,r3,-8
  41. srdi r8,r5,7 /* page is copied in 128 byte strides */
  42. addi r8,r8,-1 /* one stride copied outside loop */
  43. mtctr r8
  44. ld r5,0(r4)
  45. ld r6,8(r4)
  46. ld r7,16(r4)
  47. ldu r8,24(r4)
  48. 1: std r5,8(r3)
  49. std r6,16(r3)
  50. ld r9,8(r4)
  51. ld r10,16(r4)
  52. std r7,24(r3)
  53. std r8,32(r3)
  54. ld r11,24(r4)
  55. ld r12,32(r4)
  56. std r9,40(r3)
  57. std r10,48(r3)
  58. ld r5,40(r4)
  59. ld r6,48(r4)
  60. std r11,56(r3)
  61. std r12,64(r3)
  62. ld r7,56(r4)
  63. ld r8,64(r4)
  64. std r5,72(r3)
  65. std r6,80(r3)
  66. ld r9,72(r4)
  67. ld r10,80(r4)
  68. std r7,88(r3)
  69. std r8,96(r3)
  70. ld r11,88(r4)
  71. ld r12,96(r4)
  72. std r9,104(r3)
  73. std r10,112(r3)
  74. ld r5,104(r4)
  75. ld r6,112(r4)
  76. std r11,120(r3)
  77. stdu r12,128(r3)
  78. ld r7,120(r4)
  79. ldu r8,128(r4)
  80. bdnz 1b
  81. std r5,8(r3)
  82. std r6,16(r3)
  83. ld r9,8(r4)
  84. ld r10,16(r4)
  85. std r7,24(r3)
  86. std r8,32(r3)
  87. ld r11,24(r4)
  88. ld r12,32(r4)
  89. std r9,40(r3)
  90. std r10,48(r3)
  91. ld r5,40(r4)
  92. ld r6,48(r4)
  93. std r11,56(r3)
  94. std r12,64(r3)
  95. ld r7,56(r4)
  96. ld r8,64(r4)
  97. std r5,72(r3)
  98. std r6,80(r3)
  99. ld r9,72(r4)
  100. ld r10,80(r4)
  101. std r7,88(r3)
  102. std r8,96(r3)
  103. ld r11,88(r4)
  104. ld r12,96(r4)
  105. std r9,104(r3)
  106. std r10,112(r3)
  107. std r11,120(r3)
  108. std r12,128(r3)
  109. blr
  110. EXPORT_SYMBOL(copy_page)