Print this page
8956 Implement KPTI
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>


   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 /*
  25  * Copyright (c) 2010, Intel Corporation.
  26  * All rights reserved.
  27  */
  28 /*
  29  * Copyright 2011 Joyent, Inc. All rights reserved.
  30  */
  31 
  32 #ifndef _SYS_RM_PLATTER_H
  33 #define _SYS_RM_PLATTER_H
  34 
  35 #include <sys/types.h>
  36 #include <sys/tss.h>
  37 #include <sys/segments.h>
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 #define RM_PLATTER_CODE_SIZE            0x400
  44 #define RM_PLATTER_CPU_HALT_CODE_SIZE   0x100
  45 
  46 typedef struct rm_platter {
  47         char            rm_code[RM_PLATTER_CODE_SIZE];
  48         char            rm_cpu_halt_code[RM_PLATTER_CPU_HALT_CODE_SIZE];
  49 #if defined(__amd64)


  96         ushort_t        rm_temp_idt_lim;
  97         uint32_t        rm_temp_idt_base;
  98 
  99         /*
 100          * The code executing in the rm_platter needs the offset into the
 101          * platter at which the 64-bit code starts, so have mp_startup
 102          * calculate it and store it here.
 103          */
 104         uint32_t        rm_longmode64_addr;
 105 #endif  /* __amd64 */
 106 } rm_platter_t;
 107 
 108 /*
 109  * cpu tables put within a single structure two of the tables which need to be
 110  * allocated when a CPU starts up.
 111  *
 112  * Note: the tss should be 16 byte aligned for best performance on amd64
 113  * Since DEFAULTSTKSIZE is a multiple of PAGESIZE tss will be aligned.
 114  */
 115 struct cpu_tables {
 116         char            ct_stack[DEFAULTSTKSZ];





 117         tss_t           ct_tss;
 118 };
 119 
 120 /*
 121  * gdt entries are 8 bytes long, ensure that we have an even no. of them.
 122  */
 123 #if ((NGDT / 2) * 2 != NGDT)
 124 #error "rm_platter.h: tss not properly aligned"
 125 #endif
 126 
 127 #ifdef  __cplusplus
 128 }
 129 #endif
 130 
 131 #endif  /* _SYS_RM_PLATTER_H */


   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 /*
  25  * Copyright (c) 2010, Intel Corporation.
  26  * All rights reserved.
  27  */
  28 /*
  29  * Copyright 2018 Joyent, Inc.
  30  */
  31 
  32 #ifndef _SYS_RM_PLATTER_H
  33 #define _SYS_RM_PLATTER_H
  34 
  35 #include <sys/types.h>
  36 #include <sys/tss.h>
  37 #include <sys/segments.h>
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 #define RM_PLATTER_CODE_SIZE            0x400
  44 #define RM_PLATTER_CPU_HALT_CODE_SIZE   0x100
  45 
  46 typedef struct rm_platter {
  47         char            rm_code[RM_PLATTER_CODE_SIZE];
  48         char            rm_cpu_halt_code[RM_PLATTER_CPU_HALT_CODE_SIZE];
  49 #if defined(__amd64)


  96         ushort_t        rm_temp_idt_lim;
  97         uint32_t        rm_temp_idt_base;
  98 
  99         /*
 100          * The code executing in the rm_platter needs the offset into the
 101          * platter at which the 64-bit code starts, so have mp_startup
 102          * calculate it and store it here.
 103          */
 104         uint32_t        rm_longmode64_addr;
 105 #endif  /* __amd64 */
 106 } rm_platter_t;
 107 
 108 /*
 109  * cpu tables put within a single structure two of the tables which need to be
 110  * allocated when a CPU starts up.
 111  *
 112  * Note: the tss should be 16 byte aligned for best performance on amd64
 113  * Since DEFAULTSTKSIZE is a multiple of PAGESIZE tss will be aligned.
 114  */
 115 struct cpu_tables {
 116         /* IST stacks */
 117         char            ct_stack1[DEFAULTSTKSZ];        /* dblfault */
 118 #if !defined(__xpv)
 119         char            ct_stack2[DEFAULTSTKSZ];        /* nmi */
 120         char            ct_stack3[DEFAULTSTKSZ];        /* mce */
 121 #endif
 122         tss_t           ct_tss;
 123 };
 124 
 125 /*
 126  * gdt entries are 8 bytes long, ensure that we have an even no. of them.
 127  */
 128 #if ((NGDT / 2) * 2 != NGDT)
 129 #error "rm_platter.h: tss not properly aligned"
 130 #endif
 131 
 132 #ifdef  __cplusplus
 133 }
 134 #endif
 135 
 136 #endif  /* _SYS_RM_PLATTER_H */