mmu_context.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * linux/arch/unicore32/include/asm/mmu_context.h
  3. *
  4. * Code specific to PKUnity SoC and UniCore ISA
  5. *
  6. * Copyright (C) 2001-2010 GUAN Xue-tao
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __UNICORE_MMU_CONTEXT_H__
  13. #define __UNICORE_MMU_CONTEXT_H__
  14. #include <linux/compiler.h>
  15. #include <linux/sched.h>
  16. #include <linux/mm.h>
  17. #include <linux/vmacache.h>
  18. #include <linux/io.h>
  19. #include <asm/cacheflush.h>
  20. #include <asm/cpu-single.h>
  21. #define init_new_context(tsk, mm) 0
  22. #define destroy_context(mm) do { } while (0)
  23. /*
  24. * This is called when "tsk" is about to enter lazy TLB mode.
  25. *
  26. * mm: describes the currently active mm context
  27. * tsk: task which is entering lazy tlb
  28. * cpu: cpu number which is entering lazy tlb
  29. *
  30. * tsk->mm will be NULL
  31. */
  32. static inline void
  33. enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
  34. {
  35. }
  36. /*
  37. * This is the actual mm switch as far as the scheduler
  38. * is concerned. No registers are touched. We avoid
  39. * calling the CPU specific function when the mm hasn't
  40. * actually changed.
  41. */
  42. static inline void
  43. switch_mm(struct mm_struct *prev, struct mm_struct *next,
  44. struct task_struct *tsk)
  45. {
  46. unsigned int cpu = smp_processor_id();
  47. if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next)
  48. cpu_switch_mm(next->pgd, next);
  49. }
  50. #define deactivate_mm(tsk, mm) do { } while (0)
  51. #define activate_mm(prev, next) switch_mm(prev, next, NULL)
  52. /*
  53. * We are inserting a "fake" vma for the user-accessible vector page so
  54. * gdb and friends can get to it through ptrace and /proc/<pid>/mem.
  55. * But we also want to remove it before the generic code gets to see it
  56. * during process exit or the unmapping of it would cause total havoc.
  57. * (the macro is used as remove_vma() is static to mm/mmap.c)
  58. */
  59. #define arch_exit_mmap(mm) \
  60. do { \
  61. struct vm_area_struct *high_vma = find_vma(mm, 0xffff0000); \
  62. if (high_vma) { \
  63. BUG_ON(high_vma->vm_next); /* it should be last */ \
  64. if (high_vma->vm_prev) \
  65. high_vma->vm_prev->vm_next = NULL; \
  66. else \
  67. mm->mmap = NULL; \
  68. rb_erase(&high_vma->vm_rb, &mm->mm_rb); \
  69. vmacache_invalidate(mm); \
  70. mm->map_count--; \
  71. remove_vma(high_vma); \
  72. } \
  73. } while (0)
  74. static inline void arch_dup_mmap(struct mm_struct *oldmm,
  75. struct mm_struct *mm)
  76. {
  77. }
  78. static inline void arch_unmap(struct mm_struct *mm,
  79. struct vm_area_struct *vma,
  80. unsigned long start, unsigned long end)
  81. {
  82. }
  83. static inline void arch_bprm_mm_init(struct mm_struct *mm,
  84. struct vm_area_struct *vma)
  85. {
  86. }
  87. #endif