tlb-v7.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * linux/arch/arm/mm/tlb-v7.S
  3. *
  4. * Copyright (C) 1997-2002 Russell King
  5. * Modified for ARMv7 by Catalin Marinas
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * ARM architecture version 6 TLB handling functions.
  12. * These assume a split I/D TLB.
  13. */
  14. #include <linux/linkage.h>
  15. #include <asm/asm-offsets.h>
  16. #include <asm/page.h>
  17. #include <asm/tlbflush.h>
  18. #include "proc-macros.S"
  19. /*
  20. * v7wbi_flush_user_tlb_range(start, end, vma)
  21. *
  22. * Invalidate a range of TLB entries in the specified address space.
  23. *
  24. * - start - start address (may not be aligned)
  25. * - end - end address (exclusive, may not be aligned)
  26. * - vma - vma_struct describing address range
  27. *
  28. * It is assumed that:
  29. * - the "Invalidate single entry" instruction will invalidate
  30. * both the I and the D TLBs on Harvard-style TLBs
  31. */
  32. ENTRY(v7wbi_flush_user_tlb_range)
  33. vma_vm_mm r3, r2 @ get vma->vm_mm
  34. mmid r3, r3 @ get vm_mm->context.id
  35. dsb
  36. mov r0, r0, lsr #PAGE_SHIFT @ align address
  37. mov r1, r1, lsr #PAGE_SHIFT
  38. asid r3, r3 @ mask ASID
  39. orr r0, r3, r0, lsl #PAGE_SHIFT @ Create initial MVA
  40. mov r1, r1, lsl #PAGE_SHIFT
  41. vma_vm_flags r2, r2 @ get vma->vm_flags
  42. 1:
  43. mcr p15, 0, r0, c8, c6, 1 @ TLB invalidate D MVA (was 1)
  44. tst r2, #VM_EXEC @ Executable area ?
  45. mcrne p15, 0, r0, c8, c5, 1 @ TLB invalidate I MVA (was 1)
  46. add r0, r0, #PAGE_SZ
  47. cmp r0, r1
  48. blo 1b
  49. mov ip, #0
  50. mcr p15, 0, ip, c7, c5, 6 @ flush BTAC/BTB
  51. dsb
  52. mov pc, lr
  53. ENDPROC(v7wbi_flush_user_tlb_range)
  54. /*
  55. * v7wbi_flush_kern_tlb_range(start,end)
  56. *
  57. * Invalidate a range of kernel TLB entries
  58. *
  59. * - start - start address (may not be aligned)
  60. * - end - end address (exclusive, may not be aligned)
  61. */
  62. ENTRY(v7wbi_flush_kern_tlb_range)
  63. dsb
  64. mov r0, r0, lsr #PAGE_SHIFT @ align address
  65. mov r1, r1, lsr #PAGE_SHIFT
  66. mov r0, r0, lsl #PAGE_SHIFT
  67. mov r1, r1, lsl #PAGE_SHIFT
  68. 1:
  69. mcr p15, 0, r0, c8, c6, 1 @ TLB invalidate D MVA
  70. mcr p15, 0, r0, c8, c5, 1 @ TLB invalidate I MVA
  71. add r0, r0, #PAGE_SZ
  72. cmp r0, r1
  73. blo 1b
  74. mov r2, #0
  75. mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB
  76. dsb
  77. isb
  78. mov pc, lr
  79. ENDPROC(v7wbi_flush_kern_tlb_range)
  80. .section ".text.init", #alloc, #execinstr
  81. .type v7wbi_tlb_fns, #object
  82. ENTRY(v7wbi_tlb_fns)
  83. .long v7wbi_flush_user_tlb_range
  84. .long v7wbi_flush_kern_tlb_range
  85. .long v6wbi_tlb_flags
  86. .size v7wbi_tlb_fns, . - v7wbi_tlb_fns