mmu.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_X86_MMU_H
  3. #define _ASM_X86_MMU_H
  4. #include <linux/spinlock.h>
  5. #include <linux/rwsem.h>
  6. #include <linux/mutex.h>
  7. #include <linux/atomic.h>
  8. /*
  9. * x86 has arch-specific MMU state beyond what lives in mm_struct.
  10. */
  11. typedef struct {
  12. /*
  13. * ctx_id uniquely identifies this mm_struct. A ctx_id will never
  14. * be reused, and zero is not a valid ctx_id.
  15. */
  16. u64 ctx_id;
  17. /*
  18. * Any code that needs to do any sort of TLB flushing for this
  19. * mm will first make its changes to the page tables, then
  20. * increment tlb_gen, then flush. This lets the low-level
  21. * flushing code keep track of what needs flushing.
  22. *
  23. * This is not used on Xen PV.
  24. */
  25. atomic64_t tlb_gen;
  26. #ifdef CONFIG_MODIFY_LDT_SYSCALL
  27. struct rw_semaphore ldt_usr_sem;
  28. struct ldt_struct *ldt;
  29. #endif
  30. #ifdef CONFIG_X86_64
  31. /* True if mm supports a task running in 32 bit compatibility mode. */
  32. unsigned short ia32_compat;
  33. #endif
  34. struct mutex lock;
  35. void __user *vdso; /* vdso base address */
  36. const struct vdso_image *vdso_image; /* vdso image in use */
  37. atomic_t perf_rdpmc_allowed; /* nonzero if rdpmc is allowed */
  38. #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
  39. /*
  40. * One bit per protection key says whether userspace can
  41. * use it or not. protected by mmap_sem.
  42. */
  43. u16 pkey_allocation_map;
  44. s16 execute_only_pkey;
  45. #endif
  46. #ifdef CONFIG_X86_INTEL_MPX
  47. /* address of the bounds directory */
  48. void __user *bd_addr;
  49. #endif
  50. } mm_context_t;
  51. #define INIT_MM_CONTEXT(mm) \
  52. .context = { \
  53. .ctx_id = 1, \
  54. }
  55. void leave_mm(int cpu);
  56. #endif /* _ASM_X86_MMU_H */