mmu_context.h 2.0 KB

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