mmu_context.h 2.3 KB

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