mmu_context.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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/io.h>
  17. #include <asm/cacheflush.h>
  18. #include <asm/cpu-single.h>
  19. #define init_new_context(tsk, mm) 0
  20. #define destroy_context(mm) do { } while (0)
  21. /*
  22. * This is called when "tsk" is about to enter lazy TLB mode.
  23. *
  24. * mm: describes the currently active mm context
  25. * tsk: task which is entering lazy tlb
  26. * cpu: cpu number which is entering lazy tlb
  27. *
  28. * tsk->mm will be NULL
  29. */
  30. static inline void
  31. enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
  32. {
  33. }
  34. /*
  35. * This is the actual mm switch as far as the scheduler
  36. * is concerned. No registers are touched. We avoid
  37. * calling the CPU specific function when the mm hasn't
  38. * actually changed.
  39. */
  40. static inline void
  41. switch_mm(struct mm_struct *prev, struct mm_struct *next,
  42. struct task_struct *tsk)
  43. {
  44. unsigned int cpu = smp_processor_id();
  45. if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next)
  46. cpu_switch_mm(next->pgd, next);
  47. }
  48. #define deactivate_mm(tsk, mm) do { } while (0)
  49. #define activate_mm(prev, next) switch_mm(prev, next, NULL)
  50. /*
  51. * We are inserting a "fake" vma for the user-accessible vector page so
  52. * gdb and friends can get to it through ptrace and /proc/<pid>/mem.
  53. * But we also want to remove it before the generic code gets to see it
  54. * during process exit or the unmapping of it would cause total havoc.
  55. * (the macro is used as remove_vma() is static to mm/mmap.c)
  56. */
  57. #define arch_exit_mmap(mm) \
  58. do { \
  59. struct vm_area_struct *high_vma = find_vma(mm, 0xffff0000); \
  60. if (high_vma) { \
  61. BUG_ON(high_vma->vm_next); /* it should be last */ \
  62. if (high_vma->vm_prev) \
  63. high_vma->vm_prev->vm_next = NULL; \
  64. else \
  65. mm->mmap = NULL; \
  66. rb_erase(&high_vma->vm_rb, &mm->mm_rb); \
  67. mm->mmap_cache = NULL; \
  68. mm->map_count--; \
  69. remove_vma(high_vma); \
  70. } \
  71. } while (0)
  72. static inline void arch_dup_mmap(struct mm_struct *oldmm,
  73. struct mm_struct *mm)
  74. {
  75. }
  76. #endif