mmu_context.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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(&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(&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(struct task_struct *task, struct mm_struct *mm);
  43. extern void destroy_context(struct mm_struct *mm);
  44. #endif
  45. /*
  46. * Overrides for Emacs so that we follow Linus's tabbing style.
  47. * Emacs will notice this stuff at the end of the file and automatically
  48. * adjust the settings for this buffer only. This must remain at the end
  49. * of the file.
  50. * ---------------------------------------------------------------------------
  51. * Local variables:
  52. * c-file-style: "linux"
  53. * End:
  54. */