mmu_context.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 <linux/mm_types.h>
  23. #include <asm/setup.h>
  24. #include <asm/page.h>
  25. #include <asm/pgalloc.h>
  26. #include <asm/mem-layout.h>
  27. static inline void destroy_context(struct mm_struct *mm)
  28. {
  29. }
  30. /*
  31. * VM port hides all TLB management, so "lazy TLB" isn't very
  32. * meaningful. Even for ports to architectures with visble TLBs,
  33. * this is almost invariably a null function.
  34. */
  35. static inline void enter_lazy_tlb(struct mm_struct *mm,
  36. struct task_struct *tsk)
  37. {
  38. }
  39. /*
  40. * Architecture-specific actions, if any, for memory map deactivation.
  41. */
  42. static inline void deactivate_mm(struct task_struct *tsk,
  43. struct mm_struct *mm)
  44. {
  45. }
  46. /**
  47. * init_new_context - initialize context related info for new mm_struct instance
  48. * @tsk: pointer to a task struct
  49. * @mm: pointer to a new mm struct
  50. */
  51. static inline int init_new_context(struct task_struct *tsk,
  52. struct mm_struct *mm)
  53. {
  54. /* mm->context is set up by pgd_alloc */
  55. return 0;
  56. }
  57. /*
  58. * Switch active mm context
  59. */
  60. static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  61. struct task_struct *tsk)
  62. {
  63. int l1;
  64. /*
  65. * For virtual machine, we have to update system map if it's been
  66. * touched.
  67. */
  68. if (next->context.generation < prev->context.generation) {
  69. for (l1 = MIN_KERNEL_SEG; l1 <= max_kernel_seg; l1++)
  70. next->pgd[l1] = init_mm.pgd[l1];
  71. next->context.generation = prev->context.generation;
  72. }
  73. __vmnewmap((void *)next->context.ptbase);
  74. }
  75. /*
  76. * Activate new memory map for task
  77. */
  78. static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
  79. {
  80. unsigned long flags;
  81. local_irq_save(flags);
  82. switch_mm(prev, next, current_thread_info()->task);
  83. local_irq_restore(flags);
  84. }
  85. /* Generic hooks for arch_dup_mmap and arch_exit_mmap */
  86. #include <asm-generic/mm_hooks.h>
  87. #endif