mmu_context.h 1.8 KB

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