copypage-v4mc.S 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * linux/arch/arm/lib/copy_page-armv4mc.S
  3. *
  4. * Copyright (C) 1995-2001 Russell King
  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. * ASM optimised string functions
  11. */
  12. #include <linux/linkage.h>
  13. #include <linux/init.h>
  14. #include <asm/constants.h>
  15. .text
  16. .align 5
  17. /*
  18. * ARMv4 mini-dcache optimised copy_user_page
  19. *
  20. * We flush the destination cache lines just before we write the data into the
  21. * corresponding address. Since the Dcache is read-allocate, this removes the
  22. * Dcache aliasing issue. The writes will be forwarded to the write buffer,
  23. * and merged as appropriate.
  24. *
  25. * Note: We rely on all ARMv4 processors implementing the "invalidate D line"
  26. * instruction. If your processor does not supply this, you have to write your
  27. * own copy_user_page that does the right thing.
  28. */
  29. ENTRY(v4_mc_copy_user_page)
  30. stmfd sp!, {r4, lr} @ 2
  31. mov r4, r0
  32. mov r0, r1
  33. bl map_page_minicache
  34. mov r1, #PAGE_SZ/64 @ 1
  35. ldmia r0!, {r2, r3, ip, lr} @ 4
  36. 1: mcr p15, 0, r4, c7, c6, 1 @ 1 invalidate D line
  37. stmia r4!, {r2, r3, ip, lr} @ 4
  38. ldmia r0!, {r2, r3, ip, lr} @ 4+1
  39. stmia r4!, {r2, r3, ip, lr} @ 4
  40. ldmia r0!, {r2, r3, ip, lr} @ 4
  41. mcr p15, 0, r4, c7, c6, 1 @ 1 invalidate D line
  42. stmia r4!, {r2, r3, ip, lr} @ 4
  43. ldmia r0!, {r2, r3, ip, lr} @ 4
  44. subs r1, r1, #1 @ 1
  45. stmia r4!, {r2, r3, ip, lr} @ 4
  46. ldmneia r0!, {r2, r3, ip, lr} @ 4
  47. bne 1b @ 1
  48. ldmfd sp!, {r4, pc} @ 3
  49. .align 5
  50. /*
  51. * ARMv4 optimised clear_user_page
  52. *
  53. * Same story as above.
  54. */
  55. ENTRY(v4_mc_clear_user_page)
  56. str lr, [sp, #-4]!
  57. mov r1, #PAGE_SZ/64 @ 1
  58. mov r2, #0 @ 1
  59. mov r3, #0 @ 1
  60. mov ip, #0 @ 1
  61. mov lr, #0 @ 1
  62. 1: mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line
  63. stmia r0!, {r2, r3, ip, lr} @ 4
  64. stmia r0!, {r2, r3, ip, lr} @ 4
  65. mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line
  66. stmia r0!, {r2, r3, ip, lr} @ 4
  67. stmia r0!, {r2, r3, ip, lr} @ 4
  68. subs r1, r1, #1 @ 1
  69. bne 1b @ 1
  70. ldr pc, [sp], #4
  71. __INITDATA
  72. .type v4_mc_user_fns, #object
  73. ENTRY(v4_mc_user_fns)
  74. .long v4_mc_clear_user_page
  75. .long v4_mc_copy_user_page
  76. .size v4_mc_user_fns, . - v4_mc_user_fns