Print this page
8956 Implement KPTI
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/sys/archsystm.h
+++ new/usr/src/uts/intel/sys/archsystm.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
↓ 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 /*
23 23 * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
24 - * Copyright 2017 Joyent, Inc.
24 + * Copyright 2018 Joyent, Inc.
25 25 */
26 26
27 27 #ifndef _SYS_ARCHSYSTM_H
28 28 #define _SYS_ARCHSYSTM_H
29 29
30 30 /*
31 31 * A selection of ISA-dependent interfaces
32 32 */
33 33
34 34 #include <vm/seg_enum.h>
35 35 #include <vm/page.h>
36 36
37 37 #ifdef __cplusplus
38 38 extern "C" {
39 39 #endif
40 40
41 41 #ifdef _KERNEL
42 42
43 43 extern greg_t getfp(void);
44 44 extern int getpil(void);
45 45
46 46 extern ulong_t getcr0(void);
47 47 extern void setcr0(ulong_t);
48 48 extern ulong_t getcr8(void);
49 49 extern void setcr8(ulong_t);
50 50 extern ulong_t getcr2(void);
51 51 extern void clflush_insn(caddr_t addr);
52 52 extern void mfence_insn(void);
53 53
54 54 #if defined(__i386)
55 55 extern uint16_t getgs(void);
56 56 extern void setgs(uint16_t);
57 57
58 58 extern void patch_sse(void);
59 59 extern void patch_sse2(void);
60 60 #endif
61 61
62 62 extern void patch_xsave(void);
63 63 extern kmem_cache_t *fpsave_cachep;
64 64
65 65 extern void cli(void);
66 66 extern void sti(void);
67 67
68 68 extern void tenmicrosec(void);
69 69
70 70 extern void restore_int_flag(ulong_t);
71 71 extern void intr_restore(ulong_t);
72 72 extern ulong_t clear_int_flag(void);
↓ open down ↓ |
38 lines elided |
↑ open up ↑ |
73 73 extern ulong_t intr_clear(void);
74 74 extern ulong_t getflags(void);
75 75 extern int interrupts_enabled(void);
76 76
77 77 extern void int3(void);
78 78 extern void int18(void);
79 79 extern void int20(void);
80 80 extern void int_cmci(void);
81 81
82 82 #if defined(__amd64)
83 -extern void sys_syscall();
84 -extern void sys_syscall32();
83 +extern void sys_syscall(), tr_sys_syscall();
84 +extern void sys_syscall32(), tr_sys_syscall32();
85 85 extern void sys_lcall32();
86 86 extern void sys_syscall_int();
87 -extern void brand_sys_syscall();
88 -extern void brand_sys_syscall32();
89 -extern void brand_sys_syscall_int();
87 +extern void tr_sys_syscall_int();
88 +extern void brand_sys_syscall(), tr_brand_sys_syscall();
89 +extern void brand_sys_syscall32(), tr_brand_sys_syscall32();
90 +extern void brand_sys_syscall_int(), tr_brand_sys_syscall_int();
90 91 extern int update_sregs();
91 92 extern void reset_sregs();
92 93 #elif defined(__i386)
93 94 extern void sys_call();
95 +extern void tr_sys_call();
94 96 extern void brand_sys_call();
95 97 #endif
96 98 extern void sys_sysenter();
99 +extern void tr_sys_sysenter();
97 100 extern void _sys_sysenter_post_swapgs();
98 101 extern void brand_sys_sysenter();
102 +extern void tr_brand_sys_sysenter();
99 103 extern void _brand_sys_sysenter_post_swapgs();
100 104
101 105 extern void dosyscall(void);
102 106
103 107 extern void bind_hwcap(void);
104 108
105 109 extern uint16_t inw(int port);
106 110 extern uint32_t inl(int port);
107 111 extern void outw(int port, uint16_t value);
108 112 extern void outl(int port, uint32_t value);
109 113
110 114 extern void pc_reset(void) __NORETURN;
111 115 extern void efi_reset(void) __NORETURN;
112 116 extern void reset(void) __NORETURN;
113 117 extern int goany(void);
114 118
115 119 extern void setgregs(klwp_t *, gregset_t);
116 120 extern void getgregs(klwp_t *, gregset_t);
117 121 extern void setfpregs(klwp_t *, fpregset_t *);
118 122 extern void getfpregs(klwp_t *, fpregset_t *);
119 123
120 124 #if defined(_SYSCALL32_IMPL)
121 125 extern void getgregs32(klwp_t *, gregset32_t);
122 126 extern void setfpregs32(klwp_t *, fpregset32_t *);
123 127 extern void getfpregs32(klwp_t *, fpregset32_t *);
124 128 #endif
125 129
126 130 struct fpu_ctx;
127 131
128 132 extern void fp_free(struct fpu_ctx *, int);
129 133 extern void fp_save(struct fpu_ctx *);
130 134 extern void fp_restore(struct fpu_ctx *);
131 135
132 136 extern int fpu_pentium_fdivbug;
133 137
134 138 extern void sep_save(void *);
135 139 extern void sep_restore(void *);
136 140
137 141 extern void brand_interpositioning_enable(void);
138 142 extern void brand_interpositioning_disable(void);
139 143
140 144 struct regs;
141 145
142 146 extern int instr_size(struct regs *, caddr_t *, enum seg_rw);
143 147
144 148 extern int enable_cbcp; /* patchable in /etc/system */
145 149
146 150 extern uint_t cpu_hwcap_flags;
147 151 extern uint_t cpu_freq;
148 152 extern uint64_t cpu_freq_hz;
149 153
150 154 extern int use_sse_pagecopy;
151 155 extern int use_sse_pagezero;
152 156 extern int use_sse_copy;
153 157
154 158 extern caddr_t i86devmap(pfn_t, pgcnt_t, uint_t);
155 159 extern page_t *page_numtopp_alloc(pfn_t pfnum);
156 160
157 161 extern void hwblkclr(void *, size_t);
158 162 extern void hwblkpagecopy(const void *, void *);
159 163 extern void page_copy_no_xmm(void *dst, void *src);
160 164 extern void block_zero_no_xmm(void *dst, int len);
161 165 #define BLOCKZEROALIGN (4 * sizeof (void *))
162 166
163 167 extern void (*kcpc_hw_enable_cpc_intr)(void);
164 168
165 169 extern void init_desctbls(void);
166 170
167 171 extern user_desc_t *cpu_get_gdt(void);
168 172
169 173 extern void switch_sp_and_call(void *, void (*)(uint_t, uint_t), uint_t,
170 174 uint_t);
171 175 extern hrtime_t (*gethrtimef)(void);
172 176 extern hrtime_t (*gethrtimeunscaledf)(void);
173 177 extern void (*scalehrtimef)(hrtime_t *);
174 178 extern uint64_t (*unscalehrtimef)(hrtime_t);
175 179 extern void (*gethrestimef)(timestruc_t *);
176 180
177 181 extern void av_dispatch_softvect(uint_t);
178 182 extern void av_dispatch_autovect(uint_t);
179 183 extern uint_t atomic_btr32(uint32_t *, uint_t);
180 184 extern uint_t bsrw_insn(uint16_t);
181 185 extern int sys_rtt_common(struct regs *);
182 186 extern void fakesoftint(void);
183 187
184 188 extern void *plat_traceback(void *);
185 189
186 190 /*
187 191 * The following two macros are the four byte instruction sequence of stac, ret
188 192 * and clac, ret. These are used in startup_smap() as a part of properly setting
189 193 * up the valid instructions. For more information on SMAP, see
190 194 * uts/intel/ia32/ml/copy.s.
191 195 */
192 196 #define SMAP_CLAC_INSTR 0xc3ca010f
193 197 #define SMAP_STAC_INSTR 0xc3cb010f
194 198 extern void smap_disable(void);
195 199 extern void smap_enable(void);
196 200
197 201 #if defined(__xpv)
198 202 extern void xen_init_callbacks(void);
199 203 extern void xen_set_callback(void (*)(void), uint_t, uint_t);
200 204 extern void xen_printf(const char *, ...);
201 205 #define cpr_dprintf xen_printf
202 206 extern int xpv_panicking;
203 207 #define IN_XPV_PANIC() (xpv_panicking > 0)
204 208 #else
205 209 extern void setup_mca(void);
206 210 extern void pat_sync(void);
207 211 extern void patch_tsc_read(int);
208 212 #if defined(__amd64) && !defined(__xpv)
209 213 extern void patch_memops(uint_t);
210 214 #endif /* defined(__amd64) && !defined(__xpv) */
211 215 extern void setup_xfem(void);
212 216 #define cpr_dprintf prom_printf
213 217 #define IN_XPV_PANIC() (__lintzero)
214 218 #endif
215 219
216 220 #endif /* _KERNEL */
217 221
218 222 #if defined(_KERNEL) || defined(_BOOT)
219 223 extern uint8_t inb(int port);
220 224 extern void outb(int port, uint8_t value);
221 225 #endif
222 226
223 227 #ifdef __cplusplus
224 228 }
225 229 #endif
226 230
227 231 #endif /* _SYS_ARCHSYSTM_H */
↓ open down ↓ |
119 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX