flush.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * Cache flushing routines.
  3. *
  4. * Copyright (C) 1999-2001, 2005 Hewlett-Packard Co
  5. * David Mosberger-Tang <davidm@hpl.hp.com>
  6. *
  7. * 05/28/05 Zoltan Menyhart Dynamic stride size
  8. */
  9. #include <asm/asmmacro.h>
  10. #include <asm/export.h>
  11. /*
  12. * flush_icache_range(start,end)
  13. *
  14. * Make i-cache(s) coherent with d-caches.
  15. *
  16. * Must deal with range from start to end-1 but nothing else (need to
  17. * be careful not to touch addresses that may be unmapped).
  18. *
  19. * Note: "in0" and "in1" are preserved for debugging purposes.
  20. */
  21. .section .kprobes.text,"ax"
  22. GLOBAL_ENTRY(flush_icache_range)
  23. .prologue
  24. alloc r2=ar.pfs,2,0,0,0
  25. movl r3=ia64_i_cache_stride_shift
  26. mov r21=1
  27. ;;
  28. ld8 r20=[r3] // r20: stride shift
  29. sub r22=in1,r0,1 // last byte address
  30. ;;
  31. shr.u r23=in0,r20 // start / (stride size)
  32. shr.u r22=r22,r20 // (last byte address) / (stride size)
  33. shl r21=r21,r20 // r21: stride size of the i-cache(s)
  34. ;;
  35. sub r8=r22,r23 // number of strides - 1
  36. shl r24=r23,r20 // r24: addresses for "fc.i" =
  37. // "start" rounded down to stride boundary
  38. .save ar.lc,r3
  39. mov r3=ar.lc // save ar.lc
  40. ;;
  41. .body
  42. mov ar.lc=r8
  43. ;;
  44. /*
  45. * 32 byte aligned loop, even number of (actually 2) bundles
  46. */
  47. .Loop: fc.i r24 // issuable on M0 only
  48. add r24=r21,r24 // we flush "stride size" bytes per iteration
  49. nop.i 0
  50. br.cloop.sptk.few .Loop
  51. ;;
  52. sync.i
  53. ;;
  54. srlz.i
  55. ;;
  56. mov ar.lc=r3 // restore ar.lc
  57. br.ret.sptk.many rp
  58. END(flush_icache_range)
  59. EXPORT_SYMBOL_GPL(flush_icache_range)
  60. /*
  61. * clflush_cache_range(start,size)
  62. *
  63. * Flush cache lines from start to start+size-1.
  64. *
  65. * Must deal with range from start to start+size-1 but nothing else
  66. * (need to be careful not to touch addresses that may be
  67. * unmapped).
  68. *
  69. * Note: "in0" and "in1" are preserved for debugging purposes.
  70. */
  71. .section .kprobes.text,"ax"
  72. GLOBAL_ENTRY(clflush_cache_range)
  73. .prologue
  74. alloc r2=ar.pfs,2,0,0,0
  75. movl r3=ia64_cache_stride_shift
  76. mov r21=1
  77. add r22=in1,in0
  78. ;;
  79. ld8 r20=[r3] // r20: stride shift
  80. sub r22=r22,r0,1 // last byte address
  81. ;;
  82. shr.u r23=in0,r20 // start / (stride size)
  83. shr.u r22=r22,r20 // (last byte address) / (stride size)
  84. shl r21=r21,r20 // r21: stride size of the i-cache(s)
  85. ;;
  86. sub r8=r22,r23 // number of strides - 1
  87. shl r24=r23,r20 // r24: addresses for "fc" =
  88. // "start" rounded down to stride
  89. // boundary
  90. .save ar.lc,r3
  91. mov r3=ar.lc // save ar.lc
  92. ;;
  93. .body
  94. mov ar.lc=r8
  95. ;;
  96. /*
  97. * 32 byte aligned loop, even number of (actually 2) bundles
  98. */
  99. .Loop_fc:
  100. fc r24 // issuable on M0 only
  101. add r24=r21,r24 // we flush "stride size" bytes per iteration
  102. nop.i 0
  103. br.cloop.sptk.few .Loop_fc
  104. ;;
  105. sync.i
  106. ;;
  107. srlz.i
  108. ;;
  109. mov ar.lc=r3 // restore ar.lc
  110. br.ret.sptk.many rp
  111. END(clflush_cache_range)