mmu_context.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * include/asm-s390/mmu_context.h
  3. *
  4. * S390 version
  5. *
  6. * Derived from "include/asm-i386/mmu_context.h"
  7. */
  8. #ifndef __S390_MMU_CONTEXT_H
  9. #define __S390_MMU_CONTEXT_H
  10. #include <asm/pgalloc.h>
  11. #include <asm-generic/mm_hooks.h>
  12. static inline int init_new_context(struct task_struct *tsk,
  13. struct mm_struct *mm)
  14. {
  15. mm->context = _ASCE_TABLE_LENGTH | _ASCE_USER_BITS;
  16. #ifdef CONFIG_64BIT
  17. mm->context |= _ASCE_TYPE_REGION3;
  18. #endif
  19. return 0;
  20. }
  21. #define destroy_context(mm) do { } while (0)
  22. #ifndef __s390x__
  23. #define LCTL_OPCODE "lctl"
  24. #else
  25. #define LCTL_OPCODE "lctlg"
  26. #endif
  27. static inline void update_mm(struct mm_struct *mm, struct task_struct *tsk)
  28. {
  29. S390_lowcore.user_asce = mm->context | __pa(mm->pgd);
  30. if (switch_amode) {
  31. /* Load primary space page table origin. */
  32. pgd_t *shadow_pgd = get_shadow_table(mm->pgd) ? : mm->pgd;
  33. S390_lowcore.user_exec_asce = mm->context | __pa(shadow_pgd);
  34. asm volatile(LCTL_OPCODE" 1,1,%0\n"
  35. : : "m" (S390_lowcore.user_exec_asce) );
  36. } else
  37. /* Load home space page table origin. */
  38. asm volatile(LCTL_OPCODE" 13,13,%0"
  39. : : "m" (S390_lowcore.user_asce) );
  40. }
  41. static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  42. struct task_struct *tsk)
  43. {
  44. if (unlikely(prev == next))
  45. return;
  46. cpu_set(smp_processor_id(), next->cpu_vm_mask);
  47. update_mm(next, tsk);
  48. }
  49. #define enter_lazy_tlb(mm,tsk) do { } while (0)
  50. #define deactivate_mm(tsk,mm) do { } while (0)
  51. static inline void activate_mm(struct mm_struct *prev,
  52. struct mm_struct *next)
  53. {
  54. switch_mm(prev, next, current);
  55. set_fs(current->thread.mm_segment);
  56. }
  57. #endif /* __S390_MMU_CONTEXT_H */