mmu_context.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 "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. switch_mm_skas(&new->context.skas.id);
  26. }
  27. static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  28. struct task_struct *tsk)
  29. {
  30. unsigned cpu = smp_processor_id();
  31. if(prev != next){
  32. cpu_clear(cpu, prev->cpu_vm_mask);
  33. cpu_set(cpu, next->cpu_vm_mask);
  34. if(next != &init_mm)
  35. switch_mm_skas(&next->context.skas.id);
  36. }
  37. }
  38. static inline void enter_lazy_tlb(struct mm_struct *mm,
  39. struct task_struct *tsk)
  40. {
  41. }
  42. extern int init_new_context_skas(struct task_struct *task,
  43. struct mm_struct *mm);
  44. static inline int init_new_context(struct task_struct *task,
  45. struct mm_struct *mm)
  46. {
  47. return(init_new_context_skas(task, mm));
  48. }
  49. extern void destroy_context_skas(struct mm_struct *mm);
  50. static inline void destroy_context(struct mm_struct *mm)
  51. {
  52. destroy_context_skas(mm);
  53. }
  54. #endif
  55. /*
  56. * Overrides for Emacs so that we follow Linus's tabbing style.
  57. * Emacs will notice this stuff at the end of the file and automatically
  58. * adjust the settings for this buffer only. This must remain at the end
  59. * of the file.
  60. * ---------------------------------------------------------------------------
  61. * Local variables:
  62. * c-file-style: "linux"
  63. * End:
  64. */