mmu_context.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef __UM_MMU_CONTEXT_H
  6. #define __UM_MMU_CONTEXT_H
  7. #include <asm-generic/mm_hooks.h>
  8. #include "linux/sched.h"
  9. #include "choose-mode.h"
  10. #include "um_mmu.h"
  11. #define get_mmu_context(task) do ; while(0)
  12. #define activate_context(tsk) do ; while(0)
  13. #define deactivate_mm(tsk,mm) do { } while (0)
  14. extern void force_flush_all(void);
  15. static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
  16. {
  17. /*
  18. * This is called by fs/exec.c and fs/aio.c. In the first case, for an
  19. * exec, we don't need to do anything as we're called from userspace
  20. * and thus going to use a new host PID. In the second, we're called
  21. * from a kernel thread, and thus need to go doing the mmap's on the
  22. * host. Since they're very expensive, we want to avoid that as far as
  23. * possible.
  24. */
  25. if (old != new && (current->flags & PF_BORROWED_MM))
  26. CHOOSE_MODE(force_flush_all(),
  27. switch_mm_skas(&new->context.skas.id));
  28. }
  29. static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  30. struct task_struct *tsk)
  31. {
  32. unsigned cpu = smp_processor_id();
  33. if(prev != next){
  34. cpu_clear(cpu, prev->cpu_vm_mask);
  35. cpu_set(cpu, next->cpu_vm_mask);
  36. if(next != &init_mm)
  37. CHOOSE_MODE((void) 0,
  38. switch_mm_skas(&next->context.skas.id));
  39. }
  40. }
  41. static inline void enter_lazy_tlb(struct mm_struct *mm,
  42. struct task_struct *tsk)
  43. {
  44. }
  45. extern int init_new_context_skas(struct task_struct *task,
  46. struct mm_struct *mm);
  47. static inline int init_new_context_tt(struct task_struct *task,
  48. struct mm_struct *mm)
  49. {
  50. return(0);
  51. }
  52. static inline int init_new_context(struct task_struct *task,
  53. struct mm_struct *mm)
  54. {
  55. return(CHOOSE_MODE_PROC(init_new_context_tt, init_new_context_skas,
  56. task, mm));
  57. }
  58. extern void destroy_context_skas(struct mm_struct *mm);
  59. static inline void destroy_context(struct mm_struct *mm)
  60. {
  61. CHOOSE_MODE((void) 0, destroy_context_skas(mm));
  62. }
  63. #endif
  64. /*
  65. * Overrides for Emacs so that we follow Linus's tabbing style.
  66. * Emacs will notice this stuff at the end of the file and automatically
  67. * adjust the settings for this buffer only. This must remain at the end
  68. * of the file.
  69. * ---------------------------------------------------------------------------
  70. * Local variables:
  71. * c-file-style: "linux"
  72. * End:
  73. */