mmu_context.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * MM context support for the Hexagon architecture
  3. *
  4. * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 and
  8. * only version 2 as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  18. * 02110-1301, USA.
  19. */
  20. #ifndef _ASM_MMU_CONTEXT_H
  21. #define _ASM_MMU_CONTEXT_H
  22. #include <asm/setup.h>
  23. #include <asm/page.h>
  24. #include <asm/pgalloc.h>
  25. #include <asm/mem-layout.h>
  26. static inline void destroy_context(struct mm_struct *mm)
  27. {
  28. }
  29. /*
  30. * VM port hides all TLB management, so "lazy TLB" isn't very
  31. * meaningful. Even for ports to architectures with visble TLBs,
  32. * this is almost invariably a null function.
  33. */
  34. static inline void enter_lazy_tlb(struct mm_struct *mm,
  35. struct task_struct *tsk)
  36. {
  37. }
  38. /*
  39. * Architecture-specific actions, if any, for memory map deactivation.
  40. */
  41. static inline void deactivate_mm(struct task_struct *tsk,
  42. struct mm_struct *mm)
  43. {
  44. }
  45. /**
  46. * init_new_context - initialize context related info for new mm_struct instance
  47. * @tsk: pointer to a task struct
  48. * @mm: pointer to a new mm struct
  49. */
  50. static inline int init_new_context(struct task_struct *tsk,
  51. struct mm_struct *mm)
  52. {
  53. /* mm->context is set up by pgd_alloc */
  54. return 0;
  55. }
  56. /*
  57. * Switch active mm context
  58. */
  59. static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  60. struct task_struct *tsk)
  61. {
  62. int l1;
  63. /*
  64. * For virtual machine, we have to update system map if it's been
  65. * touched.
  66. */
  67. if (next->context.generation < prev->context.generation) {
  68. for (l1 = MIN_KERNEL_SEG; l1 <= max_kernel_seg; l1++)
  69. next->pgd[l1] = init_mm.pgd[l1];
  70. next->context.generation = prev->context.generation;
  71. }
  72. __vmnewmap((void *)next->context.ptbase);
  73. }
  74. /*
  75. * Activate new memory map for task
  76. */
  77. static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
  78. {
  79. unsigned long flags;
  80. local_irq_save(flags);
  81. switch_mm(prev, next, current_thread_info()->task);
  82. local_irq_restore(flags);
  83. }
  84. /* Generic hooks for arch_dup_mmap and arch_exit_mmap */
  85. #include <asm-generic/mm_hooks.h>
  86. #endif