tlb-v7.S 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. /*
  54. * v7wbi_flush_kern_tlb_range(start,end)
  55. *
  56. * Invalidate a range of kernel TLB entries
  57. *
  58. * - start - start address (may not be aligned)
  59. * - end - end address (exclusive, may not be aligned)
  60. */
  61. ENTRY(v7wbi_flush_kern_tlb_range)
  62. dsb
  63. mov r0, r0, lsr #PAGE_SHIFT @ align address
  64. mov r1, r1, lsr #PAGE_SHIFT
  65. mov r0, r0, lsl #PAGE_SHIFT
  66. mov r1, r1, lsl #PAGE_SHIFT
  67. 1:
  68. mcr p15, 0, r0, c8, c6, 1 @ TLB invalidate D MVA
  69. mcr p15, 0, r0, c8, c5, 1 @ TLB invalidate I MVA
  70. add r0, r0, #PAGE_SZ
  71. cmp r0, r1
  72. blo 1b
  73. mov r2, #0
  74. mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB
  75. dsb
  76. isb
  77. mov pc, lr
  78. .section ".text.init", #alloc, #execinstr
  79. .type v7wbi_tlb_fns, #object
  80. ENTRY(v7wbi_tlb_fns)
  81. .long v7wbi_flush_user_tlb_range
  82. .long v7wbi_flush_kern_tlb_range
  83. .long v6wbi_tlb_flags
  84. .size v7wbi_tlb_fns, . - v7wbi_tlb_fns