Print this page
OS-6546 Use PCID if KPTI is enabled

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/sys/mach_mmu.h
          +++ new/usr/src/uts/i86pc/sys/mach_mmu.h
↓ open down ↓ 123 lines elided ↑ open up ↑
 124  124   * PT_NOCONSIST - There is no hment entry for this mapping.
 125  125   *
 126  126   * PT_FOREIGN - used for the hypervisor, check via
 127  127   *              (pte & PT_SOFTWARE) >= PT_FOREIGN
 128  128   *              as it might set 0x800 for foreign grant table mappings.
 129  129   */
 130  130  #define PT_NOSYNC       (0x200) /* PTE was created with HAT_NOSYNC */
 131  131  #define PT_NOCONSIST    (0x400) /* PTE was created with HAT_LOAD_NOCONSIST */
 132  132  #define PT_FOREIGN      (0x600) /* MFN mapped on the hypervisor has no PFN */
 133  133  
      134 +#ifndef _BOOT
      135 +
      136 +extern ulong_t getcr3(void);
      137 +extern void setcr3(ulong_t);
      138 +
      139 +#define getcr3_pa() (getcr3() & MMU_PAGEMASK)
      140 +#define getpcid() ((getcr4() & CR4_PCIDE) ? \
      141 +        (getcr3() & MMU_PAGEOFFSET) : PCID_NONE)
      142 +
      143 +extern void mmu_invlpg(caddr_t);
      144 +
      145 +#endif
      146 +
 134  147  #ifdef __xpv
 135  148  #include <sys/xen_mmu.h>
 136  149  #else
 137  150  #include <sys/pc_mmu.h>
 138  151  #endif
 139  152  
 140  153  /*
 141  154   * The software extraction for a single Page Table Entry will always
 142  155   * be a 64 bit unsigned int. If running a non-PAE hat, the page table
 143  156   * access routines know to extend/shorten it to 32 bits.
 144  157   */
 145  158  typedef uint64_t x86pte_t;
 146  159  typedef uint32_t x86pte32_t;
 147  160  
 148  161  x86pte_t get_pteval(paddr_t, uint_t);
 149  162  void set_pteval(paddr_t, uint_t, uint_t, x86pte_t);
 150  163  paddr_t make_ptable(x86pte_t *, uint_t);
 151  164  x86pte_t *find_pte(uint64_t, paddr_t *, uint_t, uint_t);
 152  165  x86pte_t *map_pte(paddr_t, uint_t);
 153      -
 154      -#ifndef _BOOT
 155      -ulong_t getcr3();
 156      -#endif
 157  166  
 158  167  extern uint_t *shift_amt;
 159  168  extern uint_t ptes_per_table;
 160  169  extern paddr_t top_page_table;
 161  170  extern uint_t top_level;
 162  171  extern uint_t pte_size;
 163  172  extern uint_t shift_amt_nopae[];
 164  173  extern uint_t shift_amt_pae[];
 165  174  extern uint32_t lpagesize;
 166  175  
 167  176  #ifdef __cplusplus
 168  177  }
 169  178  #endif
 170  179  
 171  180  #endif /* _ASM */
 172  181  
 173  182  #endif  /* _SYS_MACH_MMU_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX