1 | /* $Id: CPUM.cpp 7696 2008-04-02 12:36:33Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * CPUM - CPU Monitor(/Manager)
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | /*******************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *******************************************************************************/
|
---|
22 | #define LOG_GROUP LOG_GROUP_CPUM
|
---|
23 | #include <VBox/cpum.h>
|
---|
24 | #include <VBox/cpumdis.h>
|
---|
25 | #include <VBox/pgm.h>
|
---|
26 | #include <VBox/mm.h>
|
---|
27 | #include <VBox/selm.h>
|
---|
28 | #include <VBox/dbgf.h>
|
---|
29 | #include <VBox/patm.h>
|
---|
30 | #include <VBox/ssm.h>
|
---|
31 | #include "CPUMInternal.h"
|
---|
32 | #include <VBox/vm.h>
|
---|
33 |
|
---|
34 | #include <VBox/param.h>
|
---|
35 | #include <VBox/dis.h>
|
---|
36 | #include <VBox/err.h>
|
---|
37 | #include <VBox/log.h>
|
---|
38 | #include <iprt/assert.h>
|
---|
39 | #include <iprt/asm.h>
|
---|
40 | #include <iprt/string.h>
|
---|
41 | #include <iprt/system.h>
|
---|
42 |
|
---|
43 |
|
---|
44 | /*******************************************************************************
|
---|
45 | * Defined Constants And Macros *
|
---|
46 | *******************************************************************************/
|
---|
47 | /** The saved state version. */
|
---|
48 | #define CPUM_SAVED_STATE_VERSION 6
|
---|
49 |
|
---|
50 |
|
---|
51 | /*******************************************************************************
|
---|
52 | * Structures and Typedefs *
|
---|
53 | *******************************************************************************/
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * What kind of cpu info dump to performe.
|
---|
57 | */
|
---|
58 | typedef enum CPUMDUMPTYPE
|
---|
59 | {
|
---|
60 | CPUMDUMPTYPE_TERSE,
|
---|
61 | CPUMDUMPTYPE_DEFAULT,
|
---|
62 | CPUMDUMPTYPE_VERBOSE
|
---|
63 |
|
---|
64 | } CPUMDUMPTYPE, *PCPUMDUMPTYPE;
|
---|
65 |
|
---|
66 |
|
---|
67 | /*******************************************************************************
|
---|
68 | * Internal Functions *
|
---|
69 | *******************************************************************************/
|
---|
70 | static int cpumR3CpuIdInit(PVM pVM);
|
---|
71 | static DECLCALLBACK(int) cpumR3Save(PVM pVM, PSSMHANDLE pSSM);
|
---|
72 | static DECLCALLBACK(int) cpumR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version);
|
---|
73 | static DECLCALLBACK(void) cpumR3InfoAll(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
74 | static DECLCALLBACK(void) cpumR3InfoGuest(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
75 | static DECLCALLBACK(void) cpumR3InfoHyper(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
76 | static DECLCALLBACK(void) cpumR3InfoHost(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
77 | static DECLCALLBACK(void) cpumR3CpuIdInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
78 |
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Initializes the CPUM.
|
---|
82 | *
|
---|
83 | * @returns VBox status code.
|
---|
84 | * @param pVM The VM to operate on.
|
---|
85 | */
|
---|
86 | CPUMR3DECL(int) CPUMR3Init(PVM pVM)
|
---|
87 | {
|
---|
88 | LogFlow(("CPUMR3Init\n"));
|
---|
89 |
|
---|
90 | /*
|
---|
91 | * Assert alignment and sizes.
|
---|
92 | */
|
---|
93 | AssertRelease(!(RT_OFFSETOF(VM, cpum.s) & 31));
|
---|
94 | AssertRelease(sizeof(pVM->cpum.s) <= sizeof(pVM->cpum.padding));
|
---|
95 |
|
---|
96 | /*
|
---|
97 | * Setup any fixed pointers and offsets.
|
---|
98 | */
|
---|
99 | pVM->cpum.s.offVM = RT_OFFSETOF(VM, cpum);
|
---|
100 | pVM->cpum.s.pCPUMHC = &pVM->cpum.s;
|
---|
101 | pVM->cpum.s.pHyperCoreR3 = CPUMCTX2CORE(&pVM->cpum.s.Hyper);
|
---|
102 | pVM->cpum.s.pHyperCoreR0 = VM_R0_ADDR(pVM, CPUMCTX2CORE(&pVM->cpum.s.Hyper));
|
---|
103 |
|
---|
104 | /* Hidden selector registers are invalid by default. */
|
---|
105 | pVM->cpum.s.fValidHiddenSelRegs = false;
|
---|
106 |
|
---|
107 | /*
|
---|
108 | * Check that the CPU supports the minimum features we require.
|
---|
109 | */
|
---|
110 | /** @todo check the contract! */
|
---|
111 | if (!ASMHasCpuId())
|
---|
112 | {
|
---|
113 | Log(("The CPU doesn't support CPUID!\n"));
|
---|
114 | return VERR_UNSUPPORTED_CPU;
|
---|
115 | }
|
---|
116 | ASMCpuId_ECX_EDX(1, &pVM->cpum.s.CPUFeatures.ecx, &pVM->cpum.s.CPUFeatures.edx);
|
---|
117 |
|
---|
118 | /* Setup the CR4 AND and OR masks used in the switcher */
|
---|
119 | /* Depends on the presence of FXSAVE(SSE) support on the host CPU */
|
---|
120 | if (!pVM->cpum.s.CPUFeatures.edx.u1FXSR)
|
---|
121 | {
|
---|
122 | Log(("The CPU doesn't support FXSAVE/FXRSTOR!\n"));
|
---|
123 | /* No FXSAVE implies no SSE */
|
---|
124 | pVM->cpum.s.CR4.AndMask = X86_CR4_PVI | X86_CR4_VME;
|
---|
125 | pVM->cpum.s.CR4.OrMask = 0;
|
---|
126 | }
|
---|
127 | else
|
---|
128 | {
|
---|
129 | pVM->cpum.s.CR4.AndMask = X86_CR4_OSXMMEEXCPT | X86_CR4_PVI | X86_CR4_VME;
|
---|
130 | pVM->cpum.s.CR4.OrMask = X86_CR4_OSFSXR;
|
---|
131 | }
|
---|
132 |
|
---|
133 | if (!pVM->cpum.s.CPUFeatures.edx.u1MMX)
|
---|
134 | {
|
---|
135 | Log(("The CPU doesn't support MMX!\n"));
|
---|
136 | return VERR_UNSUPPORTED_CPU;
|
---|
137 | }
|
---|
138 | if (!pVM->cpum.s.CPUFeatures.edx.u1TSC)
|
---|
139 | {
|
---|
140 | Log(("The CPU doesn't support TSC!\n"));
|
---|
141 | return VERR_UNSUPPORTED_CPU;
|
---|
142 | }
|
---|
143 | /* Bogus on AMD? */
|
---|
144 | if (!pVM->cpum.s.CPUFeatures.edx.u1SEP)
|
---|
145 | {
|
---|
146 | Log(("The CPU doesn't support SYSENTER/SYSEXIT!\n"));
|
---|
147 | }
|
---|
148 |
|
---|
149 | /*
|
---|
150 | * Setup hypervisor startup values.
|
---|
151 | */
|
---|
152 |
|
---|
153 | /*
|
---|
154 | * Register saved state data item.
|
---|
155 | */
|
---|
156 | int rc = SSMR3RegisterInternal(pVM, "cpum", 1, CPUM_SAVED_STATE_VERSION, sizeof(CPUM),
|
---|
157 | NULL, cpumR3Save, NULL,
|
---|
158 | NULL, cpumR3Load, NULL);
|
---|
159 | if (VBOX_FAILURE(rc))
|
---|
160 | return rc;
|
---|
161 |
|
---|
162 | /*
|
---|
163 | * Register info handlers.
|
---|
164 | */
|
---|
165 | DBGFR3InfoRegisterInternal(pVM, "cpum", "Displays the all the cpu states.", &cpumR3InfoAll);
|
---|
166 | DBGFR3InfoRegisterInternal(pVM, "cpumguest", "Displays the guest cpu state.", &cpumR3InfoGuest);
|
---|
167 | DBGFR3InfoRegisterInternal(pVM, "cpumhyper", "Displays the hypervisor cpu state.", &cpumR3InfoHyper);
|
---|
168 | DBGFR3InfoRegisterInternal(pVM, "cpumhost", "Displays the host cpu state.", &cpumR3InfoHost);
|
---|
169 | DBGFR3InfoRegisterInternal(pVM, "cpuid", "Displays the guest cpuid leaves.", &cpumR3CpuIdInfo);
|
---|
170 |
|
---|
171 | /*
|
---|
172 | * Initialize the Guest CPU state.
|
---|
173 | */
|
---|
174 | rc = cpumR3CpuIdInit(pVM);
|
---|
175 | if (VBOX_FAILURE(rc))
|
---|
176 | return rc;
|
---|
177 | CPUMR3Reset(pVM);
|
---|
178 | return VINF_SUCCESS;
|
---|
179 | }
|
---|
180 |
|
---|
181 |
|
---|
182 | /**
|
---|
183 | * Initializes the emulated CPU's cpuid information.
|
---|
184 | *
|
---|
185 | * @returns VBox status code.
|
---|
186 | * @param pVM The VM to operate on.
|
---|
187 | */
|
---|
188 | static int cpumR3CpuIdInit(PVM pVM)
|
---|
189 | {
|
---|
190 | PCPUM pCPUM = &pVM->cpum.s;
|
---|
191 | uint32_t i;
|
---|
192 |
|
---|
193 | /*
|
---|
194 | * Get the host CPUIDs.
|
---|
195 | */
|
---|
196 | for (i = 0; i < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdStd); i++)
|
---|
197 | ASMCpuId_Idx_ECX(i, 0,
|
---|
198 | &pCPUM->aGuestCpuIdStd[i].eax, &pCPUM->aGuestCpuIdStd[i].ebx,
|
---|
199 | &pCPUM->aGuestCpuIdStd[i].ecx, &pCPUM->aGuestCpuIdStd[i].edx);
|
---|
200 | for (i = 0; i < RT_ELEMENTS(pCPUM->aGuestCpuIdExt); i++)
|
---|
201 | ASMCpuId(0x80000000 + i,
|
---|
202 | &pCPUM->aGuestCpuIdExt[i].eax, &pCPUM->aGuestCpuIdExt[i].ebx,
|
---|
203 | &pCPUM->aGuestCpuIdExt[i].ecx, &pCPUM->aGuestCpuIdExt[i].edx);
|
---|
204 | for (i = 0; i < RT_ELEMENTS(pCPUM->aGuestCpuIdCentaur); i++)
|
---|
205 | ASMCpuId(0xc0000000 + i,
|
---|
206 | &pCPUM->aGuestCpuIdCentaur[i].eax, &pCPUM->aGuestCpuIdCentaur[i].ebx,
|
---|
207 | &pCPUM->aGuestCpuIdCentaur[i].ecx, &pCPUM->aGuestCpuIdCentaur[i].edx);
|
---|
208 |
|
---|
209 |
|
---|
210 | /*
|
---|
211 | * Only report features we can support.
|
---|
212 | */
|
---|
213 | pCPUM->aGuestCpuIdStd[1].edx &= X86_CPUID_FEATURE_EDX_FPU
|
---|
214 | | X86_CPUID_FEATURE_EDX_VME
|
---|
215 | | X86_CPUID_FEATURE_EDX_DE
|
---|
216 | | X86_CPUID_FEATURE_EDX_PSE
|
---|
217 | | X86_CPUID_FEATURE_EDX_TSC
|
---|
218 | | X86_CPUID_FEATURE_EDX_MSR
|
---|
219 | //| X86_CPUID_FEATURE_EDX_PAE - not implemented yet.
|
---|
220 | | X86_CPUID_FEATURE_EDX_MCE
|
---|
221 | | X86_CPUID_FEATURE_EDX_CX8
|
---|
222 | //| X86_CPUID_FEATURE_EDX_APIC - set by the APIC device if present.
|
---|
223 | /** @note we don't report sysenter/sysexit support due to our inability to keep the IOPL part of eflags in sync while in ring 1 (see #1757) */
|
---|
224 | //| X86_CPUID_FEATURE_EDX_SEP
|
---|
225 | //| X86_CPUID_FEATURE_EDX_MTRR - no MTRRs.
|
---|
226 | | X86_CPUID_FEATURE_EDX_PGE
|
---|
227 | //| X86_CPUID_FEATURE_EDX_MCA - not virtualized.
|
---|
228 | | X86_CPUID_FEATURE_EDX_CMOV
|
---|
229 | //| X86_CPUID_FEATURE_EDX_PAT - not virtualized.
|
---|
230 | //| X86_CPUID_FEATURE_EDX_PSE36 - not virtualized.
|
---|
231 | //| X86_CPUID_FEATURE_EDX_PSN - no serial number.
|
---|
232 | | X86_CPUID_FEATURE_EDX_CLFSH
|
---|
233 | //| X86_CPUID_FEATURE_EDX_DS - no debug store.
|
---|
234 | //| X86_CPUID_FEATURE_EDX_ACPI - not virtualized yet.
|
---|
235 | | X86_CPUID_FEATURE_EDX_MMX
|
---|
236 | | X86_CPUID_FEATURE_EDX_FXSR
|
---|
237 | | X86_CPUID_FEATURE_EDX_SSE
|
---|
238 | | X86_CPUID_FEATURE_EDX_SSE2
|
---|
239 | //| X86_CPUID_FEATURE_EDX_SS - no self snoop.
|
---|
240 | //| X86_CPUID_FEATURE_EDX_HTT - no hyperthreading.
|
---|
241 | //| X86_CPUID_FEATURE_EDX_TM - no thermal monitor.
|
---|
242 | //| X86_CPUID_FEATURE_EDX_PBE - no pneding break enabled.
|
---|
243 | | 0;
|
---|
244 | pCPUM->aGuestCpuIdStd[1].ecx &= 0//X86_CPUID_FEATURE_ECX_SSE3 - not supported by the recompiler yet.
|
---|
245 | | X86_CPUID_FEATURE_ECX_MONITOR
|
---|
246 | //| X86_CPUID_FEATURE_ECX_CPLDS - no CPL qualified debug store.
|
---|
247 | //| X86_CPUID_FEATURE_ECX_VMX - not virtualized.
|
---|
248 | //| X86_CPUID_FEATURE_ECX_EST - no extended speed step.
|
---|
249 | //| X86_CPUID_FEATURE_ECX_TM2 - no thermal monitor 2.
|
---|
250 | //| X86_CPUID_FEATURE_ECX_CNTXID - no L1 context id (MSR++).
|
---|
251 | | 0;
|
---|
252 |
|
---|
253 | /* ASSUMES that this is ALWAYS the AMD define feature set if present. */
|
---|
254 | pCPUM->aGuestCpuIdExt[1].edx &= X86_CPUID_AMD_FEATURE_EDX_FPU
|
---|
255 | | X86_CPUID_AMD_FEATURE_EDX_VME
|
---|
256 | | X86_CPUID_AMD_FEATURE_EDX_DE
|
---|
257 | | X86_CPUID_AMD_FEATURE_EDX_PSE
|
---|
258 | | X86_CPUID_AMD_FEATURE_EDX_TSC
|
---|
259 | | X86_CPUID_AMD_FEATURE_EDX_MSR //?? this means AMD MSRs..
|
---|
260 | //| X86_CPUID_AMD_FEATURE_EDX_PAE - not implemented yet.
|
---|
261 | //| X86_CPUID_AMD_FEATURE_EDX_MCE - not virtualized yet.
|
---|
262 | | X86_CPUID_AMD_FEATURE_EDX_CX8
|
---|
263 | //| X86_CPUID_AMD_FEATURE_EDX_APIC - set by the APIC device if present.
|
---|
264 | /** @note we don't report sysenter/sysexit support due to our inability to keep the IOPL part of eflags in sync while in ring 1 (see #1757) */
|
---|
265 | //| X86_CPUID_AMD_FEATURE_EDX_SEP
|
---|
266 | //| X86_CPUID_AMD_FEATURE_EDX_MTRR - not virtualized.
|
---|
267 | | X86_CPUID_AMD_FEATURE_EDX_PGE
|
---|
268 | //| X86_CPUID_AMD_FEATURE_EDX_MCA - not virtualized.
|
---|
269 | | X86_CPUID_AMD_FEATURE_EDX_CMOV
|
---|
270 | | X86_CPUID_AMD_FEATURE_EDX_PAT
|
---|
271 | //| X86_CPUID_AMD_FEATURE_EDX_PSE36 - not virtualized.
|
---|
272 | //| X86_CPUID_AMD_FEATURE_EDX_NX - not virtualized, requires PAE.
|
---|
273 | | X86_CPUID_AMD_FEATURE_EDX_MMX
|
---|
274 | | X86_CPUID_AMD_FEATURE_EDX_FXSR
|
---|
275 | | X86_CPUID_AMD_FEATURE_EDX_FFXSR
|
---|
276 | //| X86_CPUID_AMD_FEATURE_EDX_LONG_MODE - not yet.
|
---|
277 | | X86_CPUID_AMD_FEATURE_EDX_3DNOW_EX
|
---|
278 | | X86_CPUID_AMD_FEATURE_EDX_3DNOW
|
---|
279 | | 0;
|
---|
280 | pCPUM->aGuestCpuIdExt[1].ecx &= 0//X86_CPUID_AMD_FEATURE_ECX_SVM - not virtualized.
|
---|
281 | | 0;
|
---|
282 |
|
---|
283 | /*
|
---|
284 | * Hide HTT, multicode, SMP, whatever.
|
---|
285 | * (APIC-ID := 0 and #LogCpus := 0)
|
---|
286 | */
|
---|
287 | pCPUM->aGuestCpuIdStd[1].ebx &= 0x0000ffff;
|
---|
288 |
|
---|
289 | /*
|
---|
290 | * Determin the default.
|
---|
291 | *
|
---|
292 | * Intel returns values of the highest standard function, while AMD
|
---|
293 | * returns zeros. VIA on the other hand seems to returning nothing or
|
---|
294 | * perhaps some random garbage, we don't try duplicate this behavior.
|
---|
295 | */
|
---|
296 | ASMCpuId(pCPUM->aGuestCpuIdStd[0].eax + 10,
|
---|
297 | &pCPUM->GuestCpuIdDef.eax, &pCPUM->GuestCpuIdDef.ebx,
|
---|
298 | &pCPUM->GuestCpuIdDef.ecx, &pCPUM->GuestCpuIdDef.edx);
|
---|
299 |
|
---|
300 | /*
|
---|
301 | * Limit it the number of entries and fill the remaining with the defaults.
|
---|
302 | *
|
---|
303 | * The limits are masking off stuff about power saving and similar, this
|
---|
304 | * is perhaps a bit crudely done as there is probably some relatively harmless
|
---|
305 | * info too in these leaves (like words about having a constant TSC).
|
---|
306 | */
|
---|
307 | if (pCPUM->aGuestCpuIdStd[0].eax > 2)
|
---|
308 | pCPUM->aGuestCpuIdStd[0].eax = 2;
|
---|
309 | for (i = pCPUM->aGuestCpuIdStd[0].eax + 1; i < RT_ELEMENTS(pCPUM->aGuestCpuIdStd); i++)
|
---|
310 | pCPUM->aGuestCpuIdStd[i] = pCPUM->GuestCpuIdDef;
|
---|
311 |
|
---|
312 | if (pCPUM->aGuestCpuIdExt[0].eax > UINT32_C(0x80000004))
|
---|
313 | pCPUM->aGuestCpuIdExt[0].eax = UINT32_C(0x80000004);
|
---|
314 | for (i = pCPUM->aGuestCpuIdExt[0].eax >= UINT32_C(0x80000000)
|
---|
315 | ? pCPUM->aGuestCpuIdExt[0].eax - UINT32_C(0x80000000) + 1
|
---|
316 | : 0;
|
---|
317 | i < RT_ELEMENTS(pCPUM->aGuestCpuIdExt); i++)
|
---|
318 | pCPUM->aGuestCpuIdExt[i] = pCPUM->GuestCpuIdDef;
|
---|
319 |
|
---|
320 | /*
|
---|
321 | * Workaround for missing cpuid(0) patches: If we miss to patch a cpuid(0).eax then
|
---|
322 | * Linux tries to determine the number of processors from (cpuid(4).eax >> 26) + 1.
|
---|
323 | * We don't support more than 1 processor.
|
---|
324 | */
|
---|
325 | pCPUM->aGuestCpuIdStd[4].eax = 0;
|
---|
326 |
|
---|
327 | /*
|
---|
328 | * Centaur stuff (VIA).
|
---|
329 | *
|
---|
330 | * The important part here (we think) is to make sure the 0xc0000000
|
---|
331 | * function returns 0xc0000001. As for the features, we don't currently
|
---|
332 | * let on about any of those... 0xc0000002 seems to be some
|
---|
333 | * temperature/hz/++ stuff, include it as well (static).
|
---|
334 | */
|
---|
335 | if ( pCPUM->aGuestCpuIdCentaur[0].eax >= UINT32_C(0xc0000000)
|
---|
336 | && pCPUM->aGuestCpuIdCentaur[0].eax <= UINT32_C(0xc0000004))
|
---|
337 | {
|
---|
338 | pCPUM->aGuestCpuIdCentaur[0].eax = RT_MIN(pCPUM->aGuestCpuIdCentaur[0].eax, UINT32_C(0xc0000002));
|
---|
339 | pCPUM->aGuestCpuIdCentaur[1].edx = 0; /* all features hidden */
|
---|
340 | for (i = pCPUM->aGuestCpuIdCentaur[0].eax - UINT32_C(0xc0000000);
|
---|
341 | i < RT_ELEMENTS(pCPUM->aGuestCpuIdCentaur);
|
---|
342 | i++)
|
---|
343 | pCPUM->aGuestCpuIdCentaur[i] = pCPUM->GuestCpuIdDef;
|
---|
344 | }
|
---|
345 | else
|
---|
346 | for (i = 0; i < RT_ELEMENTS(pCPUM->aGuestCpuIdCentaur); i++)
|
---|
347 | pCPUM->aGuestCpuIdCentaur[i] = pCPUM->GuestCpuIdDef;
|
---|
348 |
|
---|
349 |
|
---|
350 | /*
|
---|
351 | * Load CPUID overrides from configuration.
|
---|
352 | */
|
---|
353 | PCPUMCPUID pCpuId = &pCPUM->aGuestCpuIdStd[0];
|
---|
354 | uint32_t cElements = ELEMENTS(pCPUM->aGuestCpuIdStd);
|
---|
355 | for (i=0;; )
|
---|
356 | {
|
---|
357 | while (cElements-- > 0)
|
---|
358 | {
|
---|
359 | PCFGMNODE pNode = CFGMR3GetChildF(CFGMR3GetRoot(pVM), "CPUM/CPUID/%RX32", i);
|
---|
360 | if (pNode)
|
---|
361 | {
|
---|
362 | uint32_t u32;
|
---|
363 | int rc = CFGMR3QueryU32(pNode, "eax", &u32);
|
---|
364 | if (VBOX_SUCCESS(rc))
|
---|
365 | pCpuId->eax = u32;
|
---|
366 | else
|
---|
367 | AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
|
---|
368 |
|
---|
369 | rc = CFGMR3QueryU32(pNode, "ebx", &u32);
|
---|
370 | if (VBOX_SUCCESS(rc))
|
---|
371 | pCpuId->ebx = u32;
|
---|
372 | else
|
---|
373 | AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
|
---|
374 |
|
---|
375 | rc = CFGMR3QueryU32(pNode, "ecx", &u32);
|
---|
376 | if (VBOX_SUCCESS(rc))
|
---|
377 | pCpuId->ecx = u32;
|
---|
378 | else
|
---|
379 | AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
|
---|
380 |
|
---|
381 | rc = CFGMR3QueryU32(pNode, "edx", &u32);
|
---|
382 | if (VBOX_SUCCESS(rc))
|
---|
383 | pCpuId->edx = u32;
|
---|
384 | else
|
---|
385 | AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
|
---|
386 | }
|
---|
387 | pCpuId++;
|
---|
388 | i++;
|
---|
389 | }
|
---|
390 |
|
---|
391 | /* next */
|
---|
392 | if ((i & UINT32_C(0xc0000000)) == 0)
|
---|
393 | {
|
---|
394 | pCpuId = &pCPUM->aGuestCpuIdExt[0];
|
---|
395 | cElements = RT_ELEMENTS(pCPUM->aGuestCpuIdExt);
|
---|
396 | i = UINT32_C(0x80000000);
|
---|
397 | }
|
---|
398 | else if ((i & UINT32_C(0xc0000000)) == UINT32_C(0x80000000))
|
---|
399 | {
|
---|
400 | pCpuId = &pCPUM->aGuestCpuIdCentaur[0];
|
---|
401 | cElements = RT_ELEMENTS(pCPUM->aGuestCpuIdCentaur);
|
---|
402 | i = UINT32_C(0xc0000000);
|
---|
403 | }
|
---|
404 | else
|
---|
405 | break;
|
---|
406 | }
|
---|
407 |
|
---|
408 | /*
|
---|
409 | * Log the cpuid and we're good.
|
---|
410 | */
|
---|
411 | LogRel(("Logical host processors: %d, processor active mask: %08x\n",
|
---|
412 | RTSystemProcessorGetCount(), RTSystemProcessorGetActiveMask()));
|
---|
413 | LogRel(("************************* CPUID dump ************************\n"));
|
---|
414 | DBGFR3Info(pVM, "cpuid", "verbose", DBGFR3InfoLogRelHlp());
|
---|
415 | LogRel(("\n"));
|
---|
416 | DBGFR3InfoLog(pVM, "cpuid", "verbose"); /* macro */
|
---|
417 | LogRel(("******************** End of CPUID dump **********************\n"));
|
---|
418 | return VINF_SUCCESS;
|
---|
419 | }
|
---|
420 |
|
---|
421 |
|
---|
422 |
|
---|
423 |
|
---|
424 | /**
|
---|
425 | * Applies relocations to data and code managed by this
|
---|
426 | * component. This function will be called at init and
|
---|
427 | * whenever the VMM need to relocate it self inside the GC.
|
---|
428 | *
|
---|
429 | * The CPUM will update the addresses used by the switcher.
|
---|
430 | *
|
---|
431 | * @param pVM The VM.
|
---|
432 | */
|
---|
433 | CPUMR3DECL(void) CPUMR3Relocate(PVM pVM)
|
---|
434 | {
|
---|
435 | LogFlow(("CPUMR3Relocate\n"));
|
---|
436 | /*
|
---|
437 | * Switcher pointers.
|
---|
438 | */
|
---|
439 | pVM->cpum.s.pCPUMGC = VM_GUEST_ADDR(pVM, &pVM->cpum.s);
|
---|
440 | pVM->cpum.s.pHyperCoreGC = MMHyperCCToGC(pVM, pVM->cpum.s.pHyperCoreR3);
|
---|
441 | Assert(pVM->cpum.s.pHyperCoreGC != NIL_RTGCPTR);
|
---|
442 | }
|
---|
443 |
|
---|
444 |
|
---|
445 | /**
|
---|
446 | * Queries the pointer to the internal CPUMCTX structure
|
---|
447 | *
|
---|
448 | * @returns VBox status code.
|
---|
449 | * @param pVM Handle to the virtual machine.
|
---|
450 | * @param ppCtx Receives the CPUMCTX GC pointer when successful.
|
---|
451 | */
|
---|
452 | CPUMR3DECL(int) CPUMR3QueryGuestCtxGCPtr(PVM pVM, GCPTRTYPE(PCPUMCTX) *ppCtx)
|
---|
453 | {
|
---|
454 | LogFlow(("CPUMR3QueryGuestCtxGCPtr\n"));
|
---|
455 | /*
|
---|
456 | * Store the address. (Later we might check how's calling, thus the RC.)
|
---|
457 | */
|
---|
458 | *ppCtx = VM_GUEST_ADDR(pVM, &pVM->cpum.s.Guest);
|
---|
459 | return VINF_SUCCESS;
|
---|
460 | }
|
---|
461 |
|
---|
462 |
|
---|
463 | /**
|
---|
464 | * Terminates the CPUM.
|
---|
465 | *
|
---|
466 | * Termination means cleaning up and freeing all resources,
|
---|
467 | * the VM it self is at this point powered off or suspended.
|
---|
468 | *
|
---|
469 | * @returns VBox status code.
|
---|
470 | * @param pVM The VM to operate on.
|
---|
471 | */
|
---|
472 | CPUMR3DECL(int) CPUMR3Term(PVM pVM)
|
---|
473 | {
|
---|
474 | /** @todo */
|
---|
475 | return 0;
|
---|
476 | }
|
---|
477 |
|
---|
478 |
|
---|
479 | /**
|
---|
480 | * Resets the CPU.
|
---|
481 | *
|
---|
482 | * @returns VINF_SUCCESS.
|
---|
483 | * @param pVM The VM handle.
|
---|
484 | */
|
---|
485 | CPUMR3DECL(void) CPUMR3Reset(PVM pVM)
|
---|
486 | {
|
---|
487 | PCPUMCTX pCtx = &pVM->cpum.s.Guest;
|
---|
488 |
|
---|
489 | /*
|
---|
490 | * Initialize everything to ZERO first.
|
---|
491 | */
|
---|
492 | uint32_t fUseFlags = pVM->cpum.s.fUseFlags & ~CPUM_USED_FPU_SINCE_REM;
|
---|
493 | memset(pCtx, 0, sizeof(*pCtx));
|
---|
494 | pVM->cpum.s.fUseFlags = fUseFlags;
|
---|
495 |
|
---|
496 | pCtx->cr0 = X86_CR0_CD | X86_CR0_NW | X86_CR0_ET; //0x60000010
|
---|
497 | pCtx->eip = 0x0000fff0;
|
---|
498 | pCtx->edx = 0x00000600; /* P6 processor */
|
---|
499 | pCtx->eflags.Bits.u1Reserved0 = 1;
|
---|
500 |
|
---|
501 | pCtx->cs = 0xf000;
|
---|
502 | pCtx->csHid.u32Base = 0xffff0000;
|
---|
503 | pCtx->csHid.u32Limit = 0x0000ffff;
|
---|
504 | pCtx->csHid.Attr.n.u1DescType = 1; /* code/data segment */
|
---|
505 | pCtx->csHid.Attr.n.u1Present = 1;
|
---|
506 | pCtx->csHid.Attr.n.u4Type = X86_SEL_TYPE_READ | X86_SEL_TYPE_CODE;
|
---|
507 |
|
---|
508 | pCtx->dsHid.u32Limit = 0x0000ffff;
|
---|
509 | pCtx->dsHid.Attr.n.u1DescType = 1; /* code/data segment */
|
---|
510 | pCtx->dsHid.Attr.n.u1Present = 1;
|
---|
511 | pCtx->dsHid.Attr.n.u4Type = X86_SEL_TYPE_RW;
|
---|
512 |
|
---|
513 | pCtx->esHid.u32Limit = 0x0000ffff;
|
---|
514 | pCtx->esHid.Attr.n.u1DescType = 1; /* code/data segment */
|
---|
515 | pCtx->esHid.Attr.n.u1Present = 1;
|
---|
516 | pCtx->esHid.Attr.n.u4Type = X86_SEL_TYPE_RW;
|
---|
517 |
|
---|
518 | pCtx->fsHid.u32Limit = 0x0000ffff;
|
---|
519 | pCtx->fsHid.Attr.n.u1DescType = 1; /* code/data segment */
|
---|
520 | pCtx->fsHid.Attr.n.u1Present = 1;
|
---|
521 | pCtx->fsHid.Attr.n.u4Type = X86_SEL_TYPE_RW;
|
---|
522 |
|
---|
523 | pCtx->gsHid.u32Limit = 0x0000ffff;
|
---|
524 | pCtx->gsHid.Attr.n.u1DescType = 1; /* code/data segment */
|
---|
525 | pCtx->gsHid.Attr.n.u1Present = 1;
|
---|
526 | pCtx->gsHid.Attr.n.u4Type = X86_SEL_TYPE_RW;
|
---|
527 |
|
---|
528 | pCtx->ssHid.u32Limit = 0x0000ffff;
|
---|
529 | pCtx->ssHid.Attr.n.u1Present = 1;
|
---|
530 | pCtx->ssHid.Attr.n.u1DescType = 1; /* code/data segment */
|
---|
531 | pCtx->ssHid.Attr.n.u4Type = X86_SEL_TYPE_RW;
|
---|
532 |
|
---|
533 | pCtx->idtr.cbIdt = 0xffff;
|
---|
534 | pCtx->gdtr.cbGdt = 0xffff;
|
---|
535 |
|
---|
536 | pCtx->ldtrHid.u32Limit = 0xffff;
|
---|
537 | pCtx->ldtrHid.Attr.n.u1Present = 1;
|
---|
538 | pCtx->ldtrHid.Attr.n.u4Type = X86_SEL_TYPE_SYS_LDT;
|
---|
539 |
|
---|
540 | pCtx->trHid.u32Limit = 0xffff;
|
---|
541 | pCtx->trHid.Attr.n.u1Present = 1;
|
---|
542 | pCtx->trHid.Attr.n.u4Type = X86_SEL_TYPE_SYS_286_TSS_BUSY;
|
---|
543 |
|
---|
544 | pCtx->dr6 = 0xFFFF0FF0;
|
---|
545 | pCtx->dr7 = 0x400;
|
---|
546 |
|
---|
547 | pCtx->fpu.FTW = 0xff; /* All tags are set, i.e. the regs are empty. */
|
---|
548 | pCtx->fpu.FCW = 0x37f;
|
---|
549 |
|
---|
550 | /* Init PAT MSR */
|
---|
551 | pCtx->msrPAT = 0x0007040600070406ULL; /* @todo correct? */
|
---|
552 | }
|
---|
553 |
|
---|
554 |
|
---|
555 |
|
---|
556 | /**
|
---|
557 | * Execute state save operation.
|
---|
558 | *
|
---|
559 | * @returns VBox status code.
|
---|
560 | * @param pVM VM Handle.
|
---|
561 | * @param pSSM SSM operation handle.
|
---|
562 | */
|
---|
563 | static DECLCALLBACK(int) cpumR3Save(PVM pVM, PSSMHANDLE pSSM)
|
---|
564 | {
|
---|
565 | /*
|
---|
566 | * Save.
|
---|
567 | */
|
---|
568 | SSMR3PutMem(pSSM, &pVM->cpum.s.Hyper, sizeof(pVM->cpum.s.Hyper));
|
---|
569 | SSMR3PutMem(pSSM, &pVM->cpum.s.Guest, sizeof(pVM->cpum.s.Guest));
|
---|
570 | SSMR3PutU32(pSSM, pVM->cpum.s.fUseFlags);
|
---|
571 | SSMR3PutU32(pSSM, pVM->cpum.s.fChanged);
|
---|
572 |
|
---|
573 | SSMR3PutU32(pSSM, ELEMENTS(pVM->cpum.s.aGuestCpuIdStd));
|
---|
574 | SSMR3PutMem(pSSM, &pVM->cpum.s.aGuestCpuIdStd[0], sizeof(pVM->cpum.s.aGuestCpuIdStd));
|
---|
575 |
|
---|
576 | SSMR3PutU32(pSSM, ELEMENTS(pVM->cpum.s.aGuestCpuIdExt));
|
---|
577 | SSMR3PutMem(pSSM, &pVM->cpum.s.aGuestCpuIdExt[0], sizeof(pVM->cpum.s.aGuestCpuIdExt));
|
---|
578 |
|
---|
579 | SSMR3PutU32(pSSM, ELEMENTS(pVM->cpum.s.aGuestCpuIdCentaur));
|
---|
580 | SSMR3PutMem(pSSM, &pVM->cpum.s.aGuestCpuIdCentaur[0], sizeof(pVM->cpum.s.aGuestCpuIdCentaur));
|
---|
581 |
|
---|
582 | SSMR3PutMem(pSSM, &pVM->cpum.s.GuestCpuIdDef, sizeof(pVM->cpum.s.GuestCpuIdDef));
|
---|
583 |
|
---|
584 | /* Add the cpuid for checking that the cpu is unchanged. */
|
---|
585 | uint32_t au32CpuId[8] = {0};
|
---|
586 | ASMCpuId(0, &au32CpuId[0], &au32CpuId[1], &au32CpuId[2], &au32CpuId[3]);
|
---|
587 | ASMCpuId(1, &au32CpuId[4], &au32CpuId[5], &au32CpuId[6], &au32CpuId[7]);
|
---|
588 | return SSMR3PutMem(pSSM, &au32CpuId[0], sizeof(au32CpuId));
|
---|
589 | }
|
---|
590 |
|
---|
591 |
|
---|
592 | /**
|
---|
593 | * Execute state load operation.
|
---|
594 | *
|
---|
595 | * @returns VBox status code.
|
---|
596 | * @param pVM VM Handle.
|
---|
597 | * @param pSSM SSM operation handle.
|
---|
598 | * @param u32Version Data layout version.
|
---|
599 | */
|
---|
600 | static DECLCALLBACK(int) cpumR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)
|
---|
601 | {
|
---|
602 | /*
|
---|
603 | * Validate version.
|
---|
604 | */
|
---|
605 | if (u32Version != CPUM_SAVED_STATE_VERSION)
|
---|
606 | {
|
---|
607 | Log(("cpuR3Load: Invalid version u32Version=%d!\n", u32Version));
|
---|
608 | return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
|
---|
609 | }
|
---|
610 |
|
---|
611 | /*
|
---|
612 | * Restore.
|
---|
613 | */
|
---|
614 | uint32_t uCR3 = pVM->cpum.s.Hyper.cr3;
|
---|
615 | uint32_t uESP = pVM->cpum.s.Hyper.esp; /* see VMMR3Relocate(). */
|
---|
616 | SSMR3GetMem(pSSM, &pVM->cpum.s.Hyper, sizeof(pVM->cpum.s.Hyper));
|
---|
617 | pVM->cpum.s.Hyper.cr3 = uCR3;
|
---|
618 | pVM->cpum.s.Hyper.esp = uESP;
|
---|
619 | SSMR3GetMem(pSSM, &pVM->cpum.s.Guest, sizeof(pVM->cpum.s.Guest));
|
---|
620 | SSMR3GetU32(pSSM, &pVM->cpum.s.fUseFlags);
|
---|
621 | SSMR3GetU32(pSSM, &pVM->cpum.s.fChanged);
|
---|
622 |
|
---|
623 | uint32_t cElements;
|
---|
624 | int rc = SSMR3GetU32(pSSM, &cElements); AssertRCReturn(rc, rc);
|
---|
625 | if (cElements != ELEMENTS(pVM->cpum.s.aGuestCpuIdStd))
|
---|
626 | return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
|
---|
627 | SSMR3GetMem(pSSM, &pVM->cpum.s.aGuestCpuIdStd[0], sizeof(pVM->cpum.s.aGuestCpuIdStd));
|
---|
628 |
|
---|
629 | rc = SSMR3GetU32(pSSM, &cElements); AssertRCReturn(rc, rc);
|
---|
630 | if (cElements != ELEMENTS(pVM->cpum.s.aGuestCpuIdExt))
|
---|
631 | return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
|
---|
632 | SSMR3GetMem(pSSM, &pVM->cpum.s.aGuestCpuIdExt[0], sizeof(pVM->cpum.s.aGuestCpuIdExt));
|
---|
633 |
|
---|
634 | rc = SSMR3GetU32(pSSM, &cElements); AssertRCReturn(rc, rc);
|
---|
635 | if (cElements != RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdCentaur))
|
---|
636 | return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
|
---|
637 | SSMR3GetMem(pSSM, &pVM->cpum.s.aGuestCpuIdCentaur[0], sizeof(pVM->cpum.s.aGuestCpuIdCentaur));
|
---|
638 |
|
---|
639 | SSMR3GetMem(pSSM, &pVM->cpum.s.GuestCpuIdDef, sizeof(pVM->cpum.s.GuestCpuIdDef));
|
---|
640 |
|
---|
641 | /*
|
---|
642 | * Check that the basic cpuid id information is unchanged.
|
---|
643 | */
|
---|
644 | uint32_t au32CpuId[8] = {0};
|
---|
645 | ASMCpuId(0, &au32CpuId[0], &au32CpuId[1], &au32CpuId[2], &au32CpuId[3]);
|
---|
646 | ASMCpuId(1, &au32CpuId[4], &au32CpuId[5], &au32CpuId[6], &au32CpuId[7]);
|
---|
647 | uint32_t au32CpuIdSaved[8];
|
---|
648 | rc = SSMR3GetMem(pSSM, &au32CpuIdSaved[0], sizeof(au32CpuIdSaved));
|
---|
649 | if (VBOX_SUCCESS(rc))
|
---|
650 | {
|
---|
651 | /* Ignore APIC ID (AMD specs). */
|
---|
652 | au32CpuId[5] &= ~0xff000000;
|
---|
653 | au32CpuIdSaved[5] &= ~0xff000000;
|
---|
654 | /* Ignore the number of Logical CPUs (AMD specs). */
|
---|
655 | au32CpuId[5] &= ~0x00ff0000;
|
---|
656 | au32CpuIdSaved[5] &= ~0x00ff0000;
|
---|
657 |
|
---|
658 | /* do the compare */
|
---|
659 | if (memcmp(au32CpuIdSaved, au32CpuId, sizeof(au32CpuIdSaved)))
|
---|
660 | {
|
---|
661 | if (SSMR3HandleGetAfter(pSSM) == SSMAFTER_DEBUG_IT)
|
---|
662 | LogRel(("cpumR3Load: CpuId mismatch! (ignored due to SSMAFTER_DEBUG_IT)\n"
|
---|
663 | "Saved=%.*Vhxs\n"
|
---|
664 | "Real =%.*Vhxs\n",
|
---|
665 | sizeof(au32CpuIdSaved), au32CpuIdSaved,
|
---|
666 | sizeof(au32CpuId), au32CpuId));
|
---|
667 | else
|
---|
668 | {
|
---|
669 | LogRel(("cpumR3Load: CpuId mismatch!\n"
|
---|
670 | "Saved=%.*Vhxs\n"
|
---|
671 | "Real =%.*Vhxs\n",
|
---|
672 | sizeof(au32CpuIdSaved), au32CpuIdSaved,
|
---|
673 | sizeof(au32CpuId), au32CpuId));
|
---|
674 | rc = VERR_SSM_LOAD_CPUID_MISMATCH;
|
---|
675 | }
|
---|
676 | }
|
---|
677 | }
|
---|
678 |
|
---|
679 | return rc;
|
---|
680 | }
|
---|
681 |
|
---|
682 |
|
---|
683 | /**
|
---|
684 | * Formats the EFLAGS value into mnemonics.
|
---|
685 | *
|
---|
686 | * @param pszEFlags Where to write the mnemonics. (Assumes sufficient buffer space.)
|
---|
687 | * @param efl The EFLAGS value.
|
---|
688 | */
|
---|
689 | static void cpumR3InfoFormatFlags(char *pszEFlags, uint32_t efl)
|
---|
690 | {
|
---|
691 | /*
|
---|
692 | * Format the flags.
|
---|
693 | */
|
---|
694 | static struct
|
---|
695 | {
|
---|
696 | const char *pszSet; const char *pszClear; uint32_t fFlag;
|
---|
697 | } s_aFlags[] =
|
---|
698 | {
|
---|
699 | { "vip",NULL, X86_EFL_VIP },
|
---|
700 | { "vif",NULL, X86_EFL_VIF },
|
---|
701 | { "ac", NULL, X86_EFL_AC },
|
---|
702 | { "vm", NULL, X86_EFL_VM },
|
---|
703 | { "rf", NULL, X86_EFL_RF },
|
---|
704 | { "nt", NULL, X86_EFL_NT },
|
---|
705 | { "ov", "nv", X86_EFL_OF },
|
---|
706 | { "dn", "up", X86_EFL_DF },
|
---|
707 | { "ei", "di", X86_EFL_IF },
|
---|
708 | { "tf", NULL, X86_EFL_TF },
|
---|
709 | { "nt", "pl", X86_EFL_SF },
|
---|
710 | { "nz", "zr", X86_EFL_ZF },
|
---|
711 | { "ac", "na", X86_EFL_AF },
|
---|
712 | { "po", "pe", X86_EFL_PF },
|
---|
713 | { "cy", "nc", X86_EFL_CF },
|
---|
714 | };
|
---|
715 | char *psz = pszEFlags;
|
---|
716 | for (unsigned i = 0; i < ELEMENTS(s_aFlags); i++)
|
---|
717 | {
|
---|
718 | const char *pszAdd = s_aFlags[i].fFlag & efl ? s_aFlags[i].pszSet : s_aFlags[i].pszClear;
|
---|
719 | if (pszAdd)
|
---|
720 | {
|
---|
721 | strcpy(psz, pszAdd);
|
---|
722 | psz += strlen(pszAdd);
|
---|
723 | *psz++ = ' ';
|
---|
724 | }
|
---|
725 | }
|
---|
726 | psz[-1] = '\0';
|
---|
727 | }
|
---|
728 |
|
---|
729 |
|
---|
730 | /**
|
---|
731 | * Formats a full register dump.
|
---|
732 | *
|
---|
733 | * @param pCtx The context to format.
|
---|
734 | * @param pCtxCore The context core to format.
|
---|
735 | * @param pHlp Output functions.
|
---|
736 | * @param enmType The dump type.
|
---|
737 | * @param pszPrefix Register name prefix.
|
---|
738 | */
|
---|
739 | static void cpumR3InfoOne(PCPUMCTX pCtx, PCCPUMCTXCORE pCtxCore, PCDBGFINFOHLP pHlp, CPUMDUMPTYPE enmType, const char *pszPrefix)
|
---|
740 | {
|
---|
741 | /*
|
---|
742 | * Format the EFLAGS.
|
---|
743 | */
|
---|
744 | uint32_t efl = pCtxCore->eflags.u32;
|
---|
745 | char szEFlags[80];
|
---|
746 | cpumR3InfoFormatFlags(&szEFlags[0], efl);
|
---|
747 |
|
---|
748 | /*
|
---|
749 | * Format the registers.
|
---|
750 | */
|
---|
751 | switch (enmType)
|
---|
752 | {
|
---|
753 | case CPUMDUMPTYPE_TERSE:
|
---|
754 | pHlp->pfnPrintf(pHlp,
|
---|
755 | "%seax=%08x %sebx=%08x %secx=%08x %sedx=%08x %sesi=%08x %sedi=%08x\n"
|
---|
756 | "%seip=%08x %sesp=%08x %sebp=%08x %siopl=%d %*s\n"
|
---|
757 | "%scs=%04x %sss=%04x %sds=%04x %ses=%04x %sfs=%04x %sgs=%04x %seflags=%08x\n",
|
---|
758 | pszPrefix, pCtxCore->eax, pszPrefix, pCtxCore->ebx, pszPrefix, pCtxCore->ecx, pszPrefix, pCtxCore->edx, pszPrefix, pCtxCore->esi, pszPrefix, pCtxCore->edi,
|
---|
759 | pszPrefix, pCtxCore->eip, pszPrefix, pCtxCore->esp, pszPrefix, pCtxCore->ebp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags,
|
---|
760 | pszPrefix, (RTSEL)pCtxCore->cs, pszPrefix, (RTSEL)pCtxCore->ss, pszPrefix, (RTSEL)pCtxCore->ds, pszPrefix, (RTSEL)pCtxCore->es,
|
---|
761 | pszPrefix, (RTSEL)pCtxCore->fs, pszPrefix, (RTSEL)pCtxCore->gs, pszPrefix, efl);
|
---|
762 | break;
|
---|
763 |
|
---|
764 | case CPUMDUMPTYPE_DEFAULT:
|
---|
765 | pHlp->pfnPrintf(pHlp,
|
---|
766 | "%seax=%08x %sebx=%08x %secx=%08x %sedx=%08x %sesi=%08x %sedi=%08x\n"
|
---|
767 | "%seip=%08x %sesp=%08x %sebp=%08x %siopl=%d %*s\n"
|
---|
768 | "%scs=%04x %sss=%04x %sds=%04x %ses=%04x %sfs=%04x %sgs=%04x %str=%04x %seflags=%08x\n"
|
---|
769 | "%scr0=%08RX64 %scr2=%08RX64 %scr3=%08RX64 %scr4=%08RX64 %sgdtr=%08x:%04x %sldtr=%04x\n"
|
---|
770 | ,
|
---|
771 | pszPrefix, pCtxCore->eax, pszPrefix, pCtxCore->ebx, pszPrefix, pCtxCore->ecx, pszPrefix, pCtxCore->edx, pszPrefix, pCtxCore->esi, pszPrefix, pCtxCore->edi,
|
---|
772 | pszPrefix, pCtxCore->eip, pszPrefix, pCtxCore->esp, pszPrefix, pCtxCore->ebp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags,
|
---|
773 | pszPrefix, (RTSEL)pCtxCore->cs, pszPrefix, (RTSEL)pCtxCore->ss, pszPrefix, (RTSEL)pCtxCore->ds, pszPrefix, (RTSEL)pCtxCore->es,
|
---|
774 | pszPrefix, (RTSEL)pCtxCore->fs, pszPrefix, (RTSEL)pCtxCore->gs, pszPrefix, (RTSEL)pCtx->tr, pszPrefix, efl,
|
---|
775 | pszPrefix, pCtx->cr0, pszPrefix, pCtx->cr2, pszPrefix, pCtx->cr3, pszPrefix, pCtx->cr4,
|
---|
776 | pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, (RTSEL)pCtx->ldtr);
|
---|
777 | break;
|
---|
778 |
|
---|
779 | case CPUMDUMPTYPE_VERBOSE:
|
---|
780 | pHlp->pfnPrintf(pHlp,
|
---|
781 | "%seax=%08x %sebx=%08x %secx=%08x %sedx=%08x %sesi=%08x %sedi=%08x\n"
|
---|
782 | "%seip=%08x %sesp=%08x %sebp=%08x %siopl=%d %*s\n"
|
---|
783 | "%scs={%04x base=%08x limit=%08x flags=%08x} %sdr0=%08RX64 %sdr1=%08RX64\n"
|
---|
784 | "%sds={%04x base=%08x limit=%08x flags=%08x} %sdr2=%08RX64 %sdr3=%08RX64\n"
|
---|
785 | "%ses={%04x base=%08x limit=%08x flags=%08x} %sdr4=%08RX64 %sdr5=%08RX64\n"
|
---|
786 | "%sfs={%04x base=%08x limit=%08x flags=%08x} %sdr6=%08RX64 %sdr7=%08RX64\n"
|
---|
787 | "%sgs={%04x base=%08x limit=%08x flags=%08x} %scr0=%08RX64 %scr2=%08RX64\n"
|
---|
788 | "%sss={%04x base=%08x limit=%08x flags=%08x} %scr3=%08RX64 %scr4=%08RX64\n"
|
---|
789 | "%sgdtr=%08x:%04x %sidtr=%08x:%04x %seflags=%08x\n"
|
---|
790 | "%sldtr={%04x base=%08x limit=%08x flags=%08x}\n"
|
---|
791 | "%str ={%04x base=%08x limit=%08x flags=%08x}\n"
|
---|
792 | "%sSysEnter={cs=%04llx eip=%08llx esp=%08llx}\n"
|
---|
793 | ,
|
---|
794 | pszPrefix, pCtxCore->eax, pszPrefix, pCtxCore->ebx, pszPrefix, pCtxCore->ecx, pszPrefix, pCtxCore->edx, pszPrefix, pCtxCore->esi, pszPrefix, pCtxCore->edi,
|
---|
795 | pszPrefix, pCtxCore->eip, pszPrefix, pCtxCore->esp, pszPrefix, pCtxCore->ebp, pszPrefix, X86_EFL_GET_IOPL(efl), *pszPrefix ? 33 : 31, szEFlags,
|
---|
796 | pszPrefix, (RTSEL)pCtxCore->cs, pCtx->csHid.u32Base, pCtx->csHid.u32Limit, pCtx->csHid.Attr.u, pszPrefix, pCtx->dr0, pszPrefix, pCtx->dr1,
|
---|
797 | pszPrefix, (RTSEL)pCtxCore->ds, pCtx->dsHid.u32Base, pCtx->dsHid.u32Limit, pCtx->dsHid.Attr.u, pszPrefix, pCtx->dr2, pszPrefix, pCtx->dr3,
|
---|
798 | pszPrefix, (RTSEL)pCtxCore->es, pCtx->esHid.u32Base, pCtx->esHid.u32Limit, pCtx->esHid.Attr.u, pszPrefix, pCtx->dr4, pszPrefix, pCtx->dr5,
|
---|
799 | pszPrefix, (RTSEL)pCtxCore->fs, pCtx->fsHid.u32Base, pCtx->fsHid.u32Limit, pCtx->fsHid.Attr.u, pszPrefix, pCtx->dr6, pszPrefix, pCtx->dr7,
|
---|
800 | pszPrefix, (RTSEL)pCtxCore->gs, pCtx->gsHid.u32Base, pCtx->gsHid.u32Limit, pCtx->gsHid.Attr.u, pszPrefix, pCtx->cr0, pszPrefix, pCtx->cr2,
|
---|
801 | pszPrefix, (RTSEL)pCtxCore->ss, pCtx->ssHid.u32Base, pCtx->ssHid.u32Limit, pCtx->ssHid.Attr.u, pszPrefix, pCtx->cr3, pszPrefix, pCtx->cr4,
|
---|
802 | pszPrefix, pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pszPrefix, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, pszPrefix, efl,
|
---|
803 | pszPrefix, (RTSEL)pCtx->ldtr, pCtx->ldtrHid.u32Base, pCtx->ldtrHid.u32Limit, pCtx->ldtrHid.Attr.u,
|
---|
804 | pszPrefix, (RTSEL)pCtx->tr, pCtx->trHid.u32Base, pCtx->trHid.u32Limit, pCtx->trHid.Attr.u,
|
---|
805 | pszPrefix, pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp);
|
---|
806 |
|
---|
807 | pHlp->pfnPrintf(pHlp,
|
---|
808 | "FPU:\n"
|
---|
809 | "%sFCW=%04x %sFSW=%04x %sFTW=%02x\n"
|
---|
810 | "%sres1=%02x %sFOP=%04x %sFPUIP=%08x %sCS=%04x %sRsvrd1=%04x\n"
|
---|
811 | "%sFPUDP=%04x %sDS=%04x %sRsvrd2=%04x %sMXCSR=%08x %sMXCSR_MASK=%08x\n"
|
---|
812 | ,
|
---|
813 | pszPrefix, pCtx->fpu.FCW, pszPrefix, pCtx->fpu.FSW, pszPrefix, pCtx->fpu.FTW,
|
---|
814 | pszPrefix, pCtx->fpu.huh1, pszPrefix, pCtx->fpu.FOP, pszPrefix, pCtx->fpu.FPUIP, pszPrefix, pCtx->fpu.CS, pszPrefix, pCtx->fpu.Rsvrd1,
|
---|
815 | pszPrefix, pCtx->fpu.FPUDP, pszPrefix, pCtx->fpu.DS, pszPrefix, pCtx->fpu.Rsrvd2,
|
---|
816 | pszPrefix, pCtx->fpu.MXCSR, pszPrefix, pCtx->fpu.MXCSR_MASK);
|
---|
817 |
|
---|
818 |
|
---|
819 | break;
|
---|
820 | }
|
---|
821 | }
|
---|
822 |
|
---|
823 |
|
---|
824 | /**
|
---|
825 | * Display all cpu states and any other cpum info.
|
---|
826 | *
|
---|
827 | * @param pVM VM Handle.
|
---|
828 | * @param pHlp The info helper functions.
|
---|
829 | * @param pszArgs Arguments, ignored.
|
---|
830 | */
|
---|
831 | static DECLCALLBACK(void) cpumR3InfoAll(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
|
---|
832 | {
|
---|
833 | cpumR3InfoGuest(pVM, pHlp, pszArgs);
|
---|
834 | cpumR3InfoHyper(pVM, pHlp, pszArgs);
|
---|
835 | cpumR3InfoHost(pVM, pHlp, pszArgs);
|
---|
836 | }
|
---|
837 |
|
---|
838 |
|
---|
839 | /**
|
---|
840 | * Parses the info argument.
|
---|
841 | *
|
---|
842 | * The argument starts with 'verbose', 'terse' or 'default' and then
|
---|
843 | * continues with the comment string.
|
---|
844 | *
|
---|
845 | * @param pszArgs The pointer to the argument string.
|
---|
846 | * @param penmType Where to store the dump type request.
|
---|
847 | * @param ppszComment Where to store the pointer to the comment string.
|
---|
848 | */
|
---|
849 | static void cpumR3InfoParseArg(const char *pszArgs, CPUMDUMPTYPE *penmType, const char **ppszComment)
|
---|
850 | {
|
---|
851 | if (!pszArgs)
|
---|
852 | {
|
---|
853 | *penmType = CPUMDUMPTYPE_DEFAULT;
|
---|
854 | *ppszComment = "";
|
---|
855 | }
|
---|
856 | else
|
---|
857 | {
|
---|
858 | if (!strncmp(pszArgs, "verbose", sizeof("verbose") - 1))
|
---|
859 | {
|
---|
860 | pszArgs += 5;
|
---|
861 | *penmType = CPUMDUMPTYPE_VERBOSE;
|
---|
862 | }
|
---|
863 | else if (!strncmp(pszArgs, "terse", sizeof("terse") - 1))
|
---|
864 | {
|
---|
865 | pszArgs += 5;
|
---|
866 | *penmType = CPUMDUMPTYPE_TERSE;
|
---|
867 | }
|
---|
868 | else if (!strncmp(pszArgs, "default", sizeof("default") - 1))
|
---|
869 | {
|
---|
870 | pszArgs += 7;
|
---|
871 | *penmType = CPUMDUMPTYPE_DEFAULT;
|
---|
872 | }
|
---|
873 | else
|
---|
874 | *penmType = CPUMDUMPTYPE_DEFAULT;
|
---|
875 | *ppszComment = RTStrStripL(pszArgs);
|
---|
876 | }
|
---|
877 | }
|
---|
878 |
|
---|
879 |
|
---|
880 | /**
|
---|
881 | * Display the guest cpu state.
|
---|
882 | *
|
---|
883 | * @param pVM VM Handle.
|
---|
884 | * @param pHlp The info helper functions.
|
---|
885 | * @param pszArgs Arguments, ignored.
|
---|
886 | */
|
---|
887 | static DECLCALLBACK(void) cpumR3InfoGuest(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
|
---|
888 | {
|
---|
889 | CPUMDUMPTYPE enmType;
|
---|
890 | const char *pszComment;
|
---|
891 | cpumR3InfoParseArg(pszArgs, &enmType, &pszComment);
|
---|
892 | pHlp->pfnPrintf(pHlp, "Guest CPUM state: %s\n", pszComment);
|
---|
893 | cpumR3InfoOne(&pVM->cpum.s.Guest, CPUMCTX2CORE(&pVM->cpum.s.Guest), pHlp, enmType, "");
|
---|
894 | }
|
---|
895 |
|
---|
896 |
|
---|
897 | /**
|
---|
898 | * Display the hypervisor cpu state.
|
---|
899 | *
|
---|
900 | * @param pVM VM Handle.
|
---|
901 | * @param pHlp The info helper functions.
|
---|
902 | * @param pszArgs Arguments, ignored.
|
---|
903 | */
|
---|
904 | static DECLCALLBACK(void) cpumR3InfoHyper(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
|
---|
905 | {
|
---|
906 | CPUMDUMPTYPE enmType;
|
---|
907 | const char *pszComment;
|
---|
908 | cpumR3InfoParseArg(pszArgs, &enmType, &pszComment);
|
---|
909 | pHlp->pfnPrintf(pHlp, "Hypervisor CPUM state: %s\n", pszComment);
|
---|
910 | cpumR3InfoOne(&pVM->cpum.s.Hyper, pVM->cpum.s.pHyperCoreR3, pHlp, enmType, ".");
|
---|
911 | pHlp->pfnPrintf(pHlp, "CR4OrMask=%#x CR4AndMask=%#x\n", pVM->cpum.s.CR4.OrMask, pVM->cpum.s.CR4.AndMask);
|
---|
912 | }
|
---|
913 |
|
---|
914 |
|
---|
915 | /**
|
---|
916 | * Display the host cpu state.
|
---|
917 | *
|
---|
918 | * @param pVM VM Handle.
|
---|
919 | * @param pHlp The info helper functions.
|
---|
920 | * @param pszArgs Arguments, ignored.
|
---|
921 | */
|
---|
922 | static DECLCALLBACK(void) cpumR3InfoHost(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
|
---|
923 | {
|
---|
924 | CPUMDUMPTYPE enmType;
|
---|
925 | const char *pszComment;
|
---|
926 | cpumR3InfoParseArg(pszArgs, &enmType, &pszComment);
|
---|
927 | pHlp->pfnPrintf(pHlp, "Host CPUM state: %s\n", pszComment);
|
---|
928 |
|
---|
929 | /*
|
---|
930 | * Format the EFLAGS.
|
---|
931 | */
|
---|
932 | PCPUMHOSTCTX pCtx = &pVM->cpum.s.Host;
|
---|
933 | #if HC_ARCH_BITS == 32
|
---|
934 | uint32_t efl = pCtx->eflags.u32;
|
---|
935 | #else
|
---|
936 | uint64_t efl = pCtx->rflags;
|
---|
937 | #endif
|
---|
938 | char szEFlags[80];
|
---|
939 | cpumR3InfoFormatFlags(&szEFlags[0], efl);
|
---|
940 |
|
---|
941 | /*
|
---|
942 | * Format the registers.
|
---|
943 | */
|
---|
944 | #if HC_ARCH_BITS == 32
|
---|
945 | # ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL
|
---|
946 | if (!(pCtx->efer & MSR_K6_EFER_LMA))
|
---|
947 | # endif
|
---|
948 | {
|
---|
949 | pHlp->pfnPrintf(pHlp,
|
---|
950 | "eax=xxxxxxxx ebx=%08x ecx=xxxxxxxx edx=xxxxxxxx esi=%08x edi=%08x\n"
|
---|
951 | "eip=xxxxxxxx esp=%08x ebp=%08x iopl=%d %31s\n"
|
---|
952 | "cs=%04x ds=%04x es=%04x fs=%04x gs=%04x eflags=%08x\n"
|
---|
953 | "cr0=%08RX64 cr2=xxxxxxxx cr3=%08RX64 cr4=%08RX64 gdtr=%08x:%04x ldtr=%04x\n"
|
---|
954 | "dr0=%08RX64 dr1=%08RX64x dr2=%08RX64 dr3=%08RX64x dr6=%08RX64 dr7=%08RX64\n"
|
---|
955 | "SysEnter={cs=%04x eip=%08x esp=%08x}\n"
|
---|
956 | ,
|
---|
957 | /*pCtx->eax,*/ pCtx->ebx, /*pCtx->ecx, pCtx->edx,*/ pCtx->esi, pCtx->edi,
|
---|
958 | /*pCtx->eip,*/ pCtx->esp, pCtx->ebp, X86_EFL_GET_IOPL(efl), szEFlags,
|
---|
959 | (RTSEL)pCtx->cs, (RTSEL)pCtx->ds, (RTSEL)pCtx->es, (RTSEL)pCtx->fs, (RTSEL)pCtx->gs, efl,
|
---|
960 | pCtx->cr0, /*pCtx->cr2,*/ pCtx->cr3, pCtx->cr4,
|
---|
961 | pCtx->dr0, pCtx->dr1, pCtx->dr2, pCtx->dr3, pCtx->dr6, pCtx->dr7,
|
---|
962 | (uint32_t)pCtx->gdtr.uAddr, pCtx->gdtr.cb, (RTSEL)pCtx->ldtr,
|
---|
963 | pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp);
|
---|
964 | }
|
---|
965 | # ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL
|
---|
966 | else
|
---|
967 | # endif
|
---|
968 | #endif
|
---|
969 | #if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBIRD_32BIT_KERNEL)
|
---|
970 | {
|
---|
971 | pHlp->pfnPrintf(pHlp,
|
---|
972 | "rax=xxxxxxxxxxxxxxxx rbx=%016RX64 rcx=xxxxxxxxxxxxxxxx\n"
|
---|
973 | "rdx=xxxxxxxxxxxxxxxx rsi=%016RX64 rdi=%016RX64\n"
|
---|
974 | "rip=xxxxxxxxxxxxxxxx rsp=%016RX64 rbp=%016RX64\n"
|
---|
975 | " r8=xxxxxxxxxxxxxxxx r9=xxxxxxxxxxxxxxxx r10=%016RX64\n"
|
---|
976 | "r11=%016RX64 r12=%016RX64 r13=%016RX64\n"
|
---|
977 | "r14=%016RX64 r15=%016RX64\n"
|
---|
978 | "iopl=%d %31s\n"
|
---|
979 | "cs=%04x ds=%04x es=%04x fs=%04x gs=%04x eflags=%08RX64\n"
|
---|
980 | "cr0=%016RX64 cr2=xxxxxxxxxxxxxxxx cr3=%016RX64\n"
|
---|
981 | "cr4=%016RX64 cr8=%016RX64 ldtr=%04x tr=%04x\n"
|
---|
982 | "dr0=%016RX64 dr1=%016RX64 dr2=%016RX64\n"
|
---|
983 | "dr3=%016RX64 dr6=%016RX64 dr7=%016RX64\n"
|
---|
984 | "gdtr=%016RX64:%04x idtr=%016RX64:%04x\n"
|
---|
985 | "SysEnter={cs=%04x eip=%08x esp=%08x}\n"
|
---|
986 | "FSbase=%016RX64 GSbase=%016RX64 efer=%08RX64\n"
|
---|
987 | ,
|
---|
988 | /*pCtx->rax,*/ pCtx->rbx, /*pCtx->rcx,
|
---|
989 | pCtx->rdx,*/ pCtx->rsi, pCtx->rdi,
|
---|
990 | /*pCtx->rip,*/ pCtx->rsp, pCtx->rbp,
|
---|
991 | /*pCtx->r8, pCtx->r9,*/ pCtx->r10,
|
---|
992 | pCtx->r11, pCtx->r12, pCtx->r13,
|
---|
993 | pCtx->r14, pCtx->r15,
|
---|
994 | X86_EFL_GET_IOPL(efl), szEFlags,
|
---|
995 | (RTSEL)pCtx->cs, (RTSEL)pCtx->ds, (RTSEL)pCtx->es, (RTSEL)pCtx->fs, (RTSEL)pCtx->gs, efl,
|
---|
996 | pCtx->cr0, /*pCtx->cr2,*/ pCtx->cr3,
|
---|
997 | pCtx->cr4, pCtx->cr8, pCtx->ldtr, pCtx->tr,
|
---|
998 | pCtx->dr0, pCtx->dr1, pCtx->dr2,
|
---|
999 | pCtx->dr3, pCtx->dr6, pCtx->dr7,
|
---|
1000 | pCtx->gdtr.uAddr, pCtx->gdtr.cb, pCtx->idtr.uAddr, pCtx->idtr.cb,
|
---|
1001 | pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp,
|
---|
1002 | pCtx->FSbase, pCtx->GSbase, pCtx->efer);
|
---|
1003 | }
|
---|
1004 | #endif
|
---|
1005 | }
|
---|
1006 |
|
---|
1007 | /**
|
---|
1008 | * Get L1 cache / TLS associativity.
|
---|
1009 | */
|
---|
1010 | static const char *getCacheAss(unsigned u, char *pszBuf)
|
---|
1011 | {
|
---|
1012 | if (u == 0)
|
---|
1013 | return "res0 ";
|
---|
1014 | if (u == 1)
|
---|
1015 | return "direct";
|
---|
1016 | if (u >= 256)
|
---|
1017 | return "???";
|
---|
1018 |
|
---|
1019 | RTStrPrintf(pszBuf, 16, "%d way", u);
|
---|
1020 | return pszBuf;
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 |
|
---|
1024 | /**
|
---|
1025 | * Get L2 cache soociativity.
|
---|
1026 | */
|
---|
1027 | const char *getL2CacheAss(unsigned u)
|
---|
1028 | {
|
---|
1029 | switch (u)
|
---|
1030 | {
|
---|
1031 | case 0: return "off ";
|
---|
1032 | case 1: return "direct";
|
---|
1033 | case 2: return "2 way ";
|
---|
1034 | case 3: return "res3 ";
|
---|
1035 | case 4: return "4 way ";
|
---|
1036 | case 5: return "res5 ";
|
---|
1037 | case 6: return "8 way ";
|
---|
1038 | case 7: return "res7 ";
|
---|
1039 | case 8: return "16 way";
|
---|
1040 | case 9: return "res9 ";
|
---|
1041 | case 10: return "res10 ";
|
---|
1042 | case 11: return "res11 ";
|
---|
1043 | case 12: return "res12 ";
|
---|
1044 | case 13: return "res13 ";
|
---|
1045 | case 14: return "res14 ";
|
---|
1046 | case 15: return "fully ";
|
---|
1047 | default:
|
---|
1048 | return "????";
|
---|
1049 | }
|
---|
1050 | }
|
---|
1051 |
|
---|
1052 |
|
---|
1053 | /**
|
---|
1054 | * Display the guest CpuId leaves.
|
---|
1055 | *
|
---|
1056 | * @param pVM VM Handle.
|
---|
1057 | * @param pHlp The info helper functions.
|
---|
1058 | * @param pszArgs "terse", "default" or "verbose".
|
---|
1059 | */
|
---|
1060 | static DECLCALLBACK(void) cpumR3CpuIdInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
|
---|
1061 | {
|
---|
1062 | /*
|
---|
1063 | * Parse the argument.
|
---|
1064 | */
|
---|
1065 | unsigned iVerbosity = 1;
|
---|
1066 | if (pszArgs)
|
---|
1067 | {
|
---|
1068 | pszArgs = RTStrStripL(pszArgs);
|
---|
1069 | if (!strcmp(pszArgs, "terse"))
|
---|
1070 | iVerbosity--;
|
---|
1071 | else if (!strcmp(pszArgs, "verbose"))
|
---|
1072 | iVerbosity++;
|
---|
1073 | }
|
---|
1074 |
|
---|
1075 | /*
|
---|
1076 | * Start cracking.
|
---|
1077 | */
|
---|
1078 | CPUMCPUID Host;
|
---|
1079 | CPUMCPUID Guest;
|
---|
1080 | unsigned cStdMax = pVM->cpum.s.aGuestCpuIdStd[0].eax;
|
---|
1081 |
|
---|
1082 | pHlp->pfnPrintf(pHlp,
|
---|
1083 | " RAW Standard CPUIDs\n"
|
---|
1084 | " Function eax ebx ecx edx\n");
|
---|
1085 | for (unsigned i = 0; i < ELEMENTS(pVM->cpum.s.aGuestCpuIdStd); i++)
|
---|
1086 | {
|
---|
1087 | Guest = pVM->cpum.s.aGuestCpuIdStd[i];
|
---|
1088 | ASMCpuId_Idx_ECX(i, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
|
---|
1089 |
|
---|
1090 | pHlp->pfnPrintf(pHlp,
|
---|
1091 | "Gst: %08x %08x %08x %08x %08x%s\n"
|
---|
1092 | "Hst: %08x %08x %08x %08x\n",
|
---|
1093 | i, Guest.eax, Guest.ebx, Guest.ecx, Guest.edx,
|
---|
1094 | i <= cStdMax ? "" : "*",
|
---|
1095 | Host.eax, Host.ebx, Host.ecx, Host.edx);
|
---|
1096 | }
|
---|
1097 |
|
---|
1098 | /*
|
---|
1099 | * If verbose, decode it.
|
---|
1100 | */
|
---|
1101 | if (iVerbosity)
|
---|
1102 | {
|
---|
1103 | Guest = pVM->cpum.s.aGuestCpuIdStd[0];
|
---|
1104 | pHlp->pfnPrintf(pHlp,
|
---|
1105 | "Name: %.04s%.04s%.04s\n"
|
---|
1106 | "Supports: 0-%x\n",
|
---|
1107 | &Guest.ebx, &Guest.edx, &Guest.ecx, Guest.eax);
|
---|
1108 | }
|
---|
1109 |
|
---|
1110 | /*
|
---|
1111 | * Get Features.
|
---|
1112 | */
|
---|
1113 | if (cStdMax >= 1 && iVerbosity)
|
---|
1114 | {
|
---|
1115 | Guest = pVM->cpum.s.aGuestCpuIdStd[1];
|
---|
1116 | uint32_t uEAX = Guest.eax;
|
---|
1117 |
|
---|
1118 | pHlp->pfnPrintf(pHlp,
|
---|
1119 | "Family: %d \tExtended: %d \tEffectiv: %d\n"
|
---|
1120 | "Model: %d \tExtended: %d \tEffectiv: %d\n"
|
---|
1121 | "Stepping: %d\n"
|
---|
1122 | "APIC ID: %#04x\n"
|
---|
1123 | "Logical CPUs: %d\n"
|
---|
1124 | "CLFLUSH Size: %d\n"
|
---|
1125 | "Brand ID: %#04x\n",
|
---|
1126 | (uEAX >> 8) & 0xf, (uEAX >> 20) & 0x7f, ((uEAX >> 8) & 0xf) + (((uEAX >> 8) & 0xf) == 0xf ? (uEAX >> 20) & 0x7f : 0),
|
---|
1127 | (uEAX >> 4) & 0xf, (uEAX >> 16) & 0x0f, ((uEAX >> 4) & 0xf) | (((uEAX >> 4) & 0xf) == 0xf ? (uEAX >> 16) & 0x0f : 0),
|
---|
1128 | (uEAX >> 0) & 0xf,
|
---|
1129 | (Guest.ebx >> 24) & 0xff,
|
---|
1130 | (Guest.ebx >> 16) & 0xff,
|
---|
1131 | (Guest.ebx >> 8) & 0xff,
|
---|
1132 | (Guest.ebx >> 0) & 0xff);
|
---|
1133 | if (iVerbosity == 1)
|
---|
1134 | {
|
---|
1135 | uint32_t uEDX = Guest.edx;
|
---|
1136 | pHlp->pfnPrintf(pHlp, "Features EDX: ");
|
---|
1137 | if (uEDX & RT_BIT(0)) pHlp->pfnPrintf(pHlp, " FPU");
|
---|
1138 | if (uEDX & RT_BIT(1)) pHlp->pfnPrintf(pHlp, " VME");
|
---|
1139 | if (uEDX & RT_BIT(2)) pHlp->pfnPrintf(pHlp, " DE");
|
---|
1140 | if (uEDX & RT_BIT(3)) pHlp->pfnPrintf(pHlp, " PSE");
|
---|
1141 | if (uEDX & RT_BIT(4)) pHlp->pfnPrintf(pHlp, " TSC");
|
---|
1142 | if (uEDX & RT_BIT(5)) pHlp->pfnPrintf(pHlp, " MSR");
|
---|
1143 | if (uEDX & RT_BIT(6)) pHlp->pfnPrintf(pHlp, " PAE");
|
---|
1144 | if (uEDX & RT_BIT(7)) pHlp->pfnPrintf(pHlp, " MCE");
|
---|
1145 | if (uEDX & RT_BIT(8)) pHlp->pfnPrintf(pHlp, " CX8");
|
---|
1146 | if (uEDX & RT_BIT(9)) pHlp->pfnPrintf(pHlp, " APIC");
|
---|
1147 | if (uEDX & RT_BIT(10)) pHlp->pfnPrintf(pHlp, " 10");
|
---|
1148 | if (uEDX & RT_BIT(11)) pHlp->pfnPrintf(pHlp, " SEP");
|
---|
1149 | if (uEDX & RT_BIT(12)) pHlp->pfnPrintf(pHlp, " MTRR");
|
---|
1150 | if (uEDX & RT_BIT(13)) pHlp->pfnPrintf(pHlp, " PGE");
|
---|
1151 | if (uEDX & RT_BIT(14)) pHlp->pfnPrintf(pHlp, " MCA");
|
---|
1152 | if (uEDX & RT_BIT(15)) pHlp->pfnPrintf(pHlp, " CMOV");
|
---|
1153 | if (uEDX & RT_BIT(16)) pHlp->pfnPrintf(pHlp, " PAT");
|
---|
1154 | if (uEDX & RT_BIT(17)) pHlp->pfnPrintf(pHlp, " PSE36");
|
---|
1155 | if (uEDX & RT_BIT(18)) pHlp->pfnPrintf(pHlp, " PSN");
|
---|
1156 | if (uEDX & RT_BIT(19)) pHlp->pfnPrintf(pHlp, " CLFSH");
|
---|
1157 | if (uEDX & RT_BIT(20)) pHlp->pfnPrintf(pHlp, " 20");
|
---|
1158 | if (uEDX & RT_BIT(21)) pHlp->pfnPrintf(pHlp, " DS");
|
---|
1159 | if (uEDX & RT_BIT(22)) pHlp->pfnPrintf(pHlp, " ACPI");
|
---|
1160 | if (uEDX & RT_BIT(23)) pHlp->pfnPrintf(pHlp, " MMX");
|
---|
1161 | if (uEDX & RT_BIT(24)) pHlp->pfnPrintf(pHlp, " FXSR");
|
---|
1162 | if (uEDX & RT_BIT(25)) pHlp->pfnPrintf(pHlp, " SSE");
|
---|
1163 | if (uEDX & RT_BIT(26)) pHlp->pfnPrintf(pHlp, " SSE2");
|
---|
1164 | if (uEDX & RT_BIT(27)) pHlp->pfnPrintf(pHlp, " SS");
|
---|
1165 | if (uEDX & RT_BIT(28)) pHlp->pfnPrintf(pHlp, " HTT");
|
---|
1166 | if (uEDX & RT_BIT(29)) pHlp->pfnPrintf(pHlp, " TM");
|
---|
1167 | if (uEDX & RT_BIT(30)) pHlp->pfnPrintf(pHlp, " 30");
|
---|
1168 | if (uEDX & RT_BIT(31)) pHlp->pfnPrintf(pHlp, " PBE");
|
---|
1169 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
1170 |
|
---|
1171 | uint32_t uECX = Guest.ecx;
|
---|
1172 | pHlp->pfnPrintf(pHlp, "Features ECX: ");
|
---|
1173 | if (uECX & RT_BIT(0)) pHlp->pfnPrintf(pHlp, " SSE3");
|
---|
1174 | if (uECX & RT_BIT(1)) pHlp->pfnPrintf(pHlp, " 1");
|
---|
1175 | if (uECX & RT_BIT(2)) pHlp->pfnPrintf(pHlp, " 2");
|
---|
1176 | if (uECX & RT_BIT(3)) pHlp->pfnPrintf(pHlp, " MONITOR");
|
---|
1177 | if (uECX & RT_BIT(4)) pHlp->pfnPrintf(pHlp, " DS-CPL");
|
---|
1178 | if (uECX & RT_BIT(5)) pHlp->pfnPrintf(pHlp, " VMX");
|
---|
1179 | if (uECX & RT_BIT(6)) pHlp->pfnPrintf(pHlp, " 6");
|
---|
1180 | if (uECX & RT_BIT(7)) pHlp->pfnPrintf(pHlp, " EST");
|
---|
1181 | if (uECX & RT_BIT(8)) pHlp->pfnPrintf(pHlp, " TM2");
|
---|
1182 | if (uECX & RT_BIT(9)) pHlp->pfnPrintf(pHlp, " 9");
|
---|
1183 | if (uECX & RT_BIT(10)) pHlp->pfnPrintf(pHlp, " CNXT-ID");
|
---|
1184 | if (uECX & RT_BIT(11)) pHlp->pfnPrintf(pHlp, " 11");
|
---|
1185 | if (uECX & RT_BIT(12)) pHlp->pfnPrintf(pHlp, " 12");
|
---|
1186 | if (uECX & RT_BIT(13)) pHlp->pfnPrintf(pHlp, " CX16");
|
---|
1187 | for (unsigned iBit = 14; iBit < 32; iBit++)
|
---|
1188 | if (uECX & RT_BIT(iBit))
|
---|
1189 | pHlp->pfnPrintf(pHlp, " %d", iBit);
|
---|
1190 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
1191 | }
|
---|
1192 | else
|
---|
1193 | {
|
---|
1194 | ASMCpuId(1, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
|
---|
1195 |
|
---|
1196 | X86CPUIDFEATEDX EdxHost = *(PX86CPUIDFEATEDX)&Host.edx;
|
---|
1197 | X86CPUIDFEATECX EcxHost = *(PX86CPUIDFEATECX)&Host.ecx;
|
---|
1198 | X86CPUIDFEATEDX EdxGuest = *(PX86CPUIDFEATEDX)&Guest.edx;
|
---|
1199 | X86CPUIDFEATECX EcxGuest = *(PX86CPUIDFEATECX)&Guest.ecx;
|
---|
1200 |
|
---|
1201 | pHlp->pfnPrintf(pHlp, "Mnemonic - Description = guest (host)\n");
|
---|
1202 | pHlp->pfnPrintf(pHlp, "FPU - x87 FPU on Chip = %d (%d)\n", EdxGuest.u1FPU, EdxHost.u1FPU);
|
---|
1203 | pHlp->pfnPrintf(pHlp, "VME - Virtual 8086 Mode Enhancements = %d (%d)\n", EdxGuest.u1VME, EdxHost.u1VME);
|
---|
1204 | pHlp->pfnPrintf(pHlp, "DE - Debugging extensions = %d (%d)\n", EdxGuest.u1DE, EdxHost.u1DE);
|
---|
1205 | pHlp->pfnPrintf(pHlp, "PSE - Page Size Extension = %d (%d)\n", EdxGuest.u1PSE, EdxHost.u1PSE);
|
---|
1206 | pHlp->pfnPrintf(pHlp, "TSC - Time Stamp Counter = %d (%d)\n", EdxGuest.u1TSC, EdxHost.u1TSC);
|
---|
1207 | pHlp->pfnPrintf(pHlp, "MSR - Model Specific Registers = %d (%d)\n", EdxGuest.u1MSR, EdxHost.u1MSR);
|
---|
1208 | pHlp->pfnPrintf(pHlp, "PAE - Physical Address Extension = %d (%d)\n", EdxGuest.u1PAE, EdxHost.u1PAE);
|
---|
1209 | pHlp->pfnPrintf(pHlp, "MCE - Machine Check Exception = %d (%d)\n", EdxGuest.u1MCE, EdxHost.u1MCE);
|
---|
1210 | pHlp->pfnPrintf(pHlp, "CX8 - CMPXCHG8B instruction = %d (%d)\n", EdxGuest.u1CX8, EdxHost.u1CX8);
|
---|
1211 | pHlp->pfnPrintf(pHlp, "APIC - APIC On-Chip = %d (%d)\n", EdxGuest.u1APIC, EdxHost.u1APIC);
|
---|
1212 | pHlp->pfnPrintf(pHlp, "Reserved = %d (%d)\n", EdxGuest.u1Reserved1, EdxHost.u1Reserved1);
|
---|
1213 | pHlp->pfnPrintf(pHlp, "SEP - SYSENTER and SYSEXIT = %d (%d)\n", EdxGuest.u1SEP, EdxHost.u1SEP);
|
---|
1214 | pHlp->pfnPrintf(pHlp, "MTRR - Memory Type Range Registers = %d (%d)\n", EdxGuest.u1MTRR, EdxHost.u1MTRR);
|
---|
1215 | pHlp->pfnPrintf(pHlp, "PGE - PTE Global Bit = %d (%d)\n", EdxGuest.u1PGE, EdxHost.u1PGE);
|
---|
1216 | pHlp->pfnPrintf(pHlp, "MCA - Machine Check Architecture = %d (%d)\n", EdxGuest.u1MCA, EdxHost.u1MCA);
|
---|
1217 | pHlp->pfnPrintf(pHlp, "CMOV - Conditional Move Instructions = %d (%d)\n", EdxGuest.u1CMOV, EdxHost.u1CMOV);
|
---|
1218 | pHlp->pfnPrintf(pHlp, "PAT - Page Attribute Table = %d (%d)\n", EdxGuest.u1PAT, EdxHost.u1PAT);
|
---|
1219 | pHlp->pfnPrintf(pHlp, "PSE-36 - 36-bit Page Size Extention = %d (%d)\n", EdxGuest.u1PSE36, EdxHost.u1PSE36);
|
---|
1220 | pHlp->pfnPrintf(pHlp, "PSN - Processor Serial Number = %d (%d)\n", EdxGuest.u1PSN, EdxHost.u1PSN);
|
---|
1221 | pHlp->pfnPrintf(pHlp, "CLFSH - CLFLUSH Instruction. = %d (%d)\n", EdxGuest.u1CLFSH, EdxHost.u1CLFSH);
|
---|
1222 | pHlp->pfnPrintf(pHlp, "Reserved = %d (%d)\n", EdxGuest.u1Reserved2, EdxHost.u1Reserved2);
|
---|
1223 | pHlp->pfnPrintf(pHlp, "DS - Debug Store = %d (%d)\n", EdxGuest.u1DS, EdxHost.u1DS);
|
---|
1224 | pHlp->pfnPrintf(pHlp, "ACPI - Thermal Mon. & Soft. Clock Ctrl.= %d (%d)\n", EdxGuest.u1ACPI, EdxHost.u1ACPI);
|
---|
1225 | pHlp->pfnPrintf(pHlp, "MMX - Intel MMX Technology = %d (%d)\n", EdxGuest.u1MMX, EdxHost.u1MMX);
|
---|
1226 | pHlp->pfnPrintf(pHlp, "FXSR - FXSAVE and FXRSTOR Instructions = %d (%d)\n", EdxGuest.u1FXSR, EdxHost.u1FXSR);
|
---|
1227 | pHlp->pfnPrintf(pHlp, "SSE - SSE Support = %d (%d)\n", EdxGuest.u1SSE, EdxHost.u1SSE);
|
---|
1228 | pHlp->pfnPrintf(pHlp, "SSE2 - SSE2 Support = %d (%d)\n", EdxGuest.u1SSE2, EdxHost.u1SSE2);
|
---|
1229 | pHlp->pfnPrintf(pHlp, "SS - Self Snoop = %d (%d)\n", EdxGuest.u1SS, EdxHost.u1SS);
|
---|
1230 | pHlp->pfnPrintf(pHlp, "HTT - Hyper-Threading Technolog = %d (%d)\n", EdxGuest.u1HTT, EdxHost.u1HTT);
|
---|
1231 | pHlp->pfnPrintf(pHlp, "TM - Thermal Monitor = %d (%d)\n", EdxGuest.u1TM, EdxHost.u1TM);
|
---|
1232 | pHlp->pfnPrintf(pHlp, "30 - Reserved = %d (%d)\n", EdxGuest.u1Reserved3, EdxHost.u1Reserved3);
|
---|
1233 | pHlp->pfnPrintf(pHlp, "PBE - Pending Break Enable = %d (%d)\n", EdxGuest.u1PBE, EdxHost.u1PBE);
|
---|
1234 |
|
---|
1235 | pHlp->pfnPrintf(pHlp, "Supports SSE3 or not = %d (%d)\n", EcxGuest.u1SSE3, EcxHost.u1SSE3);
|
---|
1236 | pHlp->pfnPrintf(pHlp, "Reserved = %d (%d)\n", EcxGuest.u2Reserved1, EcxHost.u2Reserved1);
|
---|
1237 | pHlp->pfnPrintf(pHlp, "Supports MONITOR/MWAIT = %d (%d)\n", EcxGuest.u1Monitor, EcxHost.u1Monitor);
|
---|
1238 | pHlp->pfnPrintf(pHlp, "CPL-DS - CPL Qualified Debug Store = %d (%d)\n", EcxGuest.u1CPLDS, EcxHost.u1CPLDS);
|
---|
1239 | pHlp->pfnPrintf(pHlp, "VMX - Virtual Machine Technology = %d (%d)\n", EcxGuest.u1VMX, EcxHost.u1VMX);
|
---|
1240 | pHlp->pfnPrintf(pHlp, "Reserved = %d (%d)\n", EcxGuest.u1Reserved2, EcxHost.u1Reserved2);
|
---|
1241 | pHlp->pfnPrintf(pHlp, "Enhanced SpeedStep Technology = %d (%d)\n", EcxGuest.u1EST, EcxHost.u1EST);
|
---|
1242 | pHlp->pfnPrintf(pHlp, "Terminal Monitor 2 = %d (%d)\n", EcxGuest.u1TM2, EcxHost.u1TM2);
|
---|
1243 | pHlp->pfnPrintf(pHlp, "Supports Supplemental SSE3 or not = %d (%d)\n", EcxGuest.u1SSSE3, EcxHost.u1SSSE3);
|
---|
1244 | pHlp->pfnPrintf(pHlp, "L1 Context ID = %d (%d)\n", EcxGuest.u1CNTXID, EcxHost.u1CNTXID);
|
---|
1245 | pHlp->pfnPrintf(pHlp, "Reserved = %#x (%#x)\n",EcxGuest.u2Reserved4, EcxHost.u2Reserved4);
|
---|
1246 | pHlp->pfnPrintf(pHlp, "CMPXCHG16B = %d (%d)\n", EcxGuest.u1CX16, EcxHost.u1CX16);
|
---|
1247 | pHlp->pfnPrintf(pHlp, "xTPR Update Control = %d (%d)\n", EcxGuest.u1TPRUpdate, EcxHost.u1TPRUpdate);
|
---|
1248 | pHlp->pfnPrintf(pHlp, "Reserved = %#x (%#x)\n",EcxGuest.u17Reserved5, EcxHost.u17Reserved5);
|
---|
1249 | }
|
---|
1250 | }
|
---|
1251 | if (cStdMax >= 2 && iVerbosity)
|
---|
1252 | {
|
---|
1253 | /** @todo */
|
---|
1254 | }
|
---|
1255 |
|
---|
1256 | /*
|
---|
1257 | * Extended.
|
---|
1258 | * Implemented after AMD specs.
|
---|
1259 | */
|
---|
1260 | unsigned cExtMax = pVM->cpum.s.aGuestCpuIdExt[0].eax & 0xffff;
|
---|
1261 |
|
---|
1262 | pHlp->pfnPrintf(pHlp,
|
---|
1263 | "\n"
|
---|
1264 | " RAW Extended CPUIDs\n"
|
---|
1265 | " Function eax ebx ecx edx\n");
|
---|
1266 | for (unsigned i = 0; i < ELEMENTS(pVM->cpum.s.aGuestCpuIdExt); i++)
|
---|
1267 | {
|
---|
1268 | Guest = pVM->cpum.s.aGuestCpuIdExt[i];
|
---|
1269 | ASMCpuId(0x80000000 | i, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
|
---|
1270 |
|
---|
1271 | pHlp->pfnPrintf(pHlp,
|
---|
1272 | "Gst: %08x %08x %08x %08x %08x%s\n"
|
---|
1273 | "Hst: %08x %08x %08x %08x\n",
|
---|
1274 | 0x80000000 | i, Guest.eax, Guest.ebx, Guest.ecx, Guest.edx,
|
---|
1275 | i <= cExtMax ? "" : "*",
|
---|
1276 | Host.eax, Host.ebx, Host.ecx, Host.edx);
|
---|
1277 | }
|
---|
1278 |
|
---|
1279 | /*
|
---|
1280 | * Understandable output
|
---|
1281 | */
|
---|
1282 | if (iVerbosity && cExtMax >= 0)
|
---|
1283 | {
|
---|
1284 | Guest = pVM->cpum.s.aGuestCpuIdExt[0];
|
---|
1285 | pHlp->pfnPrintf(pHlp,
|
---|
1286 | "Ext Name: %.4s%.4s%.4s\n"
|
---|
1287 | "Ext Supports: 0x80000000-%#010x\n",
|
---|
1288 | &Guest.ebx, &Guest.edx, &Guest.ecx, Guest.eax);
|
---|
1289 | }
|
---|
1290 |
|
---|
1291 | if (iVerbosity && cExtMax >= 1)
|
---|
1292 | {
|
---|
1293 | Guest = pVM->cpum.s.aGuestCpuIdExt[1];
|
---|
1294 | uint32_t uEAX = Guest.eax;
|
---|
1295 | pHlp->pfnPrintf(pHlp,
|
---|
1296 | "Family: %d \tExtended: %d \tEffectiv: %d\n"
|
---|
1297 | "Model: %d \tExtended: %d \tEffectiv: %d\n"
|
---|
1298 | "Stepping: %d\n"
|
---|
1299 | "Brand ID: %#05x\n",
|
---|
1300 | (uEAX >> 8) & 0xf, (uEAX >> 20) & 0x7f, ((uEAX >> 8) & 0xf) + (((uEAX >> 8) & 0xf) == 0xf ? (uEAX >> 20) & 0x7f : 0),
|
---|
1301 | (uEAX >> 4) & 0xf, (uEAX >> 16) & 0x0f, ((uEAX >> 4) & 0xf) | (((uEAX >> 4) & 0xf) == 0xf ? (uEAX >> 16) & 0x0f : 0),
|
---|
1302 | (uEAX >> 0) & 0xf,
|
---|
1303 | Guest.ebx & 0xfff);
|
---|
1304 |
|
---|
1305 | if (iVerbosity == 1)
|
---|
1306 | {
|
---|
1307 | uint32_t uEDX = Guest.edx;
|
---|
1308 | pHlp->pfnPrintf(pHlp, "Features EDX: ");
|
---|
1309 | if (uEDX & RT_BIT(0)) pHlp->pfnPrintf(pHlp, " FPU");
|
---|
1310 | if (uEDX & RT_BIT(1)) pHlp->pfnPrintf(pHlp, " VME");
|
---|
1311 | if (uEDX & RT_BIT(2)) pHlp->pfnPrintf(pHlp, " DE");
|
---|
1312 | if (uEDX & RT_BIT(3)) pHlp->pfnPrintf(pHlp, " PSE");
|
---|
1313 | if (uEDX & RT_BIT(4)) pHlp->pfnPrintf(pHlp, " TSC");
|
---|
1314 | if (uEDX & RT_BIT(5)) pHlp->pfnPrintf(pHlp, " MSR");
|
---|
1315 | if (uEDX & RT_BIT(6)) pHlp->pfnPrintf(pHlp, " PAE");
|
---|
1316 | if (uEDX & RT_BIT(7)) pHlp->pfnPrintf(pHlp, " MCE");
|
---|
1317 | if (uEDX & RT_BIT(8)) pHlp->pfnPrintf(pHlp, " CX8");
|
---|
1318 | if (uEDX & RT_BIT(9)) pHlp->pfnPrintf(pHlp, " APIC");
|
---|
1319 | if (uEDX & RT_BIT(10)) pHlp->pfnPrintf(pHlp, " 10");
|
---|
1320 | if (uEDX & RT_BIT(11)) pHlp->pfnPrintf(pHlp, " SCR");
|
---|
1321 | if (uEDX & RT_BIT(12)) pHlp->pfnPrintf(pHlp, " MTRR");
|
---|
1322 | if (uEDX & RT_BIT(13)) pHlp->pfnPrintf(pHlp, " PGE");
|
---|
1323 | if (uEDX & RT_BIT(14)) pHlp->pfnPrintf(pHlp, " MCA");
|
---|
1324 | if (uEDX & RT_BIT(15)) pHlp->pfnPrintf(pHlp, " CMOV");
|
---|
1325 | if (uEDX & RT_BIT(16)) pHlp->pfnPrintf(pHlp, " PAT");
|
---|
1326 | if (uEDX & RT_BIT(17)) pHlp->pfnPrintf(pHlp, " PSE36");
|
---|
1327 | if (uEDX & RT_BIT(18)) pHlp->pfnPrintf(pHlp, " 18");
|
---|
1328 | if (uEDX & RT_BIT(19)) pHlp->pfnPrintf(pHlp, " 19");
|
---|
1329 | if (uEDX & RT_BIT(20)) pHlp->pfnPrintf(pHlp, " NX");
|
---|
1330 | if (uEDX & RT_BIT(21)) pHlp->pfnPrintf(pHlp, " 21");
|
---|
1331 | if (uEDX & RT_BIT(22)) pHlp->pfnPrintf(pHlp, " ExtMMX");
|
---|
1332 | if (uEDX & RT_BIT(23)) pHlp->pfnPrintf(pHlp, " MMX");
|
---|
1333 | if (uEDX & RT_BIT(24)) pHlp->pfnPrintf(pHlp, " FXSR");
|
---|
1334 | if (uEDX & RT_BIT(25)) pHlp->pfnPrintf(pHlp, " FastFXSR");
|
---|
1335 | if (uEDX & RT_BIT(26)) pHlp->pfnPrintf(pHlp, " Page1GB");
|
---|
1336 | if (uEDX & RT_BIT(27)) pHlp->pfnPrintf(pHlp, " RDTSCP");
|
---|
1337 | if (uEDX & RT_BIT(28)) pHlp->pfnPrintf(pHlp, " 28");
|
---|
1338 | if (uEDX & RT_BIT(29)) pHlp->pfnPrintf(pHlp, " LongMode");
|
---|
1339 | if (uEDX & RT_BIT(30)) pHlp->pfnPrintf(pHlp, " Ext3DNow");
|
---|
1340 | if (uEDX & RT_BIT(31)) pHlp->pfnPrintf(pHlp, " 3DNow");
|
---|
1341 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
1342 |
|
---|
1343 | uint32_t uECX = Guest.ecx;
|
---|
1344 | pHlp->pfnPrintf(pHlp, "Features ECX: ");
|
---|
1345 | if (uECX & RT_BIT(0)) pHlp->pfnPrintf(pHlp, " LAHF/SAHF");
|
---|
1346 | if (uECX & RT_BIT(1)) pHlp->pfnPrintf(pHlp, " CMPL");
|
---|
1347 | if (uECX & RT_BIT(2)) pHlp->pfnPrintf(pHlp, " SVM");
|
---|
1348 | if (uECX & RT_BIT(3)) pHlp->pfnPrintf(pHlp, " ExtAPIC");
|
---|
1349 | if (uECX & RT_BIT(4)) pHlp->pfnPrintf(pHlp, " CR8L");
|
---|
1350 | if (uECX & RT_BIT(5)) pHlp->pfnPrintf(pHlp, " ABM");
|
---|
1351 | if (uECX & RT_BIT(6)) pHlp->pfnPrintf(pHlp, " SSE4A");
|
---|
1352 | if (uECX & RT_BIT(7)) pHlp->pfnPrintf(pHlp, " MISALNSSE");
|
---|
1353 | if (uECX & RT_BIT(8)) pHlp->pfnPrintf(pHlp, " 3DNOWPRF");
|
---|
1354 | if (uECX & RT_BIT(9)) pHlp->pfnPrintf(pHlp, " OSVW");
|
---|
1355 | if (uECX & RT_BIT(12)) pHlp->pfnPrintf(pHlp, " SKINIT");
|
---|
1356 | if (uECX & RT_BIT(13)) pHlp->pfnPrintf(pHlp, " WDT");
|
---|
1357 | for (unsigned iBit = 5; iBit < 32; iBit++)
|
---|
1358 | if (uECX & RT_BIT(iBit))
|
---|
1359 | pHlp->pfnPrintf(pHlp, " %d", iBit);
|
---|
1360 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
1361 | }
|
---|
1362 | else
|
---|
1363 | {
|
---|
1364 | ASMCpuId(0x80000001, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
|
---|
1365 |
|
---|
1366 | uint32_t uEdxGst = Guest.edx;
|
---|
1367 | uint32_t uEdxHst = Host.edx;
|
---|
1368 | pHlp->pfnPrintf(pHlp, "Mnemonic - Description = guest (host)\n");
|
---|
1369 | pHlp->pfnPrintf(pHlp, "FPU - x87 FPU on Chip = %d (%d)\n", !!(uEdxGst & RT_BIT( 0)), !!(uEdxHst & RT_BIT( 0)));
|
---|
1370 | pHlp->pfnPrintf(pHlp, "VME - Virtual 8086 Mode Enhancements = %d (%d)\n", !!(uEdxGst & RT_BIT( 1)), !!(uEdxHst & RT_BIT( 1)));
|
---|
1371 | pHlp->pfnPrintf(pHlp, "DE - Debugging extensions = %d (%d)\n", !!(uEdxGst & RT_BIT( 2)), !!(uEdxHst & RT_BIT( 2)));
|
---|
1372 | pHlp->pfnPrintf(pHlp, "PSE - Page Size Extension = %d (%d)\n", !!(uEdxGst & RT_BIT( 3)), !!(uEdxHst & RT_BIT( 3)));
|
---|
1373 | pHlp->pfnPrintf(pHlp, "TSC - Time Stamp Counter = %d (%d)\n", !!(uEdxGst & RT_BIT( 4)), !!(uEdxHst & RT_BIT( 4)));
|
---|
1374 | pHlp->pfnPrintf(pHlp, "MSR - K86 Model Specific Registers = %d (%d)\n", !!(uEdxGst & RT_BIT( 5)), !!(uEdxHst & RT_BIT( 5)));
|
---|
1375 | pHlp->pfnPrintf(pHlp, "PAE - Physical Address Extension = %d (%d)\n", !!(uEdxGst & RT_BIT( 6)), !!(uEdxHst & RT_BIT( 6)));
|
---|
1376 | pHlp->pfnPrintf(pHlp, "MCE - Machine Check Exception = %d (%d)\n", !!(uEdxGst & RT_BIT( 7)), !!(uEdxHst & RT_BIT( 7)));
|
---|
1377 | pHlp->pfnPrintf(pHlp, "CX8 - CMPXCHG8B instruction = %d (%d)\n", !!(uEdxGst & RT_BIT( 8)), !!(uEdxHst & RT_BIT( 8)));
|
---|
1378 | pHlp->pfnPrintf(pHlp, "APIC - APIC On-Chip = %d (%d)\n", !!(uEdxGst & RT_BIT( 9)), !!(uEdxHst & RT_BIT( 9)));
|
---|
1379 | pHlp->pfnPrintf(pHlp, "10 - Reserved = %d (%d)\n", !!(uEdxGst & RT_BIT(10)), !!(uEdxHst & RT_BIT(10)));
|
---|
1380 | pHlp->pfnPrintf(pHlp, "SEP - SYSCALL and SYSRET = %d (%d)\n", !!(uEdxGst & RT_BIT(11)), !!(uEdxHst & RT_BIT(11)));
|
---|
1381 | pHlp->pfnPrintf(pHlp, "MTRR - Memory Type Range Registers = %d (%d)\n", !!(uEdxGst & RT_BIT(12)), !!(uEdxHst & RT_BIT(12)));
|
---|
1382 | pHlp->pfnPrintf(pHlp, "PGE - PTE Global Bit = %d (%d)\n", !!(uEdxGst & RT_BIT(13)), !!(uEdxHst & RT_BIT(13)));
|
---|
1383 | pHlp->pfnPrintf(pHlp, "MCA - Machine Check Architecture = %d (%d)\n", !!(uEdxGst & RT_BIT(14)), !!(uEdxHst & RT_BIT(14)));
|
---|
1384 | pHlp->pfnPrintf(pHlp, "CMOV - Conditional Move Instructions = %d (%d)\n", !!(uEdxGst & RT_BIT(15)), !!(uEdxHst & RT_BIT(15)));
|
---|
1385 | pHlp->pfnPrintf(pHlp, "PAT - Page Attribute Table = %d (%d)\n", !!(uEdxGst & RT_BIT(16)), !!(uEdxHst & RT_BIT(16)));
|
---|
1386 | pHlp->pfnPrintf(pHlp, "PSE-36 - 36-bit Page Size Extention = %d (%d)\n", !!(uEdxGst & RT_BIT(17)), !!(uEdxHst & RT_BIT(17)));
|
---|
1387 | pHlp->pfnPrintf(pHlp, "18 - Reserved = %d (%d)\n", !!(uEdxGst & RT_BIT(18)), !!(uEdxHst & RT_BIT(18)));
|
---|
1388 | pHlp->pfnPrintf(pHlp, "19 - Reserved = %d (%d)\n", !!(uEdxGst & RT_BIT(19)), !!(uEdxHst & RT_BIT(19)));
|
---|
1389 | pHlp->pfnPrintf(pHlp, "NX - No-Execute Page Protection = %d (%d)\n", !!(uEdxGst & RT_BIT(20)), !!(uEdxHst & RT_BIT(20)));
|
---|
1390 | pHlp->pfnPrintf(pHlp, "DS - Debug Store = %d (%d)\n", !!(uEdxGst & RT_BIT(21)), !!(uEdxHst & RT_BIT(21)));
|
---|
1391 | pHlp->pfnPrintf(pHlp, "AXMMX - AMD Extensions to MMX Instr. = %d (%d)\n", !!(uEdxGst & RT_BIT(22)), !!(uEdxHst & RT_BIT(22)));
|
---|
1392 | pHlp->pfnPrintf(pHlp, "MMX - Intel MMX Technology = %d (%d)\n", !!(uEdxGst & RT_BIT(23)), !!(uEdxHst & RT_BIT(23)));
|
---|
1393 | pHlp->pfnPrintf(pHlp, "FXSR - FXSAVE and FXRSTOR Instructions = %d (%d)\n", !!(uEdxGst & RT_BIT(24)), !!(uEdxHst & RT_BIT(24)));
|
---|
1394 | pHlp->pfnPrintf(pHlp, "25 - AMD fast FXSAVE and FXRSTOR Instr.= %d (%d)\n", !!(uEdxGst & RT_BIT(25)), !!(uEdxHst & RT_BIT(25)));
|
---|
1395 | pHlp->pfnPrintf(pHlp, "26 - Reserved = %d (%d)\n", !!(uEdxGst & RT_BIT(26)), !!(uEdxHst & RT_BIT(26)));
|
---|
1396 | pHlp->pfnPrintf(pHlp, "27 - Reserved = %d (%d)\n", !!(uEdxGst & RT_BIT(27)), !!(uEdxHst & RT_BIT(27)));
|
---|
1397 | pHlp->pfnPrintf(pHlp, "28 - Reserved = %d (%d)\n", !!(uEdxGst & RT_BIT(28)), !!(uEdxHst & RT_BIT(28)));
|
---|
1398 | pHlp->pfnPrintf(pHlp, "29 - AMD Long Mode = %d (%d)\n", !!(uEdxGst & RT_BIT(29)), !!(uEdxHst & RT_BIT(29)));
|
---|
1399 | pHlp->pfnPrintf(pHlp, "30 - AMD Extensions to 3DNow = %d (%d)\n", !!(uEdxGst & RT_BIT(30)), !!(uEdxHst & RT_BIT(30)));
|
---|
1400 | pHlp->pfnPrintf(pHlp, "31 - AMD 3DNow = %d (%d)\n", !!(uEdxGst & RT_BIT(31)), !!(uEdxHst & RT_BIT(31)));
|
---|
1401 |
|
---|
1402 | uint32_t uEcxGst = Guest.ecx;
|
---|
1403 | uint32_t uEcxHst = Host.ecx;
|
---|
1404 | pHlp->pfnPrintf(pHlp, "LahfSahf - LAHF/SAHF in 64-bit mode = %d (%d)\n", !!(uEcxGst & RT_BIT( 0)), !!(uEcxHst & RT_BIT( 0)));
|
---|
1405 | pHlp->pfnPrintf(pHlp, "CmpLegacy - Core MP legacy mode (depr) = %d (%d)\n", !!(uEcxGst & RT_BIT( 1)), !!(uEcxHst & RT_BIT( 1)));
|
---|
1406 | pHlp->pfnPrintf(pHlp, "SVM - AMD VM Extensions = %d (%d)\n", !!(uEcxGst & RT_BIT( 2)), !!(uEcxHst & RT_BIT( 2)));
|
---|
1407 | pHlp->pfnPrintf(pHlp, "APIC registers starting at 0x400 = %d (%d)\n", !!(uEcxGst & RT_BIT( 3)), !!(uEcxHst & RT_BIT( 3)));
|
---|
1408 | pHlp->pfnPrintf(pHlp, "AltMovCR8 - LOCK MOV CR0 means MOV CR8 = %d (%d)\n", !!(uEcxGst & RT_BIT( 4)), !!(uEcxHst & RT_BIT( 4)));
|
---|
1409 | pHlp->pfnPrintf(pHlp, "Advanced bit manipulation = %d (%d)\n", !!(uEcxGst & RT_BIT( 5)), !!(uEcxHst & RT_BIT( 5)));
|
---|
1410 | pHlp->pfnPrintf(pHlp, "SSE4A instruction support = %d (%d)\n", !!(uEcxGst & RT_BIT( 6)), !!(uEcxHst & RT_BIT( 6)));
|
---|
1411 | pHlp->pfnPrintf(pHlp, "Misaligned SSE mode = %d (%d)\n", !!(uEcxGst & RT_BIT( 7)), !!(uEcxHst & RT_BIT( 7)));
|
---|
1412 | pHlp->pfnPrintf(pHlp, "PREFETCH and PREFETCHW instruction = %d (%d)\n", !!(uEcxGst & RT_BIT( 8)), !!(uEcxHst & RT_BIT( 8)));
|
---|
1413 | pHlp->pfnPrintf(pHlp, "OS visible workaround = %d (%d)\n", !!(uEcxGst & RT_BIT( 9)), !!(uEcxHst & RT_BIT( 9)));
|
---|
1414 | pHlp->pfnPrintf(pHlp, "11:10 - Reserved = %#x (%#x)\n", (uEcxGst >> 10) & 3, (uEcxHst >> 10) & 3);
|
---|
1415 | pHlp->pfnPrintf(pHlp, "SKINIT, STGI, and DEV support = %d (%d)\n", !!(uEcxGst & RT_BIT(12)), !!(uEcxHst & RT_BIT(12)));
|
---|
1416 | pHlp->pfnPrintf(pHlp, "Watchdog timer support. = %d (%d)\n", !!(uEcxGst & RT_BIT(13)), !!(uEcxHst & RT_BIT(13)));
|
---|
1417 | pHlp->pfnPrintf(pHlp, "31:14 - Reserved = %#x (%#x)\n", uEcxGst >> 14, uEcxHst >> 14);
|
---|
1418 | }
|
---|
1419 | }
|
---|
1420 |
|
---|
1421 | if (iVerbosity && cExtMax >= 2)
|
---|
1422 | {
|
---|
1423 | char szString[4*4*3+1] = {0};
|
---|
1424 | uint32_t *pu32 = (uint32_t *)szString;
|
---|
1425 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[2].eax;
|
---|
1426 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[2].ebx;
|
---|
1427 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[2].ecx;
|
---|
1428 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[2].edx;
|
---|
1429 | if (cExtMax >= 3)
|
---|
1430 | {
|
---|
1431 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[3].eax;
|
---|
1432 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[3].ebx;
|
---|
1433 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[3].ecx;
|
---|
1434 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[3].edx;
|
---|
1435 | }
|
---|
1436 | if (cExtMax >= 4)
|
---|
1437 | {
|
---|
1438 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[4].eax;
|
---|
1439 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[4].ebx;
|
---|
1440 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[4].ecx;
|
---|
1441 | *pu32++ = pVM->cpum.s.aGuestCpuIdExt[4].edx;
|
---|
1442 | }
|
---|
1443 | pHlp->pfnPrintf(pHlp, "Full Name: %s\n", szString);
|
---|
1444 | }
|
---|
1445 |
|
---|
1446 | if (iVerbosity && cExtMax >= 5)
|
---|
1447 | {
|
---|
1448 | uint32_t uEAX = pVM->cpum.s.aGuestCpuIdExt[5].eax;
|
---|
1449 | uint32_t uEBX = pVM->cpum.s.aGuestCpuIdExt[5].ebx;
|
---|
1450 | uint32_t uECX = pVM->cpum.s.aGuestCpuIdExt[5].ecx;
|
---|
1451 | uint32_t uEDX = pVM->cpum.s.aGuestCpuIdExt[5].edx;
|
---|
1452 | char sz1[32];
|
---|
1453 | char sz2[32];
|
---|
1454 |
|
---|
1455 | pHlp->pfnPrintf(pHlp,
|
---|
1456 | "TLB 2/4M Instr/Uni: %s %3d entries\n"
|
---|
1457 | "TLB 2/4M Data: %s %3d entries\n",
|
---|
1458 | getCacheAss((uEAX >> 8) & 0xff, sz1), (uEAX >> 0) & 0xff,
|
---|
1459 | getCacheAss((uEAX >> 24) & 0xff, sz2), (uEAX >> 16) & 0xff);
|
---|
1460 | pHlp->pfnPrintf(pHlp,
|
---|
1461 | "TLB 4K Instr/Uni: %s %3d entries\n"
|
---|
1462 | "TLB 4K Data: %s %3d entries\n",
|
---|
1463 | getCacheAss((uEBX >> 8) & 0xff, sz1), (uEBX >> 0) & 0xff,
|
---|
1464 | getCacheAss((uEBX >> 24) & 0xff, sz2), (uEBX >> 16) & 0xff);
|
---|
1465 | pHlp->pfnPrintf(pHlp, "L1 Instr Cache Line Size: %d bytes\n"
|
---|
1466 | "L1 Instr Cache Lines Per Tag: %d\n"
|
---|
1467 | "L1 Instr Cache Associativity: %s\n"
|
---|
1468 | "L1 Instr Cache Size: %d KB\n",
|
---|
1469 | (uEDX >> 0) & 0xff,
|
---|
1470 | (uEDX >> 8) & 0xff,
|
---|
1471 | getCacheAss((uEDX >> 16) & 0xff, sz1),
|
---|
1472 | (uEDX >> 24) & 0xff);
|
---|
1473 | pHlp->pfnPrintf(pHlp,
|
---|
1474 | "L1 Data Cache Line Size: %d bytes\n"
|
---|
1475 | "L1 Data Cache Lines Per Tag: %d\n"
|
---|
1476 | "L1 Data Cache Associativity: %s\n"
|
---|
1477 | "L1 Data Cache Size: %d KB\n",
|
---|
1478 | (uECX >> 0) & 0xff,
|
---|
1479 | (uECX >> 8) & 0xff,
|
---|
1480 | getCacheAss((uECX >> 16) & 0xff, sz1),
|
---|
1481 | (uECX >> 24) & 0xff);
|
---|
1482 | }
|
---|
1483 |
|
---|
1484 | if (iVerbosity && cExtMax >= 6)
|
---|
1485 | {
|
---|
1486 | uint32_t uEAX = pVM->cpum.s.aGuestCpuIdExt[6].eax;
|
---|
1487 | uint32_t uEBX = pVM->cpum.s.aGuestCpuIdExt[6].ebx;
|
---|
1488 | uint32_t uEDX = pVM->cpum.s.aGuestCpuIdExt[6].edx;
|
---|
1489 |
|
---|
1490 | pHlp->pfnPrintf(pHlp,
|
---|
1491 | "L2 TLB 2/4M Instr/Uni: %s %4d entries\n"
|
---|
1492 | "L2 TLB 2/4M Data: %s %4d entries\n",
|
---|
1493 | getL2CacheAss((uEAX >> 12) & 0xf), (uEAX >> 0) & 0xfff,
|
---|
1494 | getL2CacheAss((uEAX >> 28) & 0xf), (uEAX >> 16) & 0xfff);
|
---|
1495 | pHlp->pfnPrintf(pHlp,
|
---|
1496 | "L2 TLB 4K Instr/Uni: %s %4d entries\n"
|
---|
1497 | "L2 TLB 4K Data: %s %4d entries\n",
|
---|
1498 | getL2CacheAss((uEBX >> 12) & 0xf), (uEBX >> 0) & 0xfff,
|
---|
1499 | getL2CacheAss((uEBX >> 28) & 0xf), (uEBX >> 16) & 0xfff);
|
---|
1500 | pHlp->pfnPrintf(pHlp,
|
---|
1501 | "L2 Cache Line Size: %d bytes\n"
|
---|
1502 | "L2 Cache Lines Per Tag: %d\n"
|
---|
1503 | "L2 Cache Associativity: %s\n"
|
---|
1504 | "L2 Cache Size: %d KB\n",
|
---|
1505 | (uEDX >> 0) & 0xff,
|
---|
1506 | (uEDX >> 8) & 0xf,
|
---|
1507 | getL2CacheAss((uEDX >> 12) & 0xf),
|
---|
1508 | (uEDX >> 16) & 0xffff);
|
---|
1509 | }
|
---|
1510 |
|
---|
1511 | if (iVerbosity && cExtMax >= 7)
|
---|
1512 | {
|
---|
1513 | uint32_t uEDX = pVM->cpum.s.aGuestCpuIdExt[7].edx;
|
---|
1514 |
|
---|
1515 | pHlp->pfnPrintf(pHlp, "APM Features: ");
|
---|
1516 | if (uEDX & RT_BIT(0)) pHlp->pfnPrintf(pHlp, " TS");
|
---|
1517 | if (uEDX & RT_BIT(1)) pHlp->pfnPrintf(pHlp, " FID");
|
---|
1518 | if (uEDX & RT_BIT(2)) pHlp->pfnPrintf(pHlp, " VID");
|
---|
1519 | if (uEDX & RT_BIT(3)) pHlp->pfnPrintf(pHlp, " TTP");
|
---|
1520 | if (uEDX & RT_BIT(4)) pHlp->pfnPrintf(pHlp, " TM");
|
---|
1521 | if (uEDX & RT_BIT(5)) pHlp->pfnPrintf(pHlp, " STC");
|
---|
1522 | for (unsigned iBit = 6; iBit < 32; iBit++)
|
---|
1523 | if (uEDX & RT_BIT(iBit))
|
---|
1524 | pHlp->pfnPrintf(pHlp, " %d", iBit);
|
---|
1525 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
1526 | }
|
---|
1527 |
|
---|
1528 | if (iVerbosity && cExtMax >= 8)
|
---|
1529 | {
|
---|
1530 | uint32_t uEAX = pVM->cpum.s.aGuestCpuIdExt[8].eax;
|
---|
1531 | uint32_t uECX = pVM->cpum.s.aGuestCpuIdExt[8].ecx;
|
---|
1532 |
|
---|
1533 | pHlp->pfnPrintf(pHlp,
|
---|
1534 | "Physical Address Width: %d bits\n"
|
---|
1535 | "Virtual Address Width: %d bits\n",
|
---|
1536 | (uEAX >> 0) & 0xff,
|
---|
1537 | (uEAX >> 8) & 0xff);
|
---|
1538 | pHlp->pfnPrintf(pHlp,
|
---|
1539 | "Physical Core Count: %d\n",
|
---|
1540 | (uECX >> 0) & 0xff);
|
---|
1541 | }
|
---|
1542 |
|
---|
1543 |
|
---|
1544 | /*
|
---|
1545 | * Centaur.
|
---|
1546 | */
|
---|
1547 | unsigned cCentaurMax = pVM->cpum.s.aGuestCpuIdCentaur[0].eax & 0xffff;
|
---|
1548 |
|
---|
1549 | pHlp->pfnPrintf(pHlp,
|
---|
1550 | "\n"
|
---|
1551 | " RAW Centaur CPUIDs\n"
|
---|
1552 | " Function eax ebx ecx edx\n");
|
---|
1553 | for (unsigned i = 0; i < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdCentaur); i++)
|
---|
1554 | {
|
---|
1555 | Guest = pVM->cpum.s.aGuestCpuIdCentaur[i];
|
---|
1556 | ASMCpuId(0xc0000000 | i, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
|
---|
1557 |
|
---|
1558 | pHlp->pfnPrintf(pHlp,
|
---|
1559 | "Gst: %08x %08x %08x %08x %08x%s\n"
|
---|
1560 | "Hst: %08x %08x %08x %08x\n",
|
---|
1561 | 0xc0000000 | i, Guest.eax, Guest.ebx, Guest.ecx, Guest.edx,
|
---|
1562 | i <= cCentaurMax ? "" : "*",
|
---|
1563 | Host.eax, Host.ebx, Host.ecx, Host.edx);
|
---|
1564 | }
|
---|
1565 |
|
---|
1566 | /*
|
---|
1567 | * Understandable output
|
---|
1568 | */
|
---|
1569 | if (iVerbosity && cCentaurMax >= 0)
|
---|
1570 | {
|
---|
1571 | Guest = pVM->cpum.s.aGuestCpuIdCentaur[0];
|
---|
1572 | pHlp->pfnPrintf(pHlp,
|
---|
1573 | "Centaur Supports: 0xc0000000-%#010x\n",
|
---|
1574 | Guest.eax);
|
---|
1575 | }
|
---|
1576 |
|
---|
1577 | if (iVerbosity && cCentaurMax >= 1)
|
---|
1578 | {
|
---|
1579 | ASMCpuId(0xc0000001, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
|
---|
1580 | uint32_t uEdxGst = pVM->cpum.s.aGuestCpuIdExt[1].edx;
|
---|
1581 | uint32_t uEdxHst = Host.edx;
|
---|
1582 |
|
---|
1583 | if (iVerbosity == 1)
|
---|
1584 | {
|
---|
1585 | pHlp->pfnPrintf(pHlp, "Centaur Features EDX: ");
|
---|
1586 | if (uEdxGst & RT_BIT(0)) pHlp->pfnPrintf(pHlp, " AIS");
|
---|
1587 | if (uEdxGst & RT_BIT(1)) pHlp->pfnPrintf(pHlp, " AIS-E");
|
---|
1588 | if (uEdxGst & RT_BIT(2)) pHlp->pfnPrintf(pHlp, " RNG");
|
---|
1589 | if (uEdxGst & RT_BIT(3)) pHlp->pfnPrintf(pHlp, " RNG-E");
|
---|
1590 | if (uEdxGst & RT_BIT(4)) pHlp->pfnPrintf(pHlp, " LH");
|
---|
1591 | if (uEdxGst & RT_BIT(5)) pHlp->pfnPrintf(pHlp, " FEMMS");
|
---|
1592 | if (uEdxGst & RT_BIT(6)) pHlp->pfnPrintf(pHlp, " ACE");
|
---|
1593 | if (uEdxGst & RT_BIT(7)) pHlp->pfnPrintf(pHlp, " ACE-E");
|
---|
1594 | /* possibly indicating MM/HE and MM/HE-E on older chips... */
|
---|
1595 | if (uEdxGst & RT_BIT(8)) pHlp->pfnPrintf(pHlp, " ACE2");
|
---|
1596 | if (uEdxGst & RT_BIT(9)) pHlp->pfnPrintf(pHlp, " ACE2-E");
|
---|
1597 | if (uEdxGst & RT_BIT(10)) pHlp->pfnPrintf(pHlp, " PHE");
|
---|
1598 | if (uEdxGst & RT_BIT(11)) pHlp->pfnPrintf(pHlp, " PHE-E");
|
---|
1599 | if (uEdxGst & RT_BIT(12)) pHlp->pfnPrintf(pHlp, " PMM");
|
---|
1600 | if (uEdxGst & RT_BIT(13)) pHlp->pfnPrintf(pHlp, " PMM-E");
|
---|
1601 | for (unsigned iBit = 14; iBit < 32; iBit++)
|
---|
1602 | if (uEdxGst & RT_BIT(iBit))
|
---|
1603 | pHlp->pfnPrintf(pHlp, " %d", iBit);
|
---|
1604 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
1605 | }
|
---|
1606 | else
|
---|
1607 | {
|
---|
1608 | pHlp->pfnPrintf(pHlp, "Mnemonic - Description = guest (host)\n");
|
---|
1609 | pHlp->pfnPrintf(pHlp, "AIS - Alternate Instruction Set = %d (%d)\n", !!(uEdxGst & RT_BIT( 0)), !!(uEdxHst & RT_BIT( 0)));
|
---|
1610 | pHlp->pfnPrintf(pHlp, "AIS-E - AIS enabled = %d (%d)\n", !!(uEdxGst & RT_BIT( 1)), !!(uEdxHst & RT_BIT( 1)));
|
---|
1611 | pHlp->pfnPrintf(pHlp, "RNG - Random Number Generator = %d (%d)\n", !!(uEdxGst & RT_BIT( 2)), !!(uEdxHst & RT_BIT( 2)));
|
---|
1612 | pHlp->pfnPrintf(pHlp, "RNG-E - RNG enabled = %d (%d)\n", !!(uEdxGst & RT_BIT( 3)), !!(uEdxHst & RT_BIT( 3)));
|
---|
1613 | pHlp->pfnPrintf(pHlp, "LH - LongHaul MSR 0000_110Ah = %d (%d)\n", !!(uEdxGst & RT_BIT( 4)), !!(uEdxHst & RT_BIT( 4)));
|
---|
1614 | pHlp->pfnPrintf(pHlp, "FEMMS - FEMMS = %d (%d)\n", !!(uEdxGst & RT_BIT( 5)), !!(uEdxHst & RT_BIT( 5)));
|
---|
1615 | pHlp->pfnPrintf(pHlp, "ACE - Advanced Cryptography Engine = %d (%d)\n", !!(uEdxGst & RT_BIT( 6)), !!(uEdxHst & RT_BIT( 6)));
|
---|
1616 | pHlp->pfnPrintf(pHlp, "ACE-E - ACE enabled = %d (%d)\n", !!(uEdxGst & RT_BIT( 7)), !!(uEdxHst & RT_BIT( 7)));
|
---|
1617 | /* possibly indicating MM/HE and MM/HE-E on older chips... */
|
---|
1618 | pHlp->pfnPrintf(pHlp, "ACE2 - Advanced Cryptography Engine 2 = %d (%d)\n", !!(uEdxGst & RT_BIT( 8)), !!(uEdxHst & RT_BIT( 8)));
|
---|
1619 | pHlp->pfnPrintf(pHlp, "ACE2-E - ACE enabled = %d (%d)\n", !!(uEdxGst & RT_BIT( 9)), !!(uEdxHst & RT_BIT( 9)));
|
---|
1620 | pHlp->pfnPrintf(pHlp, "PHE - Hash Engine = %d (%d)\n", !!(uEdxGst & RT_BIT(10)), !!(uEdxHst & RT_BIT(10)));
|
---|
1621 | pHlp->pfnPrintf(pHlp, "PHE-E - PHE enabled = %d (%d)\n", !!(uEdxGst & RT_BIT(11)), !!(uEdxHst & RT_BIT(11)));
|
---|
1622 | pHlp->pfnPrintf(pHlp, "PMM - Montgomery Multiplier = %d (%d)\n", !!(uEdxGst & RT_BIT(12)), !!(uEdxHst & RT_BIT(12)));
|
---|
1623 | pHlp->pfnPrintf(pHlp, "PMM-E - PMM enabled = %d (%d)\n", !!(uEdxGst & RT_BIT(13)), !!(uEdxHst & RT_BIT(13)));
|
---|
1624 | for (unsigned iBit = 14; iBit < 32; iBit++)
|
---|
1625 | if ((uEdxGst | uEdxHst) & RT_BIT(iBit))
|
---|
1626 | pHlp->pfnPrintf(pHlp, "Bit %d = %d (%d)\n", !!(uEdxGst & RT_BIT(iBit)), !!(uEdxHst & RT_BIT(iBit)));
|
---|
1627 | pHlp->pfnPrintf(pHlp, "\n");
|
---|
1628 | }
|
---|
1629 | }
|
---|
1630 | }
|
---|
1631 |
|
---|
1632 |
|
---|
1633 | /**
|
---|
1634 | * Structure used when disassembling and instructions in DBGF.
|
---|
1635 | * This is used so the reader function can get the stuff it needs.
|
---|
1636 | */
|
---|
1637 | typedef struct CPUMDISASSTATE
|
---|
1638 | {
|
---|
1639 | /** Pointer to the CPU structure. */
|
---|
1640 | PDISCPUSTATE pCpu;
|
---|
1641 | /** The VM handle. */
|
---|
1642 | PVM pVM;
|
---|
1643 | /** Pointer to the first byte in the segemnt. */
|
---|
1644 | RTGCUINTPTR GCPtrSegBase;
|
---|
1645 | /** Pointer to the byte after the end of the segment. (might have wrapped!) */
|
---|
1646 | RTGCUINTPTR GCPtrSegEnd;
|
---|
1647 | /** The size of the segment minus 1. */
|
---|
1648 | RTGCUINTPTR cbSegLimit;
|
---|
1649 | /** Pointer to the current page - HC Ptr. */
|
---|
1650 | void const *pvPageHC;
|
---|
1651 | /** Pointer to the current page - GC Ptr. */
|
---|
1652 | RTGCPTR pvPageGC;
|
---|
1653 | /** The lock information that PGMPhysReleasePageMappingLock needs. */
|
---|
1654 | PGMPAGEMAPLOCK PageMapLock;
|
---|
1655 | /** Whether the PageMapLock is valid or not. */
|
---|
1656 | bool fLocked;
|
---|
1657 | } CPUMDISASSTATE, *PCPUMDISASSTATE;
|
---|
1658 |
|
---|
1659 |
|
---|
1660 | /**
|
---|
1661 | * Instruction reader.
|
---|
1662 | *
|
---|
1663 | * @returns VBox status code.
|
---|
1664 | * @param PtrSrc Address to read from.
|
---|
1665 | * In our case this is relative to the selector pointed to by the 2nd user argument of uDisCpu.
|
---|
1666 | * @param pu8Dst Where to store the bytes.
|
---|
1667 | * @param cbRead Number of bytes to read.
|
---|
1668 | * @param uDisCpu Pointer to the disassembler cpu state.
|
---|
1669 | * In this context it's always pointer to the Core of a DBGFDISASSTATE.
|
---|
1670 | */
|
---|
1671 | static DECLCALLBACK(int) cpumR3DisasInstrRead(RTHCUINTPTR PtrSrc, uint8_t *pu8Dst, uint32_t cbRead, void *uDisCpu)
|
---|
1672 | {
|
---|
1673 | PDISCPUSTATE pCpu = (PDISCPUSTATE)uDisCpu;
|
---|
1674 | PCPUMDISASSTATE pState = (PCPUMDISASSTATE)pCpu->apvUserData[0];
|
---|
1675 | Assert(cbRead > 0);
|
---|
1676 | for (;;)
|
---|
1677 | {
|
---|
1678 | RTGCUINTPTR GCPtr = PtrSrc + pState->GCPtrSegBase;
|
---|
1679 |
|
---|
1680 | /* Need to update the page translation? */
|
---|
1681 | if ( !pState->pvPageHC
|
---|
1682 | || (GCPtr >> PAGE_SHIFT) != (pState->pvPageGC >> PAGE_SHIFT))
|
---|
1683 | {
|
---|
1684 | int rc = VINF_SUCCESS;
|
---|
1685 |
|
---|
1686 | /* translate the address */
|
---|
1687 | pState->pvPageGC = GCPtr & PAGE_BASE_GC_MASK;
|
---|
1688 | if (MMHyperIsInsideArea(pState->pVM, pState->pvPageGC))
|
---|
1689 | {
|
---|
1690 | pState->pvPageHC = MMHyperGC2HC(pState->pVM, pState->pvPageGC);
|
---|
1691 | if (!pState->pvPageHC)
|
---|
1692 | rc = VERR_INVALID_POINTER;
|
---|
1693 | }
|
---|
1694 | else
|
---|
1695 | {
|
---|
1696 | /* Release mapping lock previously acquired. */
|
---|
1697 | if (pState->fLocked)
|
---|
1698 | PGMPhysReleasePageMappingLock(pState->pVM, &pState->PageMapLock);
|
---|
1699 | rc = PGMPhysGCPtr2CCPtrReadOnly(pState->pVM, pState->pvPageGC, &pState->pvPageHC, &pState->PageMapLock);
|
---|
1700 | pState->fLocked = RT_SUCCESS_NP(rc);
|
---|
1701 | }
|
---|
1702 | if (VBOX_FAILURE(rc))
|
---|
1703 | {
|
---|
1704 | pState->pvPageHC = NULL;
|
---|
1705 | return rc;
|
---|
1706 | }
|
---|
1707 | }
|
---|
1708 |
|
---|
1709 | /* check the segemnt limit */
|
---|
1710 | if (PtrSrc > pState->cbSegLimit)
|
---|
1711 | return VERR_OUT_OF_SELECTOR_BOUNDS;
|
---|
1712 |
|
---|
1713 | /* calc how much we can read */
|
---|
1714 | uint32_t cb = PAGE_SIZE - (GCPtr & PAGE_OFFSET_MASK);
|
---|
1715 | RTGCUINTPTR cbSeg = pState->GCPtrSegEnd - GCPtr;
|
---|
1716 | if (cb > cbSeg && !cbSeg)
|
---|
1717 | cb = cbSeg;
|
---|
1718 | if (cb > cbRead)
|
---|
1719 | cb = cbRead;
|
---|
1720 |
|
---|
1721 | /* read and advance */
|
---|
1722 | memcpy(pu8Dst, (char *)pState->pvPageHC + (GCPtr & PAGE_OFFSET_MASK), cb);
|
---|
1723 | cbRead -= cb;
|
---|
1724 | if (!cbRead)
|
---|
1725 | return VINF_SUCCESS;
|
---|
1726 | pu8Dst += cb;
|
---|
1727 | PtrSrc += cb;
|
---|
1728 | }
|
---|
1729 | }
|
---|
1730 |
|
---|
1731 |
|
---|
1732 | /**
|
---|
1733 | * Disassemble an instruction and return the information in the provided structure.
|
---|
1734 | *
|
---|
1735 | * @returns VBox status code.
|
---|
1736 | * @param pVM VM Handle
|
---|
1737 | * @param pCtx CPU context
|
---|
1738 | * @param GCPtrPC Program counter (relative to CS) to disassemble from.
|
---|
1739 | * @param pCpu Disassembly state
|
---|
1740 | * @param pszPrefix String prefix for logging (debug only)
|
---|
1741 | *
|
---|
1742 | */
|
---|
1743 | CPUMR3DECL(int) CPUMR3DisasmInstrCPU(PVM pVM, PCPUMCTX pCtx, RTGCPTR GCPtrPC, PDISCPUSTATE pCpu, const char *pszPrefix)
|
---|
1744 | {
|
---|
1745 | CPUMDISASSTATE State;
|
---|
1746 | int rc;
|
---|
1747 |
|
---|
1748 | State.pCpu = pCpu;
|
---|
1749 | State.pvPageGC = 0;
|
---|
1750 | State.pvPageHC = NULL;
|
---|
1751 | State.pVM = pVM;
|
---|
1752 | State.fLocked = false;
|
---|
1753 |
|
---|
1754 | /*
|
---|
1755 | * Get selector information.
|
---|
1756 | */
|
---|
1757 | if ( (pCtx->cr0 & X86_CR0_PE)
|
---|
1758 | && pCtx->eflags.Bits.u1VM == 0)
|
---|
1759 | {
|
---|
1760 | if (CPUMAreHiddenSelRegsValid(pVM))
|
---|
1761 | {
|
---|
1762 | State.GCPtrSegBase = pCtx->csHid.u32Base;
|
---|
1763 | State.GCPtrSegEnd = pCtx->csHid.u32Limit + 1 + (RTGCUINTPTR)pCtx->csHid.u32Base;
|
---|
1764 | State.cbSegLimit = pCtx->csHid.u32Limit;
|
---|
1765 | pCpu->mode = pCtx->csHid.Attr.n.u1DefBig ? CPUMODE_32BIT : CPUMODE_16BIT;
|
---|
1766 | }
|
---|
1767 | else
|
---|
1768 | {
|
---|
1769 | SELMSELINFO SelInfo;
|
---|
1770 |
|
---|
1771 | rc = SELMR3GetShadowSelectorInfo(pVM, pCtx->cs, &SelInfo);
|
---|
1772 | if (!VBOX_SUCCESS(rc))
|
---|
1773 | {
|
---|
1774 | AssertMsgFailed(("SELMR3GetShadowSelectorInfo failed for %04X:%VGv rc=%d\n", pCtx->cs, GCPtrPC, rc));
|
---|
1775 | return rc;
|
---|
1776 | }
|
---|
1777 |
|
---|
1778 | /*
|
---|
1779 | * Validate the selector.
|
---|
1780 | */
|
---|
1781 | rc = SELMSelInfoValidateCS(&SelInfo, pCtx->ss);
|
---|
1782 | if (!VBOX_SUCCESS(rc))
|
---|
1783 | {
|
---|
1784 | AssertMsgFailed(("SELMSelInfoValidateCS failed for %04X:%VGv rc=%d\n", pCtx->cs, GCPtrPC, rc));
|
---|
1785 | return rc;
|
---|
1786 | }
|
---|
1787 | State.GCPtrSegBase = SelInfo.GCPtrBase;
|
---|
1788 | State.GCPtrSegEnd = SelInfo.cbLimit + 1 + (RTGCUINTPTR)SelInfo.GCPtrBase;
|
---|
1789 | State.cbSegLimit = SelInfo.cbLimit;
|
---|
1790 | pCpu->mode = SelInfo.Raw.Gen.u1DefBig ? CPUMODE_32BIT : CPUMODE_16BIT;
|
---|
1791 | }
|
---|
1792 | }
|
---|
1793 | else
|
---|
1794 | {
|
---|
1795 | /* real or V86 mode */
|
---|
1796 | pCpu->mode = CPUMODE_16BIT;
|
---|
1797 | State.GCPtrSegBase = pCtx->cs * 16;
|
---|
1798 | State.GCPtrSegEnd = 0xFFFFFFFF;
|
---|
1799 | State.cbSegLimit = 0xFFFFFFFF;
|
---|
1800 | }
|
---|
1801 |
|
---|
1802 | /*
|
---|
1803 | * Disassemble the instruction.
|
---|
1804 | */
|
---|
1805 | pCpu->pfnReadBytes = cpumR3DisasInstrRead;
|
---|
1806 | pCpu->apvUserData[0] = &State;
|
---|
1807 |
|
---|
1808 | uint32_t cbInstr;
|
---|
1809 | #ifdef LOG_ENABLED
|
---|
1810 | rc = DISInstr(pCpu, GCPtrPC, 0, &cbInstr, NULL);
|
---|
1811 | if (VBOX_SUCCESS(rc))
|
---|
1812 | {
|
---|
1813 | #else
|
---|
1814 | char szOutput[160];
|
---|
1815 | rc = DISInstr(pCpu, GCPtrPC, 0, &cbInstr, &szOutput[0]);
|
---|
1816 | if (VBOX_SUCCESS(rc))
|
---|
1817 | {
|
---|
1818 | /* log it */
|
---|
1819 | if (pszPrefix)
|
---|
1820 | Log(("%s: %s", pszPrefix, szOutput));
|
---|
1821 | else
|
---|
1822 | Log(("%s", szOutput));
|
---|
1823 | #endif
|
---|
1824 | rc = VINF_SUCCESS;
|
---|
1825 | }
|
---|
1826 | else
|
---|
1827 | Log(("CPUMR3DisasmInstrCPU: DISInstr failed for %04X:%VGv rc=%Vrc\n", pCtx->cs, GCPtrPC, rc));
|
---|
1828 |
|
---|
1829 | /* Release mapping lock acquired in cpumR3DisasInstrRead. */
|
---|
1830 | if (State.fLocked)
|
---|
1831 | PGMPhysReleasePageMappingLock(pVM, &State.PageMapLock);
|
---|
1832 |
|
---|
1833 | return rc;
|
---|
1834 | }
|
---|
1835 |
|
---|
1836 |
|
---|
1837 | #ifdef DEBUG
|
---|
1838 | /**
|
---|
1839 | * Disassemble an instruction and dump it to the log
|
---|
1840 | *
|
---|
1841 | * @returns VBox status code.
|
---|
1842 | * @param pVM VM Handle
|
---|
1843 | * @param pCtx CPU context
|
---|
1844 | * @param pc GC instruction pointer
|
---|
1845 | * @param prefix String prefix for logging
|
---|
1846 | * @deprecated Use DBGFR3DisasInstrCurrentLog().
|
---|
1847 | *
|
---|
1848 | */
|
---|
1849 | CPUMR3DECL(void) CPUMR3DisasmInstr(PVM pVM, PCPUMCTX pCtx, RTGCPTR pc, char *prefix)
|
---|
1850 | {
|
---|
1851 | DISCPUSTATE cpu;
|
---|
1852 |
|
---|
1853 | CPUMR3DisasmInstrCPU(pVM, pCtx, pc, &cpu, prefix);
|
---|
1854 | }
|
---|
1855 |
|
---|
1856 | /**
|
---|
1857 | * Disassemble an instruction and dump it to the log
|
---|
1858 | *
|
---|
1859 | * @returns VBox status code.
|
---|
1860 | * @param pVM VM Handle
|
---|
1861 | * @param pCtx CPU context
|
---|
1862 | * @param pc GC instruction pointer
|
---|
1863 | * @param prefix String prefix for logging
|
---|
1864 | * @param nrInstructions
|
---|
1865 | *
|
---|
1866 | */
|
---|
1867 | CPUMR3DECL(void) CPUMR3DisasmBlock(PVM pVM, PCPUMCTX pCtx, RTGCPTR pc, char *prefix, int nrInstructions)
|
---|
1868 | {
|
---|
1869 | for(int i=0;i<nrInstructions;i++)
|
---|
1870 | {
|
---|
1871 | DISCPUSTATE cpu;
|
---|
1872 |
|
---|
1873 | CPUMR3DisasmInstrCPU(pVM, pCtx, pc, &cpu, prefix);
|
---|
1874 | pc += cpu.opsize;
|
---|
1875 | }
|
---|
1876 | }
|
---|
1877 |
|
---|
1878 | #endif
|
---|
1879 |
|
---|
1880 | #ifdef DEBUG
|
---|
1881 | /**
|
---|
1882 | * Debug helper - Saves guest context on raw mode entry (for fatal dump)
|
---|
1883 | *
|
---|
1884 | * @internal
|
---|
1885 | */
|
---|
1886 | CPUMR3DECL(void) CPUMR3SaveEntryCtx(PVM pVM)
|
---|
1887 | {
|
---|
1888 | pVM->cpum.s.GuestEntry = pVM->cpum.s.Guest;
|
---|
1889 | }
|
---|
1890 | #endif
|
---|
1891 |
|
---|
1892 |
|
---|
1893 | /**
|
---|
1894 | * API for controlling a few of the CPU features found in CR4.
|
---|
1895 | *
|
---|
1896 | * Currently only X86_CR4_TSD is accepted as input.
|
---|
1897 | *
|
---|
1898 | * @returns VBox status code.
|
---|
1899 | *
|
---|
1900 | * @param pVM The VM handle.
|
---|
1901 | * @param fOr The CR4 OR mask.
|
---|
1902 | * @param fAnd The CR4 AND mask.
|
---|
1903 | */
|
---|
1904 | CPUMR3DECL(int) CPUMR3SetCR4Feature(PVM pVM, RTHCUINTREG fOr, RTHCUINTREG fAnd)
|
---|
1905 | {
|
---|
1906 | AssertMsgReturn(!(fOr & ~(X86_CR4_TSD)), ("%#x\n", fOr), VERR_INVALID_PARAMETER);
|
---|
1907 | AssertMsgReturn((fAnd & ~(X86_CR4_TSD)) == ~(X86_CR4_TSD), ("%#x\n", fAnd), VERR_INVALID_PARAMETER);
|
---|
1908 |
|
---|
1909 | pVM->cpum.s.CR4.OrMask &= fAnd;
|
---|
1910 | pVM->cpum.s.CR4.OrMask |= fOr;
|
---|
1911 |
|
---|
1912 | return VINF_SUCCESS;
|
---|
1913 | }
|
---|
1914 |
|
---|