cacheflush.S 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * vDSO provided cache flush routines
  3. *
  4. * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org),
  5. * IBM Corp.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #include <linux/config.h>
  13. #include <asm/processor.h>
  14. #include <asm/ppc_asm.h>
  15. #include <asm/vdso.h>
  16. #include <asm/asm-offsets.h>
  17. .text
  18. /*
  19. * Default "generic" version of __kernel_sync_dicache.
  20. *
  21. * void __kernel_sync_dicache(unsigned long start, unsigned long end)
  22. *
  23. * Flushes the data cache & invalidate the instruction cache for the
  24. * provided range [start, end[
  25. *
  26. * Note: all CPUs supported by this kernel have a 128 bytes cache
  27. * line size so we don't have to peek that info from the datapage
  28. */
  29. V_FUNCTION_BEGIN(__kernel_sync_dicache)
  30. .cfi_startproc
  31. li r5,127
  32. andc r6,r3,r5 /* round low to line bdy */
  33. subf r8,r6,r4 /* compute length */
  34. add r8,r8,r5 /* ensure we get enough */
  35. srwi. r8,r8,7 /* compute line count */
  36. crclr cr0*4+so
  37. beqlr /* nothing to do? */
  38. mtctr r8
  39. mr r3,r6
  40. 1: dcbst 0,r3
  41. addi r3,r3,128
  42. bdnz 1b
  43. sync
  44. mtctr r8
  45. 1: icbi 0,r6
  46. addi r6,r6,128
  47. bdnz 1b
  48. isync
  49. li r3,0
  50. blr
  51. .cfi_endproc
  52. V_FUNCTION_END(__kernel_sync_dicache)
  53. /*
  54. * POWER5 version of __kernel_sync_dicache
  55. */
  56. V_FUNCTION_BEGIN(__kernel_sync_dicache_p5)
  57. .cfi_startproc
  58. crclr cr0*4+so
  59. sync
  60. isync
  61. li r3,0
  62. blr
  63. .cfi_endproc
  64. V_FUNCTION_END(__kernel_sync_dicache_p5)