1 | /** @file
|
---|
2 | * IPRT - X86 and AMD64 Structures and Definitions.
|
---|
3 | *
|
---|
4 | * @note x86.mac is generated from this file by running 'kmk incs' in the root.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2015 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * The contents of this file may alternatively be used under the terms
|
---|
19 | * of the Common Development and Distribution License Version 1.0
|
---|
20 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
21 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
22 | * CDDL are applicable instead of those of the GPL.
|
---|
23 | *
|
---|
24 | * You may elect to license modified versions of this file under the
|
---|
25 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef ___iprt_x86_h
|
---|
29 | #define ___iprt_x86_h
|
---|
30 |
|
---|
31 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
32 | # include <iprt/types.h>
|
---|
33 | # include <iprt/assert.h>
|
---|
34 | #else
|
---|
35 | # pragma D depends_on library vbox-types.d
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | /* Workaround for Solaris sys/regset.h defining CS, DS */
|
---|
39 | #ifdef RT_OS_SOLARIS
|
---|
40 | # undef CS
|
---|
41 | # undef DS
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | /** @defgroup grp_rt_x86 x86 Types and Definitions
|
---|
45 | * @ingroup grp_rt
|
---|
46 | * @{
|
---|
47 | */
|
---|
48 |
|
---|
49 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
50 | /**
|
---|
51 | * EFLAGS Bits.
|
---|
52 | */
|
---|
53 | typedef struct X86EFLAGSBITS
|
---|
54 | {
|
---|
55 | /** Bit 0 - CF - Carry flag - Status flag. */
|
---|
56 | unsigned u1CF : 1;
|
---|
57 | /** Bit 1 - 1 - Reserved flag. */
|
---|
58 | unsigned u1Reserved0 : 1;
|
---|
59 | /** Bit 2 - PF - Parity flag - Status flag. */
|
---|
60 | unsigned u1PF : 1;
|
---|
61 | /** Bit 3 - 0 - Reserved flag. */
|
---|
62 | unsigned u1Reserved1 : 1;
|
---|
63 | /** Bit 4 - AF - Auxiliary carry flag - Status flag. */
|
---|
64 | unsigned u1AF : 1;
|
---|
65 | /** Bit 5 - 0 - Reserved flag. */
|
---|
66 | unsigned u1Reserved2 : 1;
|
---|
67 | /** Bit 6 - ZF - Zero flag - Status flag. */
|
---|
68 | unsigned u1ZF : 1;
|
---|
69 | /** Bit 7 - SF - Signed flag - Status flag. */
|
---|
70 | unsigned u1SF : 1;
|
---|
71 | /** Bit 8 - TF - Trap flag - System flag. */
|
---|
72 | unsigned u1TF : 1;
|
---|
73 | /** Bit 9 - IF - Interrupt flag - System flag. */
|
---|
74 | unsigned u1IF : 1;
|
---|
75 | /** Bit 10 - DF - Direction flag - Control flag. */
|
---|
76 | unsigned u1DF : 1;
|
---|
77 | /** Bit 11 - OF - Overflow flag - Status flag. */
|
---|
78 | unsigned u1OF : 1;
|
---|
79 | /** Bit 12-13 - IOPL - I/O privilege level flag - System flag. */
|
---|
80 | unsigned u2IOPL : 2;
|
---|
81 | /** Bit 14 - NT - Nested task flag - System flag. */
|
---|
82 | unsigned u1NT : 1;
|
---|
83 | /** Bit 15 - 0 - Reserved flag. */
|
---|
84 | unsigned u1Reserved3 : 1;
|
---|
85 | /** Bit 16 - RF - Resume flag - System flag. */
|
---|
86 | unsigned u1RF : 1;
|
---|
87 | /** Bit 17 - VM - Virtual 8086 mode - System flag. */
|
---|
88 | unsigned u1VM : 1;
|
---|
89 | /** Bit 18 - AC - Alignment check flag - System flag. Works with CR0.AM. */
|
---|
90 | unsigned u1AC : 1;
|
---|
91 | /** Bit 19 - VIF - Virtual interrupt flag - System flag. */
|
---|
92 | unsigned u1VIF : 1;
|
---|
93 | /** Bit 20 - VIP - Virtual interrupt pending flag - System flag. */
|
---|
94 | unsigned u1VIP : 1;
|
---|
95 | /** Bit 21 - ID - CPUID flag - System flag. If this responds to flipping CPUID is supported. */
|
---|
96 | unsigned u1ID : 1;
|
---|
97 | /** Bit 22-31 - 0 - Reserved flag. */
|
---|
98 | unsigned u10Reserved4 : 10;
|
---|
99 | } X86EFLAGSBITS;
|
---|
100 | /** Pointer to EFLAGS bits. */
|
---|
101 | typedef X86EFLAGSBITS *PX86EFLAGSBITS;
|
---|
102 | /** Pointer to const EFLAGS bits. */
|
---|
103 | typedef const X86EFLAGSBITS *PCX86EFLAGSBITS;
|
---|
104 | #endif /* !VBOX_FOR_DTRACE_LIB */
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * EFLAGS.
|
---|
108 | */
|
---|
109 | typedef union X86EFLAGS
|
---|
110 | {
|
---|
111 | /** The plain unsigned view. */
|
---|
112 | uint32_t u;
|
---|
113 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
114 | /** The bitfield view. */
|
---|
115 | X86EFLAGSBITS Bits;
|
---|
116 | #endif
|
---|
117 | /** The 8-bit view. */
|
---|
118 | uint8_t au8[4];
|
---|
119 | /** The 16-bit view. */
|
---|
120 | uint16_t au16[2];
|
---|
121 | /** The 32-bit view. */
|
---|
122 | uint32_t au32[1];
|
---|
123 | /** The 32-bit view. */
|
---|
124 | uint32_t u32;
|
---|
125 | } X86EFLAGS;
|
---|
126 | /** Pointer to EFLAGS. */
|
---|
127 | typedef X86EFLAGS *PX86EFLAGS;
|
---|
128 | /** Pointer to const EFLAGS. */
|
---|
129 | typedef const X86EFLAGS *PCX86EFLAGS;
|
---|
130 |
|
---|
131 | /**
|
---|
132 | * RFLAGS (32 upper bits are reserved).
|
---|
133 | */
|
---|
134 | typedef union X86RFLAGS
|
---|
135 | {
|
---|
136 | /** The plain unsigned view. */
|
---|
137 | uint64_t u;
|
---|
138 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
139 | /** The bitfield view. */
|
---|
140 | X86EFLAGSBITS Bits;
|
---|
141 | #endif
|
---|
142 | /** The 8-bit view. */
|
---|
143 | uint8_t au8[8];
|
---|
144 | /** The 16-bit view. */
|
---|
145 | uint16_t au16[4];
|
---|
146 | /** The 32-bit view. */
|
---|
147 | uint32_t au32[2];
|
---|
148 | /** The 64-bit view. */
|
---|
149 | uint64_t au64[1];
|
---|
150 | /** The 64-bit view. */
|
---|
151 | uint64_t u64;
|
---|
152 | } X86RFLAGS;
|
---|
153 | /** Pointer to RFLAGS. */
|
---|
154 | typedef X86RFLAGS *PX86RFLAGS;
|
---|
155 | /** Pointer to const RFLAGS. */
|
---|
156 | typedef const X86RFLAGS *PCX86RFLAGS;
|
---|
157 |
|
---|
158 |
|
---|
159 | /** @name EFLAGS
|
---|
160 | * @{
|
---|
161 | */
|
---|
162 | /** Bit 0 - CF - Carry flag - Status flag. */
|
---|
163 | #define X86_EFL_CF RT_BIT_32(0)
|
---|
164 | #define X86_EFL_CF_BIT 0
|
---|
165 | /** Bit 1 - Reserved, reads as 1. */
|
---|
166 | #define X86_EFL_1 RT_BIT_32(1)
|
---|
167 | /** Bit 2 - PF - Parity flag - Status flag. */
|
---|
168 | #define X86_EFL_PF RT_BIT_32(2)
|
---|
169 | /** Bit 4 - AF - Auxiliary carry flag - Status flag. */
|
---|
170 | #define X86_EFL_AF RT_BIT_32(4)
|
---|
171 | #define X86_EFL_AF_BIT 4
|
---|
172 | /** Bit 6 - ZF - Zero flag - Status flag. */
|
---|
173 | #define X86_EFL_ZF RT_BIT_32(6)
|
---|
174 | #define X86_EFL_ZF_BIT 6
|
---|
175 | /** Bit 7 - SF - Signed flag - Status flag. */
|
---|
176 | #define X86_EFL_SF RT_BIT_32(7)
|
---|
177 | #define X86_EFL_SF_BIT 7
|
---|
178 | /** Bit 8 - TF - Trap flag - System flag. */
|
---|
179 | #define X86_EFL_TF RT_BIT_32(8)
|
---|
180 | /** Bit 9 - IF - Interrupt flag - System flag. */
|
---|
181 | #define X86_EFL_IF RT_BIT_32(9)
|
---|
182 | /** Bit 10 - DF - Direction flag - Control flag. */
|
---|
183 | #define X86_EFL_DF RT_BIT_32(10)
|
---|
184 | /** Bit 11 - OF - Overflow flag - Status flag. */
|
---|
185 | #define X86_EFL_OF RT_BIT_32(11)
|
---|
186 | #define X86_EFL_OF_BIT 11
|
---|
187 | /** Bit 12-13 - IOPL - I/O privilege level flag - System flag. */
|
---|
188 | #define X86_EFL_IOPL (RT_BIT_32(12) | RT_BIT_32(13))
|
---|
189 | /** Bit 14 - NT - Nested task flag - System flag. */
|
---|
190 | #define X86_EFL_NT RT_BIT_32(14)
|
---|
191 | /** Bit 16 - RF - Resume flag - System flag. */
|
---|
192 | #define X86_EFL_RF RT_BIT_32(16)
|
---|
193 | /** Bit 17 - VM - Virtual 8086 mode - System flag. */
|
---|
194 | #define X86_EFL_VM RT_BIT_32(17)
|
---|
195 | /** Bit 18 - AC - Alignment check flag - System flag. Works with CR0.AM. */
|
---|
196 | #define X86_EFL_AC RT_BIT_32(18)
|
---|
197 | /** Bit 19 - VIF - Virtual interrupt flag - System flag. */
|
---|
198 | #define X86_EFL_VIF RT_BIT_32(19)
|
---|
199 | /** Bit 20 - VIP - Virtual interrupt pending flag - System flag. */
|
---|
200 | #define X86_EFL_VIP RT_BIT_32(20)
|
---|
201 | /** Bit 21 - ID - CPUID flag - System flag. If this responds to flipping CPUID is supported. */
|
---|
202 | #define X86_EFL_ID RT_BIT_32(21)
|
---|
203 | /** All live bits. */
|
---|
204 | #define X86_EFL_LIVE_MASK UINT32_C(0x003f7fd5)
|
---|
205 | /** Read as 1 bits. */
|
---|
206 | #define X86_EFL_RA1_MASK RT_BIT_32(1)
|
---|
207 | /** IOPL shift. */
|
---|
208 | #define X86_EFL_IOPL_SHIFT 12
|
---|
209 | /** The IOPL level from the flags. */
|
---|
210 | #define X86_EFL_GET_IOPL(efl) (((efl) >> X86_EFL_IOPL_SHIFT) & 3)
|
---|
211 | /** Bits restored by popf */
|
---|
212 | #define X86_EFL_POPF_BITS ( X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_TF | X86_EFL_IF \
|
---|
213 | | X86_EFL_DF | X86_EFL_OF | X86_EFL_IOPL | X86_EFL_NT | X86_EFL_AC | X86_EFL_ID )
|
---|
214 | /** The status bits commonly updated by arithmetic instructions. */
|
---|
215 | #define X86_EFL_STATUS_BITS ( X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF )
|
---|
216 | /** @} */
|
---|
217 |
|
---|
218 |
|
---|
219 | /** CPUID Feature information - ECX.
|
---|
220 | * CPUID query with EAX=1.
|
---|
221 | */
|
---|
222 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
223 | typedef struct X86CPUIDFEATECX
|
---|
224 | {
|
---|
225 | /** Bit 0 - SSE3 - Supports SSE3 or not. */
|
---|
226 | unsigned u1SSE3 : 1;
|
---|
227 | /** Bit 1 - PCLMULQDQ. */
|
---|
228 | unsigned u1PCLMULQDQ : 1;
|
---|
229 | /** Bit 2 - DS Area 64-bit layout. */
|
---|
230 | unsigned u1DTE64 : 1;
|
---|
231 | /** Bit 3 - MONITOR - Supports MONITOR/MWAIT. */
|
---|
232 | unsigned u1Monitor : 1;
|
---|
233 | /** Bit 4 - CPL-DS - CPL Qualified Debug Store. */
|
---|
234 | unsigned u1CPLDS : 1;
|
---|
235 | /** Bit 5 - VMX - Virtual Machine Technology. */
|
---|
236 | unsigned u1VMX : 1;
|
---|
237 | /** Bit 6 - SMX: Safer Mode Extensions. */
|
---|
238 | unsigned u1SMX : 1;
|
---|
239 | /** Bit 7 - EST - Enh. SpeedStep Tech. */
|
---|
240 | unsigned u1EST : 1;
|
---|
241 | /** Bit 8 - TM2 - Terminal Monitor 2. */
|
---|
242 | unsigned u1TM2 : 1;
|
---|
243 | /** Bit 9 - SSSE3 - Supplemental Streaming SIMD Extensions 3. */
|
---|
244 | unsigned u1SSSE3 : 1;
|
---|
245 | /** Bit 10 - CNTX-ID - L1 Context ID. */
|
---|
246 | unsigned u1CNTXID : 1;
|
---|
247 | /** Bit 11 - Reserved. */
|
---|
248 | unsigned u1Reserved1 : 1;
|
---|
249 | /** Bit 12 - FMA. */
|
---|
250 | unsigned u1FMA : 1;
|
---|
251 | /** Bit 13 - CX16 - CMPXCHG16B. */
|
---|
252 | unsigned u1CX16 : 1;
|
---|
253 | /** Bit 14 - xTPR Update Control. Processor supports changing IA32_MISC_ENABLES[bit 23]. */
|
---|
254 | unsigned u1TPRUpdate : 1;
|
---|
255 | /** Bit 15 - PDCM - Perf/Debug Capability MSR. */
|
---|
256 | unsigned u1PDCM : 1;
|
---|
257 | /** Bit 16 - Reserved. */
|
---|
258 | unsigned u1Reserved2 : 1;
|
---|
259 | /** Bit 17 - PCID - Process-context identifiers. */
|
---|
260 | unsigned u1PCID : 1;
|
---|
261 | /** Bit 18 - Direct Cache Access. */
|
---|
262 | unsigned u1DCA : 1;
|
---|
263 | /** Bit 19 - SSE4_1 - Supports SSE4_1 or not. */
|
---|
264 | unsigned u1SSE4_1 : 1;
|
---|
265 | /** Bit 20 - SSE4_2 - Supports SSE4_2 or not. */
|
---|
266 | unsigned u1SSE4_2 : 1;
|
---|
267 | /** Bit 21 - x2APIC. */
|
---|
268 | unsigned u1x2APIC : 1;
|
---|
269 | /** Bit 22 - MOVBE - Supports MOVBE. */
|
---|
270 | unsigned u1MOVBE : 1;
|
---|
271 | /** Bit 23 - POPCNT - Supports POPCNT. */
|
---|
272 | unsigned u1POPCNT : 1;
|
---|
273 | /** Bit 24 - TSC-Deadline. */
|
---|
274 | unsigned u1TSCDEADLINE : 1;
|
---|
275 | /** Bit 25 - AES. */
|
---|
276 | unsigned u1AES : 1;
|
---|
277 | /** Bit 26 - XSAVE - Supports XSAVE. */
|
---|
278 | unsigned u1XSAVE : 1;
|
---|
279 | /** Bit 27 - OSXSAVE - Supports OSXSAVE. */
|
---|
280 | unsigned u1OSXSAVE : 1;
|
---|
281 | /** Bit 28 - AVX - Supports AVX instruction extensions. */
|
---|
282 | unsigned u1AVX : 1;
|
---|
283 | /** Bit 29 - F16C - Supports 16-bit floating point conversion instructions. */
|
---|
284 | unsigned u1F16C : 1;
|
---|
285 | /** Bit 30 - RDRAND - Supports RDRAND. */
|
---|
286 | unsigned u1RDRAND : 1;
|
---|
287 | /** Bit 31 - Hypervisor present (we're a guest). */
|
---|
288 | unsigned u1HVP : 1;
|
---|
289 | } X86CPUIDFEATECX;
|
---|
290 | #else /* VBOX_FOR_DTRACE_LIB */
|
---|
291 | typedef uint32_t X86CPUIDFEATECX;
|
---|
292 | #endif /* VBOX_FOR_DTRACE_LIB */
|
---|
293 | /** Pointer to CPUID Feature Information - ECX. */
|
---|
294 | typedef X86CPUIDFEATECX *PX86CPUIDFEATECX;
|
---|
295 | /** Pointer to const CPUID Feature Information - ECX. */
|
---|
296 | typedef const X86CPUIDFEATECX *PCX86CPUIDFEATECX;
|
---|
297 |
|
---|
298 |
|
---|
299 | /** CPUID Feature Information - EDX.
|
---|
300 | * CPUID query with EAX=1.
|
---|
301 | */
|
---|
302 | #ifndef VBOX_FOR_DTRACE_LIB /* DTrace different (brain-dead from a C pov) bitfield implementation */
|
---|
303 | typedef struct X86CPUIDFEATEDX
|
---|
304 | {
|
---|
305 | /** Bit 0 - FPU - x87 FPU on Chip. */
|
---|
306 | unsigned u1FPU : 1;
|
---|
307 | /** Bit 1 - VME - Virtual 8086 Mode Enhancements. */
|
---|
308 | unsigned u1VME : 1;
|
---|
309 | /** Bit 2 - DE - Debugging extensions. */
|
---|
310 | unsigned u1DE : 1;
|
---|
311 | /** Bit 3 - PSE - Page Size Extension. */
|
---|
312 | unsigned u1PSE : 1;
|
---|
313 | /** Bit 4 - TSC - Time Stamp Counter. */
|
---|
314 | unsigned u1TSC : 1;
|
---|
315 | /** Bit 5 - MSR - Model Specific Registers RDMSR and WRMSR Instructions. */
|
---|
316 | unsigned u1MSR : 1;
|
---|
317 | /** Bit 6 - PAE - Physical Address Extension. */
|
---|
318 | unsigned u1PAE : 1;
|
---|
319 | /** Bit 7 - MCE - Machine Check Exception. */
|
---|
320 | unsigned u1MCE : 1;
|
---|
321 | /** Bit 8 - CX8 - CMPXCHG8B instruction. */
|
---|
322 | unsigned u1CX8 : 1;
|
---|
323 | /** Bit 9 - APIC - APIC On-Chip. */
|
---|
324 | unsigned u1APIC : 1;
|
---|
325 | /** Bit 10 - Reserved. */
|
---|
326 | unsigned u1Reserved1 : 1;
|
---|
327 | /** Bit 11 - SEP - SYSENTER and SYSEXIT. */
|
---|
328 | unsigned u1SEP : 1;
|
---|
329 | /** Bit 12 - MTRR - Memory Type Range Registers. */
|
---|
330 | unsigned u1MTRR : 1;
|
---|
331 | /** Bit 13 - PGE - PTE Global Bit. */
|
---|
332 | unsigned u1PGE : 1;
|
---|
333 | /** Bit 14 - MCA - Machine Check Architecture. */
|
---|
334 | unsigned u1MCA : 1;
|
---|
335 | /** Bit 15 - CMOV - Conditional Move Instructions. */
|
---|
336 | unsigned u1CMOV : 1;
|
---|
337 | /** Bit 16 - PAT - Page Attribute Table. */
|
---|
338 | unsigned u1PAT : 1;
|
---|
339 | /** Bit 17 - PSE-36 - 36-bit Page Size Extension. */
|
---|
340 | unsigned u1PSE36 : 1;
|
---|
341 | /** Bit 18 - PSN - Processor Serial Number. */
|
---|
342 | unsigned u1PSN : 1;
|
---|
343 | /** Bit 19 - CLFSH - CLFLUSH Instruction. */
|
---|
344 | unsigned u1CLFSH : 1;
|
---|
345 | /** Bit 20 - Reserved. */
|
---|
346 | unsigned u1Reserved2 : 1;
|
---|
347 | /** Bit 21 - DS - Debug Store. */
|
---|
348 | unsigned u1DS : 1;
|
---|
349 | /** Bit 22 - ACPI - Thermal Monitor and Software Controlled Clock Facilities. */
|
---|
350 | unsigned u1ACPI : 1;
|
---|
351 | /** Bit 23 - MMX - Intel MMX 'Technology'. */
|
---|
352 | unsigned u1MMX : 1;
|
---|
353 | /** Bit 24 - FXSR - FXSAVE and FXRSTOR Instructions. */
|
---|
354 | unsigned u1FXSR : 1;
|
---|
355 | /** Bit 25 - SSE - SSE Support. */
|
---|
356 | unsigned u1SSE : 1;
|
---|
357 | /** Bit 26 - SSE2 - SSE2 Support. */
|
---|
358 | unsigned u1SSE2 : 1;
|
---|
359 | /** Bit 27 - SS - Self Snoop. */
|
---|
360 | unsigned u1SS : 1;
|
---|
361 | /** Bit 28 - HTT - Hyper-Threading Technology. */
|
---|
362 | unsigned u1HTT : 1;
|
---|
363 | /** Bit 29 - TM - Thermal Monitor. */
|
---|
364 | unsigned u1TM : 1;
|
---|
365 | /** Bit 30 - Reserved - . */
|
---|
366 | unsigned u1Reserved3 : 1;
|
---|
367 | /** Bit 31 - PBE - Pending Break Enabled. */
|
---|
368 | unsigned u1PBE : 1;
|
---|
369 | } X86CPUIDFEATEDX;
|
---|
370 | #else /* VBOX_FOR_DTRACE_LIB */
|
---|
371 | typedef uint32_t X86CPUIDFEATEDX;
|
---|
372 | #endif /* VBOX_FOR_DTRACE_LIB */
|
---|
373 | /** Pointer to CPUID Feature Information - EDX. */
|
---|
374 | typedef X86CPUIDFEATEDX *PX86CPUIDFEATEDX;
|
---|
375 | /** Pointer to const CPUID Feature Information - EDX. */
|
---|
376 | typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
|
---|
377 |
|
---|
378 | /** @name CPUID Vendor information.
|
---|
379 | * CPUID query with EAX=0.
|
---|
380 | * @{
|
---|
381 | */
|
---|
382 | #define X86_CPUID_VENDOR_INTEL_EBX 0x756e6547 /* Genu */
|
---|
383 | #define X86_CPUID_VENDOR_INTEL_ECX 0x6c65746e /* ntel */
|
---|
384 | #define X86_CPUID_VENDOR_INTEL_EDX 0x49656e69 /* ineI */
|
---|
385 |
|
---|
386 | #define X86_CPUID_VENDOR_AMD_EBX 0x68747541 /* Auth */
|
---|
387 | #define X86_CPUID_VENDOR_AMD_ECX 0x444d4163 /* cAMD */
|
---|
388 | #define X86_CPUID_VENDOR_AMD_EDX 0x69746e65 /* enti */
|
---|
389 |
|
---|
390 | #define X86_CPUID_VENDOR_VIA_EBX 0x746e6543 /* Cent */
|
---|
391 | #define X86_CPUID_VENDOR_VIA_ECX 0x736c7561 /* auls */
|
---|
392 | #define X86_CPUID_VENDOR_VIA_EDX 0x48727561 /* aurH */
|
---|
393 | /** @} */
|
---|
394 |
|
---|
395 |
|
---|
396 | /** @name CPUID Feature information.
|
---|
397 | * CPUID query with EAX=1.
|
---|
398 | * @{
|
---|
399 | */
|
---|
400 | /** ECX Bit 0 - SSE3 - Supports SSE3 or not. */
|
---|
401 | #define X86_CPUID_FEATURE_ECX_SSE3 RT_BIT_32(0)
|
---|
402 | /** ECX Bit 1 - PCLMUL - PCLMULQDQ support (for AES-GCM). */
|
---|
403 | #define X86_CPUID_FEATURE_ECX_PCLMUL RT_BIT_32(1)
|
---|
404 | /** ECX Bit 2 - DTES64 - DS Area 64-bit Layout. */
|
---|
405 | #define X86_CPUID_FEATURE_ECX_DTES64 RT_BIT_32(2)
|
---|
406 | /** ECX Bit 3 - MONITOR - Supports MONITOR/MWAIT. */
|
---|
407 | #define X86_CPUID_FEATURE_ECX_MONITOR RT_BIT_32(3)
|
---|
408 | /** ECX Bit 4 - CPL-DS - CPL Qualified Debug Store. */
|
---|
409 | #define X86_CPUID_FEATURE_ECX_CPLDS RT_BIT_32(4)
|
---|
410 | /** ECX Bit 5 - VMX - Virtual Machine Technology. */
|
---|
411 | #define X86_CPUID_FEATURE_ECX_VMX RT_BIT_32(5)
|
---|
412 | /** ECX Bit 6 - SMX - Safer Mode Extensions. */
|
---|
413 | #define X86_CPUID_FEATURE_ECX_SMX RT_BIT_32(6)
|
---|
414 | /** ECX Bit 7 - EST - Enh. SpeedStep Tech. */
|
---|
415 | #define X86_CPUID_FEATURE_ECX_EST RT_BIT_32(7)
|
---|
416 | /** ECX Bit 8 - TM2 - Terminal Monitor 2. */
|
---|
417 | #define X86_CPUID_FEATURE_ECX_TM2 RT_BIT_32(8)
|
---|
418 | /** ECX Bit 9 - SSSE3 - Supplemental Streaming SIMD Extensions 3. */
|
---|
419 | #define X86_CPUID_FEATURE_ECX_SSSE3 RT_BIT_32(9)
|
---|
420 | /** ECX Bit 10 - CNTX-ID - L1 Context ID. */
|
---|
421 | #define X86_CPUID_FEATURE_ECX_CNTXID RT_BIT_32(10)
|
---|
422 | /** ECX Bit 11 - SDBG - Sillicon debug interface (IA32_DEBUG_INTERFACE MSR).
|
---|
423 | * See figure 3-6 and table 3-10, in intel Vol. 2A. from 2015-01-01. */
|
---|
424 | #define X86_CPUID_FEATURE_ECX_SDBG RT_BIT_32(11)
|
---|
425 | /** ECX Bit 12 - FMA. */
|
---|
426 | #define X86_CPUID_FEATURE_ECX_FMA RT_BIT_32(12)
|
---|
427 | /** ECX Bit 13 - CX16 - CMPXCHG16B. */
|
---|
428 | #define X86_CPUID_FEATURE_ECX_CX16 RT_BIT_32(13)
|
---|
429 | /** ECX Bit 14 - xTPR Update Control. Processor supports changing IA32_MISC_ENABLES[bit 23]. */
|
---|
430 | #define X86_CPUID_FEATURE_ECX_TPRUPDATE RT_BIT_32(14)
|
---|
431 | /** ECX Bit 15 - PDCM - Perf/Debug Capability MSR. */
|
---|
432 | #define X86_CPUID_FEATURE_ECX_PDCM RT_BIT_32(15)
|
---|
433 | /** ECX Bit 17 - PCID - Process-context identifiers. */
|
---|
434 | #define X86_CPUID_FEATURE_ECX_PCID RT_BIT_32(17)
|
---|
435 | /** ECX Bit 18 - DCA - Direct Cache Access. */
|
---|
436 | #define X86_CPUID_FEATURE_ECX_DCA RT_BIT_32(18)
|
---|
437 | /** ECX Bit 19 - SSE4_1 - Supports SSE4_1 or not. */
|
---|
438 | #define X86_CPUID_FEATURE_ECX_SSE4_1 RT_BIT_32(19)
|
---|
439 | /** ECX Bit 20 - SSE4_2 - Supports SSE4_2 or not. */
|
---|
440 | #define X86_CPUID_FEATURE_ECX_SSE4_2 RT_BIT_32(20)
|
---|
441 | /** ECX Bit 21 - x2APIC support. */
|
---|
442 | #define X86_CPUID_FEATURE_ECX_X2APIC RT_BIT_32(21)
|
---|
443 | /** ECX Bit 22 - MOVBE instruction. */
|
---|
444 | #define X86_CPUID_FEATURE_ECX_MOVBE RT_BIT_32(22)
|
---|
445 | /** ECX Bit 23 - POPCNT instruction. */
|
---|
446 | #define X86_CPUID_FEATURE_ECX_POPCNT RT_BIT_32(23)
|
---|
447 | /** ECX Bir 24 - TSC-Deadline. */
|
---|
448 | #define X86_CPUID_FEATURE_ECX_TSCDEADL RT_BIT_32(24)
|
---|
449 | /** ECX Bit 25 - AES instructions. */
|
---|
450 | #define X86_CPUID_FEATURE_ECX_AES RT_BIT_32(25)
|
---|
451 | /** ECX Bit 26 - XSAVE instruction. */
|
---|
452 | #define X86_CPUID_FEATURE_ECX_XSAVE RT_BIT_32(26)
|
---|
453 | /** ECX Bit 27 - OSXSAVE instruction. */
|
---|
454 | #define X86_CPUID_FEATURE_ECX_OSXSAVE RT_BIT_32(27)
|
---|
455 | /** ECX Bit 28 - AVX. */
|
---|
456 | #define X86_CPUID_FEATURE_ECX_AVX RT_BIT_32(28)
|
---|
457 | /** ECX Bit 29 - F16C - Half-precision convert instruction support. */
|
---|
458 | #define X86_CPUID_FEATURE_ECX_F16C RT_BIT_32(29)
|
---|
459 | /** ECX Bit 30 - RDRAND instruction. */
|
---|
460 | #define X86_CPUID_FEATURE_ECX_RDRAND RT_BIT_32(30)
|
---|
461 | /** ECX Bit 31 - Hypervisor Present (software only). */
|
---|
462 | #define X86_CPUID_FEATURE_ECX_HVP RT_BIT_32(31)
|
---|
463 |
|
---|
464 |
|
---|
465 | /** Bit 0 - FPU - x87 FPU on Chip. */
|
---|
466 | #define X86_CPUID_FEATURE_EDX_FPU RT_BIT_32(0)
|
---|
467 | /** Bit 1 - VME - Virtual 8086 Mode Enhancements. */
|
---|
468 | #define X86_CPUID_FEATURE_EDX_VME RT_BIT_32(1)
|
---|
469 | /** Bit 2 - DE - Debugging extensions. */
|
---|
470 | #define X86_CPUID_FEATURE_EDX_DE RT_BIT_32(2)
|
---|
471 | /** Bit 3 - PSE - Page Size Extension. */
|
---|
472 | #define X86_CPUID_FEATURE_EDX_PSE RT_BIT_32(3)
|
---|
473 | #define X86_CPUID_FEATURE_EDX_PSE_BIT 3 /**< Bit number for X86_CPUID_FEATURE_EDX_PSE. */
|
---|
474 | /** Bit 4 - TSC - Time Stamp Counter. */
|
---|
475 | #define X86_CPUID_FEATURE_EDX_TSC RT_BIT_32(4)
|
---|
476 | /** Bit 5 - MSR - Model Specific Registers RDMSR and WRMSR Instructions. */
|
---|
477 | #define X86_CPUID_FEATURE_EDX_MSR RT_BIT_32(5)
|
---|
478 | /** Bit 6 - PAE - Physical Address Extension. */
|
---|
479 | #define X86_CPUID_FEATURE_EDX_PAE RT_BIT_32(6)
|
---|
480 | #define X86_CPUID_FEATURE_EDX_PAE_BIT 6 /**< Bit number for X86_CPUID_FEATURE_EDX_PAE. */
|
---|
481 | /** Bit 7 - MCE - Machine Check Exception. */
|
---|
482 | #define X86_CPUID_FEATURE_EDX_MCE RT_BIT_32(7)
|
---|
483 | /** Bit 8 - CX8 - CMPXCHG8B instruction. */
|
---|
484 | #define X86_CPUID_FEATURE_EDX_CX8 RT_BIT_32(8)
|
---|
485 | /** Bit 9 - APIC - APIC On-Chip. */
|
---|
486 | #define X86_CPUID_FEATURE_EDX_APIC RT_BIT_32(9)
|
---|
487 | /** Bit 11 - SEP - SYSENTER and SYSEXIT Present. */
|
---|
488 | #define X86_CPUID_FEATURE_EDX_SEP RT_BIT_32(11)
|
---|
489 | /** Bit 12 - MTRR - Memory Type Range Registers. */
|
---|
490 | #define X86_CPUID_FEATURE_EDX_MTRR RT_BIT_32(12)
|
---|
491 | /** Bit 13 - PGE - PTE Global Bit. */
|
---|
492 | #define X86_CPUID_FEATURE_EDX_PGE RT_BIT_32(13)
|
---|
493 | /** Bit 14 - MCA - Machine Check Architecture. */
|
---|
494 | #define X86_CPUID_FEATURE_EDX_MCA RT_BIT_32(14)
|
---|
495 | /** Bit 15 - CMOV - Conditional Move Instructions. */
|
---|
496 | #define X86_CPUID_FEATURE_EDX_CMOV RT_BIT_32(15)
|
---|
497 | /** Bit 16 - PAT - Page Attribute Table. */
|
---|
498 | #define X86_CPUID_FEATURE_EDX_PAT RT_BIT_32(16)
|
---|
499 | /** Bit 17 - PSE-36 - 36-bit Page Size Extension. */
|
---|
500 | #define X86_CPUID_FEATURE_EDX_PSE36 RT_BIT_32(17)
|
---|
501 | /** Bit 18 - PSN - Processor Serial Number. */
|
---|
502 | #define X86_CPUID_FEATURE_EDX_PSN RT_BIT_32(18)
|
---|
503 | /** Bit 19 - CLFSH - CLFLUSH Instruction. */
|
---|
504 | #define X86_CPUID_FEATURE_EDX_CLFSH RT_BIT_32(19)
|
---|
505 | /** Bit 21 - DS - Debug Store. */
|
---|
506 | #define X86_CPUID_FEATURE_EDX_DS RT_BIT_32(21)
|
---|
507 | /** Bit 22 - ACPI - Thermal Monitor and Software Controlled Clock Facilities. */
|
---|
508 | #define X86_CPUID_FEATURE_EDX_ACPI RT_BIT_32(22)
|
---|
509 | /** Bit 23 - MMX - Intel MMX Technology. */
|
---|
510 | #define X86_CPUID_FEATURE_EDX_MMX RT_BIT_32(23)
|
---|
511 | /** Bit 24 - FXSR - FXSAVE and FXRSTOR Instructions. */
|
---|
512 | #define X86_CPUID_FEATURE_EDX_FXSR RT_BIT_32(24)
|
---|
513 | /** Bit 25 - SSE - SSE Support. */
|
---|
514 | #define X86_CPUID_FEATURE_EDX_SSE RT_BIT_32(25)
|
---|
515 | /** Bit 26 - SSE2 - SSE2 Support. */
|
---|
516 | #define X86_CPUID_FEATURE_EDX_SSE2 RT_BIT_32(26)
|
---|
517 | /** Bit 27 - SS - Self Snoop. */
|
---|
518 | #define X86_CPUID_FEATURE_EDX_SS RT_BIT_32(27)
|
---|
519 | /** Bit 28 - HTT - Hyper-Threading Technology. */
|
---|
520 | #define X86_CPUID_FEATURE_EDX_HTT RT_BIT_32(28)
|
---|
521 | /** Bit 29 - TM - Therm. Monitor. */
|
---|
522 | #define X86_CPUID_FEATURE_EDX_TM RT_BIT_32(29)
|
---|
523 | /** Bit 31 - PBE - Pending Break Enabled. */
|
---|
524 | #define X86_CPUID_FEATURE_EDX_PBE RT_BIT_32(31)
|
---|
525 | /** @} */
|
---|
526 |
|
---|
527 | /** @name CPUID mwait/monitor information.
|
---|
528 | * CPUID query with EAX=5.
|
---|
529 | * @{
|
---|
530 | */
|
---|
531 | /** ECX Bit 0 - MWAITEXT - Supports mwait/monitor extensions or not. */
|
---|
532 | #define X86_CPUID_MWAIT_ECX_EXT RT_BIT_32(0)
|
---|
533 | /** ECX Bit 1 - MWAITBREAK - Break mwait for external interrupt even if EFLAGS.IF=0. */
|
---|
534 | #define X86_CPUID_MWAIT_ECX_BREAKIRQIF0 RT_BIT_32(1)
|
---|
535 | /** @} */
|
---|
536 |
|
---|
537 |
|
---|
538 | /** @name CPUID Structured Extended Feature information.
|
---|
539 | * CPUID query with EAX=7.
|
---|
540 | * @{
|
---|
541 | */
|
---|
542 | /** EBX Bit 0 - FSGSBASE - Supports RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE. */
|
---|
543 | #define X86_CPUID_STEXT_FEATURE_EBX_FSGSBASE RT_BIT_32(0)
|
---|
544 | /** EBX Bit 1 - TSCADJUST - Supports MSR_IA32_TSC_ADJUST. */
|
---|
545 | #define X86_CPUID_STEXT_FEATURE_EBX_TSC_ADJUST RT_BIT_32(1)
|
---|
546 | /** EBX Bit 3 - BMI1 - Advanced Bit Manipulation extension 1. */
|
---|
547 | #define X86_CPUID_STEXT_FEATURE_EBX_BMI1 RT_BIT_32(3)
|
---|
548 | /** EBX Bit 4 - HLE - Hardware Lock Elision. */
|
---|
549 | #define X86_CPUID_STEXT_FEATURE_EBX_HLE RT_BIT_32(4)
|
---|
550 | /** EBX Bit 5 - AVX2 - Advanced Vector Extensions 2. */
|
---|
551 | #define X86_CPUID_STEXT_FEATURE_EBX_AVX2 RT_BIT_32(5)
|
---|
552 | /** EBX Bit 7 - SMEP - Supervisor Mode Execution Prevention. */
|
---|
553 | #define X86_CPUID_STEXT_FEATURE_EBX_SMEP RT_BIT_32(7)
|
---|
554 | /** EBX Bit 8 - BMI2 - Advanced Bit Manipulation extension 2. */
|
---|
555 | #define X86_CPUID_STEXT_FEATURE_EBX_BMI2 RT_BIT_32(8)
|
---|
556 | /** EBX Bit 9 - ERMS - Supports Enhanced REP MOVSB/STOSB. */
|
---|
557 | #define X86_CPUID_STEXT_FEATURE_EBX_ERMS RT_BIT_32(9)
|
---|
558 | /** EBX Bit 10 - INVPCID - Supports INVPCID. */
|
---|
559 | #define X86_CPUID_STEXT_FEATURE_EBX_INVPCID RT_BIT_32(10)
|
---|
560 | /** EBX Bit 11 - RTM - Supports Restricted Transactional Memory. */
|
---|
561 | #define X86_CPUID_STEXT_FEATURE_EBX_RTM RT_BIT_32(11)
|
---|
562 | /** EBX Bit 12 - PQM - Supports Platform Quality of Service Monitoring. */
|
---|
563 | #define X86_CPUID_STEXT_FEATURE_EBX_PQM RT_BIT_32(12)
|
---|
564 | /** EBX Bit 13 - DEPFPU_CS_DS - Deprecates FPU CS, FPU DS values if set. */
|
---|
565 | #define X86_CPUID_STEXT_FEATURE_EBX_DEPR_FPU_CS_DS RT_BIT_32(13)
|
---|
566 | /** EBX Bit 14 - MPE - Supports Intel Memory Protection Extensions. */
|
---|
567 | #define X86_CPUID_STEXT_FEATURE_EBX_MPE RT_BIT_32(14)
|
---|
568 | /** EBX Bit 15 - PQE - Supports Platform Quality of Service Enforcement. */
|
---|
569 | #define X86_CPUID_STEXT_FEATURE_EBX_PQE RT_BIT_32(15)
|
---|
570 | /** EBX Bit 16 - AVX512F - Supports AVX512F. */
|
---|
571 | #define X86_CPUID_STEXT_FEATURE_EBX_AVX512F RT_BIT_32(16)
|
---|
572 | /** EBX Bit 18 - RDSEED - Supports RDSEED. */
|
---|
573 | #define X86_CPUID_STEXT_FEATURE_EBX_RDSEED RT_BIT_32(18)
|
---|
574 | /** EBX Bit 19 - ADX - Supports ADCX/ADOX. */
|
---|
575 | #define X86_CPUID_STEXT_FEATURE_EBX_ADX RT_BIT_32(19)
|
---|
576 | /** EBX Bit 20 - SMAP - Supports Supervisor Mode Access Prevention. */
|
---|
577 | #define X86_CPUID_STEXT_FEATURE_EBX_SMAP RT_BIT_32(20)
|
---|
578 | /** EBX Bit 23 - CLFLUSHOPT - Supports CLFLUSHOPT (Cache Line Flush). */
|
---|
579 | #define X86_CPUID_STEXT_FEATURE_EBX_CLFLUSHOPT RT_BIT_32(23)
|
---|
580 | /** EBX Bit 25 - INTEL_PT - Supports Intel Processor Trace. */
|
---|
581 | #define X86_CPUID_STEXT_FEATURE_EBX_INTEL_PT RT_BIT_32(25)
|
---|
582 | /** EBX Bit 26 - AVX512PF - Supports AVX512PF. */
|
---|
583 | #define X86_CPUID_STEXT_FEATURE_EBX_AVX512PF RT_BIT_32(26)
|
---|
584 | /** EBX Bit 27 - AVX512ER - Supports AVX512ER. */
|
---|
585 | #define X86_CPUID_STEXT_FEATURE_EBX_AVX512ER RT_BIT_32(27)
|
---|
586 | /** EBX Bit 28 - AVX512CD - Supports AVX512CD. */
|
---|
587 | #define X86_CPUID_STEXT_FEATURE_EBX_AVX512CD RT_BIT_32(28)
|
---|
588 | /** EBX Bit 29 - SHA - Supports Secure Hash Algorithm extensions. */
|
---|
589 | #define X86_CPUID_STEXT_FEATURE_EBX_SHA RT_BIT_32(29)
|
---|
590 |
|
---|
591 | /** ECX Bit 0 - PREFETCHWT1 - Supports the PREFETCHWT1 instruction. */
|
---|
592 | #define X86_CPUID_STEXT_FEATURE_ECX_PREFETCHWT1 RT_BIT_32(0)
|
---|
593 | /** @} */
|
---|
594 |
|
---|
595 |
|
---|
596 | /** @name CPUID Extended Feature information.
|
---|
597 | * CPUID query with EAX=0x80000001.
|
---|
598 | * @{
|
---|
599 | */
|
---|
600 | /** ECX Bit 0 - LAHF/SAHF support in 64-bit mode. */
|
---|
601 | #define X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF RT_BIT_32(0)
|
---|
602 |
|
---|
603 | /** EDX Bit 11 - SYSCALL/SYSRET. */
|
---|
604 | #define X86_CPUID_EXT_FEATURE_EDX_SYSCALL RT_BIT_32(11)
|
---|
605 | /** EDX Bit 20 - No-Execute/Execute-Disable. */
|
---|
606 | #define X86_CPUID_EXT_FEATURE_EDX_NX RT_BIT_32(20)
|
---|
607 | /** EDX Bit 26 - 1 GB large page. */
|
---|
608 | #define X86_CPUID_EXT_FEATURE_EDX_PAGE1GB RT_BIT_32(26)
|
---|
609 | /** EDX Bit 27 - RDTSCP. */
|
---|
610 | #define X86_CPUID_EXT_FEATURE_EDX_RDTSCP RT_BIT_32(27)
|
---|
611 | /** EDX Bit 29 - AMD Long Mode/Intel-64 Instructions. */
|
---|
612 | #define X86_CPUID_EXT_FEATURE_EDX_LONG_MODE RT_BIT_32(29)
|
---|
613 | /** @}*/
|
---|
614 |
|
---|
615 | /** @name CPUID AMD Feature information.
|
---|
616 | * CPUID query with EAX=0x80000001.
|
---|
617 | * @{
|
---|
618 | */
|
---|
619 | /** Bit 0 - FPU - x87 FPU on Chip. */
|
---|
620 | #define X86_CPUID_AMD_FEATURE_EDX_FPU RT_BIT_32(0)
|
---|
621 | /** Bit 1 - VME - Virtual 8086 Mode Enhancements. */
|
---|
622 | #define X86_CPUID_AMD_FEATURE_EDX_VME RT_BIT_32(1)
|
---|
623 | /** Bit 2 - DE - Debugging extensions. */
|
---|
624 | #define X86_CPUID_AMD_FEATURE_EDX_DE RT_BIT_32(2)
|
---|
625 | /** Bit 3 - PSE - Page Size Extension. */
|
---|
626 | #define X86_CPUID_AMD_FEATURE_EDX_PSE RT_BIT_32(3)
|
---|
627 | /** Bit 4 - TSC - Time Stamp Counter. */
|
---|
628 | #define X86_CPUID_AMD_FEATURE_EDX_TSC RT_BIT_32(4)
|
---|
629 | /** Bit 5 - MSR - K86 Model Specific Registers RDMSR and WRMSR Instructions. */
|
---|
630 | #define X86_CPUID_AMD_FEATURE_EDX_MSR RT_BIT_32(5)
|
---|
631 | /** Bit 6 - PAE - Physical Address Extension. */
|
---|
632 | #define X86_CPUID_AMD_FEATURE_EDX_PAE RT_BIT_32(6)
|
---|
633 | /** Bit 7 - MCE - Machine Check Exception. */
|
---|
634 | #define X86_CPUID_AMD_FEATURE_EDX_MCE RT_BIT_32(7)
|
---|
635 | /** Bit 8 - CX8 - CMPXCHG8B instruction. */
|
---|
636 | #define X86_CPUID_AMD_FEATURE_EDX_CX8 RT_BIT_32(8)
|
---|
637 | /** Bit 9 - APIC - APIC On-Chip. */
|
---|
638 | #define X86_CPUID_AMD_FEATURE_EDX_APIC RT_BIT_32(9)
|
---|
639 | /** Bit 12 - MTRR - Memory Type Range Registers. */
|
---|
640 | #define X86_CPUID_AMD_FEATURE_EDX_MTRR RT_BIT_32(12)
|
---|
641 | /** Bit 13 - PGE - PTE Global Bit. */
|
---|
642 | #define X86_CPUID_AMD_FEATURE_EDX_PGE RT_BIT_32(13)
|
---|
643 | /** Bit 14 - MCA - Machine Check Architecture. */
|
---|
644 | #define X86_CPUID_AMD_FEATURE_EDX_MCA RT_BIT_32(14)
|
---|
645 | /** Bit 15 - CMOV - Conditional Move Instructions. */
|
---|
646 | #define X86_CPUID_AMD_FEATURE_EDX_CMOV RT_BIT_32(15)
|
---|
647 | /** Bit 16 - PAT - Page Attribute Table. */
|
---|
648 | #define X86_CPUID_AMD_FEATURE_EDX_PAT RT_BIT_32(16)
|
---|
649 | /** Bit 17 - PSE-36 - 36-bit Page Size Extension. */
|
---|
650 | #define X86_CPUID_AMD_FEATURE_EDX_PSE36 RT_BIT_32(17)
|
---|
651 | /** Bit 22 - AXMMX - AMD Extensions to MMX Instructions. */
|
---|
652 | #define X86_CPUID_AMD_FEATURE_EDX_AXMMX RT_BIT_32(22)
|
---|
653 | /** Bit 23 - MMX - Intel MMX Technology. */
|
---|
654 | #define X86_CPUID_AMD_FEATURE_EDX_MMX RT_BIT_32(23)
|
---|
655 | /** Bit 24 - FXSR - FXSAVE and FXRSTOR Instructions. */
|
---|
656 | #define X86_CPUID_AMD_FEATURE_EDX_FXSR RT_BIT_32(24)
|
---|
657 | /** Bit 25 - FFXSR - AMD fast FXSAVE and FXRSTOR Instructions. */
|
---|
658 | #define X86_CPUID_AMD_FEATURE_EDX_FFXSR RT_BIT_32(25)
|
---|
659 | /** Bit 30 - 3DNOWEXT - AMD Extensions to 3DNow. */
|
---|
660 | #define X86_CPUID_AMD_FEATURE_EDX_3DNOW_EX RT_BIT_32(30)
|
---|
661 | /** Bit 31 - 3DNOW - AMD 3DNow. */
|
---|
662 | #define X86_CPUID_AMD_FEATURE_EDX_3DNOW RT_BIT_32(31)
|
---|
663 |
|
---|
664 | /** Bit 1 - CmpLegacy - Core multi-processing legacy mode. */
|
---|
665 | #define X86_CPUID_AMD_FEATURE_ECX_CMPL RT_BIT_32(1)
|
---|
666 | /** Bit 2 - SVM - AMD VM extensions. */
|
---|
667 | #define X86_CPUID_AMD_FEATURE_ECX_SVM RT_BIT_32(2)
|
---|
668 | /** Bit 3 - EXTAPIC - AMD extended APIC registers starting at 0x400. */
|
---|
669 | #define X86_CPUID_AMD_FEATURE_ECX_EXT_APIC RT_BIT_32(3)
|
---|
670 | /** Bit 4 - CR8L - AMD LOCK MOV CR0 means MOV CR8. */
|
---|
671 | #define X86_CPUID_AMD_FEATURE_ECX_CR8L RT_BIT_32(4)
|
---|
672 | /** Bit 5 - ABM - AMD Advanced bit manipulation. LZCNT instruction support. */
|
---|
673 | #define X86_CPUID_AMD_FEATURE_ECX_ABM RT_BIT_32(5)
|
---|
674 | /** Bit 6 - SSE4A - AMD EXTRQ, INSERTQ, MOVNTSS, and MOVNTSD instruction support. */
|
---|
675 | #define X86_CPUID_AMD_FEATURE_ECX_SSE4A RT_BIT_32(6)
|
---|
676 | /** Bit 7 - MISALIGNSSE - AMD Misaligned SSE mode. */
|
---|
677 | #define X86_CPUID_AMD_FEATURE_ECX_MISALNSSE RT_BIT_32(7)
|
---|
678 | /** Bit 8 - 3DNOWPRF - AMD PREFETCH and PREFETCHW instruction support. */
|
---|
679 | #define X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF RT_BIT_32(8)
|
---|
680 | /** Bit 9 - OSVW - AMD OS visible workaround. */
|
---|
681 | #define X86_CPUID_AMD_FEATURE_ECX_OSVW RT_BIT_32(9)
|
---|
682 | /** Bit 10 - IBS - Instruct based sampling. */
|
---|
683 | #define X86_CPUID_AMD_FEATURE_ECX_IBS RT_BIT_32(10)
|
---|
684 | /** Bit 11 - XOP - Extended operation support (see APM6). */
|
---|
685 | #define X86_CPUID_AMD_FEATURE_ECX_XOP RT_BIT_32(11)
|
---|
686 | /** Bit 12 - SKINIT - AMD SKINIT: SKINIT, STGI, and DEV support. */
|
---|
687 | #define X86_CPUID_AMD_FEATURE_ECX_SKINIT RT_BIT_32(12)
|
---|
688 | /** Bit 13 - WDT - AMD Watchdog timer support. */
|
---|
689 | #define X86_CPUID_AMD_FEATURE_ECX_WDT RT_BIT_32(13)
|
---|
690 | /** Bit 15 - LWP - Lightweight profiling support. */
|
---|
691 | #define X86_CPUID_AMD_FEATURE_ECX_LWP RT_BIT_32(15)
|
---|
692 | /** Bit 16 - FMA4 - Four operand FMA instruction support. */
|
---|
693 | #define X86_CPUID_AMD_FEATURE_ECX_FMA4 RT_BIT_32(16)
|
---|
694 | /** Bit 19 - NodeId - Indicates support for
|
---|
695 | * MSR_C001_100C[NodeId,NodesPerProcessr]. */
|
---|
696 | #define X86_CPUID_AMD_FEATURE_ECX_NODEID RT_BIT_32(19)
|
---|
697 | /** Bit 21 - TBM - Trailing bit manipulation instruction support. */
|
---|
698 | #define X86_CPUID_AMD_FEATURE_ECX_TBM RT_BIT_32(21)
|
---|
699 | /** Bit 22 - TopologyExtensions - . */
|
---|
700 | #define X86_CPUID_AMD_FEATURE_ECX_TOPOEXT RT_BIT_32(22)
|
---|
701 | /** @} */
|
---|
702 |
|
---|
703 |
|
---|
704 | /** @name CPUID AMD Feature information.
|
---|
705 | * CPUID query with EAX=0x80000007.
|
---|
706 | * @{
|
---|
707 | */
|
---|
708 | /** Bit 0 - TS - Temperature Sensor. */
|
---|
709 | #define X86_CPUID_AMD_ADVPOWER_EDX_TS RT_BIT_32(0)
|
---|
710 | /** Bit 1 - FID - Frequency ID Control. */
|
---|
711 | #define X86_CPUID_AMD_ADVPOWER_EDX_FID RT_BIT_32(1)
|
---|
712 | /** Bit 2 - VID - Voltage ID Control. */
|
---|
713 | #define X86_CPUID_AMD_ADVPOWER_EDX_VID RT_BIT_32(2)
|
---|
714 | /** Bit 3 - TTP - THERMTRIP. */
|
---|
715 | #define X86_CPUID_AMD_ADVPOWER_EDX_TTP RT_BIT_32(3)
|
---|
716 | /** Bit 4 - TM - Hardware Thermal Control. */
|
---|
717 | #define X86_CPUID_AMD_ADVPOWER_EDX_TM RT_BIT_32(4)
|
---|
718 | /** Bit 5 - STC - Software Thermal Control. */
|
---|
719 | #define X86_CPUID_AMD_ADVPOWER_EDX_STC RT_BIT_32(5)
|
---|
720 | /** Bit 6 - MC - 100 Mhz Multiplier Control. */
|
---|
721 | #define X86_CPUID_AMD_ADVPOWER_EDX_MC RT_BIT_32(6)
|
---|
722 | /** Bit 7 - HWPSTATE - Hardware P-State Control. */
|
---|
723 | #define X86_CPUID_AMD_ADVPOWER_EDX_HWPSTATE RT_BIT_32(7)
|
---|
724 | /** Bit 8 - TSCINVAR - TSC Invariant. */
|
---|
725 | #define X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR RT_BIT_32(8)
|
---|
726 | /** Bit 9 - CPB - TSC Invariant. */
|
---|
727 | #define X86_CPUID_AMD_ADVPOWER_EDX_CPB RT_BIT_32(9)
|
---|
728 | /** Bit 10 - EffFreqRO - MPERF/APERF. */
|
---|
729 | #define X86_CPUID_AMD_ADVPOWER_EDX_EFRO RT_BIT_32(10)
|
---|
730 | /** Bit 11 - PFI - Processor feedback interface (see EAX). */
|
---|
731 | #define X86_CPUID_AMD_ADVPOWER_EDX_PFI RT_BIT_32(11)
|
---|
732 | /** Bit 12 - PA - Processor accumulator (MSR c001_007a). */
|
---|
733 | #define X86_CPUID_AMD_ADVPOWER_EDX_PA RT_BIT_32(12)
|
---|
734 | /** @} */
|
---|
735 |
|
---|
736 |
|
---|
737 | /** @name CR0
|
---|
738 | * @{ */
|
---|
739 | /** Bit 0 - PE - Protection Enabled */
|
---|
740 | #define X86_CR0_PE RT_BIT_32(0)
|
---|
741 | #define X86_CR0_PROTECTION_ENABLE RT_BIT_32(0)
|
---|
742 | /** Bit 1 - MP - Monitor Coprocessor */
|
---|
743 | #define X86_CR0_MP RT_BIT_32(1)
|
---|
744 | #define X86_CR0_MONITOR_COPROCESSOR RT_BIT_32(1)
|
---|
745 | /** Bit 2 - EM - Emulation. */
|
---|
746 | #define X86_CR0_EM RT_BIT_32(2)
|
---|
747 | #define X86_CR0_EMULATE_FPU RT_BIT_32(2)
|
---|
748 | /** Bit 3 - TS - Task Switch. */
|
---|
749 | #define X86_CR0_TS RT_BIT_32(3)
|
---|
750 | #define X86_CR0_TASK_SWITCH RT_BIT_32(3)
|
---|
751 | /** Bit 4 - ET - Extension flag. ('hardcoded' to 1) */
|
---|
752 | #define X86_CR0_ET RT_BIT_32(4)
|
---|
753 | #define X86_CR0_EXTENSION_TYPE RT_BIT_32(4)
|
---|
754 | /** Bit 5 - NE - Numeric error. */
|
---|
755 | #define X86_CR0_NE RT_BIT_32(5)
|
---|
756 | #define X86_CR0_NUMERIC_ERROR RT_BIT_32(5)
|
---|
757 | /** Bit 16 - WP - Write Protect. */
|
---|
758 | #define X86_CR0_WP RT_BIT_32(16)
|
---|
759 | #define X86_CR0_WRITE_PROTECT RT_BIT_32(16)
|
---|
760 | /** Bit 18 - AM - Alignment Mask. */
|
---|
761 | #define X86_CR0_AM RT_BIT_32(18)
|
---|
762 | #define X86_CR0_ALIGMENT_MASK RT_BIT_32(18)
|
---|
763 | /** Bit 29 - NW - Not Write-though. */
|
---|
764 | #define X86_CR0_NW RT_BIT_32(29)
|
---|
765 | #define X86_CR0_NOT_WRITE_THROUGH RT_BIT_32(29)
|
---|
766 | /** Bit 30 - WP - Cache Disable. */
|
---|
767 | #define X86_CR0_CD RT_BIT_32(30)
|
---|
768 | #define X86_CR0_CACHE_DISABLE RT_BIT_32(30)
|
---|
769 | /** Bit 31 - PG - Paging. */
|
---|
770 | #define X86_CR0_PG RT_BIT_32(31)
|
---|
771 | #define X86_CR0_PAGING RT_BIT_32(31)
|
---|
772 | /** @} */
|
---|
773 |
|
---|
774 |
|
---|
775 | /** @name CR3
|
---|
776 | * @{ */
|
---|
777 | /** Bit 3 - PWT - Page-level Writes Transparent. */
|
---|
778 | #define X86_CR3_PWT RT_BIT_32(3)
|
---|
779 | /** Bit 4 - PCD - Page-level Cache Disable. */
|
---|
780 | #define X86_CR3_PCD RT_BIT_32(4)
|
---|
781 | /** Bits 12-31 - - Page directory page number. */
|
---|
782 | #define X86_CR3_PAGE_MASK (0xfffff000)
|
---|
783 | /** Bits 5-31 - - PAE Page directory page number. */
|
---|
784 | #define X86_CR3_PAE_PAGE_MASK (0xffffffe0)
|
---|
785 | /** Bits 12-51 - - AMD64 Page directory page number. */
|
---|
786 | #define X86_CR3_AMD64_PAGE_MASK UINT64_C(0x000ffffffffff000)
|
---|
787 | /** @} */
|
---|
788 |
|
---|
789 |
|
---|
790 | /** @name CR4
|
---|
791 | * @{ */
|
---|
792 | /** Bit 0 - VME - Virtual-8086 Mode Extensions. */
|
---|
793 | #define X86_CR4_VME RT_BIT_32(0)
|
---|
794 | /** Bit 1 - PVI - Protected-Mode Virtual Interrupts. */
|
---|
795 | #define X86_CR4_PVI RT_BIT_32(1)
|
---|
796 | /** Bit 2 - TSD - Time Stamp Disable. */
|
---|
797 | #define X86_CR4_TSD RT_BIT_32(2)
|
---|
798 | /** Bit 3 - DE - Debugging Extensions. */
|
---|
799 | #define X86_CR4_DE RT_BIT_32(3)
|
---|
800 | /** Bit 4 - PSE - Page Size Extension. */
|
---|
801 | #define X86_CR4_PSE RT_BIT_32(4)
|
---|
802 | /** Bit 5 - PAE - Physical Address Extension. */
|
---|
803 | #define X86_CR4_PAE RT_BIT_32(5)
|
---|
804 | /** Bit 6 - MCE - Machine-Check Enable. */
|
---|
805 | #define X86_CR4_MCE RT_BIT_32(6)
|
---|
806 | /** Bit 7 - PGE - Page Global Enable. */
|
---|
807 | #define X86_CR4_PGE RT_BIT_32(7)
|
---|
808 | /** Bit 8 - PCE - Performance-Monitoring Counter Enable. */
|
---|
809 | #define X86_CR4_PCE RT_BIT_32(8)
|
---|
810 | /** Bit 9 - OSFXSR - Operating System Support for FXSAVE and FXRSTORE instructions. */
|
---|
811 | #define X86_CR4_OSFXSR RT_BIT_32(9)
|
---|
812 | /** Bit 10 - OSXMMEEXCPT - Operating System Support for Unmasked SIMD Floating-Point Exceptions. */
|
---|
813 | #define X86_CR4_OSXMMEEXCPT RT_BIT_32(10)
|
---|
814 | /** Bit 13 - VMXE - VMX mode is enabled. */
|
---|
815 | #define X86_CR4_VMXE RT_BIT_32(13)
|
---|
816 | /** Bit 14 - SMXE - Safer Mode Extensions Enabled. */
|
---|
817 | #define X86_CR4_SMXE RT_BIT_32(14)
|
---|
818 | /** Bit 17 - PCIDE - Process-Context Identifiers Enabled. */
|
---|
819 | #define X86_CR4_PCIDE RT_BIT_32(17)
|
---|
820 | /** Bit 18 - OSXSAVE - Operating System Support for XSAVE and processor
|
---|
821 | * extended states. */
|
---|
822 | #define X86_CR4_OSXSAVE RT_BIT_32(18)
|
---|
823 | /** Bit 20 - SMEP - Supervisor-mode Execution Prevention enabled. */
|
---|
824 | #define X86_CR4_SMEP RT_BIT_32(20)
|
---|
825 | /** Bit 21 - SMAP - Supervisor-mode Access Prevention enabled. */
|
---|
826 | #define X86_CR4_SMAP RT_BIT_32(21)
|
---|
827 | /** Bit 22 - PKE - Protection Key Enable. */
|
---|
828 | #define X86_CR4_PKE RT_BIT_32(22)
|
---|
829 | /** @} */
|
---|
830 |
|
---|
831 |
|
---|
832 | /** @name DR6
|
---|
833 | * @{ */
|
---|
834 | /** Bit 0 - B0 - Breakpoint 0 condition detected. */
|
---|
835 | #define X86_DR6_B0 RT_BIT_32(0)
|
---|
836 | /** Bit 1 - B1 - Breakpoint 1 condition detected. */
|
---|
837 | #define X86_DR6_B1 RT_BIT_32(1)
|
---|
838 | /** Bit 2 - B2 - Breakpoint 2 condition detected. */
|
---|
839 | #define X86_DR6_B2 RT_BIT_32(2)
|
---|
840 | /** Bit 3 - B3 - Breakpoint 3 condition detected. */
|
---|
841 | #define X86_DR6_B3 RT_BIT_32(3)
|
---|
842 | /** Mask of all the Bx bits. */
|
---|
843 | #define X86_DR6_B_MASK UINT64_C(0x0000000f)
|
---|
844 | /** Bit 13 - BD - Debug register access detected. Corresponds to the X86_DR7_GD bit. */
|
---|
845 | #define X86_DR6_BD RT_BIT_32(13)
|
---|
846 | /** Bit 14 - BS - Single step */
|
---|
847 | #define X86_DR6_BS RT_BIT_32(14)
|
---|
848 | /** Bit 15 - BT - Task switch. (TSS T bit.) */
|
---|
849 | #define X86_DR6_BT RT_BIT_32(15)
|
---|
850 | /** Value of DR6 after powerup/reset. */
|
---|
851 | #define X86_DR6_INIT_VAL UINT64_C(0xFFFF0FF0)
|
---|
852 | /** Bits which must be 1s in DR6. */
|
---|
853 | #define X86_DR6_RA1_MASK UINT64_C(0xffff0ff0)
|
---|
854 | /** Bits which must be 0s in DR6. */
|
---|
855 | #define X86_DR6_RAZ_MASK RT_BIT_64(12)
|
---|
856 | /** Bits which must be 0s on writes to DR6. */
|
---|
857 | #define X86_DR6_MBZ_MASK UINT64_C(0xffffffff00000000)
|
---|
858 | /** @} */
|
---|
859 |
|
---|
860 | /** Get the DR6.Bx bit for a the given breakpoint. */
|
---|
861 | #define X86_DR6_B(iBp) RT_BIT_64(iBp)
|
---|
862 |
|
---|
863 |
|
---|
864 | /** @name DR7
|
---|
865 | * @{ */
|
---|
866 | /** Bit 0 - L0 - Local breakpoint enable. Cleared on task switch. */
|
---|
867 | #define X86_DR7_L0 RT_BIT_32(0)
|
---|
868 | /** Bit 1 - G0 - Global breakpoint enable. Not cleared on task switch. */
|
---|
869 | #define X86_DR7_G0 RT_BIT_32(1)
|
---|
870 | /** Bit 2 - L1 - Local breakpoint enable. Cleared on task switch. */
|
---|
871 | #define X86_DR7_L1 RT_BIT_32(2)
|
---|
872 | /** Bit 3 - G1 - Global breakpoint enable. Not cleared on task switch. */
|
---|
873 | #define X86_DR7_G1 RT_BIT_32(3)
|
---|
874 | /** Bit 4 - L2 - Local breakpoint enable. Cleared on task switch. */
|
---|
875 | #define X86_DR7_L2 RT_BIT_32(4)
|
---|
876 | /** Bit 5 - G2 - Global breakpoint enable. Not cleared on task switch. */
|
---|
877 | #define X86_DR7_G2 RT_BIT_32(5)
|
---|
878 | /** Bit 6 - L3 - Local breakpoint enable. Cleared on task switch. */
|
---|
879 | #define X86_DR7_L3 RT_BIT_32(6)
|
---|
880 | /** Bit 7 - G3 - Global breakpoint enable. Not cleared on task switch. */
|
---|
881 | #define X86_DR7_G3 RT_BIT_32(7)
|
---|
882 | /** Bit 8 - LE - Local breakpoint exact. (Not supported (read ignored) by P6 and later.) */
|
---|
883 | #define X86_DR7_LE RT_BIT_32(8)
|
---|
884 | /** Bit 9 - GE - Local breakpoint exact. (Not supported (read ignored) by P6 and later.) */
|
---|
885 | #define X86_DR7_GE RT_BIT_32(9)
|
---|
886 |
|
---|
887 | /** L0, L1, L2, and L3. */
|
---|
888 | #define X86_DR7_LE_ALL UINT64_C(0x0000000000000055)
|
---|
889 | /** L0, L1, L2, and L3. */
|
---|
890 | #define X86_DR7_GE_ALL UINT64_C(0x00000000000000aa)
|
---|
891 |
|
---|
892 | /** Bit 12 - IR (ICE) - Interrupt redirection on Pentium. When set, the in
|
---|
893 | * Circuit Emulator (ICE) will break emulation on breakpoints and stuff.
|
---|
894 | * May cause CPU hang if enabled without ICE attached when the ICEBP/INT1
|
---|
895 | * instruction is executed.
|
---|
896 | * @see http://www.rcollins.org/secrets/DR7.html */
|
---|
897 | #define X86_DR7_ICE_IR RT_BIT_32(12)
|
---|
898 | /** Bit 13 - GD - General detect enable. Enables emulators to get exceptions when
|
---|
899 | * any DR register is accessed. */
|
---|
900 | #define X86_DR7_GD RT_BIT_32(13)
|
---|
901 | /** Bit 14 - TR1 (ICE) - Code discontinuity trace for use with ICE on
|
---|
902 | * Pentium. */
|
---|
903 | #define X86_DR7_ICE_TR1 RT_BIT_32(14)
|
---|
904 | /** Bit 15 - TR2 (ICE) - Controls unknown ICE trace feature of the pentium. */
|
---|
905 | #define X86_DR7_ICE_TR2 RT_BIT_32(15)
|
---|
906 | /** Bit 16 & 17 - R/W0 - Read write field 0. Values X86_DR7_RW_*. */
|
---|
907 | #define X86_DR7_RW0_MASK (3 << 16)
|
---|
908 | /** Bit 18 & 19 - LEN0 - Length field 0. Values X86_DR7_LEN_*. */
|
---|
909 | #define X86_DR7_LEN0_MASK (3 << 18)
|
---|
910 | /** Bit 20 & 21 - R/W1 - Read write field 0. Values X86_DR7_RW_*. */
|
---|
911 | #define X86_DR7_RW1_MASK (3 << 20)
|
---|
912 | /** Bit 22 & 23 - LEN1 - Length field 0. Values X86_DR7_LEN_*. */
|
---|
913 | #define X86_DR7_LEN1_MASK (3 << 22)
|
---|
914 | /** Bit 24 & 25 - R/W2 - Read write field 0. Values X86_DR7_RW_*. */
|
---|
915 | #define X86_DR7_RW2_MASK (3 << 24)
|
---|
916 | /** Bit 26 & 27 - LEN2 - Length field 0. Values X86_DR7_LEN_*. */
|
---|
917 | #define X86_DR7_LEN2_MASK (3 << 26)
|
---|
918 | /** Bit 28 & 29 - R/W3 - Read write field 0. Values X86_DR7_RW_*. */
|
---|
919 | #define X86_DR7_RW3_MASK (3 << 28)
|
---|
920 | /** Bit 30 & 31 - LEN3 - Length field 0. Values X86_DR7_LEN_*. */
|
---|
921 | #define X86_DR7_LEN3_MASK (3 << 30)
|
---|
922 |
|
---|
923 | /** Bits which reads as 1s. */
|
---|
924 | #define X86_DR7_RA1_MASK RT_BIT_32(10)
|
---|
925 | /** Bits which reads as zeros. These are related to ICE (bits 12, 14, 15). */
|
---|
926 | #define X86_DR7_RAZ_MASK UINT64_C(0x0000d800)
|
---|
927 | /** Bits which must be 0s when writing to DR7. */
|
---|
928 | #define X86_DR7_MBZ_MASK UINT64_C(0xffffffff00000000)
|
---|
929 |
|
---|
930 | /** Calcs the L bit of Nth breakpoint.
|
---|
931 | * @param iBp The breakpoint number [0..3].
|
---|
932 | */
|
---|
933 | #define X86_DR7_L(iBp) ( UINT32_C(1) << (iBp * 2) )
|
---|
934 |
|
---|
935 | /** Calcs the G bit of Nth breakpoint.
|
---|
936 | * @param iBp The breakpoint number [0..3].
|
---|
937 | */
|
---|
938 | #define X86_DR7_G(iBp) ( UINT32_C(1) << (iBp * 2 + 1) )
|
---|
939 |
|
---|
940 | /** Calcs the L and G bits of Nth breakpoint.
|
---|
941 | * @param iBp The breakpoint number [0..3].
|
---|
942 | */
|
---|
943 | #define X86_DR7_L_G(iBp) ( UINT32_C(3) << (iBp * 2) )
|
---|
944 |
|
---|
945 | /** @name Read/Write values.
|
---|
946 | * @{ */
|
---|
947 | /** Break on instruction fetch only. */
|
---|
948 | #define X86_DR7_RW_EO 0U
|
---|
949 | /** Break on write only. */
|
---|
950 | #define X86_DR7_RW_WO 1U
|
---|
951 | /** Break on I/O read/write. This is only defined if CR4.DE is set. */
|
---|
952 | #define X86_DR7_RW_IO 2U
|
---|
953 | /** Break on read or write (but not instruction fetches). */
|
---|
954 | #define X86_DR7_RW_RW 3U
|
---|
955 | /** @} */
|
---|
956 |
|
---|
957 | /** Shifts a X86_DR7_RW_* value to its right place.
|
---|
958 | * @param iBp The breakpoint number [0..3].
|
---|
959 | * @param fRw One of the X86_DR7_RW_* value.
|
---|
960 | */
|
---|
961 | #define X86_DR7_RW(iBp, fRw) ( (fRw) << ((iBp) * 4 + 16) )
|
---|
962 |
|
---|
963 | /** Fetch the R/Wx bits for a given breakpoint (so it can be compared with
|
---|
964 | * one of the X86_DR7_RW_XXX constants).
|
---|
965 | *
|
---|
966 | * @returns X86_DR7_RW_XXX
|
---|
967 | * @param uDR7 DR7 value
|
---|
968 | * @param iBp The breakpoint number [0..3].
|
---|
969 | */
|
---|
970 | #define X86_DR7_GET_RW(uDR7, iBp) ( ( (uDR7) >> ((iBp) * 4 + 16) ) & UINT32_C(3) )
|
---|
971 |
|
---|
972 | /** R/W0, R/W1, R/W2, and R/W3. */
|
---|
973 | #define X86_DR7_RW_ALL_MASKS UINT32_C(0x33330000)
|
---|
974 |
|
---|
975 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
976 | /** Checks if there are any I/O breakpoint types configured in the RW
|
---|
977 | * registers. Does NOT check if these are enabled, sorry. */
|
---|
978 | # define X86_DR7_ANY_RW_IO(uDR7) \
|
---|
979 | ( ( UINT32_C(0x22220000) & (uDR7) ) /* any candidates? */ \
|
---|
980 | && ( ( (UINT32_C(0x22220000) & (uDR7) ) >> 1 ) & ~(uDR7) ) )
|
---|
981 | AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x33330000)) == 0);
|
---|
982 | AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x22220000)) == 1);
|
---|
983 | AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x32320000)) == 1);
|
---|
984 | AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x23230000)) == 1);
|
---|
985 | AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00000000)) == 0);
|
---|
986 | AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00010000)) == 0);
|
---|
987 | AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00020000)) == 1);
|
---|
988 | AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00030000)) == 0);
|
---|
989 | AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00040000)) == 0);
|
---|
990 | #endif /* !VBOX_FOR_DTRACE_LIB */
|
---|
991 |
|
---|
992 | /** @name Length values.
|
---|
993 | * @{ */
|
---|
994 | #define X86_DR7_LEN_BYTE 0U
|
---|
995 | #define X86_DR7_LEN_WORD 1U
|
---|
996 | #define X86_DR7_LEN_QWORD 2U /**< AMD64 long mode only. */
|
---|
997 | #define X86_DR7_LEN_DWORD 3U
|
---|
998 | /** @} */
|
---|
999 |
|
---|
1000 | /** Shifts a X86_DR7_LEN_* value to its right place.
|
---|
1001 | * @param iBp The breakpoint number [0..3].
|
---|
1002 | * @param cb One of the X86_DR7_LEN_* values.
|
---|
1003 | */
|
---|
1004 | #define X86_DR7_LEN(iBp, cb) ( (cb) << ((iBp) * 4 + 18) )
|
---|
1005 |
|
---|
1006 | /** Fetch the breakpoint length bits from the DR7 value.
|
---|
1007 | * @param uDR7 DR7 value
|
---|
1008 | * @param iBp The breakpoint number [0..3].
|
---|
1009 | */
|
---|
1010 | #define X86_DR7_GET_LEN(uDR7, iBp) ( ( (uDR7) >> ((iBp) * 4 + 18) ) & UINT32_C(0x3) )
|
---|
1011 |
|
---|
1012 | /** Mask used to check if any breakpoints are enabled. */
|
---|
1013 | #define X86_DR7_ENABLED_MASK UINT32_C(0x000000ff)
|
---|
1014 |
|
---|
1015 | /** LEN0, LEN1, LEN2, and LEN3. */
|
---|
1016 | #define X86_DR7_LEN_ALL_MASKS UINT32_C(0xcccc0000)
|
---|
1017 | /** R/W0, R/W1, R/W2, R/W3,LEN0, LEN1, LEN2, and LEN3. */
|
---|
1018 | #define X86_DR7_RW_LEN_ALL_MASKS UINT32_C(0xffff0000)
|
---|
1019 |
|
---|
1020 | /** Value of DR7 after powerup/reset. */
|
---|
1021 | #define X86_DR7_INIT_VAL 0x400
|
---|
1022 | /** @} */
|
---|
1023 |
|
---|
1024 |
|
---|
1025 | /** @name Machine Specific Registers
|
---|
1026 | * @{
|
---|
1027 | */
|
---|
1028 | /** Machine check address register (P5). */
|
---|
1029 | #define MSR_P5_MC_ADDR UINT32_C(0x00000000)
|
---|
1030 | /** Machine check type register (P5). */
|
---|
1031 | #define MSR_P5_MC_TYPE UINT32_C(0x00000001)
|
---|
1032 | /** Time Stamp Counter. */
|
---|
1033 | #define MSR_IA32_TSC 0x10
|
---|
1034 | #define MSR_IA32_CESR UINT32_C(0x00000011)
|
---|
1035 | #define MSR_IA32_CTR0 UINT32_C(0x00000012)
|
---|
1036 | #define MSR_IA32_CTR1 UINT32_C(0x00000013)
|
---|
1037 |
|
---|
1038 | #define MSR_IA32_PLATFORM_ID 0x17
|
---|
1039 |
|
---|
1040 | #ifndef MSR_IA32_APICBASE /* qemu cpu.h kludge */
|
---|
1041 | # define MSR_IA32_APICBASE 0x1b
|
---|
1042 | /** Local APIC enabled. */
|
---|
1043 | # define MSR_IA32_APICBASE_EN RT_BIT_64(11)
|
---|
1044 | /** X2APIC enabled (requires the EN bit to be set). */
|
---|
1045 | # define MSR_IA32_APICBASE_EXTD RT_BIT_64(10)
|
---|
1046 | /** The processor is the boot strap processor (BSP). */
|
---|
1047 | # define MSR_IA32_APICBASE_BSP RT_BIT_64(8)
|
---|
1048 | /** Minimum base address mask, consult CPUID leaf 0x80000008 for the actual
|
---|
1049 | * width. */
|
---|
1050 | # define MSR_IA32_APICBASE_BASE_MIN UINT64_C(0x0000000ffffff000)
|
---|
1051 | #endif
|
---|
1052 |
|
---|
1053 | /** Undocumented intel MSR for reporting thread and core counts.
|
---|
1054 | * Judging from the XNU sources, it seems to be introduced in Nehalem. The
|
---|
1055 | * first 16 bits is the thread count. The next 16 bits the core count, except
|
---|
1056 | * on Westmere where it seems it's only the next 4 bits for some reason. */
|
---|
1057 | #define MSR_CORE_THREAD_COUNT 0x35
|
---|
1058 |
|
---|
1059 | /** CPU Feature control. */
|
---|
1060 | #define MSR_IA32_FEATURE_CONTROL 0x3A
|
---|
1061 | #define MSR_IA32_FEATURE_CONTROL_LOCK RT_BIT_32(0)
|
---|
1062 | #define MSR_IA32_FEATURE_CONTROL_SMX_VMXON RT_BIT_32(1)
|
---|
1063 | #define MSR_IA32_FEATURE_CONTROL_VMXON RT_BIT_32(2)
|
---|
1064 |
|
---|
1065 | /** Per-processor TSC adjust MSR. */
|
---|
1066 | #define MSR_IA32_TSC_ADJUST 0x3B
|
---|
1067 |
|
---|
1068 | /** BIOS update trigger (microcode update). */
|
---|
1069 | #define MSR_IA32_BIOS_UPDT_TRIG 0x79
|
---|
1070 |
|
---|
1071 | /** BIOS update signature (microcode). */
|
---|
1072 | #define MSR_IA32_BIOS_SIGN_ID 0x8B
|
---|
1073 |
|
---|
1074 | /** SMM monitor control. */
|
---|
1075 | #define MSR_IA32_SMM_MONITOR_CTL 0x9B
|
---|
1076 |
|
---|
1077 | /** General performance counter no. 0. */
|
---|
1078 | #define MSR_IA32_PMC0 0xC1
|
---|
1079 | /** General performance counter no. 1. */
|
---|
1080 | #define MSR_IA32_PMC1 0xC2
|
---|
1081 | /** General performance counter no. 2. */
|
---|
1082 | #define MSR_IA32_PMC2 0xC3
|
---|
1083 | /** General performance counter no. 3. */
|
---|
1084 | #define MSR_IA32_PMC3 0xC4
|
---|
1085 |
|
---|
1086 | /** Nehalem power control. */
|
---|
1087 | #define MSR_IA32_PLATFORM_INFO 0xCE
|
---|
1088 |
|
---|
1089 | /** Get FSB clock status (Intel-specific). */
|
---|
1090 | #define MSR_IA32_FSB_CLOCK_STS 0xCD
|
---|
1091 |
|
---|
1092 | /** C-State configuration control. Intel specific: Nehalem, Sandy Bridge. */
|
---|
1093 | #define MSR_PKG_CST_CONFIG_CONTROL UINT32_C(0x000000e2)
|
---|
1094 |
|
---|
1095 | /** C0 Maximum Frequency Clock Count */
|
---|
1096 | #define MSR_IA32_MPERF 0xE7
|
---|
1097 | /** C0 Actual Frequency Clock Count */
|
---|
1098 | #define MSR_IA32_APERF 0xE8
|
---|
1099 |
|
---|
1100 | /** MTRR Capabilities. */
|
---|
1101 | #define MSR_IA32_MTRR_CAP 0xFE
|
---|
1102 |
|
---|
1103 | /** Cache control/info. */
|
---|
1104 | #define MSR_BBL_CR_CTL3 UINT32_C(0x11e)
|
---|
1105 |
|
---|
1106 | #ifndef MSR_IA32_SYSENTER_CS /* qemu cpu.h kludge */
|
---|
1107 | /** SYSENTER_CS - the R0 CS, indirectly giving R0 SS, R3 CS and R3 DS.
|
---|
1108 | * R0 SS == CS + 8
|
---|
1109 | * R3 CS == CS + 16
|
---|
1110 | * R3 SS == CS + 24
|
---|
1111 | */
|
---|
1112 | #define MSR_IA32_SYSENTER_CS 0x174
|
---|
1113 | /** SYSENTER_ESP - the R0 ESP. */
|
---|
1114 | #define MSR_IA32_SYSENTER_ESP 0x175
|
---|
1115 | /** SYSENTER_EIP - the R0 EIP. */
|
---|
1116 | #define MSR_IA32_SYSENTER_EIP 0x176
|
---|
1117 | #endif
|
---|
1118 |
|
---|
1119 | /** Machine Check Global Capabilities Register. */
|
---|
1120 | #define MSR_IA32_MCG_CAP 0x179
|
---|
1121 | /** Machine Check Global Status Register. */
|
---|
1122 | #define MSR_IA32_MCG_STATUS 0x17A
|
---|
1123 | /** Machine Check Global Control Register. */
|
---|
1124 | #define MSR_IA32_MCG_CTRL 0x17B
|
---|
1125 |
|
---|
1126 | /** Page Attribute Table. */
|
---|
1127 | #define MSR_IA32_CR_PAT 0x277
|
---|
1128 |
|
---|
1129 | /** Performance counter MSRs. (Intel only) */
|
---|
1130 | #define MSR_IA32_PERFEVTSEL0 0x186
|
---|
1131 | #define MSR_IA32_PERFEVTSEL1 0x187
|
---|
1132 | /** Flexible ratio, seems to be undocumented, used by XNU (tsc.c).
|
---|
1133 | * The 16th bit whether flex ratio is being used, in which case bits 15:8
|
---|
1134 | * holds a ratio that Apple takes for TSC granularity.
|
---|
1135 | *
|
---|
1136 | * @note This MSR conflicts the P4 MSR_MCG_R12 register. */
|
---|
1137 | #define MSR_FLEX_RATIO 0x194
|
---|
1138 | /** Performance state value and starting with Intel core more.
|
---|
1139 | * Apple uses the >=core features to determine TSC granularity on older CPUs. */
|
---|
1140 | #define MSR_IA32_PERF_STATUS 0x198
|
---|
1141 | #define MSR_IA32_PERF_CTL 0x199
|
---|
1142 | #define MSR_IA32_THERM_STATUS 0x19c
|
---|
1143 |
|
---|
1144 | /** Enable misc. processor features (R/W). */
|
---|
1145 | #define MSR_IA32_MISC_ENABLE 0x1A0
|
---|
1146 | /** Enable fast-strings feature (for REP MOVS and REP STORS). */
|
---|
1147 | #define MSR_IA32_MISC_ENABLE_FAST_STRINGS RT_BIT_64(0)
|
---|
1148 | /** Automatic Thermal Control Circuit Enable (R/W). */
|
---|
1149 | #define MSR_IA32_MISC_ENABLE_TCC RT_BIT_64(3)
|
---|
1150 | /** Performance Monitoring Available (R). */
|
---|
1151 | #define MSR_IA32_MISC_ENABLE_PERF_MON RT_BIT_64(7)
|
---|
1152 | /** Branch Trace Storage Unavailable (R/O). */
|
---|
1153 | #define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL RT_BIT_64(11)
|
---|
1154 | /** Precise Event Based Sampling (PEBS) Unavailable (R/O). */
|
---|
1155 | #define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL RT_BIT_64(12)
|
---|
1156 | /** Enhanced Intel SpeedStep Technology Enable (R/W). */
|
---|
1157 | #define MSR_IA32_MISC_ENABLE_SST_ENABLE RT_BIT_64(16)
|
---|
1158 | /** If MONITOR/MWAIT is supported (R/W). */
|
---|
1159 | #define MSR_IA32_MISC_ENABLE_MONITOR RT_BIT_64(18)
|
---|
1160 | /** Limit CPUID Maxval to 3 leafs (R/W). */
|
---|
1161 | #define MSR_IA32_MISC_ENABLE_LIMIT_CPUID RT_BIT_64(22)
|
---|
1162 | /** When set to 1, xTPR messages are disabled (R/W). */
|
---|
1163 | #define MSR_IA32_MISC_ENABLE_XTPR_MSG_DISABLE RT_BIT_64(23)
|
---|
1164 | /** When set to 1, the Execute Disable Bit feature (XD Bit) is disabled (R/W). */
|
---|
1165 | #define MSR_IA32_MISC_ENABLE_XD_DISABLE RT_BIT_64(34)
|
---|
1166 |
|
---|
1167 | /** Trace/Profile Resource Control (R/W) */
|
---|
1168 | #define MSR_IA32_DEBUGCTL UINT32_C(0x000001d9)
|
---|
1169 | /** The number (0..3 or 0..15) of the last branch record register on P4 and
|
---|
1170 | * related Xeons. */
|
---|
1171 | #define MSR_P4_LASTBRANCH_TOS UINT32_C(0x000001da)
|
---|
1172 | /** @name Last branch registers for P4 and Xeon, models 0 thru 2.
|
---|
1173 | * @{ */
|
---|
1174 | #define MSR_P4_LASTBRANCH_0 UINT32_C(0x000001db)
|
---|
1175 | #define MSR_P4_LASTBRANCH_1 UINT32_C(0x000001dc)
|
---|
1176 | #define MSR_P4_LASTBRANCH_2 UINT32_C(0x000001dd)
|
---|
1177 | #define MSR_P4_LASTBRANCH_3 UINT32_C(0x000001de)
|
---|
1178 | /** @} */
|
---|
1179 |
|
---|
1180 |
|
---|
1181 | #define IA32_MTRR_PHYSBASE0 0x200
|
---|
1182 | #define IA32_MTRR_PHYSMASK0 0x201
|
---|
1183 | #define IA32_MTRR_PHYSBASE1 0x202
|
---|
1184 | #define IA32_MTRR_PHYSMASK1 0x203
|
---|
1185 | #define IA32_MTRR_PHYSBASE2 0x204
|
---|
1186 | #define IA32_MTRR_PHYSMASK2 0x205
|
---|
1187 | #define IA32_MTRR_PHYSBASE3 0x206
|
---|
1188 | #define IA32_MTRR_PHYSMASK3 0x207
|
---|
1189 | #define IA32_MTRR_PHYSBASE4 0x208
|
---|
1190 | #define IA32_MTRR_PHYSMASK4 0x209
|
---|
1191 | #define IA32_MTRR_PHYSBASE5 0x20a
|
---|
1192 | #define IA32_MTRR_PHYSMASK5 0x20b
|
---|
1193 | #define IA32_MTRR_PHYSBASE6 0x20c
|
---|
1194 | #define IA32_MTRR_PHYSMASK6 0x20d
|
---|
1195 | #define IA32_MTRR_PHYSBASE7 0x20e
|
---|
1196 | #define IA32_MTRR_PHYSMASK7 0x20f
|
---|
1197 | #define IA32_MTRR_PHYSBASE8 0x210
|
---|
1198 | #define IA32_MTRR_PHYSMASK8 0x211
|
---|
1199 | #define IA32_MTRR_PHYSBASE9 0x212
|
---|
1200 | #define IA32_MTRR_PHYSMASK9 0x213
|
---|
1201 |
|
---|
1202 | /** Fixed range MTRRs.
|
---|
1203 | * @{ */
|
---|
1204 | #define IA32_MTRR_FIX64K_00000 0x250
|
---|
1205 | #define IA32_MTRR_FIX16K_80000 0x258
|
---|
1206 | #define IA32_MTRR_FIX16K_A0000 0x259
|
---|
1207 | #define IA32_MTRR_FIX4K_C0000 0x268
|
---|
1208 | #define IA32_MTRR_FIX4K_C8000 0x269
|
---|
1209 | #define IA32_MTRR_FIX4K_D0000 0x26a
|
---|
1210 | #define IA32_MTRR_FIX4K_D8000 0x26b
|
---|
1211 | #define IA32_MTRR_FIX4K_E0000 0x26c
|
---|
1212 | #define IA32_MTRR_FIX4K_E8000 0x26d
|
---|
1213 | #define IA32_MTRR_FIX4K_F0000 0x26e
|
---|
1214 | #define IA32_MTRR_FIX4K_F8000 0x26f
|
---|
1215 | /** @} */
|
---|
1216 |
|
---|
1217 | /** MTRR Default Range. */
|
---|
1218 | #define MSR_IA32_MTRR_DEF_TYPE 0x2FF
|
---|
1219 |
|
---|
1220 | #define MSR_IA32_MC0_CTL 0x400
|
---|
1221 | #define MSR_IA32_MC0_STATUS 0x401
|
---|
1222 |
|
---|
1223 | /** Basic VMX information. */
|
---|
1224 | #define MSR_IA32_VMX_BASIC_INFO 0x480
|
---|
1225 | /** Allowed settings for pin-based VM execution controls */
|
---|
1226 | #define MSR_IA32_VMX_PINBASED_CTLS 0x481
|
---|
1227 | /** Allowed settings for proc-based VM execution controls */
|
---|
1228 | #define MSR_IA32_VMX_PROCBASED_CTLS 0x482
|
---|
1229 | /** Allowed settings for the VMX exit controls. */
|
---|
1230 | #define MSR_IA32_VMX_EXIT_CTLS 0x483
|
---|
1231 | /** Allowed settings for the VMX entry controls. */
|
---|
1232 | #define MSR_IA32_VMX_ENTRY_CTLS 0x484
|
---|
1233 | /** Misc VMX info. */
|
---|
1234 | #define MSR_IA32_VMX_MISC 0x485
|
---|
1235 | /** Fixed cleared bits in CR0. */
|
---|
1236 | #define MSR_IA32_VMX_CR0_FIXED0 0x486
|
---|
1237 | /** Fixed set bits in CR0. */
|
---|
1238 | #define MSR_IA32_VMX_CR0_FIXED1 0x487
|
---|
1239 | /** Fixed cleared bits in CR4. */
|
---|
1240 | #define MSR_IA32_VMX_CR4_FIXED0 0x488
|
---|
1241 | /** Fixed set bits in CR4. */
|
---|
1242 | #define MSR_IA32_VMX_CR4_FIXED1 0x489
|
---|
1243 | /** Information for enumerating fields in the VMCS. */
|
---|
1244 | #define MSR_IA32_VMX_VMCS_ENUM 0x48A
|
---|
1245 | /** Allowed settings for the VM-functions controls. */
|
---|
1246 | #define MSR_IA32_VMX_VMFUNC 0x491
|
---|
1247 | /** Allowed settings for secondary proc-based VM execution controls */
|
---|
1248 | #define MSR_IA32_VMX_PROCBASED_CTLS2 0x48B
|
---|
1249 | /** EPT capabilities. */
|
---|
1250 | #define MSR_IA32_VMX_EPT_VPID_CAP 0x48C
|
---|
1251 | /** DS Save Area (R/W). */
|
---|
1252 | #define MSR_IA32_DS_AREA 0x600
|
---|
1253 | /** Running Average Power Limit (RAPL) power units. */
|
---|
1254 | #define MSR_RAPL_POWER_UNIT 0x606
|
---|
1255 |
|
---|
1256 | /** X2APIC MSR range start. */
|
---|
1257 | #define MSR_IA32_X2APIC_START 0x800
|
---|
1258 | /** X2APIC MSR - APIC ID Register. */
|
---|
1259 | #define MSR_IA32_X2APIC_ID 0x802
|
---|
1260 | /** X2APIC MSR - APIC Version Register. */
|
---|
1261 | #define MSR_IA32_X2APIC_VERSION 0x803
|
---|
1262 | /** X2APIC MSR - Task Priority Register. */
|
---|
1263 | #define MSR_IA32_X2APIC_TPR 0x808
|
---|
1264 | /** X2APIC MSR - Processor Priority register. */
|
---|
1265 | #define MSR_IA32_X2APIC_PPR 0x80A
|
---|
1266 | /** X2APIC MSR - End Of Interrupt register. */
|
---|
1267 | #define MSR_IA32_X2APIC_EOI 0x80B
|
---|
1268 | /** X2APIC MSR - Logical Destination Register. */
|
---|
1269 | #define MSR_IA32_X2APIC_LDR 0x80D
|
---|
1270 | /** X2APIC MSR - Spurious Interrupt Vector Register. */
|
---|
1271 | #define MSR_IA32_X2APIC_SVR 0x80F
|
---|
1272 | /** X2APIC MSR - In-service Register (bits 31:0). */
|
---|
1273 | #define MSR_IA32_X2APIC_ISR0 0x810
|
---|
1274 | /** X2APIC MSR - In-service Register (bits 63:32). */
|
---|
1275 | #define MSR_IA32_X2APIC_ISR1 0x811
|
---|
1276 | /** X2APIC MSR - In-service Register (bits 95:64). */
|
---|
1277 | #define MSR_IA32_X2APIC_ISR2 0x812
|
---|
1278 | /** X2APIC MSR - In-service Register (bits 127:96). */
|
---|
1279 | #define MSR_IA32_X2APIC_ISR3 0x813
|
---|
1280 | /** X2APIC MSR - In-service Register (bits 159:128). */
|
---|
1281 | #define MSR_IA32_X2APIC_ISR4 0x814
|
---|
1282 | /** X2APIC MSR - In-service Register (bits 191:160). */
|
---|
1283 | #define MSR_IA32_X2APIC_ISR5 0x815
|
---|
1284 | /** X2APIC MSR - In-service Register (bits 223:192). */
|
---|
1285 | #define MSR_IA32_X2APIC_ISR6 0x816
|
---|
1286 | /** X2APIC MSR - In-service Register (bits 255:224). */
|
---|
1287 | #define MSR_IA32_X2APIC_ISR7 0x817
|
---|
1288 | /** X2APIC MSR - Trigger Mode Register (bits 31:0). */
|
---|
1289 | #define MSR_IA32_X2APIC_TMR0 0x818
|
---|
1290 | /** X2APIC MSR - Trigger Mode Register (bits 63:32). */
|
---|
1291 | #define MSR_IA32_X2APIC_TMR1 0x819
|
---|
1292 | /** X2APIC MSR - Trigger Mode Register (bits 95:64). */
|
---|
1293 | #define MSR_IA32_X2APIC_TMR2 0x81A
|
---|
1294 | /** X2APIC MSR - Trigger Mode Register (bits 127:96). */
|
---|
1295 | #define MSR_IA32_X2APIC_TMR3 0x81B
|
---|
1296 | /** X2APIC MSR - Trigger Mode Register (bits 159:128). */
|
---|
1297 | #define MSR_IA32_X2APIC_TMR4 0x81C
|
---|
1298 | /** X2APIC MSR - Trigger Mode Register (bits 191:160). */
|
---|
1299 | #define MSR_IA32_X2APIC_TMR5 0x81D
|
---|
1300 | /** X2APIC MSR - Trigger Mode Register (bits 223:192). */
|
---|
1301 | #define MSR_IA32_X2APIC_TMR6 0x81E
|
---|
1302 | /** X2APIC MSR - Trigger Mode Register (bits 255:224). */
|
---|
1303 | #define MSR_IA32_X2APIC_TMR7 0x81F
|
---|
1304 | /** X2APIC MSR - Interrupt Request Register (bits 31:0). */
|
---|
1305 | #define MSR_IA32_X2APIC_IRR0 0x820
|
---|
1306 | /** X2APIC MSR - Interrupt Request Register (bits 63:32). */
|
---|
1307 | #define MSR_IA32_X2APIC_IRR1 0x821
|
---|
1308 | /** X2APIC MSR - Interrupt Request Register (bits 95:64). */
|
---|
1309 | #define MSR_IA32_X2APIC_IRR2 0x822
|
---|
1310 | /** X2APIC MSR - Interrupt Request Register (bits 127:96). */
|
---|
1311 | #define MSR_IA32_X2APIC_IRR3 0x823
|
---|
1312 | /** X2APIC MSR - Interrupt Request Register (bits 159:128). */
|
---|
1313 | #define MSR_IA32_X2APIC_IRR4 0x824
|
---|
1314 | /** X2APIC MSR - Interrupt Request Register (bits 191:160). */
|
---|
1315 | #define MSR_IA32_X2APIC_IRR5 0x825
|
---|
1316 | /** X2APIC MSR - Interrupt Request Register (bits 223:192). */
|
---|
1317 | #define MSR_IA32_X2APIC_IRR6 0x826
|
---|
1318 | /** X2APIC MSR - Interrupt Request Register (bits 255:224). */
|
---|
1319 | #define MSR_IA32_X2APIC_IRR7 0x827
|
---|
1320 | /** X2APIC MSR - Error Status Register. */
|
---|
1321 | #define MSR_IA32_X2APIC_ESR 0x828
|
---|
1322 | /** X2APIC MSR - LVT CMCI Register. */
|
---|
1323 | #define MSR_IA32_X2APIC_LVT_CMCI 0x82F
|
---|
1324 | /** X2APIC MSR - Interrupt Command Register. */
|
---|
1325 | #define MSR_IA32_X2APIC_ICR 0x830
|
---|
1326 | /** X2APIC MSR - LVT Timer Register. */
|
---|
1327 | #define MSR_IA32_X2APIC_LVT_TIMER 0x832
|
---|
1328 | /** X2APIC MSR - LVT Thermal Sensor Register. */
|
---|
1329 | #define MSR_IA32_X2APIC_LVT_THERMAL 0x833
|
---|
1330 | /** X2APIC MSR - LVT Performance Counter Register. */
|
---|
1331 | #define MSR_IA32_X2APIC_LVT_PERF 0x834
|
---|
1332 | /** X2APIC MSR - LVT LINT0 Register. */
|
---|
1333 | #define MSR_IA32_X2APIC_LVT_LINT0 0x835
|
---|
1334 | /** X2APIC MSR - LVT LINT1 Register. */
|
---|
1335 | #define MSR_IA32_X2APIC_LVT_LINT1 0x836
|
---|
1336 | /** X2APIC MSR - LVT Error Register . */
|
---|
1337 | #define MSR_IA32_X2APIC_LVT_ERROR 0x837
|
---|
1338 | /** X2APIC MSR - Timer Initial Count Register. */
|
---|
1339 | #define MSR_IA32_X2APIC_TIMER_ICR 0x838
|
---|
1340 | /** X2APIC MSR - Timer Current Count Register. */
|
---|
1341 | #define MSR_IA32_X2APIC_TIMER_CCR 0x839
|
---|
1342 | /** X2APIC MSR - Timer Divide Configuration Register. */
|
---|
1343 | #define MSR_IA32_X2APIC_TIMER_DCR 0x83E
|
---|
1344 | /** X2APIC MSR - Self IPI. */
|
---|
1345 | #define MSR_IA32_X2APIC_SELF_IPI 0x83F
|
---|
1346 | /** X2APIC MSR range end. */
|
---|
1347 | #define MSR_IA32_X2APIC_END 0xBFF
|
---|
1348 | /** X2APIC MSR - LVT start range. */
|
---|
1349 | #define MSR_IA32_X2APIC_LVT_START MSR_IA32_X2APIC_LVT_TIMER
|
---|
1350 | /** X2APIC MSR - LVT end range (inclusive). */
|
---|
1351 | #define MSR_IA32_X2APIC_LVT_END MSR_IA32_X2APIC_LVT_ERROR
|
---|
1352 |
|
---|
1353 | /** K6 EFER - Extended Feature Enable Register. */
|
---|
1354 | #define MSR_K6_EFER UINT32_C(0xc0000080)
|
---|
1355 | /** @todo document EFER */
|
---|
1356 | /** Bit 0 - SCE - System call extensions (SYSCALL / SYSRET). (R/W) */
|
---|
1357 | #define MSR_K6_EFER_SCE RT_BIT_32(0)
|
---|
1358 | /** Bit 8 - LME - Long mode enabled. (R/W) */
|
---|
1359 | #define MSR_K6_EFER_LME RT_BIT_32(8)
|
---|
1360 | /** Bit 10 - LMA - Long mode active. (R) */
|
---|
1361 | #define MSR_K6_EFER_LMA RT_BIT_32(10)
|
---|
1362 | /** Bit 11 - NXE - No-Execute Page Protection Enabled. (R/W) */
|
---|
1363 | #define MSR_K6_EFER_NXE RT_BIT_32(11)
|
---|
1364 | /** Bit 12 - SVME - Secure VM Extension Enabled. (R/W) */
|
---|
1365 | #define MSR_K6_EFER_SVME RT_BIT_32(12)
|
---|
1366 | /** Bit 13 - LMSLE - Long Mode Segment Limit Enable. (R/W?) */
|
---|
1367 | #define MSR_K6_EFER_LMSLE RT_BIT_32(13)
|
---|
1368 | /** Bit 14 - FFXSR - Fast FXSAVE / FXRSTOR (skip XMM*). (R/W) */
|
---|
1369 | #define MSR_K6_EFER_FFXSR RT_BIT_32(14)
|
---|
1370 | /** Bit 15 - TCE - Translation Cache Extension. (R/W) */
|
---|
1371 | #define MSR_K6_EFER_TCE RT_BIT_32(15)
|
---|
1372 | /** K6 STAR - SYSCALL/RET targets. */
|
---|
1373 | #define MSR_K6_STAR UINT32_C(0xc0000081)
|
---|
1374 | /** Shift value for getting the SYSRET CS and SS value. */
|
---|
1375 | #define MSR_K6_STAR_SYSRET_CS_SS_SHIFT 48
|
---|
1376 | /** Shift value for getting the SYSCALL CS and SS value. */
|
---|
1377 | #define MSR_K6_STAR_SYSCALL_CS_SS_SHIFT 32
|
---|
1378 | /** Selector mask for use after shifting. */
|
---|
1379 | #define MSR_K6_STAR_SEL_MASK UINT32_C(0xffff)
|
---|
1380 | /** The mask which give the SYSCALL EIP. */
|
---|
1381 | #define MSR_K6_STAR_SYSCALL_EIP_MASK UINT32_C(0xffffffff)
|
---|
1382 | /** K6 WHCR - Write Handling Control Register. */
|
---|
1383 | #define MSR_K6_WHCR UINT32_C(0xc0000082)
|
---|
1384 | /** K6 UWCCR - UC/WC Cacheability Control Register. */
|
---|
1385 | #define MSR_K6_UWCCR UINT32_C(0xc0000085)
|
---|
1386 | /** K6 PSOR - Processor State Observability Register. */
|
---|
1387 | #define MSR_K6_PSOR UINT32_C(0xc0000087)
|
---|
1388 | /** K6 PFIR - Page Flush/Invalidate Register. */
|
---|
1389 | #define MSR_K6_PFIR UINT32_C(0xc0000088)
|
---|
1390 |
|
---|
1391 | /** Performance counter MSRs. (AMD only) */
|
---|
1392 | #define MSR_K7_EVNTSEL0 UINT32_C(0xc0010000)
|
---|
1393 | #define MSR_K7_EVNTSEL1 UINT32_C(0xc0010001)
|
---|
1394 | #define MSR_K7_EVNTSEL2 UINT32_C(0xc0010002)
|
---|
1395 | #define MSR_K7_EVNTSEL3 UINT32_C(0xc0010003)
|
---|
1396 | #define MSR_K7_PERFCTR0 UINT32_C(0xc0010004)
|
---|
1397 | #define MSR_K7_PERFCTR1 UINT32_C(0xc0010005)
|
---|
1398 | #define MSR_K7_PERFCTR2 UINT32_C(0xc0010006)
|
---|
1399 | #define MSR_K7_PERFCTR3 UINT32_C(0xc0010007)
|
---|
1400 |
|
---|
1401 | /** K8 LSTAR - Long mode SYSCALL target (RIP). */
|
---|
1402 | #define MSR_K8_LSTAR UINT32_C(0xc0000082)
|
---|
1403 | /** K8 CSTAR - Compatibility mode SYSCALL target (RIP). */
|
---|
1404 | #define MSR_K8_CSTAR UINT32_C(0xc0000083)
|
---|
1405 | /** K8 SF_MASK - SYSCALL flag mask. (aka SFMASK) */
|
---|
1406 | #define MSR_K8_SF_MASK UINT32_C(0xc0000084)
|
---|
1407 | /** K8 FS.base - The 64-bit base FS register. */
|
---|
1408 | #define MSR_K8_FS_BASE UINT32_C(0xc0000100)
|
---|
1409 | /** K8 GS.base - The 64-bit base GS register. */
|
---|
1410 | #define MSR_K8_GS_BASE UINT32_C(0xc0000101)
|
---|
1411 | /** K8 KernelGSbase - Used with SWAPGS. */
|
---|
1412 | #define MSR_K8_KERNEL_GS_BASE UINT32_C(0xc0000102)
|
---|
1413 | /** K8 TSC_AUX - Used with RDTSCP. */
|
---|
1414 | #define MSR_K8_TSC_AUX UINT32_C(0xc0000103)
|
---|
1415 | #define MSR_K8_SYSCFG UINT32_C(0xc0010010)
|
---|
1416 | #define MSR_K8_HWCR UINT32_C(0xc0010015)
|
---|
1417 | #define MSR_K8_IORRBASE0 UINT32_C(0xc0010016)
|
---|
1418 | #define MSR_K8_IORRMASK0 UINT32_C(0xc0010017)
|
---|
1419 | #define MSR_K8_IORRBASE1 UINT32_C(0xc0010018)
|
---|
1420 | #define MSR_K8_IORRMASK1 UINT32_C(0xc0010019)
|
---|
1421 | #define MSR_K8_TOP_MEM1 UINT32_C(0xc001001a)
|
---|
1422 | #define MSR_K8_TOP_MEM2 UINT32_C(0xc001001d)
|
---|
1423 | /** North bridge config? See BIOS & Kernel dev guides for
|
---|
1424 | * details. */
|
---|
1425 | #define MSR_K8_NB_CFG UINT32_C(0xc001001f)
|
---|
1426 |
|
---|
1427 | /** Hypertransport interrupt pending register.
|
---|
1428 | * "BIOS and Kernel Developer's Guide for AMD NPT Family 0Fh Processors" */
|
---|
1429 | #define MSR_K8_INT_PENDING UINT32_C(0xc0010055)
|
---|
1430 | #define MSR_K8_VM_CR UINT32_C(0xc0010114)
|
---|
1431 | #define MSR_K8_VM_CR_SVM_DISABLE RT_BIT_32(4)
|
---|
1432 |
|
---|
1433 | #define MSR_K8_IGNNE UINT32_C(0xc0010115)
|
---|
1434 | #define MSR_K8_SMM_CTL UINT32_C(0xc0010116)
|
---|
1435 | /** SVM - VM_HSAVE_PA - Physical address for saving and restoring
|
---|
1436 | * host state during world switch. */
|
---|
1437 | #define MSR_K8_VM_HSAVE_PA UINT32_C(0xc0010117)
|
---|
1438 |
|
---|
1439 | /** @} */
|
---|
1440 |
|
---|
1441 |
|
---|
1442 | /** @name Page Table / Directory / Directory Pointers / L4.
|
---|
1443 | * @{
|
---|
1444 | */
|
---|
1445 |
|
---|
1446 | /** Page table/directory entry as an unsigned integer. */
|
---|
1447 | typedef uint32_t X86PGUINT;
|
---|
1448 | /** Pointer to a page table/directory table entry as an unsigned integer. */
|
---|
1449 | typedef X86PGUINT *PX86PGUINT;
|
---|
1450 | /** Pointer to an const page table/directory table entry as an unsigned integer. */
|
---|
1451 | typedef X86PGUINT const *PCX86PGUINT;
|
---|
1452 |
|
---|
1453 | /** Number of entries in a 32-bit PT/PD. */
|
---|
1454 | #define X86_PG_ENTRIES 1024
|
---|
1455 |
|
---|
1456 |
|
---|
1457 | /** PAE page table/page directory/pdpt/l4/l5 entry as an unsigned integer. */
|
---|
1458 | typedef uint64_t X86PGPAEUINT;
|
---|
1459 | /** Pointer to a PAE page table/page directory/pdpt/l4/l5 entry as an unsigned integer. */
|
---|
1460 | typedef X86PGPAEUINT *PX86PGPAEUINT;
|
---|
1461 | /** Pointer to an const PAE page table/page directory/pdpt/l4/l5 entry as an unsigned integer. */
|
---|
1462 | typedef X86PGPAEUINT const *PCX86PGPAEUINT;
|
---|
1463 |
|
---|
1464 | /** Number of entries in a PAE PT/PD. */
|
---|
1465 | #define X86_PG_PAE_ENTRIES 512
|
---|
1466 | /** Number of entries in a PAE PDPT. */
|
---|
1467 | #define X86_PG_PAE_PDPE_ENTRIES 4
|
---|
1468 |
|
---|
1469 | /** Number of entries in an AMD64 PT/PD/PDPT/L4/L5. */
|
---|
1470 | #define X86_PG_AMD64_ENTRIES X86_PG_PAE_ENTRIES
|
---|
1471 | /** Number of entries in an AMD64 PDPT.
|
---|
1472 | * Just for complementing X86_PG_PAE_PDPE_ENTRIES, using X86_PG_AMD64_ENTRIES for this is fine too. */
|
---|
1473 | #define X86_PG_AMD64_PDPE_ENTRIES X86_PG_AMD64_ENTRIES
|
---|
1474 |
|
---|
1475 | /** The size of a 4KB page. */
|
---|
1476 | #define X86_PAGE_4K_SIZE _4K
|
---|
1477 | /** The page shift of a 4KB page. */
|
---|
1478 | #define X86_PAGE_4K_SHIFT 12
|
---|
1479 | /** The 4KB page offset mask. */
|
---|
1480 | #define X86_PAGE_4K_OFFSET_MASK 0xfff
|
---|
1481 | /** The 4KB page base mask for virtual addresses. */
|
---|
1482 | #define X86_PAGE_4K_BASE_MASK 0xfffffffffffff000ULL
|
---|
1483 | /** The 4KB page base mask for virtual addresses - 32bit version. */
|
---|
1484 | #define X86_PAGE_4K_BASE_MASK_32 0xfffff000U
|
---|
1485 |
|
---|
1486 | /** The size of a 2MB page. */
|
---|
1487 | #define X86_PAGE_2M_SIZE _2M
|
---|
1488 | /** The page shift of a 2MB page. */
|
---|
1489 | #define X86_PAGE_2M_SHIFT 21
|
---|
1490 | /** The 2MB page offset mask. */
|
---|
1491 | #define X86_PAGE_2M_OFFSET_MASK 0x001fffff
|
---|
1492 | /** The 2MB page base mask for virtual addresses. */
|
---|
1493 | #define X86_PAGE_2M_BASE_MASK 0xffffffffffe00000ULL
|
---|
1494 | /** The 2MB page base mask for virtual addresses - 32bit version. */
|
---|
1495 | #define X86_PAGE_2M_BASE_MASK_32 0xffe00000U
|
---|
1496 |
|
---|
1497 | /** The size of a 4MB page. */
|
---|
1498 | #define X86_PAGE_4M_SIZE _4M
|
---|
1499 | /** The page shift of a 4MB page. */
|
---|
1500 | #define X86_PAGE_4M_SHIFT 22
|
---|
1501 | /** The 4MB page offset mask. */
|
---|
1502 | #define X86_PAGE_4M_OFFSET_MASK 0x003fffff
|
---|
1503 | /** The 4MB page base mask for virtual addresses. */
|
---|
1504 | #define X86_PAGE_4M_BASE_MASK 0xffffffffffc00000ULL
|
---|
1505 | /** The 4MB page base mask for virtual addresses - 32bit version. */
|
---|
1506 | #define X86_PAGE_4M_BASE_MASK_32 0xffc00000U
|
---|
1507 |
|
---|
1508 | /**
|
---|
1509 | * Check if the given address is canonical.
|
---|
1510 | */
|
---|
1511 | #define X86_IS_CANONICAL(a_u64Addr) ((uint64_t)(a_u64Addr) + UINT64_C(0x800000000000) < UINT64_C(0x1000000000000))
|
---|
1512 |
|
---|
1513 |
|
---|
1514 | /** @name Page Table Entry
|
---|
1515 | * @{
|
---|
1516 | */
|
---|
1517 | /** Bit 0 - P - Present bit. */
|
---|
1518 | #define X86_PTE_BIT_P 0
|
---|
1519 | /** Bit 1 - R/W - Read (clear) / Write (set) bit. */
|
---|
1520 | #define X86_PTE_BIT_RW 1
|
---|
1521 | /** Bit 2 - U/S - User (set) / Supervisor (clear) bit. */
|
---|
1522 | #define X86_PTE_BIT_US 2
|
---|
1523 | /** Bit 3 - PWT - Page level write thru bit. */
|
---|
1524 | #define X86_PTE_BIT_PWT 3
|
---|
1525 | /** Bit 4 - PCD - Page level cache disable bit. */
|
---|
1526 | #define X86_PTE_BIT_PCD 4
|
---|
1527 | /** Bit 5 - A - Access bit. */
|
---|
1528 | #define X86_PTE_BIT_A 5
|
---|
1529 | /** Bit 6 - D - Dirty bit. */
|
---|
1530 | #define X86_PTE_BIT_D 6
|
---|
1531 | /** Bit 7 - PAT - Page Attribute Table index bit. Reserved and 0 if not supported. */
|
---|
1532 | #define X86_PTE_BIT_PAT 7
|
---|
1533 | /** Bit 8 - G - Global flag. */
|
---|
1534 | #define X86_PTE_BIT_G 8
|
---|
1535 |
|
---|
1536 | /** Bit 0 - P - Present bit mask. */
|
---|
1537 | #define X86_PTE_P RT_BIT_32(0)
|
---|
1538 | /** Bit 1 - R/W - Read (clear) / Write (set) bit mask. */
|
---|
1539 | #define X86_PTE_RW RT_BIT_32(1)
|
---|
1540 | /** Bit 2 - U/S - User (set) / Supervisor (clear) bit mask. */
|
---|
1541 | #define X86_PTE_US RT_BIT_32(2)
|
---|
1542 | /** Bit 3 - PWT - Page level write thru bit mask. */
|
---|
1543 | #define X86_PTE_PWT RT_BIT_32(3)
|
---|
1544 | /** Bit 4 - PCD - Page level cache disable bit mask. */
|
---|
1545 | #define X86_PTE_PCD RT_BIT_32(4)
|
---|
1546 | /** Bit 5 - A - Access bit mask. */
|
---|
1547 | #define X86_PTE_A RT_BIT_32(5)
|
---|
1548 | /** Bit 6 - D - Dirty bit mask. */
|
---|
1549 | #define X86_PTE_D RT_BIT_32(6)
|
---|
1550 | /** Bit 7 - PAT - Page Attribute Table index bit mask. Reserved and 0 if not supported. */
|
---|
1551 | #define X86_PTE_PAT RT_BIT_32(7)
|
---|
1552 | /** Bit 8 - G - Global bit mask. */
|
---|
1553 | #define X86_PTE_G RT_BIT_32(8)
|
---|
1554 |
|
---|
1555 | /** Bits 9-11 - - Available for use to system software. */
|
---|
1556 | #define X86_PTE_AVL_MASK (RT_BIT_32(9) | RT_BIT_32(10) | RT_BIT_32(11))
|
---|
1557 | /** Bits 12-31 - - Physical Page number of the next level. */
|
---|
1558 | #define X86_PTE_PG_MASK ( 0xfffff000 )
|
---|
1559 |
|
---|
1560 | /** Bits 12-51 - - PAE - Physical Page number of the next level. */
|
---|
1561 | #define X86_PTE_PAE_PG_MASK UINT64_C(0x000ffffffffff000)
|
---|
1562 | /** Bits 63 - NX - PAE/LM - No execution flag. */
|
---|
1563 | #define X86_PTE_PAE_NX RT_BIT_64(63)
|
---|
1564 | /** Bits 62-52 - - PAE - MBZ bits when NX is active. */
|
---|
1565 | #define X86_PTE_PAE_MBZ_MASK_NX UINT64_C(0x7ff0000000000000)
|
---|
1566 | /** Bits 63-52 - - PAE - MBZ bits when no NX. */
|
---|
1567 | #define X86_PTE_PAE_MBZ_MASK_NO_NX UINT64_C(0xfff0000000000000)
|
---|
1568 | /** No bits - - LM - MBZ bits when NX is active. */
|
---|
1569 | #define X86_PTE_LM_MBZ_MASK_NX UINT64_C(0x0000000000000000)
|
---|
1570 | /** Bits 63 - - LM - MBZ bits when no NX. */
|
---|
1571 | #define X86_PTE_LM_MBZ_MASK_NO_NX UINT64_C(0x8000000000000000)
|
---|
1572 |
|
---|
1573 | /**
|
---|
1574 | * Page table entry.
|
---|
1575 | */
|
---|
1576 | typedef struct X86PTEBITS
|
---|
1577 | {
|
---|
1578 | /** Flags whether(=1) or not the page is present. */
|
---|
1579 | uint32_t u1Present : 1;
|
---|
1580 | /** Read(=0) / Write(=1) flag. */
|
---|
1581 | uint32_t u1Write : 1;
|
---|
1582 | /** User(=1) / Supervisor (=0) flag. */
|
---|
1583 | uint32_t u1User : 1;
|
---|
1584 | /** Write Thru flag. If PAT enabled, bit 0 of the index. */
|
---|
1585 | uint32_t u1WriteThru : 1;
|
---|
1586 | /** Cache disabled flag. If PAT enabled, bit 1 of the index. */
|
---|
1587 | uint32_t u1CacheDisable : 1;
|
---|
1588 | /** Accessed flag.
|
---|
1589 | * Indicates that the page have been read or written to. */
|
---|
1590 | uint32_t u1Accessed : 1;
|
---|
1591 | /** Dirty flag.
|
---|
1592 | * Indicates that the page has been written to. */
|
---|
1593 | uint32_t u1Dirty : 1;
|
---|
1594 | /** Reserved / If PAT enabled, bit 2 of the index. */
|
---|
1595 | uint32_t u1PAT : 1;
|
---|
1596 | /** Global flag. (Ignored in all but final level.) */
|
---|
1597 | uint32_t u1Global : 1;
|
---|
1598 | /** Available for use to system software. */
|
---|
1599 | uint32_t u3Available : 3;
|
---|
1600 | /** Physical Page number of the next level. */
|
---|
1601 | uint32_t u20PageNo : 20;
|
---|
1602 | } X86PTEBITS;
|
---|
1603 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
1604 | AssertCompileSize(X86PTEBITS, 4);
|
---|
1605 | #endif
|
---|
1606 | /** Pointer to a page table entry. */
|
---|
1607 | typedef X86PTEBITS *PX86PTEBITS;
|
---|
1608 | /** Pointer to a const page table entry. */
|
---|
1609 | typedef const X86PTEBITS *PCX86PTEBITS;
|
---|
1610 |
|
---|
1611 | /**
|
---|
1612 | * Page table entry.
|
---|
1613 | */
|
---|
1614 | typedef union X86PTE
|
---|
1615 | {
|
---|
1616 | /** Unsigned integer view */
|
---|
1617 | X86PGUINT u;
|
---|
1618 | /** Bit field view. */
|
---|
1619 | X86PTEBITS n;
|
---|
1620 | /** 32-bit view. */
|
---|
1621 | uint32_t au32[1];
|
---|
1622 | /** 16-bit view. */
|
---|
1623 | uint16_t au16[2];
|
---|
1624 | /** 8-bit view. */
|
---|
1625 | uint8_t au8[4];
|
---|
1626 | } X86PTE;
|
---|
1627 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
1628 | AssertCompileSize(X86PTE, 4);
|
---|
1629 | #endif
|
---|
1630 | /** Pointer to a page table entry. */
|
---|
1631 | typedef X86PTE *PX86PTE;
|
---|
1632 | /** Pointer to a const page table entry. */
|
---|
1633 | typedef const X86PTE *PCX86PTE;
|
---|
1634 |
|
---|
1635 |
|
---|
1636 | /**
|
---|
1637 | * PAE page table entry.
|
---|
1638 | */
|
---|
1639 | typedef struct X86PTEPAEBITS
|
---|
1640 | {
|
---|
1641 | /** Flags whether(=1) or not the page is present. */
|
---|
1642 | uint32_t u1Present : 1;
|
---|
1643 | /** Read(=0) / Write(=1) flag. */
|
---|
1644 | uint32_t u1Write : 1;
|
---|
1645 | /** User(=1) / Supervisor(=0) flag. */
|
---|
1646 | uint32_t u1User : 1;
|
---|
1647 | /** Write Thru flag. If PAT enabled, bit 0 of the index. */
|
---|
1648 | uint32_t u1WriteThru : 1;
|
---|
1649 | /** Cache disabled flag. If PAT enabled, bit 1 of the index. */
|
---|
1650 | uint32_t u1CacheDisable : 1;
|
---|
1651 | /** Accessed flag.
|
---|
1652 | * Indicates that the page have been read or written to. */
|
---|
1653 | uint32_t u1Accessed : 1;
|
---|
1654 | /** Dirty flag.
|
---|
1655 | * Indicates that the page has been written to. */
|
---|
1656 | uint32_t u1Dirty : 1;
|
---|
1657 | /** Reserved / If PAT enabled, bit 2 of the index. */
|
---|
1658 | uint32_t u1PAT : 1;
|
---|
1659 | /** Global flag. (Ignored in all but final level.) */
|
---|
1660 | uint32_t u1Global : 1;
|
---|
1661 | /** Available for use to system software. */
|
---|
1662 | uint32_t u3Available : 3;
|
---|
1663 | /** Physical Page number of the next level - Low Part. Don't use this. */
|
---|
1664 | uint32_t u20PageNoLow : 20;
|
---|
1665 | /** Physical Page number of the next level - High Part. Don't use this. */
|
---|
1666 | uint32_t u20PageNoHigh : 20;
|
---|
1667 | /** MBZ bits */
|
---|
1668 | uint32_t u11Reserved : 11;
|
---|
1669 | /** No Execute flag. */
|
---|
1670 | uint32_t u1NoExecute : 1;
|
---|
1671 | } X86PTEPAEBITS;
|
---|
1672 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
1673 | AssertCompileSize(X86PTEPAEBITS, 8);
|
---|
1674 | #endif
|
---|
1675 | /** Pointer to a page table entry. */
|
---|
1676 | typedef X86PTEPAEBITS *PX86PTEPAEBITS;
|
---|
1677 | /** Pointer to a page table entry. */
|
---|
1678 | typedef const X86PTEPAEBITS *PCX86PTEPAEBITS;
|
---|
1679 |
|
---|
1680 | /**
|
---|
1681 | * PAE Page table entry.
|
---|
1682 | */
|
---|
1683 | typedef union X86PTEPAE
|
---|
1684 | {
|
---|
1685 | /** Unsigned integer view */
|
---|
1686 | X86PGPAEUINT u;
|
---|
1687 | /** Bit field view. */
|
---|
1688 | X86PTEPAEBITS n;
|
---|
1689 | /** 32-bit view. */
|
---|
1690 | uint32_t au32[2];
|
---|
1691 | /** 16-bit view. */
|
---|
1692 | uint16_t au16[4];
|
---|
1693 | /** 8-bit view. */
|
---|
1694 | uint8_t au8[8];
|
---|
1695 | } X86PTEPAE;
|
---|
1696 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
1697 | AssertCompileSize(X86PTEPAE, 8);
|
---|
1698 | #endif
|
---|
1699 | /** Pointer to a PAE page table entry. */
|
---|
1700 | typedef X86PTEPAE *PX86PTEPAE;
|
---|
1701 | /** Pointer to a const PAE page table entry. */
|
---|
1702 | typedef const X86PTEPAE *PCX86PTEPAE;
|
---|
1703 | /** @} */
|
---|
1704 |
|
---|
1705 | /**
|
---|
1706 | * Page table.
|
---|
1707 | */
|
---|
1708 | typedef struct X86PT
|
---|
1709 | {
|
---|
1710 | /** PTE Array. */
|
---|
1711 | X86PTE a[X86_PG_ENTRIES];
|
---|
1712 | } X86PT;
|
---|
1713 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
1714 | AssertCompileSize(X86PT, 4096);
|
---|
1715 | #endif
|
---|
1716 | /** Pointer to a page table. */
|
---|
1717 | typedef X86PT *PX86PT;
|
---|
1718 | /** Pointer to a const page table. */
|
---|
1719 | typedef const X86PT *PCX86PT;
|
---|
1720 |
|
---|
1721 | /** The page shift to get the PT index. */
|
---|
1722 | #define X86_PT_SHIFT 12
|
---|
1723 | /** The PT index mask (apply to a shifted page address). */
|
---|
1724 | #define X86_PT_MASK 0x3ff
|
---|
1725 |
|
---|
1726 |
|
---|
1727 | /**
|
---|
1728 | * Page directory.
|
---|
1729 | */
|
---|
1730 | typedef struct X86PTPAE
|
---|
1731 | {
|
---|
1732 | /** PTE Array. */
|
---|
1733 | X86PTEPAE a[X86_PG_PAE_ENTRIES];
|
---|
1734 | } X86PTPAE;
|
---|
1735 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
1736 | AssertCompileSize(X86PTPAE, 4096);
|
---|
1737 | #endif
|
---|
1738 | /** Pointer to a page table. */
|
---|
1739 | typedef X86PTPAE *PX86PTPAE;
|
---|
1740 | /** Pointer to a const page table. */
|
---|
1741 | typedef const X86PTPAE *PCX86PTPAE;
|
---|
1742 |
|
---|
1743 | /** The page shift to get the PA PTE index. */
|
---|
1744 | #define X86_PT_PAE_SHIFT 12
|
---|
1745 | /** The PAE PT index mask (apply to a shifted page address). */
|
---|
1746 | #define X86_PT_PAE_MASK 0x1ff
|
---|
1747 |
|
---|
1748 |
|
---|
1749 | /** @name 4KB Page Directory Entry
|
---|
1750 | * @{
|
---|
1751 | */
|
---|
1752 | /** Bit 0 - P - Present bit. */
|
---|
1753 | #define X86_PDE_P RT_BIT_32(0)
|
---|
1754 | /** Bit 1 - R/W - Read (clear) / Write (set) bit. */
|
---|
1755 | #define X86_PDE_RW RT_BIT_32(1)
|
---|
1756 | /** Bit 2 - U/S - User (set) / Supervisor (clear) bit. */
|
---|
1757 | #define X86_PDE_US RT_BIT_32(2)
|
---|
1758 | /** Bit 3 - PWT - Page level write thru bit. */
|
---|
1759 | #define X86_PDE_PWT RT_BIT_32(3)
|
---|
1760 | /** Bit 4 - PCD - Page level cache disable bit. */
|
---|
1761 | #define X86_PDE_PCD RT_BIT_32(4)
|
---|
1762 | /** Bit 5 - A - Access bit. */
|
---|
1763 | #define X86_PDE_A RT_BIT_32(5)
|
---|
1764 | /** Bit 7 - PS - Page size attribute.
|
---|
1765 | * Clear mean 4KB pages, set means large pages (2/4MB). */
|
---|
1766 | #define X86_PDE_PS RT_BIT_32(7)
|
---|
1767 | /** Bits 9-11 - - Available for use to system software. */
|
---|
1768 | #define X86_PDE_AVL_MASK (RT_BIT_32(9) | RT_BIT_32(10) | RT_BIT_32(11))
|
---|
1769 | /** Bits 12-31 - - Physical Page number of the next level. */
|
---|
1770 | #define X86_PDE_PG_MASK ( 0xfffff000 )
|
---|
1771 |
|
---|
1772 | /** Bits 12-51 - - PAE - Physical Page number of the next level. */
|
---|
1773 | #define X86_PDE_PAE_PG_MASK UINT64_C(0x000ffffffffff000)
|
---|
1774 | /** Bits 63 - NX - PAE/LM - No execution flag. */
|
---|
1775 | #define X86_PDE_PAE_NX RT_BIT_64(63)
|
---|
1776 | /** Bits 62-52, 7 - - PAE - MBZ bits when NX is active. */
|
---|
1777 | #define X86_PDE_PAE_MBZ_MASK_NX UINT64_C(0x7ff0000000000080)
|
---|
1778 | /** Bits 63-52, 7 - - PAE - MBZ bits when no NX. */
|
---|
1779 | #define X86_PDE_PAE_MBZ_MASK_NO_NX UINT64_C(0xfff0000000000080)
|
---|
1780 | /** Bit 7 - - LM - MBZ bits when NX is active. */
|
---|
1781 | #define X86_PDE_LM_MBZ_MASK_NX UINT64_C(0x0000000000000080)
|
---|
1782 | /** Bits 63, 7 - - LM - MBZ bits when no NX. */
|
---|
1783 | #define X86_PDE_LM_MBZ_MASK_NO_NX UINT64_C(0x8000000000000080)
|
---|
1784 |
|
---|
1785 | /**
|
---|
1786 | * Page directory entry.
|
---|
1787 | */
|
---|
1788 | typedef struct X86PDEBITS
|
---|
1789 | {
|
---|
1790 | /** Flags whether(=1) or not the page is present. */
|
---|
1791 | uint32_t u1Present : 1;
|
---|
1792 | /** Read(=0) / Write(=1) flag. */
|
---|
1793 | uint32_t u1Write : 1;
|
---|
1794 | /** User(=1) / Supervisor (=0) flag. */
|
---|
1795 | uint32_t u1User : 1;
|
---|
1796 | /** Write Thru flag. If PAT enabled, bit 0 of the index. */
|
---|
1797 | uint32_t u1WriteThru : 1;
|
---|
1798 | /** Cache disabled flag. If PAT enabled, bit 1 of the index. */
|
---|
1799 | uint32_t u1CacheDisable : 1;
|
---|
1800 | /** Accessed flag.
|
---|
1801 | * Indicates that the page has been read or written to. */
|
---|
1802 | uint32_t u1Accessed : 1;
|
---|
1803 | /** Reserved / Ignored (dirty bit). */
|
---|
1804 | uint32_t u1Reserved0 : 1;
|
---|
1805 | /** Size bit if PSE is enabled - in any event it's 0. */
|
---|
1806 | uint32_t u1Size : 1;
|
---|
1807 | /** Reserved / Ignored (global bit). */
|
---|
1808 | uint32_t u1Reserved1 : 1;
|
---|
1809 | /** Available for use to system software. */
|
---|
1810 | uint32_t u3Available : 3;
|
---|
1811 | /** Physical Page number of the next level. */
|
---|
1812 | uint32_t u20PageNo : 20;
|
---|
1813 | } X86PDEBITS;
|
---|
1814 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
1815 | AssertCompileSize(X86PDEBITS, 4);
|
---|
1816 | #endif
|
---|
1817 | /** Pointer to a page directory entry. */
|
---|
1818 | typedef X86PDEBITS *PX86PDEBITS;
|
---|
1819 | /** Pointer to a const page directory entry. */
|
---|
1820 | typedef const X86PDEBITS *PCX86PDEBITS;
|
---|
1821 |
|
---|
1822 |
|
---|
1823 | /**
|
---|
1824 | * PAE page directory entry.
|
---|
1825 | */
|
---|
1826 | typedef struct X86PDEPAEBITS
|
---|
1827 | {
|
---|
1828 | /** Flags whether(=1) or not the page is present. */
|
---|
1829 | uint32_t u1Present : 1;
|
---|
1830 | /** Read(=0) / Write(=1) flag. */
|
---|
1831 | uint32_t u1Write : 1;
|
---|
1832 | /** User(=1) / Supervisor (=0) flag. */
|
---|
1833 | uint32_t u1User : 1;
|
---|
1834 | /** Write Thru flag. If PAT enabled, bit 0 of the index. */
|
---|
1835 | uint32_t u1WriteThru : 1;
|
---|
1836 | /** Cache disabled flag. If PAT enabled, bit 1 of the index. */
|
---|
1837 | uint32_t u1CacheDisable : 1;
|
---|
1838 | /** Accessed flag.
|
---|
1839 | * Indicates that the page has been read or written to. */
|
---|
1840 | uint32_t u1Accessed : 1;
|
---|
1841 | /** Reserved / Ignored (dirty bit). */
|
---|
1842 | uint32_t u1Reserved0 : 1;
|
---|
1843 | /** Size bit if PSE is enabled - in any event it's 0. */
|
---|
1844 | uint32_t u1Size : 1;
|
---|
1845 | /** Reserved / Ignored (global bit). / */
|
---|
1846 | uint32_t u1Reserved1 : 1;
|
---|
1847 | /** Available for use to system software. */
|
---|
1848 | uint32_t u3Available : 3;
|
---|
1849 | /** Physical Page number of the next level - Low Part. Don't use! */
|
---|
1850 | uint32_t u20PageNoLow : 20;
|
---|
1851 | /** Physical Page number of the next level - High Part. Don't use! */
|
---|
1852 | uint32_t u20PageNoHigh : 20;
|
---|
1853 | /** MBZ bits */
|
---|
1854 | uint32_t u11Reserved : 11;
|
---|
1855 | /** No Execute flag. */
|
---|
1856 | uint32_t u1NoExecute : 1;
|
---|
1857 | } X86PDEPAEBITS;
|
---|
1858 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
1859 | AssertCompileSize(X86PDEPAEBITS, 8);
|
---|
1860 | #endif
|
---|
1861 | /** Pointer to a page directory entry. */
|
---|
1862 | typedef X86PDEPAEBITS *PX86PDEPAEBITS;
|
---|
1863 | /** Pointer to a const page directory entry. */
|
---|
1864 | typedef const X86PDEPAEBITS *PCX86PDEPAEBITS;
|
---|
1865 |
|
---|
1866 | /** @} */
|
---|
1867 |
|
---|
1868 |
|
---|
1869 | /** @name 2/4MB Page Directory Entry
|
---|
1870 | * @{
|
---|
1871 | */
|
---|
1872 | /** Bit 0 - P - Present bit. */
|
---|
1873 | #define X86_PDE4M_P RT_BIT_32(0)
|
---|
1874 | /** Bit 1 - R/W - Read (clear) / Write (set) bit. */
|
---|
1875 | #define X86_PDE4M_RW RT_BIT_32(1)
|
---|
1876 | /** Bit 2 - U/S - User (set) / Supervisor (clear) bit. */
|
---|
1877 | #define X86_PDE4M_US RT_BIT_32(2)
|
---|
1878 | /** Bit 3 - PWT - Page level write thru bit. */
|
---|
1879 | #define X86_PDE4M_PWT RT_BIT_32(3)
|
---|
1880 | /** Bit 4 - PCD - Page level cache disable bit. */
|
---|
1881 | #define X86_PDE4M_PCD RT_BIT_32(4)
|
---|
1882 | /** Bit 5 - A - Access bit. */
|
---|
1883 | #define X86_PDE4M_A RT_BIT_32(5)
|
---|
1884 | /** Bit 6 - D - Dirty bit. */
|
---|
1885 | #define X86_PDE4M_D RT_BIT_32(6)
|
---|
1886 | /** Bit 7 - PS - Page size attribute. Clear mean 4KB pages, set means large pages (2/4MB). */
|
---|
1887 | #define X86_PDE4M_PS RT_BIT_32(7)
|
---|
1888 | /** Bit 8 - G - Global flag. */
|
---|
1889 | #define X86_PDE4M_G RT_BIT_32(8)
|
---|
1890 | /** Bits 9-11 - AVL - Available for use to system software. */
|
---|
1891 | #define X86_PDE4M_AVL (RT_BIT_32(9) | RT_BIT_32(10) | RT_BIT_32(11))
|
---|
1892 | /** Bit 12 - PAT - Page Attribute Table index bit. Reserved and 0 if not supported. */
|
---|
1893 | #define X86_PDE4M_PAT RT_BIT_32(12)
|
---|
1894 | /** Shift to get from X86_PTE_PAT to X86_PDE4M_PAT. */
|
---|
1895 | #define X86_PDE4M_PAT_SHIFT (12 - 7)
|
---|
1896 | /** Bits 22-31 - - Physical Page number. */
|
---|
1897 | #define X86_PDE4M_PG_MASK ( 0xffc00000 )
|
---|
1898 | /** Bits 20-13 - - Physical Page number high part (32-39 bits). AMD64 hack. */
|
---|
1899 | #define X86_PDE4M_PG_HIGH_MASK ( 0x001fe000 )
|
---|
1900 | /** The number of bits to the high part of the page number. */
|
---|
1901 | #define X86_PDE4M_PG_HIGH_SHIFT 19
|
---|
1902 | /** Bit 21 - - MBZ bits for AMD CPUs, no PSE36. */
|
---|
1903 | #define X86_PDE4M_MBZ_MASK RT_BIT_32(21)
|
---|
1904 |
|
---|
1905 | /** Bits 21-51 - - PAE/LM - Physical Page number.
|
---|
1906 | * (Bits 40-51 (long mode) & bits 36-51 (pae legacy) are reserved according to the Intel docs; AMD allows for more.) */
|
---|
1907 | #define X86_PDE2M_PAE_PG_MASK UINT64_C(0x000fffffffe00000)
|
---|
1908 | /** Bits 63 - NX - PAE/LM - No execution flag. */
|
---|
1909 | #define X86_PDE2M_PAE_NX RT_BIT_64(63)
|
---|
1910 | /** Bits 62-52, 20-13 - - PAE - MBZ bits when NX is active. */
|
---|
1911 | #define X86_PDE2M_PAE_MBZ_MASK_NX UINT64_C(0x7ff00000001fe000)
|
---|
1912 | /** Bits 63-52, 20-13 - - PAE - MBZ bits when no NX. */
|
---|
1913 | #define X86_PDE2M_PAE_MBZ_MASK_NO_NX UINT64_C(0xfff00000001fe000)
|
---|
1914 | /** Bits 20-13 - - LM - MBZ bits when NX is active. */
|
---|
1915 | #define X86_PDE2M_LM_MBZ_MASK_NX UINT64_C(0x00000000001fe000)
|
---|
1916 | /** Bits 63, 20-13 - - LM - MBZ bits when no NX. */
|
---|
1917 | #define X86_PDE2M_LM_MBZ_MASK_NO_NX UINT64_C(0x80000000001fe000)
|
---|
1918 |
|
---|
1919 | /**
|
---|
1920 | * 4MB page directory entry.
|
---|
1921 | */
|
---|
1922 | typedef struct X86PDE4MBITS
|
---|
1923 | {
|
---|
1924 | /** Flags whether(=1) or not the page is present. */
|
---|
1925 | uint32_t u1Present : 1;
|
---|
1926 | /** Read(=0) / Write(=1) flag. */
|
---|
1927 | uint32_t u1Write : 1;
|
---|
1928 | /** User(=1) / Supervisor (=0) flag. */
|
---|
1929 | uint32_t u1User : 1;
|
---|
1930 | /** Write Thru flag. If PAT enabled, bit 0 of the index. */
|
---|
1931 | uint32_t u1WriteThru : 1;
|
---|
1932 | /** Cache disabled flag. If PAT enabled, bit 1 of the index. */
|
---|
1933 | uint32_t u1CacheDisable : 1;
|
---|
1934 | /** Accessed flag.
|
---|
1935 | * Indicates that the page have been read or written to. */
|
---|
1936 | uint32_t u1Accessed : 1;
|
---|
1937 | /** Dirty flag.
|
---|
1938 | * Indicates that the page has been written to. */
|
---|
1939 | uint32_t u1Dirty : 1;
|
---|
1940 | /** Page size flag - always 1 for 4MB entries. */
|
---|
1941 | uint32_t u1Size : 1;
|
---|
1942 | /** Global flag. */
|
---|
1943 | uint32_t u1Global : 1;
|
---|
1944 | /** Available for use to system software. */
|
---|
1945 | uint32_t u3Available : 3;
|
---|
1946 | /** Reserved / If PAT enabled, bit 2 of the index. */
|
---|
1947 | uint32_t u1PAT : 1;
|
---|
1948 | /** Bits 32-39 of the page number on AMD64.
|
---|
1949 | * This AMD64 hack allows accessing 40bits of physical memory without PAE. */
|
---|
1950 | uint32_t u8PageNoHigh : 8;
|
---|
1951 | /** Reserved. */
|
---|
1952 | uint32_t u1Reserved : 1;
|
---|
1953 | /** Physical Page number of the page. */
|
---|
1954 | uint32_t u10PageNo : 10;
|
---|
1955 | } X86PDE4MBITS;
|
---|
1956 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
1957 | AssertCompileSize(X86PDE4MBITS, 4);
|
---|
1958 | #endif
|
---|
1959 | /** Pointer to a page table entry. */
|
---|
1960 | typedef X86PDE4MBITS *PX86PDE4MBITS;
|
---|
1961 | /** Pointer to a const page table entry. */
|
---|
1962 | typedef const X86PDE4MBITS *PCX86PDE4MBITS;
|
---|
1963 |
|
---|
1964 |
|
---|
1965 | /**
|
---|
1966 | * 2MB PAE page directory entry.
|
---|
1967 | */
|
---|
1968 | typedef struct X86PDE2MPAEBITS
|
---|
1969 | {
|
---|
1970 | /** Flags whether(=1) or not the page is present. */
|
---|
1971 | uint32_t u1Present : 1;
|
---|
1972 | /** Read(=0) / Write(=1) flag. */
|
---|
1973 | uint32_t u1Write : 1;
|
---|
1974 | /** User(=1) / Supervisor(=0) flag. */
|
---|
1975 | uint32_t u1User : 1;
|
---|
1976 | /** Write Thru flag. If PAT enabled, bit 0 of the index. */
|
---|
1977 | uint32_t u1WriteThru : 1;
|
---|
1978 | /** Cache disabled flag. If PAT enabled, bit 1 of the index. */
|
---|
1979 | uint32_t u1CacheDisable : 1;
|
---|
1980 | /** Accessed flag.
|
---|
1981 | * Indicates that the page have been read or written to. */
|
---|
1982 | uint32_t u1Accessed : 1;
|
---|
1983 | /** Dirty flag.
|
---|
1984 | * Indicates that the page has been written to. */
|
---|
1985 | uint32_t u1Dirty : 1;
|
---|
1986 | /** Page size flag - always 1 for 2MB entries. */
|
---|
1987 | uint32_t u1Size : 1;
|
---|
1988 | /** Global flag. */
|
---|
1989 | uint32_t u1Global : 1;
|
---|
1990 | /** Available for use to system software. */
|
---|
1991 | uint32_t u3Available : 3;
|
---|
1992 | /** Reserved / If PAT enabled, bit 2 of the index. */
|
---|
1993 | uint32_t u1PAT : 1;
|
---|
1994 | /** Reserved. */
|
---|
1995 | uint32_t u9Reserved : 9;
|
---|
1996 | /** Physical Page number of the next level - Low part. Don't use! */
|
---|
1997 | uint32_t u10PageNoLow : 10;
|
---|
1998 | /** Physical Page number of the next level - High part. Don't use! */
|
---|
1999 | uint32_t u20PageNoHigh : 20;
|
---|
2000 | /** MBZ bits */
|
---|
2001 | uint32_t u11Reserved : 11;
|
---|
2002 | /** No Execute flag. */
|
---|
2003 | uint32_t u1NoExecute : 1;
|
---|
2004 | } X86PDE2MPAEBITS;
|
---|
2005 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2006 | AssertCompileSize(X86PDE2MPAEBITS, 8);
|
---|
2007 | #endif
|
---|
2008 | /** Pointer to a 2MB PAE page table entry. */
|
---|
2009 | typedef X86PDE2MPAEBITS *PX86PDE2MPAEBITS;
|
---|
2010 | /** Pointer to a 2MB PAE page table entry. */
|
---|
2011 | typedef const X86PDE2MPAEBITS *PCX86PDE2MPAEBITS;
|
---|
2012 |
|
---|
2013 | /** @} */
|
---|
2014 |
|
---|
2015 | /**
|
---|
2016 | * Page directory entry.
|
---|
2017 | */
|
---|
2018 | typedef union X86PDE
|
---|
2019 | {
|
---|
2020 | /** Unsigned integer view. */
|
---|
2021 | X86PGUINT u;
|
---|
2022 | /** Normal view. */
|
---|
2023 | X86PDEBITS n;
|
---|
2024 | /** 4MB view (big). */
|
---|
2025 | X86PDE4MBITS b;
|
---|
2026 | /** 8 bit unsigned integer view. */
|
---|
2027 | uint8_t au8[4];
|
---|
2028 | /** 16 bit unsigned integer view. */
|
---|
2029 | uint16_t au16[2];
|
---|
2030 | /** 32 bit unsigned integer view. */
|
---|
2031 | uint32_t au32[1];
|
---|
2032 | } X86PDE;
|
---|
2033 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2034 | AssertCompileSize(X86PDE, 4);
|
---|
2035 | #endif
|
---|
2036 | /** Pointer to a page directory entry. */
|
---|
2037 | typedef X86PDE *PX86PDE;
|
---|
2038 | /** Pointer to a const page directory entry. */
|
---|
2039 | typedef const X86PDE *PCX86PDE;
|
---|
2040 |
|
---|
2041 | /**
|
---|
2042 | * PAE page directory entry.
|
---|
2043 | */
|
---|
2044 | typedef union X86PDEPAE
|
---|
2045 | {
|
---|
2046 | /** Unsigned integer view. */
|
---|
2047 | X86PGPAEUINT u;
|
---|
2048 | /** Normal view. */
|
---|
2049 | X86PDEPAEBITS n;
|
---|
2050 | /** 2MB page view (big). */
|
---|
2051 | X86PDE2MPAEBITS b;
|
---|
2052 | /** 8 bit unsigned integer view. */
|
---|
2053 | uint8_t au8[8];
|
---|
2054 | /** 16 bit unsigned integer view. */
|
---|
2055 | uint16_t au16[4];
|
---|
2056 | /** 32 bit unsigned integer view. */
|
---|
2057 | uint32_t au32[2];
|
---|
2058 | } X86PDEPAE;
|
---|
2059 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2060 | AssertCompileSize(X86PDEPAE, 8);
|
---|
2061 | #endif
|
---|
2062 | /** Pointer to a page directory entry. */
|
---|
2063 | typedef X86PDEPAE *PX86PDEPAE;
|
---|
2064 | /** Pointer to a const page directory entry. */
|
---|
2065 | typedef const X86PDEPAE *PCX86PDEPAE;
|
---|
2066 |
|
---|
2067 | /**
|
---|
2068 | * Page directory.
|
---|
2069 | */
|
---|
2070 | typedef struct X86PD
|
---|
2071 | {
|
---|
2072 | /** PDE Array. */
|
---|
2073 | X86PDE a[X86_PG_ENTRIES];
|
---|
2074 | } X86PD;
|
---|
2075 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2076 | AssertCompileSize(X86PD, 4096);
|
---|
2077 | #endif
|
---|
2078 | /** Pointer to a page directory. */
|
---|
2079 | typedef X86PD *PX86PD;
|
---|
2080 | /** Pointer to a const page directory. */
|
---|
2081 | typedef const X86PD *PCX86PD;
|
---|
2082 |
|
---|
2083 | /** The page shift to get the PD index. */
|
---|
2084 | #define X86_PD_SHIFT 22
|
---|
2085 | /** The PD index mask (apply to a shifted page address). */
|
---|
2086 | #define X86_PD_MASK 0x3ff
|
---|
2087 |
|
---|
2088 |
|
---|
2089 | /**
|
---|
2090 | * PAE page directory.
|
---|
2091 | */
|
---|
2092 | typedef struct X86PDPAE
|
---|
2093 | {
|
---|
2094 | /** PDE Array. */
|
---|
2095 | X86PDEPAE a[X86_PG_PAE_ENTRIES];
|
---|
2096 | } X86PDPAE;
|
---|
2097 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2098 | AssertCompileSize(X86PDPAE, 4096);
|
---|
2099 | #endif
|
---|
2100 | /** Pointer to a PAE page directory. */
|
---|
2101 | typedef X86PDPAE *PX86PDPAE;
|
---|
2102 | /** Pointer to a const PAE page directory. */
|
---|
2103 | typedef const X86PDPAE *PCX86PDPAE;
|
---|
2104 |
|
---|
2105 | /** The page shift to get the PAE PD index. */
|
---|
2106 | #define X86_PD_PAE_SHIFT 21
|
---|
2107 | /** The PAE PD index mask (apply to a shifted page address). */
|
---|
2108 | #define X86_PD_PAE_MASK 0x1ff
|
---|
2109 |
|
---|
2110 |
|
---|
2111 | /** @name Page Directory Pointer Table Entry (PAE)
|
---|
2112 | * @{
|
---|
2113 | */
|
---|
2114 | /** Bit 0 - P - Present bit. */
|
---|
2115 | #define X86_PDPE_P RT_BIT_32(0)
|
---|
2116 | /** Bit 1 - R/W - Read (clear) / Write (set) bit. Long Mode only. */
|
---|
2117 | #define X86_PDPE_RW RT_BIT_32(1)
|
---|
2118 | /** Bit 2 - U/S - User (set) / Supervisor (clear) bit. Long Mode only. */
|
---|
2119 | #define X86_PDPE_US RT_BIT_32(2)
|
---|
2120 | /** Bit 3 - PWT - Page level write thru bit. */
|
---|
2121 | #define X86_PDPE_PWT RT_BIT_32(3)
|
---|
2122 | /** Bit 4 - PCD - Page level cache disable bit. */
|
---|
2123 | #define X86_PDPE_PCD RT_BIT_32(4)
|
---|
2124 | /** Bit 5 - A - Access bit. Long Mode only. */
|
---|
2125 | #define X86_PDPE_A RT_BIT_32(5)
|
---|
2126 | /** Bit 7 - PS - Page size (1GB). Long Mode only. */
|
---|
2127 | #define X86_PDPE_LM_PS RT_BIT_32(7)
|
---|
2128 | /** Bits 9-11 - - Available for use to system software. */
|
---|
2129 | #define X86_PDPE_AVL_MASK (RT_BIT_32(9) | RT_BIT_32(10) | RT_BIT_32(11))
|
---|
2130 | /** Bits 12-51 - - PAE - Physical Page number of the next level. */
|
---|
2131 | #define X86_PDPE_PG_MASK UINT64_C(0x000ffffffffff000)
|
---|
2132 | /** Bits 63-52, 8-5, 2-1 - - PAE - MBZ bits (NX is long mode only). */
|
---|
2133 | #define X86_PDPE_PAE_MBZ_MASK UINT64_C(0xfff00000000001e6)
|
---|
2134 | /** Bits 63 - NX - LM - No execution flag. Long Mode only. */
|
---|
2135 | #define X86_PDPE_LM_NX RT_BIT_64(63)
|
---|
2136 | /** Bits 8, 7 - - LM - MBZ bits when NX is active. */
|
---|
2137 | #define X86_PDPE_LM_MBZ_MASK_NX UINT64_C(0x0000000000000180)
|
---|
2138 | /** Bits 63, 8, 7 - - LM - MBZ bits when no NX. */
|
---|
2139 | #define X86_PDPE_LM_MBZ_MASK_NO_NX UINT64_C(0x8000000000000180)
|
---|
2140 | /** Bits 29-13 - - LM - MBZ bits for 1GB page entry when NX is active. */
|
---|
2141 | #define X86_PDPE1G_LM_MBZ_MASK_NX UINT64_C(0x000000003fffe000)
|
---|
2142 | /** Bits 63, 29-13 - - LM - MBZ bits for 1GB page entry when no NX. */
|
---|
2143 | #define X86_PDPE1G_LM_MBZ_MASK_NO_NX UINT64_C(0x800000003fffe000)
|
---|
2144 |
|
---|
2145 |
|
---|
2146 | /**
|
---|
2147 | * Page directory pointer table entry.
|
---|
2148 | */
|
---|
2149 | typedef struct X86PDPEBITS
|
---|
2150 | {
|
---|
2151 | /** Flags whether(=1) or not the page is present. */
|
---|
2152 | uint32_t u1Present : 1;
|
---|
2153 | /** Chunk of reserved bits. */
|
---|
2154 | uint32_t u2Reserved : 2;
|
---|
2155 | /** Write Thru flag. If PAT enabled, bit 0 of the index. */
|
---|
2156 | uint32_t u1WriteThru : 1;
|
---|
2157 | /** Cache disabled flag. If PAT enabled, bit 1 of the index. */
|
---|
2158 | uint32_t u1CacheDisable : 1;
|
---|
2159 | /** Chunk of reserved bits. */
|
---|
2160 | uint32_t u4Reserved : 4;
|
---|
2161 | /** Available for use to system software. */
|
---|
2162 | uint32_t u3Available : 3;
|
---|
2163 | /** Physical Page number of the next level - Low Part. Don't use! */
|
---|
2164 | uint32_t u20PageNoLow : 20;
|
---|
2165 | /** Physical Page number of the next level - High Part. Don't use! */
|
---|
2166 | uint32_t u20PageNoHigh : 20;
|
---|
2167 | /** MBZ bits */
|
---|
2168 | uint32_t u12Reserved : 12;
|
---|
2169 | } X86PDPEBITS;
|
---|
2170 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2171 | AssertCompileSize(X86PDPEBITS, 8);
|
---|
2172 | #endif
|
---|
2173 | /** Pointer to a page directory pointer table entry. */
|
---|
2174 | typedef X86PDPEBITS *PX86PTPEBITS;
|
---|
2175 | /** Pointer to a const page directory pointer table entry. */
|
---|
2176 | typedef const X86PDPEBITS *PCX86PTPEBITS;
|
---|
2177 |
|
---|
2178 | /**
|
---|
2179 | * Page directory pointer table entry. AMD64 version
|
---|
2180 | */
|
---|
2181 | typedef struct X86PDPEAMD64BITS
|
---|
2182 | {
|
---|
2183 | /** Flags whether(=1) or not the page is present. */
|
---|
2184 | uint32_t u1Present : 1;
|
---|
2185 | /** Read(=0) / Write(=1) flag. */
|
---|
2186 | uint32_t u1Write : 1;
|
---|
2187 | /** User(=1) / Supervisor (=0) flag. */
|
---|
2188 | uint32_t u1User : 1;
|
---|
2189 | /** Write Thru flag. If PAT enabled, bit 0 of the index. */
|
---|
2190 | uint32_t u1WriteThru : 1;
|
---|
2191 | /** Cache disabled flag. If PAT enabled, bit 1 of the index. */
|
---|
2192 | uint32_t u1CacheDisable : 1;
|
---|
2193 | /** Accessed flag.
|
---|
2194 | * Indicates that the page have been read or written to. */
|
---|
2195 | uint32_t u1Accessed : 1;
|
---|
2196 | /** Chunk of reserved bits. */
|
---|
2197 | uint32_t u3Reserved : 3;
|
---|
2198 | /** Available for use to system software. */
|
---|
2199 | uint32_t u3Available : 3;
|
---|
2200 | /** Physical Page number of the next level - Low Part. Don't use! */
|
---|
2201 | uint32_t u20PageNoLow : 20;
|
---|
2202 | /** Physical Page number of the next level - High Part. Don't use! */
|
---|
2203 | uint32_t u20PageNoHigh : 20;
|
---|
2204 | /** MBZ bits */
|
---|
2205 | uint32_t u11Reserved : 11;
|
---|
2206 | /** No Execute flag. */
|
---|
2207 | uint32_t u1NoExecute : 1;
|
---|
2208 | } X86PDPEAMD64BITS;
|
---|
2209 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2210 | AssertCompileSize(X86PDPEAMD64BITS, 8);
|
---|
2211 | #endif
|
---|
2212 | /** Pointer to a page directory pointer table entry. */
|
---|
2213 | typedef X86PDPEAMD64BITS *PX86PDPEAMD64BITS;
|
---|
2214 | /** Pointer to a const page directory pointer table entry. */
|
---|
2215 | typedef const X86PDPEAMD64BITS *PCX86PDPEAMD64BITS;
|
---|
2216 |
|
---|
2217 | /**
|
---|
2218 | * Page directory pointer table entry for 1GB page. (AMD64 only)
|
---|
2219 | */
|
---|
2220 | typedef struct X86PDPE1GB
|
---|
2221 | {
|
---|
2222 | /** 0: Flags whether(=1) or not the page is present. */
|
---|
2223 | uint32_t u1Present : 1;
|
---|
2224 | /** 1: Read(=0) / Write(=1) flag. */
|
---|
2225 | uint32_t u1Write : 1;
|
---|
2226 | /** 2: User(=1) / Supervisor (=0) flag. */
|
---|
2227 | uint32_t u1User : 1;
|
---|
2228 | /** 3: Write Thru flag. If PAT enabled, bit 0 of the index. */
|
---|
2229 | uint32_t u1WriteThru : 1;
|
---|
2230 | /** 4: Cache disabled flag. If PAT enabled, bit 1 of the index. */
|
---|
2231 | uint32_t u1CacheDisable : 1;
|
---|
2232 | /** 5: Accessed flag.
|
---|
2233 | * Indicates that the page have been read or written to. */
|
---|
2234 | uint32_t u1Accessed : 1;
|
---|
2235 | /** 6: Dirty flag for 1GB pages. */
|
---|
2236 | uint32_t u1Dirty : 1;
|
---|
2237 | /** 7: Indicates 1GB page if set. */
|
---|
2238 | uint32_t u1Size : 1;
|
---|
2239 | /** 8: Global 1GB page. */
|
---|
2240 | uint32_t u1Global: 1;
|
---|
2241 | /** 9-11: Available for use to system software. */
|
---|
2242 | uint32_t u3Available : 3;
|
---|
2243 | /** 12: PAT bit for 1GB page. */
|
---|
2244 | uint32_t u1PAT : 1;
|
---|
2245 | /** 13-29: MBZ bits. */
|
---|
2246 | uint32_t u17Reserved : 17;
|
---|
2247 | /** 30-31: Physical page number - Low Part. Don't use! */
|
---|
2248 | uint32_t u2PageNoLow : 2;
|
---|
2249 | /** 32-51: Physical Page number of the next level - High Part. Don't use! */
|
---|
2250 | uint32_t u20PageNoHigh : 20;
|
---|
2251 | /** 52-62: MBZ bits */
|
---|
2252 | uint32_t u11Reserved : 11;
|
---|
2253 | /** 63: No Execute flag. */
|
---|
2254 | uint32_t u1NoExecute : 1;
|
---|
2255 | } X86PDPE1GB;
|
---|
2256 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2257 | AssertCompileSize(X86PDPE1GB, 8);
|
---|
2258 | #endif
|
---|
2259 | /** Pointer to a page directory pointer table entry for a 1GB page. */
|
---|
2260 | typedef X86PDPE1GB *PX86PDPE1GB;
|
---|
2261 | /** Pointer to a const page directory pointer table entry for a 1GB page. */
|
---|
2262 | typedef const X86PDPE1GB *PCX86PDPE1GB;
|
---|
2263 |
|
---|
2264 | /**
|
---|
2265 | * Page directory pointer table entry.
|
---|
2266 | */
|
---|
2267 | typedef union X86PDPE
|
---|
2268 | {
|
---|
2269 | /** Unsigned integer view. */
|
---|
2270 | X86PGPAEUINT u;
|
---|
2271 | /** Normal view. */
|
---|
2272 | X86PDPEBITS n;
|
---|
2273 | /** AMD64 view. */
|
---|
2274 | X86PDPEAMD64BITS lm;
|
---|
2275 | /** AMD64 big view. */
|
---|
2276 | X86PDPE1GB b;
|
---|
2277 | /** 8 bit unsigned integer view. */
|
---|
2278 | uint8_t au8[8];
|
---|
2279 | /** 16 bit unsigned integer view. */
|
---|
2280 | uint16_t au16[4];
|
---|
2281 | /** 32 bit unsigned integer view. */
|
---|
2282 | uint32_t au32[2];
|
---|
2283 | } X86PDPE;
|
---|
2284 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2285 | AssertCompileSize(X86PDPE, 8);
|
---|
2286 | #endif
|
---|
2287 | /** Pointer to a page directory pointer table entry. */
|
---|
2288 | typedef X86PDPE *PX86PDPE;
|
---|
2289 | /** Pointer to a const page directory pointer table entry. */
|
---|
2290 | typedef const X86PDPE *PCX86PDPE;
|
---|
2291 |
|
---|
2292 |
|
---|
2293 | /**
|
---|
2294 | * Page directory pointer table.
|
---|
2295 | */
|
---|
2296 | typedef struct X86PDPT
|
---|
2297 | {
|
---|
2298 | /** PDE Array. */
|
---|
2299 | X86PDPE a[X86_PG_AMD64_PDPE_ENTRIES];
|
---|
2300 | } X86PDPT;
|
---|
2301 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2302 | AssertCompileSize(X86PDPT, 4096);
|
---|
2303 | #endif
|
---|
2304 | /** Pointer to a page directory pointer table. */
|
---|
2305 | typedef X86PDPT *PX86PDPT;
|
---|
2306 | /** Pointer to a const page directory pointer table. */
|
---|
2307 | typedef const X86PDPT *PCX86PDPT;
|
---|
2308 |
|
---|
2309 | /** The page shift to get the PDPT index. */
|
---|
2310 | #define X86_PDPT_SHIFT 30
|
---|
2311 | /** The PDPT index mask (apply to a shifted page address). (32 bits PAE) */
|
---|
2312 | #define X86_PDPT_MASK_PAE 0x3
|
---|
2313 | /** The PDPT index mask (apply to a shifted page address). (64 bits PAE)*/
|
---|
2314 | #define X86_PDPT_MASK_AMD64 0x1ff
|
---|
2315 |
|
---|
2316 | /** @} */
|
---|
2317 |
|
---|
2318 |
|
---|
2319 | /** @name Page Map Level-4 Entry (Long Mode PAE)
|
---|
2320 | * @{
|
---|
2321 | */
|
---|
2322 | /** Bit 0 - P - Present bit. */
|
---|
2323 | #define X86_PML4E_P RT_BIT_32(0)
|
---|
2324 | /** Bit 1 - R/W - Read (clear) / Write (set) bit. */
|
---|
2325 | #define X86_PML4E_RW RT_BIT_32(1)
|
---|
2326 | /** Bit 2 - U/S - User (set) / Supervisor (clear) bit. */
|
---|
2327 | #define X86_PML4E_US RT_BIT_32(2)
|
---|
2328 | /** Bit 3 - PWT - Page level write thru bit. */
|
---|
2329 | #define X86_PML4E_PWT RT_BIT_32(3)
|
---|
2330 | /** Bit 4 - PCD - Page level cache disable bit. */
|
---|
2331 | #define X86_PML4E_PCD RT_BIT_32(4)
|
---|
2332 | /** Bit 5 - A - Access bit. */
|
---|
2333 | #define X86_PML4E_A RT_BIT_32(5)
|
---|
2334 | /** Bits 9-11 - - Available for use to system software. */
|
---|
2335 | #define X86_PML4E_AVL_MASK (RT_BIT_32(9) | RT_BIT_32(10) | RT_BIT_32(11))
|
---|
2336 | /** Bits 12-51 - - PAE - Physical Page number of the next level. */
|
---|
2337 | #define X86_PML4E_PG_MASK UINT64_C(0x000ffffffffff000)
|
---|
2338 | /** Bits 8, 7 - - MBZ bits when NX is active. */
|
---|
2339 | #define X86_PML4E_MBZ_MASK_NX UINT64_C(0x0000000000000080)
|
---|
2340 | /** Bits 63, 7 - - MBZ bits when no NX. */
|
---|
2341 | #define X86_PML4E_MBZ_MASK_NO_NX UINT64_C(0x8000000000000080)
|
---|
2342 | /** Bits 63 - NX - PAE - No execution flag. */
|
---|
2343 | #define X86_PML4E_NX RT_BIT_64(63)
|
---|
2344 |
|
---|
2345 | /**
|
---|
2346 | * Page Map Level-4 Entry
|
---|
2347 | */
|
---|
2348 | typedef struct X86PML4EBITS
|
---|
2349 | {
|
---|
2350 | /** Flags whether(=1) or not the page is present. */
|
---|
2351 | uint32_t u1Present : 1;
|
---|
2352 | /** Read(=0) / Write(=1) flag. */
|
---|
2353 | uint32_t u1Write : 1;
|
---|
2354 | /** User(=1) / Supervisor (=0) flag. */
|
---|
2355 | uint32_t u1User : 1;
|
---|
2356 | /** Write Thru flag. If PAT enabled, bit 0 of the index. */
|
---|
2357 | uint32_t u1WriteThru : 1;
|
---|
2358 | /** Cache disabled flag. If PAT enabled, bit 1 of the index. */
|
---|
2359 | uint32_t u1CacheDisable : 1;
|
---|
2360 | /** Accessed flag.
|
---|
2361 | * Indicates that the page have been read or written to. */
|
---|
2362 | uint32_t u1Accessed : 1;
|
---|
2363 | /** Chunk of reserved bits. */
|
---|
2364 | uint32_t u3Reserved : 3;
|
---|
2365 | /** Available for use to system software. */
|
---|
2366 | uint32_t u3Available : 3;
|
---|
2367 | /** Physical Page number of the next level - Low Part. Don't use! */
|
---|
2368 | uint32_t u20PageNoLow : 20;
|
---|
2369 | /** Physical Page number of the next level - High Part. Don't use! */
|
---|
2370 | uint32_t u20PageNoHigh : 20;
|
---|
2371 | /** MBZ bits */
|
---|
2372 | uint32_t u11Reserved : 11;
|
---|
2373 | /** No Execute flag. */
|
---|
2374 | uint32_t u1NoExecute : 1;
|
---|
2375 | } X86PML4EBITS;
|
---|
2376 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2377 | AssertCompileSize(X86PML4EBITS, 8);
|
---|
2378 | #endif
|
---|
2379 | /** Pointer to a page map level-4 entry. */
|
---|
2380 | typedef X86PML4EBITS *PX86PML4EBITS;
|
---|
2381 | /** Pointer to a const page map level-4 entry. */
|
---|
2382 | typedef const X86PML4EBITS *PCX86PML4EBITS;
|
---|
2383 |
|
---|
2384 | /**
|
---|
2385 | * Page Map Level-4 Entry.
|
---|
2386 | */
|
---|
2387 | typedef union X86PML4E
|
---|
2388 | {
|
---|
2389 | /** Unsigned integer view. */
|
---|
2390 | X86PGPAEUINT u;
|
---|
2391 | /** Normal view. */
|
---|
2392 | X86PML4EBITS n;
|
---|
2393 | /** 8 bit unsigned integer view. */
|
---|
2394 | uint8_t au8[8];
|
---|
2395 | /** 16 bit unsigned integer view. */
|
---|
2396 | uint16_t au16[4];
|
---|
2397 | /** 32 bit unsigned integer view. */
|
---|
2398 | uint32_t au32[2];
|
---|
2399 | } X86PML4E;
|
---|
2400 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2401 | AssertCompileSize(X86PML4E, 8);
|
---|
2402 | #endif
|
---|
2403 | /** Pointer to a page map level-4 entry. */
|
---|
2404 | typedef X86PML4E *PX86PML4E;
|
---|
2405 | /** Pointer to a const page map level-4 entry. */
|
---|
2406 | typedef const X86PML4E *PCX86PML4E;
|
---|
2407 |
|
---|
2408 |
|
---|
2409 | /**
|
---|
2410 | * Page Map Level-4.
|
---|
2411 | */
|
---|
2412 | typedef struct X86PML4
|
---|
2413 | {
|
---|
2414 | /** PDE Array. */
|
---|
2415 | X86PML4E a[X86_PG_PAE_ENTRIES];
|
---|
2416 | } X86PML4;
|
---|
2417 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2418 | AssertCompileSize(X86PML4, 4096);
|
---|
2419 | #endif
|
---|
2420 | /** Pointer to a page map level-4. */
|
---|
2421 | typedef X86PML4 *PX86PML4;
|
---|
2422 | /** Pointer to a const page map level-4. */
|
---|
2423 | typedef const X86PML4 *PCX86PML4;
|
---|
2424 |
|
---|
2425 | /** The page shift to get the PML4 index. */
|
---|
2426 | #define X86_PML4_SHIFT 39
|
---|
2427 | /** The PML4 index mask (apply to a shifted page address). */
|
---|
2428 | #define X86_PML4_MASK 0x1ff
|
---|
2429 |
|
---|
2430 | /** @} */
|
---|
2431 |
|
---|
2432 | /** @} */
|
---|
2433 |
|
---|
2434 | /**
|
---|
2435 | * 32-bit protected mode FSTENV image.
|
---|
2436 | */
|
---|
2437 | typedef struct X86FSTENV32P
|
---|
2438 | {
|
---|
2439 | uint16_t FCW;
|
---|
2440 | uint16_t padding1;
|
---|
2441 | uint16_t FSW;
|
---|
2442 | uint16_t padding2;
|
---|
2443 | uint16_t FTW;
|
---|
2444 | uint16_t padding3;
|
---|
2445 | uint32_t FPUIP;
|
---|
2446 | uint16_t FPUCS;
|
---|
2447 | uint16_t FOP;
|
---|
2448 | uint32_t FPUDP;
|
---|
2449 | uint16_t FPUDS;
|
---|
2450 | uint16_t padding4;
|
---|
2451 | } X86FSTENV32P;
|
---|
2452 | /** Pointer to a 32-bit protected mode FSTENV image. */
|
---|
2453 | typedef X86FSTENV32P *PX86FSTENV32P;
|
---|
2454 | /** Pointer to a const 32-bit protected mode FSTENV image. */
|
---|
2455 | typedef X86FSTENV32P const *PCX86FSTENV32P;
|
---|
2456 |
|
---|
2457 |
|
---|
2458 | /**
|
---|
2459 | * 80-bit MMX/FPU register type.
|
---|
2460 | */
|
---|
2461 | typedef struct X86FPUMMX
|
---|
2462 | {
|
---|
2463 | uint8_t reg[10];
|
---|
2464 | } X86FPUMMX;
|
---|
2465 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2466 | AssertCompileSize(X86FPUMMX, 10);
|
---|
2467 | #endif
|
---|
2468 | /** Pointer to a 80-bit MMX/FPU register type. */
|
---|
2469 | typedef X86FPUMMX *PX86FPUMMX;
|
---|
2470 | /** Pointer to a const 80-bit MMX/FPU register type. */
|
---|
2471 | typedef const X86FPUMMX *PCX86FPUMMX;
|
---|
2472 |
|
---|
2473 | /** FPU (x87) register. */
|
---|
2474 | typedef union X86FPUREG
|
---|
2475 | {
|
---|
2476 | /** MMX view. */
|
---|
2477 | uint64_t mmx;
|
---|
2478 | /** FPU view - todo. */
|
---|
2479 | X86FPUMMX fpu;
|
---|
2480 | /** Extended precision floating point view. */
|
---|
2481 | RTFLOAT80U r80;
|
---|
2482 | /** Extended precision floating point view v2 */
|
---|
2483 | RTFLOAT80U2 r80Ex;
|
---|
2484 | /** 8-bit view. */
|
---|
2485 | uint8_t au8[16];
|
---|
2486 | /** 16-bit view. */
|
---|
2487 | uint16_t au16[8];
|
---|
2488 | /** 32-bit view. */
|
---|
2489 | uint32_t au32[4];
|
---|
2490 | /** 64-bit view. */
|
---|
2491 | uint64_t au64[2];
|
---|
2492 | /** 128-bit view. (yeah, very helpful) */
|
---|
2493 | uint128_t au128[1];
|
---|
2494 | } X86FPUREG;
|
---|
2495 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2496 | AssertCompileSize(X86FPUREG, 16);
|
---|
2497 | #endif
|
---|
2498 | /** Pointer to a FPU register. */
|
---|
2499 | typedef X86FPUREG *PX86FPUREG;
|
---|
2500 | /** Pointer to a const FPU register. */
|
---|
2501 | typedef X86FPUREG const *PCX86FPUREG;
|
---|
2502 |
|
---|
2503 | /**
|
---|
2504 | * XMM register union.
|
---|
2505 | */
|
---|
2506 | typedef union X86XMMREG
|
---|
2507 | {
|
---|
2508 | /** XMM Register view *. */
|
---|
2509 | uint128_t xmm;
|
---|
2510 | /** 8-bit view. */
|
---|
2511 | uint8_t au8[16];
|
---|
2512 | /** 16-bit view. */
|
---|
2513 | uint16_t au16[8];
|
---|
2514 | /** 32-bit view. */
|
---|
2515 | uint32_t au32[4];
|
---|
2516 | /** 64-bit view. */
|
---|
2517 | uint64_t au64[2];
|
---|
2518 | /** 128-bit view. (yeah, very helpful) */
|
---|
2519 | uint128_t au128[1];
|
---|
2520 | } X86XMMREG;
|
---|
2521 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2522 | AssertCompileSize(X86XMMREG, 16);
|
---|
2523 | #endif
|
---|
2524 | /** Pointer to an XMM register state. */
|
---|
2525 | typedef X86XMMREG *PX86XMMREG;
|
---|
2526 | /** Pointer to a const XMM register state. */
|
---|
2527 | typedef X86XMMREG const *PCX86XMMREG;
|
---|
2528 |
|
---|
2529 | /**
|
---|
2530 | * YMM register union.
|
---|
2531 | */
|
---|
2532 | typedef union X86YMMREG
|
---|
2533 | {
|
---|
2534 | /** 8-bit view. */
|
---|
2535 | uint8_t au8[32];
|
---|
2536 | /** 16-bit view. */
|
---|
2537 | uint16_t au16[16];
|
---|
2538 | /** 32-bit view. */
|
---|
2539 | uint32_t au32[8];
|
---|
2540 | /** 64-bit view. */
|
---|
2541 | uint64_t au64[4];
|
---|
2542 | /** 128-bit view. (yeah, very helpful) */
|
---|
2543 | uint128_t au128[2];
|
---|
2544 | /** XMM sub register view. */
|
---|
2545 | X86XMMREG aXmm[2];
|
---|
2546 | } X86YMMREG;
|
---|
2547 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2548 | AssertCompileSize(X86YMMREG, 32);
|
---|
2549 | #endif
|
---|
2550 | /** Pointer to an YMM register state. */
|
---|
2551 | typedef X86YMMREG *PX86YMMREG;
|
---|
2552 | /** Pointer to a const YMM register state. */
|
---|
2553 | typedef X86YMMREG const *PCX86YMMREG;
|
---|
2554 |
|
---|
2555 | /**
|
---|
2556 | * ZMM register union.
|
---|
2557 | */
|
---|
2558 | typedef union X86ZMMREG
|
---|
2559 | {
|
---|
2560 | /** 8-bit view. */
|
---|
2561 | uint8_t au8[64];
|
---|
2562 | /** 16-bit view. */
|
---|
2563 | uint16_t au16[32];
|
---|
2564 | /** 32-bit view. */
|
---|
2565 | uint32_t au32[16];
|
---|
2566 | /** 64-bit view. */
|
---|
2567 | uint64_t au64[8];
|
---|
2568 | /** 128-bit view. (yeah, very helpful) */
|
---|
2569 | uint128_t au128[4];
|
---|
2570 | /** XMM sub register view. */
|
---|
2571 | X86XMMREG aXmm[4];
|
---|
2572 | /** YMM sub register view. */
|
---|
2573 | X86YMMREG aYmm[2];
|
---|
2574 | } X86ZMMREG;
|
---|
2575 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2576 | AssertCompileSize(X86ZMMREG, 64);
|
---|
2577 | #endif
|
---|
2578 | /** Pointer to an ZMM register state. */
|
---|
2579 | typedef X86ZMMREG *PX86ZMMREG;
|
---|
2580 | /** Pointer to a const ZMM register state. */
|
---|
2581 | typedef X86ZMMREG const *PCX86ZMMREG;
|
---|
2582 |
|
---|
2583 |
|
---|
2584 | /**
|
---|
2585 | * 32-bit FPU state (aka FSAVE/FRSTOR Memory Region).
|
---|
2586 | * @todo verify this...
|
---|
2587 | */
|
---|
2588 | #pragma pack(1)
|
---|
2589 | typedef struct X86FPUSTATE
|
---|
2590 | {
|
---|
2591 | /** 0x00 - Control word. */
|
---|
2592 | uint16_t FCW;
|
---|
2593 | /** 0x02 - Alignment word */
|
---|
2594 | uint16_t Dummy1;
|
---|
2595 | /** 0x04 - Status word. */
|
---|
2596 | uint16_t FSW;
|
---|
2597 | /** 0x06 - Alignment word */
|
---|
2598 | uint16_t Dummy2;
|
---|
2599 | /** 0x08 - Tag word */
|
---|
2600 | uint16_t FTW;
|
---|
2601 | /** 0x0a - Alignment word */
|
---|
2602 | uint16_t Dummy3;
|
---|
2603 |
|
---|
2604 | /** 0x0c - Instruction pointer. */
|
---|
2605 | uint32_t FPUIP;
|
---|
2606 | /** 0x10 - Code selector. */
|
---|
2607 | uint16_t CS;
|
---|
2608 | /** 0x12 - Opcode. */
|
---|
2609 | uint16_t FOP;
|
---|
2610 | /** 0x14 - FOO. */
|
---|
2611 | uint32_t FPUOO;
|
---|
2612 | /** 0x18 - FOS. */
|
---|
2613 | uint32_t FPUOS;
|
---|
2614 | /** 0x1c - FPU register. */
|
---|
2615 | X86FPUREG regs[8];
|
---|
2616 | } X86FPUSTATE;
|
---|
2617 | #pragma pack()
|
---|
2618 | /** Pointer to a FPU state. */
|
---|
2619 | typedef X86FPUSTATE *PX86FPUSTATE;
|
---|
2620 | /** Pointer to a const FPU state. */
|
---|
2621 | typedef const X86FPUSTATE *PCX86FPUSTATE;
|
---|
2622 |
|
---|
2623 | /**
|
---|
2624 | * FPU Extended state (aka FXSAVE/FXRSTORE Memory Region).
|
---|
2625 | */
|
---|
2626 | #pragma pack(1)
|
---|
2627 | typedef struct X86FXSTATE
|
---|
2628 | {
|
---|
2629 | /** 0x00 - Control word. */
|
---|
2630 | uint16_t FCW;
|
---|
2631 | /** 0x02 - Status word. */
|
---|
2632 | uint16_t FSW;
|
---|
2633 | /** 0x04 - Tag word. (The upper byte is always zero.) */
|
---|
2634 | uint16_t FTW;
|
---|
2635 | /** 0x06 - Opcode. */
|
---|
2636 | uint16_t FOP;
|
---|
2637 | /** 0x08 - Instruction pointer. */
|
---|
2638 | uint32_t FPUIP;
|
---|
2639 | /** 0x0c - Code selector. */
|
---|
2640 | uint16_t CS;
|
---|
2641 | uint16_t Rsrvd1;
|
---|
2642 | /** 0x10 - Data pointer. */
|
---|
2643 | uint32_t FPUDP;
|
---|
2644 | /** 0x14 - Data segment */
|
---|
2645 | uint16_t DS;
|
---|
2646 | /** 0x16 */
|
---|
2647 | uint16_t Rsrvd2;
|
---|
2648 | /** 0x18 */
|
---|
2649 | uint32_t MXCSR;
|
---|
2650 | /** 0x1c */
|
---|
2651 | uint32_t MXCSR_MASK;
|
---|
2652 | /** 0x20 - FPU registers. */
|
---|
2653 | X86FPUREG aRegs[8];
|
---|
2654 | /** 0xA0 - XMM registers - 8 registers in 32 bits mode, 16 in long mode. */
|
---|
2655 | X86XMMREG aXMM[16];
|
---|
2656 | /* - offset 416 - */
|
---|
2657 | uint32_t au32RsrvdRest[(464 - 416) / sizeof(uint32_t)];
|
---|
2658 | /* - offset 464 - Software usable reserved bits. */
|
---|
2659 | uint32_t au32RsrvdForSoftware[(512 - 464) / sizeof(uint32_t)];
|
---|
2660 | } X86FXSTATE;
|
---|
2661 | #pragma pack()
|
---|
2662 | /** Pointer to a FPU Extended state. */
|
---|
2663 | typedef X86FXSTATE *PX86FXSTATE;
|
---|
2664 | /** Pointer to a const FPU Extended state. */
|
---|
2665 | typedef const X86FXSTATE *PCX86FXSTATE;
|
---|
2666 |
|
---|
2667 | /** Offset for software usable reserved bits (464:511) where we store a 32-bit
|
---|
2668 | * magic. Don't forget to update x86.mac if you change this! */
|
---|
2669 | #define X86_OFF_FXSTATE_RSVD 0x1d0
|
---|
2670 | /** The 32-bit magic used to recognize if this a 32-bit FPU state. Don't
|
---|
2671 | * forget to update x86.mac if you change this!
|
---|
2672 | * @todo r=bird: This has nothing what-so-ever to do here.... */
|
---|
2673 | #define X86_FXSTATE_RSVD_32BIT_MAGIC 0x32b3232b
|
---|
2674 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2675 | AssertCompileSize(X86FXSTATE, 512);
|
---|
2676 | AssertCompileMemberOffset(X86FXSTATE, au32RsrvdForSoftware, X86_OFF_FXSTATE_RSVD);
|
---|
2677 | #endif
|
---|
2678 |
|
---|
2679 | /** @name FPU status word flags.
|
---|
2680 | * @{ */
|
---|
2681 | /** Exception Flag: Invalid operation. */
|
---|
2682 | #define X86_FSW_IE RT_BIT_32(0)
|
---|
2683 | /** Exception Flag: Denormalized operand. */
|
---|
2684 | #define X86_FSW_DE RT_BIT_32(1)
|
---|
2685 | /** Exception Flag: Zero divide. */
|
---|
2686 | #define X86_FSW_ZE RT_BIT_32(2)
|
---|
2687 | /** Exception Flag: Overflow. */
|
---|
2688 | #define X86_FSW_OE RT_BIT_32(3)
|
---|
2689 | /** Exception Flag: Underflow. */
|
---|
2690 | #define X86_FSW_UE RT_BIT_32(4)
|
---|
2691 | /** Exception Flag: Precision. */
|
---|
2692 | #define X86_FSW_PE RT_BIT_32(5)
|
---|
2693 | /** Stack fault. */
|
---|
2694 | #define X86_FSW_SF RT_BIT_32(6)
|
---|
2695 | /** Error summary status. */
|
---|
2696 | #define X86_FSW_ES RT_BIT_32(7)
|
---|
2697 | /** Mask of exceptions flags, excluding the summary bit. */
|
---|
2698 | #define X86_FSW_XCPT_MASK UINT16_C(0x007f)
|
---|
2699 | /** Mask of exceptions flags, including the summary bit. */
|
---|
2700 | #define X86_FSW_XCPT_ES_MASK UINT16_C(0x00ff)
|
---|
2701 | /** Condition code 0. */
|
---|
2702 | #define X86_FSW_C0 RT_BIT_32(8)
|
---|
2703 | /** Condition code 1. */
|
---|
2704 | #define X86_FSW_C1 RT_BIT_32(9)
|
---|
2705 | /** Condition code 2. */
|
---|
2706 | #define X86_FSW_C2 RT_BIT_32(10)
|
---|
2707 | /** Top of the stack mask. */
|
---|
2708 | #define X86_FSW_TOP_MASK UINT16_C(0x3800)
|
---|
2709 | /** TOP shift value. */
|
---|
2710 | #define X86_FSW_TOP_SHIFT 11
|
---|
2711 | /** Mask for getting TOP value after shifting it right. */
|
---|
2712 | #define X86_FSW_TOP_SMASK UINT16_C(0x0007)
|
---|
2713 | /** Get the TOP value. */
|
---|
2714 | #define X86_FSW_TOP_GET(a_uFsw) (((a_uFsw) >> X86_FSW_TOP_SHIFT) & X86_FSW_TOP_SMASK)
|
---|
2715 | /** Condition code 3. */
|
---|
2716 | #define X86_FSW_C3 RT_BIT_32(14)
|
---|
2717 | /** Mask of exceptions flags, including the summary bit. */
|
---|
2718 | #define X86_FSW_C_MASK UINT16_C(0x4700)
|
---|
2719 | /** FPU busy. */
|
---|
2720 | #define X86_FSW_B RT_BIT_32(15)
|
---|
2721 | /** @} */
|
---|
2722 |
|
---|
2723 |
|
---|
2724 | /** @name FPU control word flags.
|
---|
2725 | * @{ */
|
---|
2726 | /** Exception Mask: Invalid operation. */
|
---|
2727 | #define X86_FCW_IM RT_BIT_32(0)
|
---|
2728 | /** Exception Mask: Denormalized operand. */
|
---|
2729 | #define X86_FCW_DM RT_BIT_32(1)
|
---|
2730 | /** Exception Mask: Zero divide. */
|
---|
2731 | #define X86_FCW_ZM RT_BIT_32(2)
|
---|
2732 | /** Exception Mask: Overflow. */
|
---|
2733 | #define X86_FCW_OM RT_BIT_32(3)
|
---|
2734 | /** Exception Mask: Underflow. */
|
---|
2735 | #define X86_FCW_UM RT_BIT_32(4)
|
---|
2736 | /** Exception Mask: Precision. */
|
---|
2737 | #define X86_FCW_PM RT_BIT_32(5)
|
---|
2738 | /** Mask all exceptions, the value typically loaded (by for instance fninit).
|
---|
2739 | * @remarks This includes reserved bit 6. */
|
---|
2740 | #define X86_FCW_MASK_ALL UINT16_C(0x007f)
|
---|
2741 | /** Mask all exceptions. Same as X86_FSW_XCPT_MASK. */
|
---|
2742 | #define X86_FCW_XCPT_MASK UINT16_C(0x003f)
|
---|
2743 | /** Precision control mask. */
|
---|
2744 | #define X86_FCW_PC_MASK UINT16_C(0x0300)
|
---|
2745 | /** Precision control: 24-bit. */
|
---|
2746 | #define X86_FCW_PC_24 UINT16_C(0x0000)
|
---|
2747 | /** Precision control: Reserved. */
|
---|
2748 | #define X86_FCW_PC_RSVD UINT16_C(0x0100)
|
---|
2749 | /** Precision control: 53-bit. */
|
---|
2750 | #define X86_FCW_PC_53 UINT16_C(0x0200)
|
---|
2751 | /** Precision control: 64-bit. */
|
---|
2752 | #define X86_FCW_PC_64 UINT16_C(0x0300)
|
---|
2753 | /** Rounding control mask. */
|
---|
2754 | #define X86_FCW_RC_MASK UINT16_C(0x0c00)
|
---|
2755 | /** Rounding control: To nearest. */
|
---|
2756 | #define X86_FCW_RC_NEAREST UINT16_C(0x0000)
|
---|
2757 | /** Rounding control: Down. */
|
---|
2758 | #define X86_FCW_RC_DOWN UINT16_C(0x0400)
|
---|
2759 | /** Rounding control: Up. */
|
---|
2760 | #define X86_FCW_RC_UP UINT16_C(0x0800)
|
---|
2761 | /** Rounding control: Towards zero. */
|
---|
2762 | #define X86_FCW_RC_ZERO UINT16_C(0x0c00)
|
---|
2763 | /** Bits which should be zero, apparently. */
|
---|
2764 | #define X86_FCW_ZERO_MASK UINT16_C(0xf080)
|
---|
2765 | /** @} */
|
---|
2766 |
|
---|
2767 | /** @name SSE MXCSR
|
---|
2768 | * @{ */
|
---|
2769 | /** Exception Flag: Invalid operation. */
|
---|
2770 | #define X86_MXSCR_IE RT_BIT_32(0)
|
---|
2771 | /** Exception Flag: Denormalized operand. */
|
---|
2772 | #define X86_MXSCR_DE RT_BIT_32(1)
|
---|
2773 | /** Exception Flag: Zero divide. */
|
---|
2774 | #define X86_MXSCR_ZE RT_BIT_32(2)
|
---|
2775 | /** Exception Flag: Overflow. */
|
---|
2776 | #define X86_MXSCR_OE RT_BIT_32(3)
|
---|
2777 | /** Exception Flag: Underflow. */
|
---|
2778 | #define X86_MXSCR_UE RT_BIT_32(4)
|
---|
2779 | /** Exception Flag: Precision. */
|
---|
2780 | #define X86_MXSCR_PE RT_BIT_32(5)
|
---|
2781 |
|
---|
2782 | /** Denormals are zero. */
|
---|
2783 | #define X86_MXSCR_DAZ RT_BIT_32(6)
|
---|
2784 |
|
---|
2785 | /** Exception Mask: Invalid operation. */
|
---|
2786 | #define X86_MXSCR_IM RT_BIT_32(7)
|
---|
2787 | /** Exception Mask: Denormalized operand. */
|
---|
2788 | #define X86_MXSCR_DM RT_BIT_32(8)
|
---|
2789 | /** Exception Mask: Zero divide. */
|
---|
2790 | #define X86_MXSCR_ZM RT_BIT_32(9)
|
---|
2791 | /** Exception Mask: Overflow. */
|
---|
2792 | #define X86_MXSCR_OM RT_BIT_32(10)
|
---|
2793 | /** Exception Mask: Underflow. */
|
---|
2794 | #define X86_MXSCR_UM RT_BIT_32(11)
|
---|
2795 | /** Exception Mask: Precision. */
|
---|
2796 | #define X86_MXSCR_PM RT_BIT_32(12)
|
---|
2797 |
|
---|
2798 | /** Rounding control mask. */
|
---|
2799 | #define X86_MXSCR_RC_MASK UINT16_C(0x6000)
|
---|
2800 | /** Rounding control: To nearest. */
|
---|
2801 | #define X86_MXSCR_RC_NEAREST UINT16_C(0x0000)
|
---|
2802 | /** Rounding control: Down. */
|
---|
2803 | #define X86_MXSCR_RC_DOWN UINT16_C(0x2000)
|
---|
2804 | /** Rounding control: Up. */
|
---|
2805 | #define X86_MXSCR_RC_UP UINT16_C(0x4000)
|
---|
2806 | /** Rounding control: Towards zero. */
|
---|
2807 | #define X86_MXSCR_RC_ZERO UINT16_C(0x6000)
|
---|
2808 |
|
---|
2809 | /** Flush-to-zero for masked underflow. */
|
---|
2810 | #define X86_MXSCR_FZ RT_BIT_32(15)
|
---|
2811 |
|
---|
2812 | /** Misaligned Exception Mask (AMD MISALIGNSSE). */
|
---|
2813 | #define X86_MXSCR_MM RT_BIT_32(17)
|
---|
2814 | /** @} */
|
---|
2815 |
|
---|
2816 | /**
|
---|
2817 | * XSAVE header.
|
---|
2818 | */
|
---|
2819 | typedef struct X86XSAVEHDR
|
---|
2820 | {
|
---|
2821 | /** XTATE_BV - Bitmap indicating whether a component is in the state. */
|
---|
2822 | uint64_t bmXState;
|
---|
2823 | /** XCOMP_BC - Bitmap used by instructions applying structure compaction. */
|
---|
2824 | uint64_t bmXComp;
|
---|
2825 | /** Reserved for furture extensions, probably MBZ. */
|
---|
2826 | uint64_t au64Reserved[6];
|
---|
2827 | } X86XSAVEHDR;
|
---|
2828 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2829 | AssertCompileSize(X86XSAVEHDR, 64);
|
---|
2830 | #endif
|
---|
2831 | /** Pointer to an XSAVE header. */
|
---|
2832 | typedef X86XSAVEHDR *PX86XSAVEHDR;
|
---|
2833 | /** Pointer to a const XSAVE header. */
|
---|
2834 | typedef X86XSAVEHDR const *PCX86XSAVEHDR;
|
---|
2835 |
|
---|
2836 |
|
---|
2837 | /**
|
---|
2838 | * The high 128-bit YMM register state (XSAVE_C_YMM).
|
---|
2839 | * (The lower 128-bits being in X86FXSTATE.)
|
---|
2840 | */
|
---|
2841 | typedef struct X86XSAVEYMMHI
|
---|
2842 | {
|
---|
2843 | /** 16 registers in 64-bit mode, 8 in 32-bit mode. */
|
---|
2844 | X86XMMREG aYmmHi[16];
|
---|
2845 | } X86XSAVEYMMHI;
|
---|
2846 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2847 | AssertCompileSize(X86XSAVEYMMHI, 256);
|
---|
2848 | #endif
|
---|
2849 | /** Pointer to a high 128-bit YMM register state. */
|
---|
2850 | typedef X86XSAVEYMMHI *PX86XSAVEYMMHI;
|
---|
2851 | /** Pointer to a const high 128-bit YMM register state. */
|
---|
2852 | typedef X86XSAVEYMMHI const *PCX86XSAVEYMMHI;
|
---|
2853 |
|
---|
2854 | /**
|
---|
2855 | * Intel MPX bound registers state (XSAVE_C_BNDREGS).
|
---|
2856 | */
|
---|
2857 | typedef struct X86XSAVEBNDREGS
|
---|
2858 | {
|
---|
2859 | /** Array of registers (BND0...BND3). */
|
---|
2860 | struct
|
---|
2861 | {
|
---|
2862 | /** Lower bound. */
|
---|
2863 | uint64_t uLowerBound;
|
---|
2864 | /** Upper bound. */
|
---|
2865 | uint64_t uUpperBound;
|
---|
2866 | } aRegs[4];
|
---|
2867 | } X86XSAVEBNDREGS;
|
---|
2868 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2869 | AssertCompileSize(X86XSAVEBNDREGS, 64);
|
---|
2870 | #endif
|
---|
2871 | /** Pointer to a MPX bound register state. */
|
---|
2872 | typedef X86XSAVEBNDREGS *PX86XSAVEBNDREGS;
|
---|
2873 | /** Pointer to a const MPX bound register state. */
|
---|
2874 | typedef X86XSAVEBNDREGS const *PCX86XSAVEBNDREGS;
|
---|
2875 |
|
---|
2876 | /**
|
---|
2877 | * Intel MPX bound config and status register state (XSAVE_C_BNDCSR).
|
---|
2878 | */
|
---|
2879 | typedef struct X86XSAVEBNDCFG
|
---|
2880 | {
|
---|
2881 | uint64_t fConfig;
|
---|
2882 | uint64_t fStatus;
|
---|
2883 | } X86XSAVEBNDCFG;
|
---|
2884 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2885 | AssertCompileSize(X86XSAVEBNDCFG, 16);
|
---|
2886 | #endif
|
---|
2887 | /** Pointer to a MPX bound config and status register state. */
|
---|
2888 | typedef X86XSAVEBNDCFG *PX86XSAVEBNDCFG;
|
---|
2889 | /** Pointer to a const MPX bound config and status register state. */
|
---|
2890 | typedef X86XSAVEBNDCFG *PCX86XSAVEBNDCFG;
|
---|
2891 |
|
---|
2892 | /**
|
---|
2893 | * AVX-512 opmask state (XSAVE_C_OPMASK).
|
---|
2894 | */
|
---|
2895 | typedef struct X86XSAVEOPMASK
|
---|
2896 | {
|
---|
2897 | /** The K0..K7 values. */
|
---|
2898 | uint64_t aKRegs[8];
|
---|
2899 | } X86XSAVEOPMASK;
|
---|
2900 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2901 | AssertCompileSize(X86XSAVEOPMASK, 64);
|
---|
2902 | #endif
|
---|
2903 | /** Pointer to a AVX-512 opmask state. */
|
---|
2904 | typedef X86XSAVEOPMASK *PX86XSAVEOPMASK;
|
---|
2905 | /** Pointer to a const AVX-512 opmask state. */
|
---|
2906 | typedef X86XSAVEOPMASK const *PCX86XSAVEOPMASK;
|
---|
2907 |
|
---|
2908 | /**
|
---|
2909 | * ZMM0-15 upper 256 bits introduced in AVX-512 (XSAVE_C_ZMM_HI256).
|
---|
2910 | */
|
---|
2911 | typedef struct X86XSAVEZMMHI256
|
---|
2912 | {
|
---|
2913 | /** Upper 256-bits of ZMM0-15. */
|
---|
2914 | X86YMMREG aHi256Regs[16];
|
---|
2915 | } X86XSAVEZMMHI256;
|
---|
2916 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2917 | AssertCompileSize(X86XSAVEZMMHI256, 512);
|
---|
2918 | #endif
|
---|
2919 | /** Pointer to a state comprising the upper 256-bits of ZMM0-15. */
|
---|
2920 | typedef X86XSAVEZMMHI256 *PX86XSAVEZMMHI256;
|
---|
2921 | /** Pointer to a const state comprising the upper 256-bits of ZMM0-15. */
|
---|
2922 | typedef X86XSAVEZMMHI256 const *PCX86XSAVEZMMHI256;
|
---|
2923 |
|
---|
2924 | /**
|
---|
2925 | * ZMM16-31 register state introduced in AVX-512 (XSAVE_C_ZMM_16HI).
|
---|
2926 | */
|
---|
2927 | typedef struct X86XSAVEZMM16HI
|
---|
2928 | {
|
---|
2929 | /** ZMM16 thru ZMM31. */
|
---|
2930 | X86ZMMREG aRegs[16];
|
---|
2931 | } X86XSAVEZMM16HI;
|
---|
2932 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2933 | AssertCompileSize(X86XSAVEZMM16HI, 1024);
|
---|
2934 | #endif
|
---|
2935 | /** Pointer to a state comprising ZMM16-32. */
|
---|
2936 | typedef X86XSAVEZMM16HI *PX86XSAVEZMM16HI;
|
---|
2937 | /** Pointer to a const state comprising ZMM16-32. */
|
---|
2938 | typedef X86XSAVEZMM16HI const *PCX86XSAVEZMM16HI;
|
---|
2939 |
|
---|
2940 | /**
|
---|
2941 | * AMD Light weight profiling state (XSAVE_C_LWP).
|
---|
2942 | *
|
---|
2943 | * We probably won't play with this as AMD seems to be dropping from their "zen"
|
---|
2944 | * processor micro architecture.
|
---|
2945 | */
|
---|
2946 | typedef struct X86XSAVELWP
|
---|
2947 | {
|
---|
2948 | /** Details when needed. */
|
---|
2949 | uint64_t auLater[128/8];
|
---|
2950 | } X86XSAVELWP;
|
---|
2951 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
2952 | AssertCompileSize(X86XSAVELWP, 128);
|
---|
2953 | #endif
|
---|
2954 |
|
---|
2955 |
|
---|
2956 | /**
|
---|
2957 | * x86 FPU/SSE/AVX/XXXX state.
|
---|
2958 | *
|
---|
2959 | * Please bump DBGFCORE_FMT_VERSION by 1 in dbgfcorefmt.h if you make any
|
---|
2960 | * changes to this structure.
|
---|
2961 | */
|
---|
2962 | typedef struct X86XSAVEAREA
|
---|
2963 | {
|
---|
2964 | /** The x87 and SSE region (or legacy region if you like). */
|
---|
2965 | X86FXSTATE x87;
|
---|
2966 | /** The XSAVE header. */
|
---|
2967 | X86XSAVEHDR Hdr;
|
---|
2968 | /** Beyond the header, there isn't really a fixed layout, but we can
|
---|
2969 | generally assume the YMM (AVX) register extensions are present and
|
---|
2970 | follows immediately. */
|
---|
2971 | union
|
---|
2972 | {
|
---|
2973 | /** This is a typical layout on intel CPUs (good for debuggers). */
|
---|
2974 | struct
|
---|
2975 | {
|
---|
2976 | X86XSAVEYMMHI YmmHi;
|
---|
2977 | X86XSAVEBNDREGS BndRegs;
|
---|
2978 | X86XSAVEBNDCFG BndCfg;
|
---|
2979 | uint8_t abFudgeToMatchDocs[0xB0];
|
---|
2980 | X86XSAVEOPMASK Opmask;
|
---|
2981 | X86XSAVEZMMHI256 ZmmHi256;
|
---|
2982 | X86XSAVEZMM16HI Zmm16Hi;
|
---|
2983 | } Intel;
|
---|
2984 |
|
---|
2985 | /** This is a typical layout on AMD Bulldozer type CPUs (good for debuggers). */
|
---|
2986 | struct
|
---|
2987 | {
|
---|
2988 | X86XSAVEYMMHI YmmHi;
|
---|
2989 | X86XSAVELWP Lwp;
|
---|
2990 | } AmdBd;
|
---|
2991 |
|
---|
2992 | /** To enbling static deployments that have a reasonable chance of working for
|
---|
2993 | * the next 3-6 CPU generations without running short on space, we allocate a
|
---|
2994 | * lot of extra space here, making the structure a round 8KB in size. This
|
---|
2995 | * leaves us 7616 bytes for extended state. The skylake xeons are likely to use
|
---|
2996 | * 2112 of these, leaving us with 5504 bytes for future Intel generations. */
|
---|
2997 | uint8_t ab[8192 - 512 - 64];
|
---|
2998 | } u;
|
---|
2999 | } X86XSAVEAREA;
|
---|
3000 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3001 | AssertCompileSize(X86XSAVEAREA, 8192);
|
---|
3002 | AssertCompileMemberSize(X86XSAVEAREA, u.Intel, 0x840 /*2112 => total 0xa80 (2688) */);
|
---|
3003 | AssertCompileMemberOffset(X86XSAVEAREA, Hdr, 0x200);
|
---|
3004 | AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.YmmHi, 0x240);
|
---|
3005 | AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.BndRegs, 0x340);
|
---|
3006 | AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.BndCfg, 0x380);
|
---|
3007 | AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.Opmask, 0x440 /* 1088 */);
|
---|
3008 | AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.ZmmHi256, 0x480 /* 1152 */);
|
---|
3009 | AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.Zmm16Hi, 0x680 /* 1664 */);
|
---|
3010 | #endif
|
---|
3011 | /** Pointer to a XSAVE area. */
|
---|
3012 | typedef X86XSAVEAREA *PX86XSAVEAREA;
|
---|
3013 | /** Pointer to a const XSAVE area. */
|
---|
3014 | typedef X86XSAVEAREA const *PCX86XSAVEAREA;
|
---|
3015 |
|
---|
3016 |
|
---|
3017 | /** @name XSAVE_C_XXX - XSAVE State Components Bits.
|
---|
3018 | * @{ */
|
---|
3019 | /** Bit 0 - x87 - Legacy FPU state (bit number) */
|
---|
3020 | #define XSAVE_C_X87_BIT 0
|
---|
3021 | /** Bit 0 - x87 - Legacy FPU state. */
|
---|
3022 | #define XSAVE_C_X87 RT_BIT_64(XSAVE_C_X87_BIT)
|
---|
3023 | /** Bit 1 - SSE - 128-bit SSE state (bit number). */
|
---|
3024 | #define XSAVE_C_SSE_BIT 1
|
---|
3025 | /** Bit 1 - SSE - 128-bit SSE state. */
|
---|
3026 | #define XSAVE_C_SSE RT_BIT_64(XSAVE_C_SSE_BIT)
|
---|
3027 | /** Bit 2 - YMM_Hi128 - Upper 128 bits of YMM0-15 (AVX) (bit number). */
|
---|
3028 | #define XSAVE_C_YMM_BIT 2
|
---|
3029 | /** Bit 2 - YMM_Hi128 - Upper 128 bits of YMM0-15 (AVX). */
|
---|
3030 | #define XSAVE_C_YMM RT_BIT_64(XSAVE_C_YMM_BIT)
|
---|
3031 | /** Bit 3 - BNDREGS - MPX bound register state (bit number). */
|
---|
3032 | #define XSAVE_C_BNDREGS_BIT 3
|
---|
3033 | /** Bit 3 - BNDREGS - MPX bound register state. */
|
---|
3034 | #define XSAVE_C_BNDREGS RT_BIT_64(XSAVE_C_BNDREGS_BIT)
|
---|
3035 | /** Bit 4 - BNDCSR - MPX bound config and status state (bit number). */
|
---|
3036 | #define XSAVE_C_BNDCSR_BIT 4
|
---|
3037 | /** Bit 4 - BNDCSR - MPX bound config and status state. */
|
---|
3038 | #define XSAVE_C_BNDCSR RT_BIT_64(XSAVE_C_BNDCSR_BIT)
|
---|
3039 | /** Bit 5 - Opmask - opmask state (bit number). */
|
---|
3040 | #define XSAVE_C_OPMASK_BIT 5
|
---|
3041 | /** Bit 5 - Opmask - opmask state. */
|
---|
3042 | #define XSAVE_C_OPMASK RT_BIT_64(XSAVE_C_OPMASK_BIT)
|
---|
3043 | /** Bit 6 - ZMM_Hi256 - Upper 256 bits of ZMM0-15 (AVX-512) (bit number). */
|
---|
3044 | #define XSAVE_C_ZMM_HI256_BIT 6
|
---|
3045 | /** Bit 6 - ZMM_Hi256 - Upper 256 bits of ZMM0-15 (AVX-512). */
|
---|
3046 | #define XSAVE_C_ZMM_HI256 RT_BIT_64(XSAVE_C_ZMM_HI256_BIT)
|
---|
3047 | /** Bit 7 - Hi16_ZMM - 512-bits ZMM16-31 state (AVX-512) (bit number). */
|
---|
3048 | #define XSAVE_C_ZMM_16HI_BIT 7
|
---|
3049 | /** Bit 7 - Hi16_ZMM - 512-bits ZMM16-31 state (AVX-512). */
|
---|
3050 | #define XSAVE_C_ZMM_16HI RT_BIT_64(XSAVE_C_ZMM_16HI_BIT)
|
---|
3051 | /** Bit 9 - PKRU - Protection-key state (bit number). */
|
---|
3052 | #define XSAVE_C_PKRU_BIT 9
|
---|
3053 | /** Bit 9 - PKRU - Protection-key state. */
|
---|
3054 | #define XSAVE_C_PKRU RT_BIT_64(XSAVE_C_PKRU_BIT)
|
---|
3055 | /** Bit 62 - LWP - Lightweight Profiling (AMD) (bit number). */
|
---|
3056 | #define XSAVE_C_LWP_BIT 62
|
---|
3057 | /** Bit 62 - LWP - Lightweight Profiling (AMD). */
|
---|
3058 | #define XSAVE_C_LWP RT_BIT_64(XSAVE_C_LWP_BIT)
|
---|
3059 | /** @} */
|
---|
3060 |
|
---|
3061 |
|
---|
3062 |
|
---|
3063 | /** @name Selector Descriptor
|
---|
3064 | * @{
|
---|
3065 | */
|
---|
3066 |
|
---|
3067 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3068 | /**
|
---|
3069 | * Descriptor attributes (as seen by VT-x).
|
---|
3070 | */
|
---|
3071 | typedef struct X86DESCATTRBITS
|
---|
3072 | {
|
---|
3073 | /** 00 - Segment Type. */
|
---|
3074 | unsigned u4Type : 4;
|
---|
3075 | /** 04 - Descriptor Type. System(=0) or code/data selector */
|
---|
3076 | unsigned u1DescType : 1;
|
---|
3077 | /** 05 - Descriptor Privilege level. */
|
---|
3078 | unsigned u2Dpl : 2;
|
---|
3079 | /** 07 - Flags selector present(=1) or not. */
|
---|
3080 | unsigned u1Present : 1;
|
---|
3081 | /** 08 - Segment limit 16-19. */
|
---|
3082 | unsigned u4LimitHigh : 4;
|
---|
3083 | /** 0c - Available for system software. */
|
---|
3084 | unsigned u1Available : 1;
|
---|
3085 | /** 0d - 32 bits mode: Reserved - 0, long mode: Long Attribute Bit. */
|
---|
3086 | unsigned u1Long : 1;
|
---|
3087 | /** 0e - This flags meaning depends on the segment type. Try make sense out
|
---|
3088 | * of the intel manual yourself. */
|
---|
3089 | unsigned u1DefBig : 1;
|
---|
3090 | /** 0f - Granularity of the limit. If set 4KB granularity is used, if
|
---|
3091 | * clear byte. */
|
---|
3092 | unsigned u1Granularity : 1;
|
---|
3093 | /** 10 - "Unusable" selector, special Intel (VT-x only?) bit. */
|
---|
3094 | unsigned u1Unusable : 1;
|
---|
3095 | } X86DESCATTRBITS;
|
---|
3096 | #endif /* !VBOX_FOR_DTRACE_LIB */
|
---|
3097 |
|
---|
3098 | /** @name X86DESCATTR masks
|
---|
3099 | * @{ */
|
---|
3100 | #define X86DESCATTR_TYPE UINT32_C(0x0000000f)
|
---|
3101 | #define X86DESCATTR_DT UINT32_C(0x00000010)
|
---|
3102 | #define X86DESCATTR_DPL UINT32_C(0x00000060)
|
---|
3103 | #define X86DESCATTR_DPL_SHIFT 5 /**< Shift count for the DPL value. */
|
---|
3104 | #define X86DESCATTR_P UINT32_C(0x00000080)
|
---|
3105 | #define X86DESCATTR_LIMIT_HIGH UINT32_C(0x00000f00)
|
---|
3106 | #define X86DESCATTR_AVL UINT32_C(0x00001000)
|
---|
3107 | #define X86DESCATTR_L UINT32_C(0x00002000)
|
---|
3108 | #define X86DESCATTR_D UINT32_C(0x00004000)
|
---|
3109 | #define X86DESCATTR_G UINT32_C(0x00008000)
|
---|
3110 | #define X86DESCATTR_UNUSABLE UINT32_C(0x00010000)
|
---|
3111 | /** @} */
|
---|
3112 |
|
---|
3113 | #pragma pack(1)
|
---|
3114 | typedef union X86DESCATTR
|
---|
3115 | {
|
---|
3116 | /** Unsigned integer view. */
|
---|
3117 | uint32_t u;
|
---|
3118 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3119 | /** Normal view. */
|
---|
3120 | X86DESCATTRBITS n;
|
---|
3121 | #endif
|
---|
3122 | } X86DESCATTR;
|
---|
3123 | #pragma pack()
|
---|
3124 | /** Pointer to descriptor attributes. */
|
---|
3125 | typedef X86DESCATTR *PX86DESCATTR;
|
---|
3126 | /** Pointer to const descriptor attributes. */
|
---|
3127 | typedef const X86DESCATTR *PCX86DESCATTR;
|
---|
3128 |
|
---|
3129 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3130 |
|
---|
3131 | /**
|
---|
3132 | * Generic descriptor table entry
|
---|
3133 | */
|
---|
3134 | #pragma pack(1)
|
---|
3135 | typedef struct X86DESCGENERIC
|
---|
3136 | {
|
---|
3137 | /** 00 - Limit - Low word. */
|
---|
3138 | unsigned u16LimitLow : 16;
|
---|
3139 | /** 10 - Base address - low word.
|
---|
3140 | * Don't try set this to 24 because MSC is doing stupid things then. */
|
---|
3141 | unsigned u16BaseLow : 16;
|
---|
3142 | /** 20 - Base address - first 8 bits of high word. */
|
---|
3143 | unsigned u8BaseHigh1 : 8;
|
---|
3144 | /** 28 - Segment Type. */
|
---|
3145 | unsigned u4Type : 4;
|
---|
3146 | /** 2c - Descriptor Type. System(=0) or code/data selector */
|
---|
3147 | unsigned u1DescType : 1;
|
---|
3148 | /** 2d - Descriptor Privilege level. */
|
---|
3149 | unsigned u2Dpl : 2;
|
---|
3150 | /** 2f - Flags selector present(=1) or not. */
|
---|
3151 | unsigned u1Present : 1;
|
---|
3152 | /** 30 - Segment limit 16-19. */
|
---|
3153 | unsigned u4LimitHigh : 4;
|
---|
3154 | /** 34 - Available for system software. */
|
---|
3155 | unsigned u1Available : 1;
|
---|
3156 | /** 35 - 32 bits mode: Reserved - 0, long mode: Long Attribute Bit. */
|
---|
3157 | unsigned u1Long : 1;
|
---|
3158 | /** 36 - This flags meaning depends on the segment type. Try make sense out
|
---|
3159 | * of the intel manual yourself. */
|
---|
3160 | unsigned u1DefBig : 1;
|
---|
3161 | /** 37 - Granularity of the limit. If set 4KB granularity is used, if
|
---|
3162 | * clear byte. */
|
---|
3163 | unsigned u1Granularity : 1;
|
---|
3164 | /** 38 - Base address - highest 8 bits. */
|
---|
3165 | unsigned u8BaseHigh2 : 8;
|
---|
3166 | } X86DESCGENERIC;
|
---|
3167 | #pragma pack()
|
---|
3168 | /** Pointer to a generic descriptor entry. */
|
---|
3169 | typedef X86DESCGENERIC *PX86DESCGENERIC;
|
---|
3170 | /** Pointer to a const generic descriptor entry. */
|
---|
3171 | typedef const X86DESCGENERIC *PCX86DESCGENERIC;
|
---|
3172 |
|
---|
3173 | /** @name Bit offsets of X86DESCGENERIC members.
|
---|
3174 | * @{*/
|
---|
3175 | #define X86DESCGENERIC_BIT_OFF_LIMIT_LOW (0) /**< Bit offset of X86DESCGENERIC::u16LimitLow. */
|
---|
3176 | #define X86DESCGENERIC_BIT_OFF_BASE_LOW (16) /**< Bit offset of X86DESCGENERIC::u16BaseLow. */
|
---|
3177 | #define X86DESCGENERIC_BIT_OFF_BASE_HIGH1 (32) /**< Bit offset of X86DESCGENERIC::u8BaseHigh1. */
|
---|
3178 | #define X86DESCGENERIC_BIT_OFF_TYPE (40) /**< Bit offset of X86DESCGENERIC::u4Type. */
|
---|
3179 | #define X86DESCGENERIC_BIT_OFF_DESC_TYPE (44) /**< Bit offset of X86DESCGENERIC::u1DescType. */
|
---|
3180 | #define X86DESCGENERIC_BIT_OFF_DPL (45) /**< Bit offset of X86DESCGENERIC::u2Dpl. */
|
---|
3181 | #define X86DESCGENERIC_BIT_OFF_PRESENT (47) /**< Bit offset of X86DESCGENERIC::uu1Present. */
|
---|
3182 | #define X86DESCGENERIC_BIT_OFF_LIMIT_HIGH (48) /**< Bit offset of X86DESCGENERIC::u4LimitHigh. */
|
---|
3183 | #define X86DESCGENERIC_BIT_OFF_AVAILABLE (52) /**< Bit offset of X86DESCGENERIC::u1Available. */
|
---|
3184 | #define X86DESCGENERIC_BIT_OFF_LONG (53) /**< Bit offset of X86DESCGENERIC::u1Long. */
|
---|
3185 | #define X86DESCGENERIC_BIT_OFF_DEF_BIG (54) /**< Bit offset of X86DESCGENERIC::u1DefBig. */
|
---|
3186 | #define X86DESCGENERIC_BIT_OFF_GRANULARITY (55) /**< Bit offset of X86DESCGENERIC::u1Granularity. */
|
---|
3187 | #define X86DESCGENERIC_BIT_OFF_BASE_HIGH2 (56) /**< Bit offset of X86DESCGENERIC::u8BaseHigh2. */
|
---|
3188 | /** @} */
|
---|
3189 |
|
---|
3190 |
|
---|
3191 | /** @name LAR mask
|
---|
3192 | * @{ */
|
---|
3193 | #define X86LAR_F_TYPE UINT16_C( 0x0f00)
|
---|
3194 | #define X86LAR_F_DT UINT16_C( 0x1000)
|
---|
3195 | #define X86LAR_F_DPL UINT16_C( 0x6000)
|
---|
3196 | #define X86LAR_F_DPL_SHIFT 13 /**< Shift count for the DPL value. */
|
---|
3197 | #define X86LAR_F_P UINT16_C( 0x8000)
|
---|
3198 | #define X86LAR_F_AVL UINT32_C(0x00100000)
|
---|
3199 | #define X86LAR_F_L UINT32_C(0x00200000)
|
---|
3200 | #define X86LAR_F_D UINT32_C(0x00400000)
|
---|
3201 | #define X86LAR_F_G UINT32_C(0x00800000)
|
---|
3202 | /** @} */
|
---|
3203 |
|
---|
3204 |
|
---|
3205 | /**
|
---|
3206 | * Call-, Interrupt-, Trap- or Task-gate descriptor (legacy).
|
---|
3207 | */
|
---|
3208 | typedef struct X86DESCGATE
|
---|
3209 | {
|
---|
3210 | /** 00 - Target code segment offset - Low word.
|
---|
3211 | * Ignored if task-gate. */
|
---|
3212 | unsigned u16OffsetLow : 16;
|
---|
3213 | /** 10 - Target code segment selector for call-, interrupt- and trap-gates,
|
---|
3214 | * TSS selector if task-gate. */
|
---|
3215 | unsigned u16Sel : 16;
|
---|
3216 | /** 20 - Number of parameters for a call-gate.
|
---|
3217 | * Ignored if interrupt-, trap- or task-gate. */
|
---|
3218 | unsigned u4ParmCount : 4;
|
---|
3219 | /** 24 - Reserved / ignored. */
|
---|
3220 | unsigned u4Reserved : 4;
|
---|
3221 | /** 28 - Segment Type. */
|
---|
3222 | unsigned u4Type : 4;
|
---|
3223 | /** 2c - Descriptor Type (0 = system). */
|
---|
3224 | unsigned u1DescType : 1;
|
---|
3225 | /** 2d - Descriptor Privilege level. */
|
---|
3226 | unsigned u2Dpl : 2;
|
---|
3227 | /** 2f - Flags selector present(=1) or not. */
|
---|
3228 | unsigned u1Present : 1;
|
---|
3229 | /** 30 - Target code segment offset - High word.
|
---|
3230 | * Ignored if task-gate. */
|
---|
3231 | unsigned u16OffsetHigh : 16;
|
---|
3232 | } X86DESCGATE;
|
---|
3233 | /** Pointer to a Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
|
---|
3234 | typedef X86DESCGATE *PX86DESCGATE;
|
---|
3235 | /** Pointer to a const Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
|
---|
3236 | typedef const X86DESCGATE *PCX86DESCGATE;
|
---|
3237 |
|
---|
3238 | #endif /* VBOX_FOR_DTRACE_LIB */
|
---|
3239 |
|
---|
3240 | /**
|
---|
3241 | * Descriptor table entry.
|
---|
3242 | */
|
---|
3243 | #pragma pack(1)
|
---|
3244 | typedef union X86DESC
|
---|
3245 | {
|
---|
3246 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3247 | /** Generic descriptor view. */
|
---|
3248 | X86DESCGENERIC Gen;
|
---|
3249 | /** Gate descriptor view. */
|
---|
3250 | X86DESCGATE Gate;
|
---|
3251 | #endif
|
---|
3252 |
|
---|
3253 | /** 8 bit unsigned integer view. */
|
---|
3254 | uint8_t au8[8];
|
---|
3255 | /** 16 bit unsigned integer view. */
|
---|
3256 | uint16_t au16[4];
|
---|
3257 | /** 32 bit unsigned integer view. */
|
---|
3258 | uint32_t au32[2];
|
---|
3259 | /** 64 bit unsigned integer view. */
|
---|
3260 | uint64_t au64[1];
|
---|
3261 | /** Unsigned integer view. */
|
---|
3262 | uint64_t u;
|
---|
3263 | } X86DESC;
|
---|
3264 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3265 | AssertCompileSize(X86DESC, 8);
|
---|
3266 | #endif
|
---|
3267 | #pragma pack()
|
---|
3268 | /** Pointer to descriptor table entry. */
|
---|
3269 | typedef X86DESC *PX86DESC;
|
---|
3270 | /** Pointer to const descriptor table entry. */
|
---|
3271 | typedef const X86DESC *PCX86DESC;
|
---|
3272 |
|
---|
3273 | /** @def X86DESC_BASE
|
---|
3274 | * Return the base address of a descriptor.
|
---|
3275 | */
|
---|
3276 | #define X86DESC_BASE(a_pDesc) /*ASM-NOINC*/ \
|
---|
3277 | ( ((uint32_t)((a_pDesc)->Gen.u8BaseHigh2) << 24) \
|
---|
3278 | | ( (a_pDesc)->Gen.u8BaseHigh1 << 16) \
|
---|
3279 | | ( (a_pDesc)->Gen.u16BaseLow ) )
|
---|
3280 |
|
---|
3281 | /** @def X86DESC_LIMIT
|
---|
3282 | * Return the limit of a descriptor.
|
---|
3283 | */
|
---|
3284 | #define X86DESC_LIMIT(a_pDesc) /*ASM-NOINC*/ \
|
---|
3285 | ( ((uint32_t)((a_pDesc)->Gen.u4LimitHigh) << 16) \
|
---|
3286 | | ( (a_pDesc)->Gen.u16LimitLow ) )
|
---|
3287 |
|
---|
3288 | /** @def X86DESC_LIMIT_G
|
---|
3289 | * Return the limit of a descriptor with the granularity bit taken into account.
|
---|
3290 | * @returns Selector limit (uint32_t).
|
---|
3291 | * @param a_pDesc Pointer to the descriptor.
|
---|
3292 | */
|
---|
3293 | #define X86DESC_LIMIT_G(a_pDesc) /*ASM-NOINC*/ \
|
---|
3294 | ( (a_pDesc)->Gen.u1Granularity \
|
---|
3295 | ? ( ( ((uint32_t)(a_pDesc)->Gen.u4LimitHigh << 16) | (a_pDesc)->Gen.u16LimitLow ) << 12 ) | UINT32_C(0xfff) \
|
---|
3296 | : ((uint32_t)(a_pDesc)->Gen.u4LimitHigh << 16) | (a_pDesc)->Gen.u16LimitLow \
|
---|
3297 | )
|
---|
3298 |
|
---|
3299 | /** @def X86DESC_GET_HID_ATTR
|
---|
3300 | * Get the descriptor attributes for the hidden register.
|
---|
3301 | */
|
---|
3302 | #define X86DESC_GET_HID_ATTR(a_pDesc) /*ASM-NOINC*/ \
|
---|
3303 | ( ((a_pDesc)->u >> (16+16+8)) & UINT32_C(0xf0ff) ) /** @todo do we have a define for 0xf0ff? */
|
---|
3304 |
|
---|
3305 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3306 |
|
---|
3307 | /**
|
---|
3308 | * 64 bits generic descriptor table entry
|
---|
3309 | * Note: most of these bits have no meaning in long mode.
|
---|
3310 | */
|
---|
3311 | #pragma pack(1)
|
---|
3312 | typedef struct X86DESC64GENERIC
|
---|
3313 | {
|
---|
3314 | /** Limit - Low word - *IGNORED*. */
|
---|
3315 | uint32_t u16LimitLow : 16;
|
---|
3316 | /** Base address - low word. - *IGNORED*
|
---|
3317 | * Don't try set this to 24 because MSC is doing stupid things then. */
|
---|
3318 | uint32_t u16BaseLow : 16;
|
---|
3319 | /** Base address - first 8 bits of high word. - *IGNORED* */
|
---|
3320 | uint32_t u8BaseHigh1 : 8;
|
---|
3321 | /** Segment Type. */
|
---|
3322 | uint32_t u4Type : 4;
|
---|
3323 | /** Descriptor Type. System(=0) or code/data selector */
|
---|
3324 | uint32_t u1DescType : 1;
|
---|
3325 | /** Descriptor Privilege level. */
|
---|
3326 | uint32_t u2Dpl : 2;
|
---|
3327 | /** Flags selector present(=1) or not. */
|
---|
3328 | uint32_t u1Present : 1;
|
---|
3329 | /** Segment limit 16-19. - *IGNORED* */
|
---|
3330 | uint32_t u4LimitHigh : 4;
|
---|
3331 | /** Available for system software. - *IGNORED* */
|
---|
3332 | uint32_t u1Available : 1;
|
---|
3333 | /** Long mode flag. */
|
---|
3334 | uint32_t u1Long : 1;
|
---|
3335 | /** This flags meaning depends on the segment type. Try make sense out
|
---|
3336 | * of the intel manual yourself. */
|
---|
3337 | uint32_t u1DefBig : 1;
|
---|
3338 | /** Granularity of the limit. If set 4KB granularity is used, if
|
---|
3339 | * clear byte. - *IGNORED* */
|
---|
3340 | uint32_t u1Granularity : 1;
|
---|
3341 | /** Base address - highest 8 bits. - *IGNORED* */
|
---|
3342 | uint32_t u8BaseHigh2 : 8;
|
---|
3343 | /** Base address - bits 63-32. */
|
---|
3344 | uint32_t u32BaseHigh3 : 32;
|
---|
3345 | uint32_t u8Reserved : 8;
|
---|
3346 | uint32_t u5Zeros : 5;
|
---|
3347 | uint32_t u19Reserved : 19;
|
---|
3348 | } X86DESC64GENERIC;
|
---|
3349 | #pragma pack()
|
---|
3350 | /** Pointer to a generic descriptor entry. */
|
---|
3351 | typedef X86DESC64GENERIC *PX86DESC64GENERIC;
|
---|
3352 | /** Pointer to a const generic descriptor entry. */
|
---|
3353 | typedef const X86DESC64GENERIC *PCX86DESC64GENERIC;
|
---|
3354 |
|
---|
3355 | /**
|
---|
3356 | * System descriptor table entry (64 bits)
|
---|
3357 | *
|
---|
3358 | * @remarks This is, save a couple of comments, identical to X86DESC64GENERIC...
|
---|
3359 | */
|
---|
3360 | #pragma pack(1)
|
---|
3361 | typedef struct X86DESC64SYSTEM
|
---|
3362 | {
|
---|
3363 | /** Limit - Low word. */
|
---|
3364 | uint32_t u16LimitLow : 16;
|
---|
3365 | /** Base address - low word.
|
---|
3366 | * Don't try set this to 24 because MSC is doing stupid things then. */
|
---|
3367 | uint32_t u16BaseLow : 16;
|
---|
3368 | /** Base address - first 8 bits of high word. */
|
---|
3369 | uint32_t u8BaseHigh1 : 8;
|
---|
3370 | /** Segment Type. */
|
---|
3371 | uint32_t u4Type : 4;
|
---|
3372 | /** Descriptor Type. System(=0) or code/data selector */
|
---|
3373 | uint32_t u1DescType : 1;
|
---|
3374 | /** Descriptor Privilege level. */
|
---|
3375 | uint32_t u2Dpl : 2;
|
---|
3376 | /** Flags selector present(=1) or not. */
|
---|
3377 | uint32_t u1Present : 1;
|
---|
3378 | /** Segment limit 16-19. */
|
---|
3379 | uint32_t u4LimitHigh : 4;
|
---|
3380 | /** Available for system software. */
|
---|
3381 | uint32_t u1Available : 1;
|
---|
3382 | /** Reserved - 0. */
|
---|
3383 | uint32_t u1Reserved : 1;
|
---|
3384 | /** This flags meaning depends on the segment type. Try make sense out
|
---|
3385 | * of the intel manual yourself. */
|
---|
3386 | uint32_t u1DefBig : 1;
|
---|
3387 | /** Granularity of the limit. If set 4KB granularity is used, if
|
---|
3388 | * clear byte. */
|
---|
3389 | uint32_t u1Granularity : 1;
|
---|
3390 | /** Base address - bits 31-24. */
|
---|
3391 | uint32_t u8BaseHigh2 : 8;
|
---|
3392 | /** Base address - bits 63-32. */
|
---|
3393 | uint32_t u32BaseHigh3 : 32;
|
---|
3394 | uint32_t u8Reserved : 8;
|
---|
3395 | uint32_t u5Zeros : 5;
|
---|
3396 | uint32_t u19Reserved : 19;
|
---|
3397 | } X86DESC64SYSTEM;
|
---|
3398 | #pragma pack()
|
---|
3399 | /** Pointer to a system descriptor entry. */
|
---|
3400 | typedef X86DESC64SYSTEM *PX86DESC64SYSTEM;
|
---|
3401 | /** Pointer to a const system descriptor entry. */
|
---|
3402 | typedef const X86DESC64SYSTEM *PCX86DESC64SYSTEM;
|
---|
3403 |
|
---|
3404 | /**
|
---|
3405 | * Call-, Interrupt-, Trap- or Task-gate descriptor (64-bit).
|
---|
3406 | */
|
---|
3407 | typedef struct X86DESC64GATE
|
---|
3408 | {
|
---|
3409 | /** Target code segment offset - Low word. */
|
---|
3410 | uint32_t u16OffsetLow : 16;
|
---|
3411 | /** Target code segment selector. */
|
---|
3412 | uint32_t u16Sel : 16;
|
---|
3413 | /** Interrupt stack table for interrupt- and trap-gates.
|
---|
3414 | * Ignored by call-gates. */
|
---|
3415 | uint32_t u3IST : 3;
|
---|
3416 | /** Reserved / ignored. */
|
---|
3417 | uint32_t u5Reserved : 5;
|
---|
3418 | /** Segment Type. */
|
---|
3419 | uint32_t u4Type : 4;
|
---|
3420 | /** Descriptor Type (0 = system). */
|
---|
3421 | uint32_t u1DescType : 1;
|
---|
3422 | /** Descriptor Privilege level. */
|
---|
3423 | uint32_t u2Dpl : 2;
|
---|
3424 | /** Flags selector present(=1) or not. */
|
---|
3425 | uint32_t u1Present : 1;
|
---|
3426 | /** Target code segment offset - High word.
|
---|
3427 | * Ignored if task-gate. */
|
---|
3428 | uint32_t u16OffsetHigh : 16;
|
---|
3429 | /** Target code segment offset - Top dword.
|
---|
3430 | * Ignored if task-gate. */
|
---|
3431 | uint32_t u32OffsetTop : 32;
|
---|
3432 | /** Reserved / ignored / must be zero.
|
---|
3433 | * For call-gates bits 8 thru 12 must be zero, the other gates ignores this. */
|
---|
3434 | uint32_t u32Reserved : 32;
|
---|
3435 | } X86DESC64GATE;
|
---|
3436 | AssertCompileSize(X86DESC64GATE, 16);
|
---|
3437 | /** Pointer to a Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
|
---|
3438 | typedef X86DESC64GATE *PX86DESC64GATE;
|
---|
3439 | /** Pointer to a const Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
|
---|
3440 | typedef const X86DESC64GATE *PCX86DESC64GATE;
|
---|
3441 |
|
---|
3442 | #endif /* VBOX_FOR_DTRACE_LIB */
|
---|
3443 |
|
---|
3444 | /**
|
---|
3445 | * Descriptor table entry.
|
---|
3446 | */
|
---|
3447 | #pragma pack(1)
|
---|
3448 | typedef union X86DESC64
|
---|
3449 | {
|
---|
3450 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3451 | /** Generic descriptor view. */
|
---|
3452 | X86DESC64GENERIC Gen;
|
---|
3453 | /** System descriptor view. */
|
---|
3454 | X86DESC64SYSTEM System;
|
---|
3455 | /** Gate descriptor view. */
|
---|
3456 | X86DESC64GATE Gate;
|
---|
3457 | #endif
|
---|
3458 |
|
---|
3459 | /** 8 bit unsigned integer view. */
|
---|
3460 | uint8_t au8[16];
|
---|
3461 | /** 16 bit unsigned integer view. */
|
---|
3462 | uint16_t au16[8];
|
---|
3463 | /** 32 bit unsigned integer view. */
|
---|
3464 | uint32_t au32[4];
|
---|
3465 | /** 64 bit unsigned integer view. */
|
---|
3466 | uint64_t au64[2];
|
---|
3467 | } X86DESC64;
|
---|
3468 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3469 | AssertCompileSize(X86DESC64, 16);
|
---|
3470 | #endif
|
---|
3471 | #pragma pack()
|
---|
3472 | /** Pointer to descriptor table entry. */
|
---|
3473 | typedef X86DESC64 *PX86DESC64;
|
---|
3474 | /** Pointer to const descriptor table entry. */
|
---|
3475 | typedef const X86DESC64 *PCX86DESC64;
|
---|
3476 |
|
---|
3477 | /** @def X86DESC64_BASE
|
---|
3478 | * Return the base of a 64-bit descriptor.
|
---|
3479 | */
|
---|
3480 | #define X86DESC64_BASE(a_pDesc) /*ASM-NOINC*/ \
|
---|
3481 | ( ((uint64_t)((a_pDesc)->Gen.u32BaseHigh3) << 32) \
|
---|
3482 | | ((uint32_t)((a_pDesc)->Gen.u8BaseHigh2) << 24) \
|
---|
3483 | | ( (a_pDesc)->Gen.u8BaseHigh1 << 16) \
|
---|
3484 | | ( (a_pDesc)->Gen.u16BaseLow ) )
|
---|
3485 |
|
---|
3486 |
|
---|
3487 |
|
---|
3488 | /** @name Host system descriptor table entry - Use with care!
|
---|
3489 | * @{ */
|
---|
3490 | /** Host system descriptor table entry. */
|
---|
3491 | #if HC_ARCH_BITS == 64
|
---|
3492 | typedef X86DESC64 X86DESCHC;
|
---|
3493 | #else
|
---|
3494 | typedef X86DESC X86DESCHC;
|
---|
3495 | #endif
|
---|
3496 | /** Pointer to a host system descriptor table entry. */
|
---|
3497 | #if HC_ARCH_BITS == 64
|
---|
3498 | typedef PX86DESC64 PX86DESCHC;
|
---|
3499 | #else
|
---|
3500 | typedef PX86DESC PX86DESCHC;
|
---|
3501 | #endif
|
---|
3502 | /** Pointer to a const host system descriptor table entry. */
|
---|
3503 | #if HC_ARCH_BITS == 64
|
---|
3504 | typedef PCX86DESC64 PCX86DESCHC;
|
---|
3505 | #else
|
---|
3506 | typedef PCX86DESC PCX86DESCHC;
|
---|
3507 | #endif
|
---|
3508 | /** @} */
|
---|
3509 |
|
---|
3510 |
|
---|
3511 | /** @name Selector Descriptor Types.
|
---|
3512 | * @{
|
---|
3513 | */
|
---|
3514 |
|
---|
3515 | /** @name Non-System Selector Types.
|
---|
3516 | * @{ */
|
---|
3517 | /** Code(=set)/Data(=clear) bit. */
|
---|
3518 | #define X86_SEL_TYPE_CODE 8
|
---|
3519 | /** Memory(=set)/System(=clear) bit. */
|
---|
3520 | #define X86_SEL_TYPE_MEMORY RT_BIT_32(4)
|
---|
3521 | /** Accessed bit. */
|
---|
3522 | #define X86_SEL_TYPE_ACCESSED 1
|
---|
3523 | /** Expand down bit (for data selectors only). */
|
---|
3524 | #define X86_SEL_TYPE_DOWN 4
|
---|
3525 | /** Conforming bit (for code selectors only). */
|
---|
3526 | #define X86_SEL_TYPE_CONF 4
|
---|
3527 | /** Write bit (for data selectors only). */
|
---|
3528 | #define X86_SEL_TYPE_WRITE 2
|
---|
3529 | /** Read bit (for code selectors only). */
|
---|
3530 | #define X86_SEL_TYPE_READ 2
|
---|
3531 | /** The bit number of the code segment read bit (relative to u4Type). */
|
---|
3532 | #define X86_SEL_TYPE_READ_BIT 1
|
---|
3533 |
|
---|
3534 | /** Read only selector type. */
|
---|
3535 | #define X86_SEL_TYPE_RO 0
|
---|
3536 | /** Accessed read only selector type. */
|
---|
3537 | #define X86_SEL_TYPE_RO_ACC (0 | X86_SEL_TYPE_ACCESSED)
|
---|
3538 | /** Read write selector type. */
|
---|
3539 | #define X86_SEL_TYPE_RW 2
|
---|
3540 | /** Accessed read write selector type. */
|
---|
3541 | #define X86_SEL_TYPE_RW_ACC (2 | X86_SEL_TYPE_ACCESSED)
|
---|
3542 | /** Expand down read only selector type. */
|
---|
3543 | #define X86_SEL_TYPE_RO_DOWN 4
|
---|
3544 | /** Accessed expand down read only selector type. */
|
---|
3545 | #define X86_SEL_TYPE_RO_DOWN_ACC (4 | X86_SEL_TYPE_ACCESSED)
|
---|
3546 | /** Expand down read write selector type. */
|
---|
3547 | #define X86_SEL_TYPE_RW_DOWN 6
|
---|
3548 | /** Accessed expand down read write selector type. */
|
---|
3549 | #define X86_SEL_TYPE_RW_DOWN_ACC (6 | X86_SEL_TYPE_ACCESSED)
|
---|
3550 | /** Execute only selector type. */
|
---|
3551 | #define X86_SEL_TYPE_EO (0 | X86_SEL_TYPE_CODE)
|
---|
3552 | /** Accessed execute only selector type. */
|
---|
3553 | #define X86_SEL_TYPE_EO_ACC (0 | X86_SEL_TYPE_CODE | X86_SEL_TYPE_ACCESSED)
|
---|
3554 | /** Execute and read selector type. */
|
---|
3555 | #define X86_SEL_TYPE_ER (2 | X86_SEL_TYPE_CODE)
|
---|
3556 | /** Accessed execute and read selector type. */
|
---|
3557 | #define X86_SEL_TYPE_ER_ACC (2 | X86_SEL_TYPE_CODE | X86_SEL_TYPE_ACCESSED)
|
---|
3558 | /** Conforming execute only selector type. */
|
---|
3559 | #define X86_SEL_TYPE_EO_CONF (4 | X86_SEL_TYPE_CODE)
|
---|
3560 | /** Accessed Conforming execute only selector type. */
|
---|
3561 | #define X86_SEL_TYPE_EO_CONF_ACC (4 | X86_SEL_TYPE_CODE | X86_SEL_TYPE_ACCESSED)
|
---|
3562 | /** Conforming execute and write selector type. */
|
---|
3563 | #define X86_SEL_TYPE_ER_CONF (6 | X86_SEL_TYPE_CODE)
|
---|
3564 | /** Accessed Conforming execute and write selector type. */
|
---|
3565 | #define X86_SEL_TYPE_ER_CONF_ACC (6 | X86_SEL_TYPE_CODE | X86_SEL_TYPE_ACCESSED)
|
---|
3566 | /** @} */
|
---|
3567 |
|
---|
3568 |
|
---|
3569 | /** @name System Selector Types.
|
---|
3570 | * @{ */
|
---|
3571 | /** The TSS busy bit mask. */
|
---|
3572 | #define X86_SEL_TYPE_SYS_TSS_BUSY_MASK 2
|
---|
3573 |
|
---|
3574 | /** Undefined system selector type. */
|
---|
3575 | #define X86_SEL_TYPE_SYS_UNDEFINED 0
|
---|
3576 | /** 286 TSS selector. */
|
---|
3577 | #define X86_SEL_TYPE_SYS_286_TSS_AVAIL 1
|
---|
3578 | /** LDT selector. */
|
---|
3579 | #define X86_SEL_TYPE_SYS_LDT 2
|
---|
3580 | /** 286 TSS selector - Busy. */
|
---|
3581 | #define X86_SEL_TYPE_SYS_286_TSS_BUSY 3
|
---|
3582 | /** 286 Callgate selector. */
|
---|
3583 | #define X86_SEL_TYPE_SYS_286_CALL_GATE 4
|
---|
3584 | /** Taskgate selector. */
|
---|
3585 | #define X86_SEL_TYPE_SYS_TASK_GATE 5
|
---|
3586 | /** 286 Interrupt gate selector. */
|
---|
3587 | #define X86_SEL_TYPE_SYS_286_INT_GATE 6
|
---|
3588 | /** 286 Trapgate selector. */
|
---|
3589 | #define X86_SEL_TYPE_SYS_286_TRAP_GATE 7
|
---|
3590 | /** Undefined system selector. */
|
---|
3591 | #define X86_SEL_TYPE_SYS_UNDEFINED2 8
|
---|
3592 | /** 386 TSS selector. */
|
---|
3593 | #define X86_SEL_TYPE_SYS_386_TSS_AVAIL 9
|
---|
3594 | /** Undefined system selector. */
|
---|
3595 | #define X86_SEL_TYPE_SYS_UNDEFINED3 0xA
|
---|
3596 | /** 386 TSS selector - Busy. */
|
---|
3597 | #define X86_SEL_TYPE_SYS_386_TSS_BUSY 0xB
|
---|
3598 | /** 386 Callgate selector. */
|
---|
3599 | #define X86_SEL_TYPE_SYS_386_CALL_GATE 0xC
|
---|
3600 | /** Undefined system selector. */
|
---|
3601 | #define X86_SEL_TYPE_SYS_UNDEFINED4 0xD
|
---|
3602 | /** 386 Interruptgate selector. */
|
---|
3603 | #define X86_SEL_TYPE_SYS_386_INT_GATE 0xE
|
---|
3604 | /** 386 Trapgate selector. */
|
---|
3605 | #define X86_SEL_TYPE_SYS_386_TRAP_GATE 0xF
|
---|
3606 | /** @} */
|
---|
3607 |
|
---|
3608 | /** @name AMD64 System Selector Types.
|
---|
3609 | * @{ */
|
---|
3610 | /** LDT selector. */
|
---|
3611 | #define AMD64_SEL_TYPE_SYS_LDT 2
|
---|
3612 | /** TSS selector - Busy. */
|
---|
3613 | #define AMD64_SEL_TYPE_SYS_TSS_AVAIL 9
|
---|
3614 | /** TSS selector - Busy. */
|
---|
3615 | #define AMD64_SEL_TYPE_SYS_TSS_BUSY 0xB
|
---|
3616 | /** Callgate selector. */
|
---|
3617 | #define AMD64_SEL_TYPE_SYS_CALL_GATE 0xC
|
---|
3618 | /** Interruptgate selector. */
|
---|
3619 | #define AMD64_SEL_TYPE_SYS_INT_GATE 0xE
|
---|
3620 | /** Trapgate selector. */
|
---|
3621 | #define AMD64_SEL_TYPE_SYS_TRAP_GATE 0xF
|
---|
3622 | /** @} */
|
---|
3623 |
|
---|
3624 | /** @} */
|
---|
3625 |
|
---|
3626 |
|
---|
3627 | /** @name Descriptor Table Entry Flag Masks.
|
---|
3628 | * These are for the 2nd 32-bit word of a descriptor.
|
---|
3629 | * @{ */
|
---|
3630 | /** Bits 8-11 - TYPE - Descriptor type mask. */
|
---|
3631 | #define X86_DESC_TYPE_MASK (RT_BIT_32(8) | RT_BIT_32(9) | RT_BIT_32(10) | RT_BIT_32(11))
|
---|
3632 | /** Bit 12 - S - System (=0) or Code/Data (=1). */
|
---|
3633 | #define X86_DESC_S RT_BIT_32(12)
|
---|
3634 | /** Bits 13-14 - DPL - Descriptor Privilege Level. */
|
---|
3635 | #define X86_DESC_DPL (RT_BIT_32(13) | RT_BIT_32(14))
|
---|
3636 | /** Bit 15 - P - Present. */
|
---|
3637 | #define X86_DESC_P RT_BIT_32(15)
|
---|
3638 | /** Bit 20 - AVL - Available for system software. */
|
---|
3639 | #define X86_DESC_AVL RT_BIT_32(20)
|
---|
3640 | /** Bit 22 - DB - Default operation size. 0 = 16 bit, 1 = 32 bit. */
|
---|
3641 | #define X86_DESC_DB RT_BIT_32(22)
|
---|
3642 | /** Bit 23 - G - Granularity of the limit. If set 4KB granularity is
|
---|
3643 | * used, if clear byte. */
|
---|
3644 | #define X86_DESC_G RT_BIT_32(23)
|
---|
3645 | /** @} */
|
---|
3646 |
|
---|
3647 | /** @} */
|
---|
3648 |
|
---|
3649 |
|
---|
3650 | /** @name Task Segments.
|
---|
3651 | * @{
|
---|
3652 | */
|
---|
3653 |
|
---|
3654 | /**
|
---|
3655 | * The minimum TSS descriptor limit for 286 tasks.
|
---|
3656 | */
|
---|
3657 | #define X86_SEL_TYPE_SYS_286_TSS_LIMIT_MIN 0x2b
|
---|
3658 |
|
---|
3659 | /**
|
---|
3660 | * The minimum TSS descriptor segment limit for 386 tasks.
|
---|
3661 | */
|
---|
3662 | #define X86_SEL_TYPE_SYS_386_TSS_LIMIT_MIN 0x67
|
---|
3663 |
|
---|
3664 | /**
|
---|
3665 | * 16-bit Task Segment (TSS).
|
---|
3666 | */
|
---|
3667 | #pragma pack(1)
|
---|
3668 | typedef struct X86TSS16
|
---|
3669 | {
|
---|
3670 | /** Back link to previous task. (static) */
|
---|
3671 | RTSEL selPrev;
|
---|
3672 | /** Ring-0 stack pointer. (static) */
|
---|
3673 | uint16_t sp0;
|
---|
3674 | /** Ring-0 stack segment. (static) */
|
---|
3675 | RTSEL ss0;
|
---|
3676 | /** Ring-1 stack pointer. (static) */
|
---|
3677 | uint16_t sp1;
|
---|
3678 | /** Ring-1 stack segment. (static) */
|
---|
3679 | RTSEL ss1;
|
---|
3680 | /** Ring-2 stack pointer. (static) */
|
---|
3681 | uint16_t sp2;
|
---|
3682 | /** Ring-2 stack segment. (static) */
|
---|
3683 | RTSEL ss2;
|
---|
3684 | /** IP before task switch. */
|
---|
3685 | uint16_t ip;
|
---|
3686 | /** FLAGS before task switch. */
|
---|
3687 | uint16_t flags;
|
---|
3688 | /** AX before task switch. */
|
---|
3689 | uint16_t ax;
|
---|
3690 | /** CX before task switch. */
|
---|
3691 | uint16_t cx;
|
---|
3692 | /** DX before task switch. */
|
---|
3693 | uint16_t dx;
|
---|
3694 | /** BX before task switch. */
|
---|
3695 | uint16_t bx;
|
---|
3696 | /** SP before task switch. */
|
---|
3697 | uint16_t sp;
|
---|
3698 | /** BP before task switch. */
|
---|
3699 | uint16_t bp;
|
---|
3700 | /** SI before task switch. */
|
---|
3701 | uint16_t si;
|
---|
3702 | /** DI before task switch. */
|
---|
3703 | uint16_t di;
|
---|
3704 | /** ES before task switch. */
|
---|
3705 | RTSEL es;
|
---|
3706 | /** CS before task switch. */
|
---|
3707 | RTSEL cs;
|
---|
3708 | /** SS before task switch. */
|
---|
3709 | RTSEL ss;
|
---|
3710 | /** DS before task switch. */
|
---|
3711 | RTSEL ds;
|
---|
3712 | /** LDTR before task switch. */
|
---|
3713 | RTSEL selLdt;
|
---|
3714 | } X86TSS16;
|
---|
3715 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3716 | AssertCompileSize(X86TSS16, X86_SEL_TYPE_SYS_286_TSS_LIMIT_MIN + 1);
|
---|
3717 | #endif
|
---|
3718 | #pragma pack()
|
---|
3719 | /** Pointer to a 16-bit task segment. */
|
---|
3720 | typedef X86TSS16 *PX86TSS16;
|
---|
3721 | /** Pointer to a const 16-bit task segment. */
|
---|
3722 | typedef const X86TSS16 *PCX86TSS16;
|
---|
3723 |
|
---|
3724 |
|
---|
3725 | /**
|
---|
3726 | * 32-bit Task Segment (TSS).
|
---|
3727 | */
|
---|
3728 | #pragma pack(1)
|
---|
3729 | typedef struct X86TSS32
|
---|
3730 | {
|
---|
3731 | /** Back link to previous task. (static) */
|
---|
3732 | RTSEL selPrev;
|
---|
3733 | uint16_t padding1;
|
---|
3734 | /** Ring-0 stack pointer. (static) */
|
---|
3735 | uint32_t esp0;
|
---|
3736 | /** Ring-0 stack segment. (static) */
|
---|
3737 | RTSEL ss0;
|
---|
3738 | uint16_t padding_ss0;
|
---|
3739 | /** Ring-1 stack pointer. (static) */
|
---|
3740 | uint32_t esp1;
|
---|
3741 | /** Ring-1 stack segment. (static) */
|
---|
3742 | RTSEL ss1;
|
---|
3743 | uint16_t padding_ss1;
|
---|
3744 | /** Ring-2 stack pointer. (static) */
|
---|
3745 | uint32_t esp2;
|
---|
3746 | /** Ring-2 stack segment. (static) */
|
---|
3747 | RTSEL ss2;
|
---|
3748 | uint16_t padding_ss2;
|
---|
3749 | /** Page directory for the task. (static) */
|
---|
3750 | uint32_t cr3;
|
---|
3751 | /** EIP before task switch. */
|
---|
3752 | uint32_t eip;
|
---|
3753 | /** EFLAGS before task switch. */
|
---|
3754 | uint32_t eflags;
|
---|
3755 | /** EAX before task switch. */
|
---|
3756 | uint32_t eax;
|
---|
3757 | /** ECX before task switch. */
|
---|
3758 | uint32_t ecx;
|
---|
3759 | /** EDX before task switch. */
|
---|
3760 | uint32_t edx;
|
---|
3761 | /** EBX before task switch. */
|
---|
3762 | uint32_t ebx;
|
---|
3763 | /** ESP before task switch. */
|
---|
3764 | uint32_t esp;
|
---|
3765 | /** EBP before task switch. */
|
---|
3766 | uint32_t ebp;
|
---|
3767 | /** ESI before task switch. */
|
---|
3768 | uint32_t esi;
|
---|
3769 | /** EDI before task switch. */
|
---|
3770 | uint32_t edi;
|
---|
3771 | /** ES before task switch. */
|
---|
3772 | RTSEL es;
|
---|
3773 | uint16_t padding_es;
|
---|
3774 | /** CS before task switch. */
|
---|
3775 | RTSEL cs;
|
---|
3776 | uint16_t padding_cs;
|
---|
3777 | /** SS before task switch. */
|
---|
3778 | RTSEL ss;
|
---|
3779 | uint16_t padding_ss;
|
---|
3780 | /** DS before task switch. */
|
---|
3781 | RTSEL ds;
|
---|
3782 | uint16_t padding_ds;
|
---|
3783 | /** FS before task switch. */
|
---|
3784 | RTSEL fs;
|
---|
3785 | uint16_t padding_fs;
|
---|
3786 | /** GS before task switch. */
|
---|
3787 | RTSEL gs;
|
---|
3788 | uint16_t padding_gs;
|
---|
3789 | /** LDTR before task switch. */
|
---|
3790 | RTSEL selLdt;
|
---|
3791 | uint16_t padding_ldt;
|
---|
3792 | /** Debug trap flag */
|
---|
3793 | uint16_t fDebugTrap;
|
---|
3794 | /** Offset relative to the TSS of the start of the I/O Bitmap
|
---|
3795 | * and the end of the interrupt redirection bitmap. */
|
---|
3796 | uint16_t offIoBitmap;
|
---|
3797 | } X86TSS32;
|
---|
3798 | #pragma pack()
|
---|
3799 | /** Pointer to task segment. */
|
---|
3800 | typedef X86TSS32 *PX86TSS32;
|
---|
3801 | /** Pointer to const task segment. */
|
---|
3802 | typedef const X86TSS32 *PCX86TSS32;
|
---|
3803 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3804 | AssertCompileSize(X86TSS32, X86_SEL_TYPE_SYS_386_TSS_LIMIT_MIN + 1);
|
---|
3805 | AssertCompileMemberOffset(X86TSS32, cr3, 28);
|
---|
3806 | AssertCompileMemberOffset(X86TSS32, offIoBitmap, 102);
|
---|
3807 | #endif
|
---|
3808 |
|
---|
3809 | /**
|
---|
3810 | * 64-bit Task segment.
|
---|
3811 | */
|
---|
3812 | #pragma pack(1)
|
---|
3813 | typedef struct X86TSS64
|
---|
3814 | {
|
---|
3815 | /** Reserved. */
|
---|
3816 | uint32_t u32Reserved;
|
---|
3817 | /** Ring-0 stack pointer. (static) */
|
---|
3818 | uint64_t rsp0;
|
---|
3819 | /** Ring-1 stack pointer. (static) */
|
---|
3820 | uint64_t rsp1;
|
---|
3821 | /** Ring-2 stack pointer. (static) */
|
---|
3822 | uint64_t rsp2;
|
---|
3823 | /** Reserved. */
|
---|
3824 | uint32_t u32Reserved2[2];
|
---|
3825 | /* IST */
|
---|
3826 | uint64_t ist1;
|
---|
3827 | uint64_t ist2;
|
---|
3828 | uint64_t ist3;
|
---|
3829 | uint64_t ist4;
|
---|
3830 | uint64_t ist5;
|
---|
3831 | uint64_t ist6;
|
---|
3832 | uint64_t ist7;
|
---|
3833 | /* Reserved. */
|
---|
3834 | uint16_t u16Reserved[5];
|
---|
3835 | /** Offset relative to the TSS of the start of the I/O Bitmap
|
---|
3836 | * and the end of the interrupt redirection bitmap. */
|
---|
3837 | uint16_t offIoBitmap;
|
---|
3838 | } X86TSS64;
|
---|
3839 | #pragma pack()
|
---|
3840 | /** Pointer to a 64-bit task segment. */
|
---|
3841 | typedef X86TSS64 *PX86TSS64;
|
---|
3842 | /** Pointer to a const 64-bit task segment. */
|
---|
3843 | typedef const X86TSS64 *PCX86TSS64;
|
---|
3844 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
3845 | AssertCompileSize(X86TSS64, X86_SEL_TYPE_SYS_386_TSS_LIMIT_MIN + 1);
|
---|
3846 | #endif
|
---|
3847 |
|
---|
3848 | /** @} */
|
---|
3849 |
|
---|
3850 |
|
---|
3851 | /** @name Selectors.
|
---|
3852 | * @{
|
---|
3853 | */
|
---|
3854 |
|
---|
3855 | /**
|
---|
3856 | * The shift used to convert a selector from and to index an index (C).
|
---|
3857 | */
|
---|
3858 | #define X86_SEL_SHIFT 3
|
---|
3859 |
|
---|
3860 | /**
|
---|
3861 | * The mask used to mask off the table indicator and RPL of an selector.
|
---|
3862 | */
|
---|
3863 | #define X86_SEL_MASK 0xfff8U
|
---|
3864 |
|
---|
3865 | /**
|
---|
3866 | * The mask used to mask off the RPL of an selector.
|
---|
3867 | * This is suitable for checking for NULL selectors.
|
---|
3868 | */
|
---|
3869 | #define X86_SEL_MASK_OFF_RPL 0xfffcU
|
---|
3870 |
|
---|
3871 | /**
|
---|
3872 | * The bit indicating that a selector is in the LDT and not in the GDT.
|
---|
3873 | */
|
---|
3874 | #define X86_SEL_LDT 0x0004U
|
---|
3875 |
|
---|
3876 | /**
|
---|
3877 | * The bit mask for getting the RPL of a selector.
|
---|
3878 | */
|
---|
3879 | #define X86_SEL_RPL 0x0003U
|
---|
3880 |
|
---|
3881 | /**
|
---|
3882 | * The mask covering both RPL and LDT.
|
---|
3883 | * This is incidentally the same as sizeof(X86DESC) - 1, so good for limit
|
---|
3884 | * checks.
|
---|
3885 | */
|
---|
3886 | #define X86_SEL_RPL_LDT 0x0007U
|
---|
3887 |
|
---|
3888 | /** @} */
|
---|
3889 |
|
---|
3890 |
|
---|
3891 | /**
|
---|
3892 | * x86 Exceptions/Faults/Traps.
|
---|
3893 | */
|
---|
3894 | typedef enum X86XCPT
|
---|
3895 | {
|
---|
3896 | /** \#DE - Divide error. */
|
---|
3897 | X86_XCPT_DE = 0x00,
|
---|
3898 | /** \#DB - Debug event (single step, DRx, ..) */
|
---|
3899 | X86_XCPT_DB = 0x01,
|
---|
3900 | /** NMI - Non-Maskable Interrupt */
|
---|
3901 | X86_XCPT_NMI = 0x02,
|
---|
3902 | /** \#BP - Breakpoint (INT3). */
|
---|
3903 | X86_XCPT_BP = 0x03,
|
---|
3904 | /** \#OF - Overflow (INTO). */
|
---|
3905 | X86_XCPT_OF = 0x04,
|
---|
3906 | /** \#BR - Bound range exceeded (BOUND). */
|
---|
3907 | X86_XCPT_BR = 0x05,
|
---|
3908 | /** \#UD - Undefined opcode. */
|
---|
3909 | X86_XCPT_UD = 0x06,
|
---|
3910 | /** \#NM - Device not available (math coprocessor device). */
|
---|
3911 | X86_XCPT_NM = 0x07,
|
---|
3912 | /** \#DF - Double fault. */
|
---|
3913 | X86_XCPT_DF = 0x08,
|
---|
3914 | /** ??? - Coprocessor segment overrun (obsolete). */
|
---|
3915 | X86_XCPT_CO_SEG_OVERRUN = 0x09,
|
---|
3916 | /** \#TS - Taskswitch (TSS). */
|
---|
3917 | X86_XCPT_TS = 0x0a,
|
---|
3918 | /** \#NP - Segment no present. */
|
---|
3919 | X86_XCPT_NP = 0x0b,
|
---|
3920 | /** \#SS - Stack segment fault. */
|
---|
3921 | X86_XCPT_SS = 0x0c,
|
---|
3922 | /** \#GP - General protection fault. */
|
---|
3923 | X86_XCPT_GP = 0x0d,
|
---|
3924 | /** \#PF - Page fault. */
|
---|
3925 | X86_XCPT_PF = 0x0e,
|
---|
3926 | /* 0x0f is reserved (to avoid conflict with spurious interrupts in BIOS setup). */
|
---|
3927 | /** \#MF - Math fault (FPU). */
|
---|
3928 | X86_XCPT_MF = 0x10,
|
---|
3929 | /** \#AC - Alignment check. */
|
---|
3930 | X86_XCPT_AC = 0x11,
|
---|
3931 | /** \#MC - Machine check. */
|
---|
3932 | X86_XCPT_MC = 0x12,
|
---|
3933 | /** \#XF - SIMD Floating-Pointer Exception. */
|
---|
3934 | X86_XCPT_XF = 0x13,
|
---|
3935 | /** \#VE - Virtualization Exception. */
|
---|
3936 | X86_XCPT_VE = 0x14,
|
---|
3937 | /** \#SX - Security Exception. */
|
---|
3938 | X86_XCPT_SX = 0x1f
|
---|
3939 | } X86XCPT;
|
---|
3940 | /** Pointer to a x86 exception code. */
|
---|
3941 | typedef X86XCPT *PX86XCPT;
|
---|
3942 | /** Pointer to a const x86 exception code. */
|
---|
3943 | typedef const X86XCPT *PCX86XCPT;
|
---|
3944 | /** The maximum exception value. */
|
---|
3945 | #define X86_XCPT_MAX (X86_XCPT_SX)
|
---|
3946 |
|
---|
3947 |
|
---|
3948 | /** @name Trap Error Codes
|
---|
3949 | * @{
|
---|
3950 | */
|
---|
3951 | /** External indicator. */
|
---|
3952 | #define X86_TRAP_ERR_EXTERNAL 1
|
---|
3953 | /** IDT indicator. */
|
---|
3954 | #define X86_TRAP_ERR_IDT 2
|
---|
3955 | /** Descriptor table indicator - If set LDT, if clear GDT. */
|
---|
3956 | #define X86_TRAP_ERR_TI 4
|
---|
3957 | /** Mask for getting the selector. */
|
---|
3958 | #define X86_TRAP_ERR_SEL_MASK 0xfff8
|
---|
3959 | /** Shift for getting the selector table index (C type index). */
|
---|
3960 | #define X86_TRAP_ERR_SEL_SHIFT 3
|
---|
3961 | /** @} */
|
---|
3962 |
|
---|
3963 |
|
---|
3964 | /** @name \#PF Trap Error Codes
|
---|
3965 | * @{
|
---|
3966 | */
|
---|
3967 | /** Bit 0 - P - Not present (clear) or page level protection (set) fault. */
|
---|
3968 | #define X86_TRAP_PF_P RT_BIT_32(0)
|
---|
3969 | /** Bit 1 - R/W - Read (clear) or write (set) access. */
|
---|
3970 | #define X86_TRAP_PF_RW RT_BIT_32(1)
|
---|
3971 | /** Bit 2 - U/S - CPU executing in user mode (set) or supervisor mode (clear). */
|
---|
3972 | #define X86_TRAP_PF_US RT_BIT_32(2)
|
---|
3973 | /** Bit 3 - RSVD- Reserved bit violation (set), i.e. reserved bit was set to 1. */
|
---|
3974 | #define X86_TRAP_PF_RSVD RT_BIT_32(3)
|
---|
3975 | /** Bit 4 - I/D - Instruction fetch (set) / Data access (clear) - PAE + NXE. */
|
---|
3976 | #define X86_TRAP_PF_ID RT_BIT_32(4)
|
---|
3977 | /** Bit 5 - PK - Protection-key violation (AMD64 mode only). */
|
---|
3978 | #define X86_TRAP_PF_PK RT_BIT_32(5)
|
---|
3979 | /** @} */
|
---|
3980 |
|
---|
3981 | #pragma pack(1)
|
---|
3982 | /**
|
---|
3983 | * 16-bit IDTR.
|
---|
3984 | */
|
---|
3985 | typedef struct X86IDTR16
|
---|
3986 | {
|
---|
3987 | /** Offset. */
|
---|
3988 | uint16_t offSel;
|
---|
3989 | /** Selector. */
|
---|
3990 | uint16_t uSel;
|
---|
3991 | } X86IDTR16, *PX86IDTR16;
|
---|
3992 | #pragma pack()
|
---|
3993 |
|
---|
3994 | #pragma pack(1)
|
---|
3995 | /**
|
---|
3996 | * 32-bit IDTR/GDTR.
|
---|
3997 | */
|
---|
3998 | typedef struct X86XDTR32
|
---|
3999 | {
|
---|
4000 | /** Size of the descriptor table. */
|
---|
4001 | uint16_t cb;
|
---|
4002 | /** Address of the descriptor table. */
|
---|
4003 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
4004 | uint32_t uAddr;
|
---|
4005 | #else
|
---|
4006 | uint16_t au16Addr[2];
|
---|
4007 | #endif
|
---|
4008 | } X86XDTR32, *PX86XDTR32;
|
---|
4009 | #pragma pack()
|
---|
4010 |
|
---|
4011 | #pragma pack(1)
|
---|
4012 | /**
|
---|
4013 | * 64-bit IDTR/GDTR.
|
---|
4014 | */
|
---|
4015 | typedef struct X86XDTR64
|
---|
4016 | {
|
---|
4017 | /** Size of the descriptor table. */
|
---|
4018 | uint16_t cb;
|
---|
4019 | /** Address of the descriptor table. */
|
---|
4020 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
4021 | uint64_t uAddr;
|
---|
4022 | #else
|
---|
4023 | uint16_t au16Addr[4];
|
---|
4024 | #endif
|
---|
4025 | } X86XDTR64, *PX86XDTR64;
|
---|
4026 | #pragma pack()
|
---|
4027 |
|
---|
4028 |
|
---|
4029 | /** @name ModR/M
|
---|
4030 | * @{ */
|
---|
4031 | #define X86_MODRM_RM_MASK UINT8_C(0x07)
|
---|
4032 | #define X86_MODRM_REG_MASK UINT8_C(0x38)
|
---|
4033 | #define X86_MODRM_REG_SMASK UINT8_C(0x07)
|
---|
4034 | #define X86_MODRM_REG_SHIFT 3
|
---|
4035 | #define X86_MODRM_MOD_MASK UINT8_C(0xc0)
|
---|
4036 | #define X86_MODRM_MOD_SMASK UINT8_C(0x03)
|
---|
4037 | #define X86_MODRM_MOD_SHIFT 6
|
---|
4038 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
4039 | AssertCompile((X86_MODRM_RM_MASK | X86_MODRM_REG_MASK | X86_MODRM_MOD_MASK) == 0xff);
|
---|
4040 | AssertCompile((X86_MODRM_REG_MASK >> X86_MODRM_REG_SHIFT) == X86_MODRM_REG_SMASK);
|
---|
4041 | AssertCompile((X86_MODRM_MOD_MASK >> X86_MODRM_MOD_SHIFT) == X86_MODRM_MOD_SMASK);
|
---|
4042 | #endif
|
---|
4043 | /** @} */
|
---|
4044 |
|
---|
4045 | /** @name SIB
|
---|
4046 | * @{ */
|
---|
4047 | #define X86_SIB_BASE_MASK UINT8_C(0x07)
|
---|
4048 | #define X86_SIB_INDEX_MASK UINT8_C(0x38)
|
---|
4049 | #define X86_SIB_INDEX_SMASK UINT8_C(0x07)
|
---|
4050 | #define X86_SIB_INDEX_SHIFT 3
|
---|
4051 | #define X86_SIB_SCALE_MASK UINT8_C(0xc0)
|
---|
4052 | #define X86_SIB_SCALE_SMASK UINT8_C(0x03)
|
---|
4053 | #define X86_SIB_SCALE_SHIFT 6
|
---|
4054 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
4055 | AssertCompile((X86_SIB_BASE_MASK | X86_SIB_INDEX_MASK | X86_SIB_SCALE_MASK) == 0xff);
|
---|
4056 | AssertCompile((X86_SIB_INDEX_MASK >> X86_SIB_INDEX_SHIFT) == X86_SIB_INDEX_SMASK);
|
---|
4057 | AssertCompile((X86_SIB_SCALE_MASK >> X86_SIB_SCALE_SHIFT) == X86_SIB_SCALE_SMASK);
|
---|
4058 | #endif
|
---|
4059 | /** @} */
|
---|
4060 |
|
---|
4061 | /** @name General register indexes
|
---|
4062 | * @{ */
|
---|
4063 | #define X86_GREG_xAX 0
|
---|
4064 | #define X86_GREG_xCX 1
|
---|
4065 | #define X86_GREG_xDX 2
|
---|
4066 | #define X86_GREG_xBX 3
|
---|
4067 | #define X86_GREG_xSP 4
|
---|
4068 | #define X86_GREG_xBP 5
|
---|
4069 | #define X86_GREG_xSI 6
|
---|
4070 | #define X86_GREG_xDI 7
|
---|
4071 | #define X86_GREG_x8 8
|
---|
4072 | #define X86_GREG_x9 9
|
---|
4073 | #define X86_GREG_x10 10
|
---|
4074 | #define X86_GREG_x11 11
|
---|
4075 | #define X86_GREG_x12 12
|
---|
4076 | #define X86_GREG_x13 13
|
---|
4077 | #define X86_GREG_x14 14
|
---|
4078 | #define X86_GREG_x15 15
|
---|
4079 | /** @} */
|
---|
4080 |
|
---|
4081 | /** @name X86_SREG_XXX - Segment register indexes.
|
---|
4082 | * @{ */
|
---|
4083 | #define X86_SREG_ES 0
|
---|
4084 | #define X86_SREG_CS 1
|
---|
4085 | #define X86_SREG_SS 2
|
---|
4086 | #define X86_SREG_DS 3
|
---|
4087 | #define X86_SREG_FS 4
|
---|
4088 | #define X86_SREG_GS 5
|
---|
4089 | /** @} */
|
---|
4090 | /** Segment register count. */
|
---|
4091 | #define X86_SREG_COUNT 6
|
---|
4092 |
|
---|
4093 |
|
---|
4094 | /** @name X86_OP_XXX - Prefixes
|
---|
4095 | * @{ */
|
---|
4096 | #define X86_OP_PRF_CS UINT8_C(0x2e)
|
---|
4097 | #define X86_OP_PRF_SS UINT8_C(0x36)
|
---|
4098 | #define X86_OP_PRF_DS UINT8_C(0x3e)
|
---|
4099 | #define X86_OP_PRF_ES UINT8_C(0x26)
|
---|
4100 | #define X86_OP_PRF_FS UINT8_C(0x64)
|
---|
4101 | #define X86_OP_PRF_GS UINT8_C(0x65)
|
---|
4102 | #define X86_OP_PRF_SIZE_OP UINT8_C(0x66)
|
---|
4103 | #define X86_OP_PRF_SIZE_ADDR UINT8_C(0x67)
|
---|
4104 | #define X86_OP_PRF_LOCK UINT8_C(0xf0)
|
---|
4105 | #define X86_OP_PRF_REPZ UINT8_C(0xf2)
|
---|
4106 | #define X86_OP_PRF_REPNZ UINT8_C(0xf3)
|
---|
4107 | #define X86_OP_REX_B UINT8_C(0x41)
|
---|
4108 | #define X86_OP_REX_X UINT8_C(0x42)
|
---|
4109 | #define X86_OP_REX_R UINT8_C(0x44)
|
---|
4110 | #define X86_OP_REX_W UINT8_C(0x48)
|
---|
4111 | /** @} */
|
---|
4112 |
|
---|
4113 |
|
---|
4114 | /** @} */
|
---|
4115 |
|
---|
4116 | #endif
|
---|
4117 |
|
---|