copypage_64.S 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. .section ".toc","aw"
  14. PPC64_CACHES:
  15. .tc ppc64_caches[TC],ppc64_caches
  16. .section ".text"
  17. _GLOBAL_TOC(copy_page)
  18. BEGIN_FTR_SECTION
  19. lis r5,PAGE_SIZE@h
  20. FTR_SECTION_ELSE
  21. b copypage_power7
  22. ALT_FTR_SECTION_END_IFCLR(CPU_FTR_VMX_COPY)
  23. ori r5,r5,PAGE_SIZE@l
  24. BEGIN_FTR_SECTION
  25. ld r10,PPC64_CACHES@toc(r2)
  26. lwz r11,DCACHEL1LOGLINESIZE(r10) /* log2 of cache line size */
  27. lwz r12,DCACHEL1LINESIZE(r10) /* get cache line size */
  28. li r9,0
  29. srd r8,r5,r11
  30. mtctr r8
  31. .Lsetup:
  32. dcbt r9,r4
  33. dcbz r9,r3
  34. add r9,r9,r12
  35. bdnz .Lsetup
  36. END_FTR_SECTION_IFSET(CPU_FTR_CP_USE_DCBTZ)
  37. addi r3,r3,-8
  38. srdi r8,r5,7 /* page is copied in 128 byte strides */
  39. addi r8,r8,-1 /* one stride copied outside loop */
  40. mtctr r8
  41. ld r5,0(r4)
  42. ld r6,8(r4)
  43. ld r7,16(r4)
  44. ldu r8,24(r4)
  45. 1: std r5,8(r3)
  46. std r6,16(r3)
  47. ld r9,8(r4)
  48. ld r10,16(r4)
  49. std r7,24(r3)
  50. std r8,32(r3)
  51. ld r11,24(r4)
  52. ld r12,32(r4)
  53. std r9,40(r3)
  54. std r10,48(r3)
  55. ld r5,40(r4)
  56. ld r6,48(r4)
  57. std r11,56(r3)
  58. std r12,64(r3)
  59. ld r7,56(r4)
  60. ld r8,64(r4)
  61. std r5,72(r3)
  62. std r6,80(r3)
  63. ld r9,72(r4)
  64. ld r10,80(r4)
  65. std r7,88(r3)
  66. std r8,96(r3)
  67. ld r11,88(r4)
  68. ld r12,96(r4)
  69. std r9,104(r3)
  70. std r10,112(r3)
  71. ld r5,104(r4)
  72. ld r6,112(r4)
  73. std r11,120(r3)
  74. stdu r12,128(r3)
  75. ld r7,120(r4)
  76. ldu r8,128(r4)
  77. bdnz 1b
  78. std r5,8(r3)
  79. std r6,16(r3)
  80. ld r9,8(r4)
  81. ld r10,16(r4)
  82. std r7,24(r3)
  83. std r8,32(r3)
  84. ld r11,24(r4)
  85. ld r12,32(r4)
  86. std r9,40(r3)
  87. std r10,48(r3)
  88. ld r5,40(r4)
  89. ld r6,48(r4)
  90. std r11,56(r3)
  91. std r12,64(r3)
  92. ld r7,56(r4)
  93. ld r8,64(r4)
  94. std r5,72(r3)
  95. std r6,80(r3)
  96. ld r9,72(r4)
  97. ld r10,80(r4)
  98. std r7,88(r3)
  99. std r8,96(r3)
  100. ld r11,88(r4)
  101. ld r12,96(r4)
  102. std r9,104(r3)
  103. std r10,112(r3)
  104. std r11,120(r3)
  105. std r12,128(r3)
  106. blr