mmu_context.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. /*
  24. * The proto-VSID space has 2^35 - 1 segments available for user mappings.
  25. * Each segment contains 2^28 bytes. Each context maps 2^44 bytes,
  26. * so we can support 2^19-1 contexts (19 == 35 + 28 - 44).
  27. */
  28. #define NO_CONTEXT 0
  29. #define MAX_CONTEXT ((1UL << 19) - 1)
  30. extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
  31. extern void destroy_context(struct mm_struct *mm);
  32. extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm);
  33. extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
  34. /*
  35. * switch_mm is the entry point called from the architecture independent
  36. * code in kernel/sched.c
  37. */
  38. static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  39. struct task_struct *tsk)
  40. {
  41. if (!cpu_isset(smp_processor_id(), next->cpu_vm_mask))
  42. cpu_set(smp_processor_id(), next->cpu_vm_mask);
  43. /* No need to flush userspace segments if the mm doesnt change */
  44. if (prev == next)
  45. return;
  46. #ifdef CONFIG_ALTIVEC
  47. if (cpu_has_feature(CPU_FTR_ALTIVEC))
  48. asm volatile ("dssall");
  49. #endif /* CONFIG_ALTIVEC */
  50. if (cpu_has_feature(CPU_FTR_SLB))
  51. switch_slb(tsk, next);
  52. else
  53. switch_stab(tsk, next);
  54. }
  55. #define deactivate_mm(tsk,mm) do { } while (0)
  56. /*
  57. * After we have set current->mm to a new value, this activates
  58. * the context for the new mm so we see the new mappings.
  59. */
  60. static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
  61. {
  62. unsigned long flags;
  63. local_irq_save(flags);
  64. switch_mm(prev, next, current);
  65. local_irq_restore(flags);
  66. }
  67. #endif /* CONFIG_PPC64 */
  68. #endif /* __KERNEL__ */
  69. #endif /* __ASM_POWERPC_MMU_CONTEXT_H */