copypage-xsc3.S 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * linux/arch/arm/lib/copypage-xsc3.S
  3. *
  4. * Copyright (C) 2004 Intel Corp.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * Adapted for 3rd gen XScale core, no more mini-dcache
  11. * Author: Matt Gilbert (matthew.m.gilbert@intel.com)
  12. */
  13. #include <linux/linkage.h>
  14. #include <linux/init.h>
  15. #include <asm/asm-offsets.h>
  16. /*
  17. * General note:
  18. * We don't really want write-allocate cache behaviour for these functions
  19. * since that will just eat through 8K of the cache.
  20. */
  21. .text
  22. .align 5
  23. /*
  24. * XSC3 optimised copy_user_page
  25. * r0 = destination
  26. * r1 = source
  27. * r2 = virtual user address of ultimate destination page
  28. *
  29. * The source page may have some clean entries in the cache already, but we
  30. * can safely ignore them - break_cow() will flush them out of the cache
  31. * if we eventually end up using our copied page.
  32. *
  33. */
  34. ENTRY(xsc3_mc_copy_user_page)
  35. stmfd sp!, {r4, r5, lr}
  36. mov lr, #PAGE_SZ/64-1
  37. pld [r1, #0]
  38. pld [r1, #32]
  39. 1: pld [r1, #64]
  40. pld [r1, #96]
  41. 2: ldrd r2, [r1], #8
  42. mov ip, r0
  43. ldrd r4, [r1], #8
  44. mcr p15, 0, ip, c7, c6, 1 @ invalidate
  45. strd r2, [r0], #8
  46. ldrd r2, [r1], #8
  47. strd r4, [r0], #8
  48. ldrd r4, [r1], #8
  49. strd r2, [r0], #8
  50. strd r4, [r0], #8
  51. ldrd r2, [r1], #8
  52. mov ip, r0
  53. ldrd r4, [r1], #8
  54. mcr p15, 0, ip, c7, c6, 1 @ invalidate
  55. strd r2, [r0], #8
  56. ldrd r2, [r1], #8
  57. subs lr, lr, #1
  58. strd r4, [r0], #8
  59. ldrd r4, [r1], #8
  60. strd r2, [r0], #8
  61. strd r4, [r0], #8
  62. bgt 1b
  63. beq 2b
  64. ldmfd sp!, {r4, r5, pc}
  65. .align 5
  66. /*
  67. * XScale optimised clear_user_page
  68. * r0 = destination
  69. * r1 = virtual user address of ultimate destination page
  70. */
  71. ENTRY(xsc3_mc_clear_user_page)
  72. mov r1, #PAGE_SZ/32
  73. mov r2, #0
  74. mov r3, #0
  75. 1: mcr p15, 0, r0, c7, c6, 1 @ invalidate line
  76. strd r2, [r0], #8
  77. strd r2, [r0], #8
  78. strd r2, [r0], #8
  79. strd r2, [r0], #8
  80. subs r1, r1, #1
  81. bne 1b
  82. mov pc, lr
  83. __INITDATA
  84. .type xsc3_mc_user_fns, #object
  85. ENTRY(xsc3_mc_user_fns)
  86. .long xsc3_mc_clear_user_page
  87. .long xsc3_mc_copy_user_page
  88. .size xsc3_mc_user_fns, . - xsc3_mc_user_fns