flush.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. GLOBAL_ENTRY(flush_icache_range)
  21. .prologue
  22. alloc r2=ar.pfs,2,0,0,0
  23. movl r3=ia64_i_cache_stride_shift
  24. mov r21=1
  25. ;;
  26. ld8 r20=[r3] // r20: stride shift
  27. sub r22=in1,r0,1 // last byte address
  28. ;;
  29. shr.u r23=in0,r20 // start / (stride size)
  30. shr.u r22=r22,r20 // (last byte address) / (stride size)
  31. shl r21=r21,r20 // r21: stride size of the i-cache(s)
  32. ;;
  33. sub r8=r22,r23 // number of strides - 1
  34. shl r24=r23,r20 // r24: addresses for "fc.i" =
  35. // "start" rounded down to stride boundary
  36. .save ar.lc,r3
  37. mov r3=ar.lc // save ar.lc
  38. ;;
  39. .body
  40. mov ar.lc=r8
  41. ;;
  42. /*
  43. * 32 byte aligned loop, even number of (actually 2) bundles
  44. */
  45. .Loop: fc.i r24 // issuable on M0 only
  46. add r24=r21,r24 // we flush "stride size" bytes per iteration
  47. nop.i 0
  48. br.cloop.sptk.few .Loop
  49. ;;
  50. sync.i
  51. ;;
  52. srlz.i
  53. ;;
  54. mov ar.lc=r3 // restore ar.lc
  55. br.ret.sptk.many rp
  56. END(flush_icache_range)