mmu_context.h 2.3 KB

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