Print this page
10908 Simplify SMAP relocations with krtld
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
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 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 #endif
59 59
60 60 extern kmem_cache_t *fpsave_cachep;
61 61
62 62 extern void cli(void);
63 63 extern void sti(void);
64 64
65 65 extern void tenmicrosec(void);
66 66
67 67 extern void restore_int_flag(ulong_t);
68 68 extern void intr_restore(ulong_t);
69 69 extern ulong_t clear_int_flag(void);
70 70 extern ulong_t intr_clear(void);
71 71 extern ulong_t getflags(void);
72 72 extern int interrupts_enabled(void);
73 73
74 74 extern void int3(void);
75 75 extern void int18(void);
76 76 extern void int20(void);
77 77 extern void int_cmci(void);
78 78
79 79 #if defined(__amd64)
80 80 extern void sys_syscall(), tr_sys_syscall();
81 81 extern void sys_syscall32(), tr_sys_syscall32();
82 82 extern void sys_lcall32();
83 83 extern void sys_syscall_int();
84 84 extern void tr_sys_syscall_int();
85 85 extern void brand_sys_syscall(), tr_brand_sys_syscall();
86 86 extern void brand_sys_syscall32(), tr_brand_sys_syscall32();
87 87 extern void brand_sys_syscall_int(), tr_brand_sys_syscall_int();
88 88 extern int update_sregs();
89 89 extern void reset_sregs();
90 90 #elif defined(__i386)
91 91 extern void sys_call();
92 92 extern void tr_sys_call();
93 93 extern void brand_sys_call();
94 94 #endif
95 95 extern void sys_sysenter();
96 96 extern void tr_sys_sysenter();
97 97 extern void _sys_sysenter_post_swapgs();
98 98 extern void brand_sys_sysenter();
99 99 extern void tr_brand_sys_sysenter();
100 100 extern void _brand_sys_sysenter_post_swapgs();
101 101
102 102 extern void dosyscall(void);
103 103
104 104 extern void bind_hwcap(void);
105 105
106 106 extern uint16_t inw(int port);
107 107 extern uint32_t inl(int port);
108 108 extern void outw(int port, uint16_t value);
109 109 extern void outl(int port, uint32_t value);
110 110
111 111 extern void pc_reset(void) __NORETURN;
112 112 extern void efi_reset(void) __NORETURN;
113 113 extern void reset(void) __NORETURN;
114 114 extern int goany(void);
115 115
116 116 extern void setgregs(klwp_t *, gregset_t);
117 117 extern void getgregs(klwp_t *, gregset_t);
118 118 extern void setfpregs(klwp_t *, fpregset_t *);
119 119 extern void getfpregs(klwp_t *, fpregset_t *);
120 120
121 121 #if defined(_SYSCALL32_IMPL)
122 122 extern void getgregs32(klwp_t *, gregset32_t);
123 123 extern void setfpregs32(klwp_t *, fpregset32_t *);
124 124 extern void getfpregs32(klwp_t *, fpregset32_t *);
125 125 #endif
126 126
127 127 struct fpu_ctx;
128 128
129 129 extern void fp_free(struct fpu_ctx *, int);
130 130 extern void fp_save(struct fpu_ctx *);
131 131 extern void fp_restore(struct fpu_ctx *);
132 132
133 133 extern int fpu_pentium_fdivbug;
134 134
135 135 extern void sep_save(void *);
136 136 extern void sep_restore(void *);
137 137
138 138 extern void brand_interpositioning_enable(void);
139 139 extern void brand_interpositioning_disable(void);
140 140
141 141 struct regs;
142 142
143 143 extern int instr_size(struct regs *, caddr_t *, enum seg_rw);
144 144
145 145 extern int enable_cbcp; /* patchable in /etc/system */
146 146
147 147 extern uint_t cpu_hwcap_flags;
148 148 extern uint_t cpu_freq;
149 149 extern uint64_t cpu_freq_hz;
150 150
151 151 extern int use_sse_pagecopy;
152 152 extern int use_sse_pagezero;
153 153 extern int use_sse_copy;
154 154
155 155 extern caddr_t i86devmap(pfn_t, pgcnt_t, uint_t);
156 156 extern page_t *page_numtopp_alloc(pfn_t pfnum);
157 157
158 158 extern void hwblkclr(void *, size_t);
159 159 extern void hwblkpagecopy(const void *, void *);
160 160 extern void page_copy_no_xmm(void *dst, void *src);
161 161 extern void block_zero_no_xmm(void *dst, int len);
162 162 #define BLOCKZEROALIGN (4 * sizeof (void *))
163 163
164 164 extern void (*kcpc_hw_enable_cpc_intr)(void);
165 165
166 166 extern void init_desctbls(void);
167 167
168 168 extern user_desc_t *cpu_get_gdt(void);
169 169
170 170 extern void switch_sp_and_call(void *, void (*)(uint_t, uint_t), uint_t,
171 171 uint_t);
172 172 extern hrtime_t (*gethrtimef)(void);
173 173 extern hrtime_t (*gethrtimeunscaledf)(void);
174 174 extern void (*scalehrtimef)(hrtime_t *);
175 175 extern uint64_t (*unscalehrtimef)(hrtime_t);
176 176 extern void (*gethrestimef)(timestruc_t *);
177 177
↓ open down ↓ |
177 lines elided |
↑ open up ↑ |
178 178 extern void av_dispatch_softvect(uint_t);
179 179 extern void av_dispatch_autovect(uint_t);
180 180 extern uint_t atomic_btr32(uint32_t *, uint_t);
181 181 extern uint_t bsrw_insn(uint16_t);
182 182 extern int sys_rtt_common(struct regs *);
183 183 extern void fakesoftint(void);
184 184
185 185 extern void *plat_traceback(void *);
186 186
187 187 /*
188 - * The following two macros are the four byte instruction sequence of stac, ret
189 - * and clac, ret. These are used in startup_smap() as a part of properly setting
190 - * up the valid instructions. For more information on SMAP, see
191 - * uts/intel/ia32/ml/copy.s.
188 + * The following two macros are the four byte instruction sequence of stac, nop
189 + * and clac, nop. These are used in startup_smap() and hotinline_smap() as a
190 + * part of properly setting up the valid instructions. For more information on
191 + * SMAP, see uts/intel/ia32/ml/copy.s, uts/i86pc/os/machdep.c and
192 + * uts/common/os/modctl.c.
193 + *
194 + * Note that smap_disable and smap_enable are resolved to stubs at compile time,
195 + * but inlined at runtime by do_hotinlines() in uts/i86pc/os/machdep.c.
192 196 */
193 -#define SMAP_CLAC_INSTR 0xc3ca010f
194 -#define SMAP_STAC_INSTR 0xc3cb010f
197 +#define SMAP_CLAC_INSTR 0x90ca010f
198 +#define SMAP_STAC_INSTR 0x90cb010f
195 199 extern void smap_disable(void);
196 200 extern void smap_enable(void);
197 201
198 202 #if defined(__xpv)
199 203 extern void xen_init_callbacks(void);
200 204 extern void xen_set_callback(void (*)(void), uint_t, uint_t);
201 205 extern void xen_printf(const char *, ...);
202 206 #define cpr_dprintf xen_printf
203 207 extern int xpv_panicking;
204 208 #define IN_XPV_PANIC() (xpv_panicking > 0)
205 209 #else
206 210 extern void setup_mca(void);
207 211 extern void pat_sync(void);
208 212 extern void patch_tsc_read(int);
209 213 #if defined(__amd64) && !defined(__xpv)
210 214 extern void patch_memops(uint_t);
211 215 #endif /* defined(__amd64) && !defined(__xpv) */
212 216 extern void setup_xfem(void);
213 217 #define cpr_dprintf prom_printf
214 218 #define IN_XPV_PANIC() (__lintzero)
215 219 #endif
216 220
217 221 #endif /* _KERNEL */
218 222
219 223 #if defined(_KERNEL) || defined(_BOOT)
220 224 extern uint8_t inb(int port);
221 225 extern void outb(int port, uint8_t value);
222 226 #endif
223 227
224 228 #ifdef __cplusplus
225 229 }
226 230 #endif
227 231
228 232 #endif /* _SYS_ARCHSYSTM_H */
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX