VirtualBox

Changeset 24295 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Nov 3, 2009 5:11:08 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
54290
Message:

Added interfaces to override cpuid leafs.

Location:
trunk/src/VBox/Main/xml
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r24276 r24295  
    12661266}
    12671267
     1268/**
     1269 * Called from MachineConfigFile::readHardware() to cpuid information.
     1270 * @param elmCpuid
     1271 * @param ll
     1272 */
     1273void 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}
    12681293
    12691294/**
     
    15181543            if ((pelmCPUChild = pelmHwChild->findChildElement("SyntheticCpu")))
    15191544                pelmCPUChild->getAttributeValue("enabled", hw.fSyntheticCpu);
     1545            if ((pelmCPUChild = pelmHwChild->findChildElement("CpuIdTree")))
     1546                readCpuIdTree(*pelmHwChild, hw.llCpuIdLeafs);
    15201547        }
    15211548        else if (pelmHwChild->nameEquals("Memory"))
     
    23992426    pelmCPU->setAttribute("count", hw.cCPUs);
    24002427
     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
    24012443    xml::ElementNode *pelmMemory = pelmHardware->createChild("Memory");
    24022444    pelmMemory->setAttribute("RAMSize", hw.ulMemorySizeMB);
  • trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd

    r23750 r24295  
    8080    </xsd:simpleType>
    8181  </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>
    8288</xsd:simpleType>
    8389
     
    461467</xsd:simpleType>
    462468
     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
    463484<xsd:complexType name="TCPU">
    464485  <xsd:sequence>
     
    468489    <xsd:element name="PAE" type="TPAEType" minOccurs="0"/>
    469490    <xsd:element name="SyntheticCpu" type="TSyntheticCpuType" minOccurs="0"/>
     491    <xsd:element name="CpuIdTree" type="TCpuIdTree" minOccurs="0"/>
    470492  </xsd:sequence>
    471493  <xsd:attribute name="count" type="TCPUCount" default="1"/>
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette