Changeset 24295 in vbox
- Timestamp:
- Nov 3, 2009 5:11:08 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r24279 r24295 1347 1347 STDMETHODIMP Machine::SetCpuProperty(CpuPropertyType_T property, BOOL aVal) 1348 1348 { 1349 if (!aVal)1350 return E_POINTER;1351 1352 1349 AutoCaller autoCaller(this); 1353 1350 CheckComRCReturnRC(autoCaller.rc()); … … 1373 1370 return S_OK; 1374 1371 } 1372 1373 STDMETHODIMP Machine::GetCpuIdLeaf(ULONG id, ULONG *aValEax, ULONG *aValEbx, ULONG *aValEcx, ULONG *aValEdx) 1374 { 1375 if (!aValEax || !aValEbx || !aValEcx || !aValEdx) 1376 return E_POINTER; 1377 1378 AutoCaller autoCaller(this); 1379 CheckComRCReturnRC(autoCaller.rc()); 1380 1381 AutoReadLock alock(this); 1382 1383 switch(id) 1384 { 1385 case 0x0: 1386 case 0x1: 1387 case 0x2: 1388 case 0x3: 1389 case 0x4: 1390 case 0x5: 1391 case 0x6: 1392 case 0x7: 1393 case 0x8: 1394 case 0x9: 1395 case 0xA: 1396 if (mHWData->mCpuIdStdLeafs[id].ulId != id) 1397 return E_INVALIDARG; /* not set */ 1398 1399 *aValEax = mHWData->mCpuIdStdLeafs[id].ulEax; 1400 *aValEbx = mHWData->mCpuIdStdLeafs[id].ulEbx; 1401 *aValEcx = mHWData->mCpuIdStdLeafs[id].ulEcx; 1402 *aValEdx = mHWData->mCpuIdStdLeafs[id].ulEdx; 1403 break; 1404 1405 case 0x80000000: 1406 case 0x80000001: 1407 case 0x80000002: 1408 case 0x80000003: 1409 case 0x80000004: 1410 case 0x80000005: 1411 case 0x80000006: 1412 case 0x80000007: 1413 case 0x80000008: 1414 case 0x80000009: 1415 case 0x8000000A: 1416 if (mHWData->mCpuIdExtLeafs[id - 0x80000000].ulId != id) 1417 return E_INVALIDARG; /* not set */ 1418 1419 *aValEax = mHWData->mCpuIdExtLeafs[id - 0x80000000].ulEax; 1420 *aValEbx = mHWData->mCpuIdExtLeafs[id - 0x80000000].ulEbx; 1421 *aValEcx = mHWData->mCpuIdExtLeafs[id - 0x80000000].ulEcx; 1422 *aValEdx = mHWData->mCpuIdExtLeafs[id - 0x80000000].ulEdx; 1423 break; 1424 1425 default: 1426 return E_INVALIDARG; 1427 } 1428 return S_OK; 1429 } 1430 1431 STDMETHODIMP Machine::SetCpuIdLeaf(ULONG id, ULONG aValEax, ULONG aValEbx, ULONG aValEcx, ULONG aValEdx) 1432 { 1433 AutoCaller autoCaller(this); 1434 CheckComRCReturnRC(autoCaller.rc()); 1435 1436 AutoWriteLock alock(this); 1437 1438 HRESULT rc = checkStateDependency(MutableStateDep); 1439 CheckComRCReturnRC(rc); 1440 1441 switch(id) 1442 { 1443 case 0x0: 1444 case 0x1: 1445 case 0x2: 1446 case 0x3: 1447 case 0x4: 1448 case 0x5: 1449 case 0x6: 1450 case 0x7: 1451 case 0x8: 1452 case 0x9: 1453 case 0xA: 1454 AssertRelease(id < RT_ELEMENTS(mHWData->mCpuIdStdLeafs)); 1455 mHWData->mCpuIdStdLeafs[id].ulId = id; 1456 mHWData->mCpuIdStdLeafs[id].ulEax = aValEax; 1457 mHWData->mCpuIdStdLeafs[id].ulEbx = aValEbx; 1458 mHWData->mCpuIdStdLeafs[id].ulEcx = aValEcx; 1459 mHWData->mCpuIdStdLeafs[id].ulEdx = aValEdx; 1460 break; 1461 1462 case 0x80000000: 1463 case 0x80000001: 1464 case 0x80000002: 1465 case 0x80000003: 1466 case 0x80000004: 1467 case 0x80000005: 1468 case 0x80000006: 1469 case 0x80000007: 1470 case 0x80000008: 1471 case 0x80000009: 1472 case 0x8000000A: 1473 AssertRelease(id - 0x80000000 < RT_ELEMENTS(mHWData->mCpuIdExtLeafs)); 1474 mHWData->mCpuIdExtLeafs[id - 0x80000000].ulId = id; 1475 mHWData->mCpuIdExtLeafs[id - 0x80000000].ulEax = aValEax; 1476 mHWData->mCpuIdExtLeafs[id - 0x80000000].ulEbx = aValEbx; 1477 mHWData->mCpuIdExtLeafs[id - 0x80000000].ulEcx = aValEcx; 1478 mHWData->mCpuIdExtLeafs[id - 0x80000000].ulEdx = aValEdx; 1479 break; 1480 1481 default: 1482 return E_INVALIDARG; 1483 } 1484 return S_OK; 1485 } 1486 1375 1487 1376 1488 STDMETHODIMP Machine::GetHWVirtExProperty(HWVirtExPropertyType_T property, BOOL *aVal) … … 5377 5489 mHWData->mCPUCount = data.cCPUs; 5378 5490 5491 // cpuid leafs 5492 for (settings::CpuIdLeafsList::const_iterator it = data.llCpuIdLeafs.begin(); 5493 it != data.llCpuIdLeafs.end(); 5494 ++it) 5495 { 5496 const settings::CpuIdLeaf &leaf = *it; 5497 5498 switch (leaf.ulId) 5499 { 5500 case 0x0: 5501 case 0x1: 5502 case 0x2: 5503 case 0x3: 5504 case 0x4: 5505 case 0x5: 5506 case 0x6: 5507 case 0x7: 5508 case 0x8: 5509 case 0x9: 5510 case 0xA: 5511 mHWData->mCpuIdStdLeafs[leaf.ulId] = leaf; 5512 break; 5513 5514 case 0x80000000: 5515 case 0x80000001: 5516 case 0x80000002: 5517 case 0x80000003: 5518 case 0x80000004: 5519 case 0x80000005: 5520 case 0x80000006: 5521 case 0x80000007: 5522 case 0x80000008: 5523 case 0x80000009: 5524 case 0x8000000A: 5525 mHWData->mCpuIdExtLeafs[leaf.ulId - 0x80000000] = leaf; 5526 break; 5527 5528 default: 5529 /* just ignore */ 5530 break; 5531 } 5532 } 5533 5379 5534 mHWData->mMemorySize = data.ulMemorySizeMB; 5380 5535 … … 6320 6475 data.fPAE = !!mHWData->mPAEEnabled; 6321 6476 data.fSyntheticCpu = !!mHWData->mSyntheticCpu; 6477 6478 /* Standard and Extended CPUID leafs. */ 6479 for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdStdLeafs); idx++) 6480 { 6481 if (mHWData->mCpuIdStdLeafs[idx].ulId != -1) 6482 data.llCpuIdLeafs.push_back(mHWData->mCpuIdStdLeafs[idx]); 6483 } 6484 for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdExtLeafs); idx++) 6485 { 6486 if (mHWData->mCpuIdExtLeafs[idx].ulId != -1) 6487 data.llCpuIdLeafs.push_back(mHWData->mCpuIdExtLeafs[idx]); 6488 } 6322 6489 6323 6490 data.cCPUs = mHWData->mCPUCount; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r24275 r24295 4059 4059 <interface 4060 4060 name="IMachine" extends="$unknown" 4061 uuid=" 59080235-41e1-41ca-aa28-33f6992d1646"4061 uuid="c9e6bf40-f415-4a59-bb86-5190d93e49f6" 4062 4062 wsmap="managed" 4063 4063 > … … 5136 5136 </method> 5137 5137 5138 <method name="getCpuIdLeaf" const="yes"> 5139 <desc> 5140 Returns the virtual CPU cpuid leaf for the specified index 5141 5142 <result name="E_INVALIDARG"> 5143 Invalid id. 5144 </result> 5145 5146 </desc> 5147 <param name="id" type="unsigned long" dir="in"> 5148 <desc> 5149 Cpuid leaf index. 5150 </desc> 5151 </param> 5152 <param name="valEax" type="unsigned long" dir="out"> 5153 <desc> 5154 Cpuid leaf value for register eax. 5155 </desc> 5156 </param> 5157 <param name="valEbx" type="unsigned long" dir="out"> 5158 <desc> 5159 Cpuid leaf value for register ebx. 5160 </desc> 5161 </param> 5162 <param name="valEcx" type="unsigned long" dir="out"> 5163 <desc> 5164 Cpuid leaf value for register ecx. 5165 </desc> 5166 </param> 5167 <param name="valEdx" type="unsigned long" dir="out"> 5168 <desc> 5169 Cpuid leaf value for register edx. 5170 </desc> 5171 </param> 5172 </method> 5173 5174 <method name="setCpuIdLeaf" const="yes"> 5175 <desc> 5176 Sets the virtual CPU cpuid leaf for the specified index 5177 5178 <result name="E_INVALIDARG"> 5179 Invalid id. 5180 </result> 5181 5182 </desc> 5183 <param name="id" type="unsigned long" dir="in"> 5184 <desc> 5185 Cpuid leaf index. 5186 </desc> 5187 </param> 5188 <param name="valEax" type="unsigned long" dir="in"> 5189 <desc> 5190 Cpuid leaf value for register eax. 5191 </desc> 5192 </param> 5193 <param name="valEbx" type="unsigned long" dir="in"> 5194 <desc> 5195 Cpuid leaf value for register ebx. 5196 </desc> 5197 </param> 5198 <param name="valEcx" type="unsigned long" dir="in"> 5199 <desc> 5200 Cpuid leaf value for register ecx. 5201 </desc> 5202 </param> 5203 <param name="valEdx" type="unsigned long" dir="in"> 5204 <desc> 5205 Cpuid leaf value for register edx. 5206 </desc> 5207 </param> 5208 </method> 5209 5138 5210 <method name="getHWVirtExProperty" const="yes"> 5139 5211 <desc> -
trunk/src/VBox/Main/include/MachineImpl.h
r24250 r24295 36 36 #include "BIOSSettingsImpl.h" 37 37 #include "StorageControllerImpl.h" // required for MachineImpl.h to compile on Windows 38 #include "VBox/settings.h" 38 39 #ifdef VBOX_WITH_RESOURCE_USAGE_API 39 40 #include "PerformanceImpl.h" … … 297 298 ULONG mCPUCount; 298 299 BOOL mAccelerate3DEnabled; 300 301 settings::CpuIdLeaf mCpuIdStdLeafs[0x10]; 302 settings::CpuIdLeaf mCpuIdExtLeafs[0x10]; 299 303 300 304 DeviceType_T mBootOrder[SchemaDefs::MaxBootPosition]; … … 593 597 STDMETHOD(GetCpuProperty)(CpuPropertyType_T property, BOOL *aVal); 594 598 STDMETHOD(SetCpuProperty)(CpuPropertyType_T property, BOOL aVal); 599 STDMETHOD(GetCpuIdLeaf)(ULONG id, ULONG *aValEax, ULONG *aValEbx, ULONG *aValEcx, ULONG *aValEdx); 600 STDMETHOD(SetCpuIdLeaf)(ULONG id, ULONG aValEax, ULONG aValEbx, ULONG aValEcx, ULONG aValEdx); 595 601 STDMETHOD(GetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL *aVal); 596 602 STDMETHOD(SetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL aVal); -
trunk/src/VBox/Main/xml/Settings.cpp
r24276 r24295 1266 1266 } 1267 1267 1268 /** 1269 * Called from MachineConfigFile::readHardware() to cpuid information. 1270 * @param elmCpuid 1271 * @param ll 1272 */ 1273 void MachineConfigFile::readCpuIdTree(const xml::ElementNode &elmCpuid, 1274 CpuIdLeafsList &ll) 1275 { 1276 xml::NodesLoop nl1(elmCpuid, "CpuId"); 1277 const xml::ElementNode *pelmCpuIdLeaf; 1278 while ((pelmCpuIdLeaf = nl1.forAllNodes())) 1279 { 1280 CpuIdLeaf leaf; 1281 1282 if (!pelmCpuIdLeaf->getAttributeValue("id", leaf.ulId)) 1283 throw ConfigFileError(this, pelmCpuIdLeaf, N_("Required CpuId/@id attribute is missing")); 1284 1285 pelmCpuIdLeaf->getAttributeValue("eax", leaf.ulEax); 1286 pelmCpuIdLeaf->getAttributeValue("ebx", leaf.ulEbx); 1287 pelmCpuIdLeaf->getAttributeValue("ecx", leaf.ulEcx); 1288 pelmCpuIdLeaf->getAttributeValue("edx", leaf.ulEdx); 1289 1290 ll.push_back(leaf); 1291 } 1292 } 1268 1293 1269 1294 /** … … 1518 1543 if ((pelmCPUChild = pelmHwChild->findChildElement("SyntheticCpu"))) 1519 1544 pelmCPUChild->getAttributeValue("enabled", hw.fSyntheticCpu); 1545 if ((pelmCPUChild = pelmHwChild->findChildElement("CpuIdTree"))) 1546 readCpuIdTree(*pelmHwChild, hw.llCpuIdLeafs); 1520 1547 } 1521 1548 else if (pelmHwChild->nameEquals("Memory")) … … 2399 2426 pelmCPU->setAttribute("count", hw.cCPUs); 2400 2427 2428 xml::ElementNode *pelmCpuIdTree = pelmHardware->createChild("CpuId"); 2429 for (CpuIdLeafsList::const_iterator it = hw.llCpuIdLeafs.begin(); 2430 it != hw.llCpuIdLeafs.end(); 2431 ++it) 2432 { 2433 const CpuIdLeaf &leaf = *it; 2434 2435 xml::ElementNode *pelmCpuIdLeaf = pelmCpuIdTree->createChild("CpuIdLeaf"); 2436 pelmCpuIdLeaf->setAttribute("id", leaf.ulId); 2437 pelmCpuIdLeaf->setAttribute("eax", leaf.ulEax); 2438 pelmCpuIdLeaf->setAttribute("ebx", leaf.ulEbx); 2439 pelmCpuIdLeaf->setAttribute("ecx", leaf.ulEcx); 2440 pelmCpuIdLeaf->setAttribute("edx", leaf.ulEdx); 2441 } 2442 2401 2443 xml::ElementNode *pelmMemory = pelmHardware->createChild("Memory"); 2402 2444 pelmMemory->setAttribute("RAMSize", hw.ulMemorySizeMB); -
trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
r23750 r24295 80 80 </xsd:simpleType> 81 81 </xsd:union> 82 </xsd:simpleType> 83 84 <xsd:simpleType name="TUInt32Hex"> 85 <xsd:restriction base="xsd:string"> 86 <xsd:pattern value="0x[A-Fa-f0-9]{1,8}"/> 87 </xsd:restriction> 82 88 </xsd:simpleType> 83 89 … … 461 467 </xsd:simpleType> 462 468 469 <xsd:complexType name="TCpuIdLeaf"> 470 <xsd:attribute name="id" type="TUInt32Hex" use="required"/> 471 <xsd:attribute name="eax" type="TUInt32Hex" use="required"/> 472 <xsd:attribute name="ebx" type="TUInt32Hex" use="required"/> 473 <xsd:attribute name="ecx" type="TUInt32Hex" use="required"/> 474 <xsd:attribute name="edx" type="TUInt32Hex" use="required"/> 475 </xsd:complexType> 476 477 <xsd:complexType name="TCpuIdTree"> 478 <xsd:sequence> 479 <xsd:element name="CpuIdLeaf" type="TCpuIdLeaf" 480 minOccurs="0" maxOccurs="unbounded"/> 481 </xsd:sequence> 482 </xsd:complexType> 483 463 484 <xsd:complexType name="TCPU"> 464 485 <xsd:sequence> … … 468 489 <xsd:element name="PAE" type="TPAEType" minOccurs="0"/> 469 490 <xsd:element name="SyntheticCpu" type="TSyntheticCpuType" minOccurs="0"/> 491 <xsd:element name="CpuIdTree" type="TCpuIdTree" minOccurs="0"/> 470 492 </xsd:sequence> 471 493 <xsd:attribute name="count" type="TCPUCount" default="1"/>
Note:
See TracChangeset
for help on using the changeset viewer.