flush.S 2.6 KB

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