mmu_context.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. /*
  13. * get a new mmu context.. S390 don't know about contexts.
  14. */
  15. #define init_new_context(tsk,mm) 0
  16. #define destroy_context(mm) do { } while (0)
  17. #ifndef __s390x__
  18. #define LCTL_OPCODE "lctl"
  19. #define PGTABLE_BITS (_SEGMENT_TABLE|USER_STD_MASK)
  20. #else
  21. #define LCTL_OPCODE "lctlg"
  22. #define PGTABLE_BITS (_REGION_TABLE|USER_STD_MASK)
  23. #endif
  24. static inline void enter_lazy_tlb(struct mm_struct *mm,
  25. struct task_struct *tsk)
  26. {
  27. }
  28. static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  29. struct task_struct *tsk)
  30. {
  31. pgd_t *shadow_pgd = get_shadow_pgd(next->pgd);
  32. if (prev != next) {
  33. S390_lowcore.user_asce = (__pa(next->pgd) & PAGE_MASK) |
  34. PGTABLE_BITS;
  35. if (shadow_pgd) {
  36. /* Load primary/secondary space page table origin. */
  37. S390_lowcore.user_exec_asce =
  38. (__pa(shadow_pgd) & PAGE_MASK) | PGTABLE_BITS;
  39. asm volatile(LCTL_OPCODE" 1,1,%0\n"
  40. LCTL_OPCODE" 7,7,%1"
  41. : : "m" (S390_lowcore.user_exec_asce),
  42. "m" (S390_lowcore.user_asce) );
  43. } else if (switch_amode) {
  44. /* Load primary space page table origin. */
  45. asm volatile(LCTL_OPCODE" 1,1,%0"
  46. : : "m" (S390_lowcore.user_asce) );
  47. } else
  48. /* Load home space page table origin. */
  49. asm volatile(LCTL_OPCODE" 13,13,%0"
  50. : : "m" (S390_lowcore.user_asce) );
  51. }
  52. cpu_set(smp_processor_id(), next->cpu_vm_mask);
  53. }
  54. #define deactivate_mm(tsk,mm) do { } while (0)
  55. static inline void activate_mm(struct mm_struct *prev,
  56. struct mm_struct *next)
  57. {
  58. switch_mm(prev, next, current);
  59. set_fs(current->thread.mm_segment);
  60. }
  61. #endif /* __S390_MMU_CONTEXT_H */