mmu_context.h 2.3 KB

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