Print this page
8956 Implement KPTI
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
9210 remove KMDB branch debugging support
9211 ::crregs could do with cr2/cr3 support
9209 ::ttrace should be able to filter by thread
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Yuri Pankov <yuripv@yuripv.net>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/sys/controlregs.h
          +++ new/usr/src/uts/intel/sys/controlregs.h
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  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 (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - * Copyright 2015, Joyent, Inc.
       23 + * Copyright 2018, Joyent, Inc.
  24   24   */
  25   25  
  26   26  #ifndef _SYS_CONTROLREGS_H
  27   27  #define _SYS_CONTROLREGS_H
  28   28  
  29   29  #ifndef _ASM
  30   30  #include <sys/types.h>
  31   31  #endif
  32   32  
  33   33  #ifdef __cplusplus
↓ open down ↓ 47 lines elided ↑ open up ↑
  81   81   * - set emulate (all fp instructions cause #nm)
  82   82   * - clear monitor coprocessor (so fwait/wait doesn't #nm)
  83   83   */
  84   84  #define CR0_DISABLE_FPU_FLAGS(cr)       \
  85   85          (((cr) | CR0_EM) & (uint32_t)~CR0_MP)
  86   86  
  87   87  /* CR3 Register */
  88   88  
  89   89  #define CR3_PCD 0x00000010              /* cache disable                */
  90   90  #define CR3_PWT 0x00000008              /* write through                */
       91 +#if defined(_ASM)
       92 +#define CR3_NOINVL_BIT  0x8000000000000000
       93 +#else
       94 +#define CR3_NOINVL_BIT  0x8000000000000000ULL /* no invalidation        */
       95 +#endif
       96 +#define PCID_NONE       0x000           /* generic PCID                 */
       97 +#define PCID_KERNEL     0x000           /* kernel's PCID                */
       98 +#define PCID_USER       0x001           /* user-space PCID              */
  91   99  
  92      -#define FMT_CR3 "\20\5pcd\4pwt"
  93      -
  94  100  /* CR4 Register */
  95  101  
  96  102  #define CR4_VME         0x0001          /* virtual-8086 mode extensions */
  97  103  #define CR4_PVI         0x0002          /* protected-mode virtual interrupts */
  98  104  #define CR4_TSD         0x0004          /* time stamp disable           */
  99  105  #define CR4_DE          0x0008          /* debugging extensions         */
 100  106  #define CR4_PSE         0x0010          /* page size extensions         */
 101  107  #define CR4_PAE         0x0020          /* physical address extension   */
 102  108  #define CR4_MCE         0x0040          /* machine check enable         */
 103  109  #define CR4_PGE         0x0080          /* page global enable           */
 104  110  #define CR4_PCE         0x0100          /* perf-monitoring counter enable */
 105  111  #define CR4_OSFXSR      0x0200          /* OS fxsave/fxrstor support    */
 106  112  #define CR4_OSXMMEXCPT  0x0400          /* OS unmasked exception support */
 107  113                                          /* 0x0800 reserved */
 108  114                                          /* 0x1000 reserved */
 109  115  #define CR4_VMXE        0x2000
 110  116  #define CR4_SMXE        0x4000
      117 +#define CR4_PCIDE       0x20000         /* PCID enable */
 111  118  #define CR4_OSXSAVE     0x40000         /* OS xsave/xrestore support    */
 112  119  #define CR4_SMEP        0x100000        /* NX for user pages in kernel */
 113  120  #define CR4_SMAP        0x200000        /* kernel can't access user pages */
 114  121  
 115  122  #define FMT_CR4                                         \
 116      -        "\20\26smap\25smep\23osxsav"                    \
      123 +        "\20\26smap\25smep\23osxsav\22pcide"            \
 117  124          "\17smxe\16vmxe\13xmme\12fxsr\11pce\10pge"      \
 118  125          "\7mce\6pae\5pse\4de\3tsd\2pvi\1vme"
 119  126  
 120  127  /*
 121  128   * Enable the SSE-related control bits to explain to the processor that
 122  129   * we're managing XMM state and exceptions
 123  130   */
 124  131  #define CR4_ENABLE_SSE_FLAGS(cr)        \
 125  132          ((cr) | CR4_OSFXSR | CR4_OSXMMEXCPT)
 126  133  
↓ open down ↓ 115 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX