Print this page
8956 Implement KPTI
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
9208 hati_demap_func should take pagesize into account
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Tim Kordas <tim.kordas@joyent.com>
Reviewed by: Yuri Pankov <yuripv@yuripv.net>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/vm/hat_pte.h
          +++ new/usr/src/uts/i86pc/vm/hat_pte.h
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + * Copyright 2018 Joyent, Inc.
  24   25   */
  25   26  
  26   27  #ifndef _VM_HAT_PTE_H
  27   28  #define _VM_HAT_PTE_H
  28   29  
  29   30  #ifdef  __cplusplus
  30   31  extern "C" {
  31   32  #endif
  32   33  
  33   34  #include <sys/types.h>
↓ open down ↓ 97 lines elided ↑ open up ↑
 131  132   * future processors.
 132  133   *
 133  134   * The type of "level_t" is signed so that it can be used like:
 134  135   *      level_t l;
 135  136   *      ...
 136  137   *      while (--l >= 0)
 137  138   *              ...
 138  139   */
 139  140  #define MAX_NUM_LEVEL           4
 140  141  #define MAX_PAGE_LEVEL          2
      142 +#define MIN_PAGE_LEVEL          0
 141  143  typedef int8_t level_t;
 142  144  #define LEVEL_SHIFT(l)  (mmu.level_shift[l])
 143  145  #define LEVEL_SIZE(l)   (mmu.level_size[l])
 144  146  #define LEVEL_OFFSET(l) (mmu.level_offset[l])
 145  147  #define LEVEL_MASK(l)   (mmu.level_mask[l])
 146  148  
 147  149  /*
 148  150   * Macros to:
 149  151   * Check for a PFN above 4Gig and 64Gig for 32 bit PAE support
 150  152   */
 151  153  #define PFN_4G          (4ull * (1024 * 1024 * 1024 / MMU_PAGESIZE))
 152  154  #define PFN_64G         (64ull * (1024 * 1024 * 1024 / MMU_PAGESIZE))
 153  155  #define PFN_ABOVE4G(pfn) ((pfn) >= PFN_4G)
 154  156  #define PFN_ABOVE64G(pfn) ((pfn) >= PFN_64G)
 155  157  
 156  158  /*
 157      - * The CR3 register holds the physical address of the top level page table.
      159 + * The CR3 register holds the physical address of the top level page table,
      160 + * along with the current PCID if any.
 158  161   */
 159      -#define MAKECR3(pfn)    mmu_ptob(pfn)
      162 +#define MAKECR3(pfn, pcid)      (mmu_ptob(pfn) | pcid)
 160  163  
 161  164  /*
 162  165   * HAT/MMU parameters that depend on kernel mode and/or processor type
 163  166   */
 164  167  struct htable;
 165  168  struct hat_mmu_info {
 166  169          x86pte_t pt_nx;         /* either 0 or PT_NX */
 167  170          x86pte_t pt_global;     /* either 0 or PT_GLOBAL */
 168  171  
 169  172          pfn_t highest_pfn;
 170  173  
 171  174          uint_t num_level;       /* number of page table levels in use */
 172  175          uint_t max_level;       /* just num_level - 1 */
 173  176          uint_t max_page_level;  /* maximum level at which we can map a page */
 174  177          uint_t umax_page_level; /* max user page map level */
 175  178          uint_t ptes_per_table;  /* # of entries in lower level page tables */
 176      -        uint_t top_level_count; /* # of entries in top most level page table */
      179 +        uint_t top_level_count; /* # of entries in top-level page table */
      180 +        uint_t top_level_uslots; /* # of user slots in top-level page table */
      181 +        uint_t num_copied_ents; /* # of PCP-copied PTEs to create */
      182 +        /* 32-bit versions of values */
      183 +        uint_t top_level_uslots32;
      184 +        uint_t max_level32;
      185 +        uint_t num_copied_ents32;
 177  186  
 178      -        uint_t  hash_cnt;       /* cnt of entries in htable_hash_cache */
 179      -        uint_t  vlp_hash_cnt;   /* cnt of entries in vlp htable_hash_cache */
      187 +        uint_t hash_cnt;        /* cnt of entries in htable_hash_cache */
      188 +        uint_t hat32_hash_cnt;  /* cnt of entries in 32-bit htable_hash_cache */
 180  189  
 181  190          uint_t pae_hat;         /* either 0 or 1 */
 182  191  
 183  192          uintptr_t hole_start;   /* start of VA hole (or -1 if none) */
 184  193          uintptr_t hole_end;     /* end of VA hole (or 0 if none) */
 185  194  
 186  195          struct htable **kmap_htables; /* htables for segmap + 32 bit heap */
 187  196          x86pte_t *kmap_ptes;    /* mapping of pagetables that map kmap */
 188  197          uintptr_t kmap_addr;    /* start addr of kmap */
 189  198          uintptr_t kmap_eaddr;   /* end addr of kmap */
↓ open down ↓ 112 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX