Print this page
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/intel/sys/procfs_isa.h
+++ new/usr/src/uts/intel/sys/procfs_isa.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, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 /*
28 28 * Copyright 2023 Oxide Computer Company
29 29 */
30 30
31 31 #ifndef _SYS_PROCFS_ISA_H
32 32 #define _SYS_PROCFS_ISA_H
33 33
34 34 /*
35 35 * Instruction Set Architecture specific component of <sys/procfs.h>
36 36 * i386 version
37 37 */
38 38
39 39 #include <sys/regset.h>
40 40
41 41 #ifdef __cplusplus
42 42 extern "C" {
43 43 #endif
44 44
45 45 /*
46 46 * Possible values of pr_dmodel.
47 47 * This isn't isa-specific, but it needs to be defined here for other reasons.
48 48 */
49 49 #define PR_MODEL_UNKNOWN 0
50 50 #define PR_MODEL_ILP32 1 /* process data model is ILP32 */
51 51 #define PR_MODEL_LP64 2 /* process data model is LP64 */
52 52
53 53 /*
54 54 * To determine whether application is running native.
55 55 */
56 56 #if defined(_LP64)
57 57 #define PR_MODEL_NATIVE PR_MODEL_LP64
58 58 #elif defined(_ILP32)
59 59 #define PR_MODEL_NATIVE PR_MODEL_ILP32
60 60 #else
61 61 #error "No DATAMODEL_NATIVE specified"
62 62 #endif /* _LP64 || _ILP32 */
63 63
64 64 #if defined(__i386) || defined(__amd64)
65 65 /*
66 66 * Holds one i386 or amd64 instruction
67 67 */
68 68 typedef uchar_t instr_t;
69 69 #endif
70 70
71 71 #define NPRGREG _NGREG
72 72 #define prgreg_t greg_t
73 73 #define prgregset_t gregset_t
74 74 #define prfpregset _fpu
75 75 #define prfpregset_t fpregset_t
76 76
77 77 #if defined(_SYSCALL32)
78 78 /*
79 79 * kernel view of the ia32 register set
80 80 */
81 81 typedef uchar_t instr32_t;
82 82 #if defined(__amd64)
83 83 #define NPRGREG32 _NGREG32
84 84 #define prgreg32_t greg32_t
85 85 #define prgregset32_t gregset32_t
86 86 #define prfpregset32 fpu32
87 87 #define prfpregset32_t fpregset32_t
88 88 #else
89 89 #define NPRGREG32 _NGREG
90 90 #define prgreg32_t greg_t
91 91 #define prgregset32_t gregset_t
92 92 #define prfpregset32 _fpu
93 93 #define prfpregset32_t fpregset_t
94 94 #endif
95 95 #endif /* _SYSCALL32 */
96 96
97 97 #if defined(__amd64)
98 98 /*
99 99 * The following defines are for portability (see <sys/regset.h>).
100 100 */
101 101 #define R_PC REG_RIP
102 102 #define R_PS REG_RFL
103 103 #define R_SP REG_RSP
104 104 #define R_FP REG_RBP
105 105 #define R_R0 REG_RAX
106 106 #define R_R1 REG_RDX
107 107 #elif defined(__i386)
108 108 /*
109 109 * The following defines are for portability (see <sys/regset.h>).
110 110 */
111 111 #define R_PC EIP
112 112 #define R_PS EFL
113 113 #define R_SP UESP
114 114 #define R_FP EBP
115 115 #define R_R0 EAX
116 116 #define R_R1 EDX
117 117 #endif
118 118
119 119 /*
120 120 * The x86 xregs structure is a blob of data that contains a header with several
121 121 * descriptors that describe the region of additional data that corresponds to
122 122 * it. Effectively this looks like:
123 123 *
124 124 * 0 +-----------------+
125 125 * | prxregset_hdr_t |
126 126 * +-----------------+
127 127 * | Info 0 (XCR) |-------+
128 128 * +-----------------+ |
129 129 * | Info 1 (XSAVE) |----------+
130 130 * +-----------------+ | |
131 131 * ... | |
132 132 * +-----------------+ | |
133 133 * | Info n (Hi ZMM) |-------------+
134 134 * +-----------------+ | | |
135 135 * +-----------------+ | | |
136 136 * | prxregset_xcr_t |<------+ | |
137 137 * +-----------------+ | |
138 138 * +-------------------+ | |
139 139 * | prxregset_xsave_t |<-------+ |
140 140 * | | |
141 141 * | XMM + xsave | |
142 142 * +-------------------+ |
143 143 * ... |
144 144 * +---------------------+ |
145 145 * | prxregset_hi_zmm_t |<--------+
146 146 * | |
147 147 * | 1 KiB %zmm16-%zmm31 |
148 148 * +---------------------+
149 149 *
150 150 * The actual structure size will vary based on the CPU features present. For
151 151 * more information, see proc(5). When adding structures, please make sure all
152 152 * structures are multiples of 16 bytes (0x10) so as to ensure alignment.
153 153 */
154 154 typedef struct prxregset prxregset_t;
155 155
156 156 #define PRX_INFO_XCR 0x01
157 157 #define PRX_INFO_XSAVE 0x02
158 158 #define PRX_INFO_YMM 0x03
159 159 #define PRX_INFO_OPMASK 0x04
160 160 #define PRX_INFO_ZMM 0x05
161 161 #define PRX_INFO_HI_ZMM 0x06
162 162
163 163 typedef struct prxregset_info {
164 164 uint32_t pri_type;
165 165 uint32_t pri_flags;
166 166 uint32_t pri_size;
167 167 uint32_t pri_offset;
168 168 } prxregset_info_t;
169 169
170 170 #define PR_TYPE_XSAVE 0x01
171 171
172 172 typedef struct prxregset_hdr {
173 173 uint32_t pr_type;
174 174 uint32_t pr_size;
175 175 uint32_t pr_flags;
176 176 uint32_t pr_pad[4];
177 177 uint32_t pr_ninfo;
178 178 #if defined(_STDC_C99) || defined(__C99FEATURES__)
179 179 prxregset_info_t pr_info[];
180 180 #endif
181 181 } prxregset_hdr_t;
182 182
183 183 typedef struct prxregset_xcr {
184 184 uint64_t prx_xcr_xcr0;
185 185 uint64_t prx_xcr_xfd;
186 186 uint64_t prx_xcr_pad[2];
187 187 } prxregset_xcr_t;
188 188
189 189 typedef struct prxregset_xsave {
190 190 uint16_t prx_fx_fcw;
191 191 uint16_t prx_fx_fsw;
192 192 uint16_t prx_fx_fctw; /* compressed tag word */
193 193 uint16_t prx_fx_fop;
194 194 #if defined(__amd64)
195 195 uint64_t prx_fx_rip;
196 196 uint64_t prx_fx_rdp;
197 197 #else
198 198 uint32_t prx_fx_eip;
199 199 uint16_t prx_fx_cs;
200 200 uint16_t __prx_fx_ign0;
201 201 uint32_t prx_fx_dp;
202 202 uint16_t prx_fx_ds;
203 203 uint16_t __prx_fx_ign1;
204 204 #endif
205 205 uint32_t prx_fx_mxcsr;
206 206 uint32_t prx_fx_mxcsr_mask;
207 207 union {
208 208 uint16_t prx_fpr_16[5]; /* 80-bits of x87 state */
209 209 u_longlong_t prx_fpr_mmx; /* 64-bit mmx register */
210 210 uint32_t _prx__fpr_pad[4]; /* (pad out to 128-bits) */
211 211 } fx_st[8];
212 212 #if defined(__amd64)
213 213 upad128_t prx_fx_xmm[16]; /* 128-bit registers */
214 214 upad128_t __prx_fx_ign2[6];
215 215 #else
216 216 upad128_t prx_fx_xmm[8]; /* 128-bit registers */
217 217 upad128_t __prx_fx_ign2[14];
218 218 #endif
219 219 uint64_t prx_xsh_xstate_bv;
220 220 uint64_t prx_xsh_xcomp_bv;
221 221 uint64_t prx_xsh_reserved[6];
222 222 } prxregset_xsave_t;
223 223
224 224 typedef struct prxregset_ymm {
225 225 #if defined(__amd64)
226 226 upad128_t prx_ymm[16];
227 227 #else
228 228 upad128_t prx_ymm[8];
229 229 upad128_t prx_rsvd[8];
230 230 #endif
231 231 } prxregset_ymm_t;
232 232
233 233 typedef struct prxregset_opmask {
234 234 uint64_t prx_opmask[8];
235 235 } prxregset_opmask_t;
236 236
237 237 typedef struct prxregset_zmm {
238 238 #if defined(__amd64)
239 239 upad256_t prx_zmm[16];
240 240 #else
241 241 upad256_t prx_zmm[8];
242 242 upad256_t prx_rsvd[8];
243 243 #endif
244 244 } prxregset_zmm_t;
245 245
246 246 typedef struct prxregset_hi_zmm {
247 247 #if defined(__amd64)
248 248 upad512_t prx_hi_zmm[16];
249 249 #else
250 250 upad512_t prx_rsvd[16];
251 251 #endif
252 252 } prxregset_hi_zmm_t;
253 253
254 254 #ifdef __cplusplus
255 255 }
256 256 #endif
257 257
258 258 #endif /* _SYS_PROCFS_ISA_H */
|
↓ open down ↓ |
258 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX