- Timestamp:
- Jul 27, 2016 1:19:55 PM (8 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
r62478 r62591 2239 2239 2240 2240 /** 2241 * Insert hypervisor identification leaves.2242 *2243 * We only return minimal information, primarily ensuring that the2244 * 0x40000000 function returns 0x40000001 and identifying ourselves.2245 * Hypervisor-specific interface is supported through GIM which will2246 * modify these leaves if required depending on the GIM provider.2247 *2248 * @returns VBox status code.2249 * @param pCpum The CPUM instance data.2250 * @param pConfig The CPUID configuration we've read from CFGM.2251 */2252 static int cpumR3CpuIdPlantHypervisorLeaves(PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)2253 {2254 CPUMCPUIDLEAF NewLeaf;2255 NewLeaf.uLeaf = UINT32_C(0x40000000);2256 NewLeaf.uSubLeaf = 0;2257 NewLeaf.fSubLeafMask = 0;2258 NewLeaf.uEax = UINT32_C(0x40000001);2259 NewLeaf.uEbx = 0x786f4256 /* 'VBox' */;2260 NewLeaf.uEcx = 0x786f4256 /* 'VBox' */;2261 NewLeaf.uEdx = 0x786f4256 /* 'VBox' */;2262 NewLeaf.fFlags = 0;2263 int rc = cpumR3CpuIdInsert(NULL /* pVM */, &pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves, &NewLeaf);2264 AssertLogRelRCReturn(rc, rc);2265 2266 NewLeaf.uLeaf = UINT32_C(0x40000001);2267 NewLeaf.uEax = 0x656e6f6e; /* 'none' */2268 NewLeaf.uEbx = 0;2269 NewLeaf.uEcx = 0;2270 NewLeaf.uEdx = 0;2271 NewLeaf.fFlags = 0;2272 rc = cpumR3CpuIdInsert(NULL /* pVM */, &pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves, &NewLeaf);2273 AssertLogRelRCReturn(rc, rc);2274 2275 return VINF_SUCCESS;2276 }2277 2278 2279 /**2280 2241 * Mini CPU selection support for making Mac OS X happy. 2281 2242 * … … 4033 3994 4034 3995 /* 4035 * Plant our own hypervisor CPUID leaves.4036 */4037 if (RT_SUCCESS(rc))4038 rc = cpumR3CpuIdPlantHypervisorLeaves(pCpum, &Config);4039 4040 /*4041 3996 * MSR fudging. 4042 3997 */ … … 4095 4050 if (fEnable) 4096 4051 CPUMR3SetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_NX); 4097 4098 /* We don't enable the Hypervisor Present bit by default, but it may be needed by some guests. */4099 rc = CFGMR3QueryBoolDef(pCpumCfg, "EnableHVP", &fEnable, false);4100 AssertRCReturn(rc, rc);4101 if (fEnable)4102 CPUMR3SetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_HVP);4103 4052 4104 4053 return VINF_SUCCESS; -
trunk/src/VBox/VMM/VMMR3/GIMMinimal.cpp
r62478 r62591 50 50 51 51 /* 52 * E nable the Hypervisor Present.52 * Expose HVP (Hypervisor Present) bit to the guest. 53 53 */ 54 54 CPUMR3SetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_HVP); 55 55 56 return VINF_SUCCESS; 56 /* 57 * Insert the hypervisor leaf range. 58 */ 59 CPUMCPUIDLEAF HyperLeaf; 60 RT_ZERO(HyperLeaf); 61 HyperLeaf.uLeaf = UINT32_C(0x40000000); 62 HyperLeaf.uEax = UINT32_C(0x40000010); /* Maximum leaf we implement. */ 63 int rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf); 64 if (RT_SUCCESS(rc)) 65 { 66 /* 67 * Insert missing zero leaves (you never know what missing leaves are 68 * going to return when read). 69 */ 70 RT_ZERO(HyperLeaf); 71 for (uint32_t uLeaf = UINT32_C(0x40000001); uLeaf <= UINT32_C(0x40000010); uLeaf++) 72 { 73 HyperLeaf.uLeaf = uLeaf; 74 rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf); 75 AssertLogRelRCReturn(rc, rc); 76 } 77 } 78 else 79 LogRel(("GIM: Minimal: Failed to insert hypervisor leaf %#RX32. rc=%Rrc\n", HyperLeaf.uLeaf, rc)); 80 81 return rc; 57 82 } 58 83 … … 78 103 if (RT_SUCCESS(rc)) 79 104 { 80 HyperLeaf.uEax = UINT32_C(0x40000010); /* Maximum leaf we implement. */ 81 rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf); 82 AssertLogRelRCReturn(rc, rc); 83 84 /* 85 * Insert missing zero leaves (you never know what missing leaves are 86 * going to return when read). 87 */ 88 for (uint32_t uLeaf = UINT32_C(0x40000001); uLeaf < UINT32_C(0x40000010); uLeaf++) 89 { 90 rc = CPUMR3CpuIdGetLeaf(pVM, &HyperLeaf, uLeaf, 0 /* uSubLeaf */); 91 if (RT_FAILURE(rc)) 92 { 93 RT_ZERO(HyperLeaf); 94 HyperLeaf.uLeaf = uLeaf; 95 rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf); 96 AssertLogRelRCReturn(rc, rc); 97 } 98 } 105 Assert(HyperLeaf.uEax >= 0x40000010); 99 106 100 107 /* … … 118 125 } 119 126 else 120 LogRel(("GIM: Minimal: failed to get hypervisor leaf 0x40000000. \n"));127 LogRel(("GIM: Minimal: failed to get hypervisor leaf 0x40000000. rc=%Rrc\n", rc)); 121 128 122 129 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.