mmu_context.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef __PPC64_MMU_CONTEXT_H
  2. #define __PPC64_MMU_CONTEXT_H
  3. #include <linux/config.h>
  4. #include <linux/kernel.h>
  5. #include <linux/mm.h>
  6. #include <asm/mmu.h>
  7. #include <asm/cputable.h>
  8. /*
  9. * Copyright (C) 2001 PPC 64 Team, IBM Corp
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version
  14. * 2 of the License, or (at your option) any later version.
  15. */
  16. static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
  17. {
  18. }
  19. #define NO_CONTEXT 0
  20. #define MAX_CONTEXT (0x100000-1)
  21. extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
  22. extern void destroy_context(struct mm_struct *mm);
  23. extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm);
  24. extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
  25. /*
  26. * switch_mm is the entry point called from the architecture independent
  27. * code in kernel/sched.c
  28. */
  29. static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  30. struct task_struct *tsk)
  31. {
  32. if (!cpu_isset(smp_processor_id(), next->cpu_vm_mask))
  33. cpu_set(smp_processor_id(), next->cpu_vm_mask);
  34. /* No need to flush userspace segments if the mm doesnt change */
  35. if (prev == next)
  36. return;
  37. #ifdef CONFIG_ALTIVEC
  38. if (cpu_has_feature(CPU_FTR_ALTIVEC))
  39. asm volatile ("dssall");
  40. #endif /* CONFIG_ALTIVEC */
  41. if (cpu_has_feature(CPU_FTR_SLB))
  42. switch_slb(tsk, next);
  43. else
  44. switch_stab(tsk, next);
  45. }
  46. #define deactivate_mm(tsk,mm) do { } while (0)
  47. /*
  48. * After we have set current->mm to a new value, this activates
  49. * the context for the new mm so we see the new mappings.
  50. */
  51. static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
  52. {
  53. unsigned long flags;
  54. local_irq_save(flags);
  55. switch_mm(prev, next, current);
  56. local_irq_restore(flags);
  57. }
  58. #endif /* __PPC64_MMU_CONTEXT_H */