VirtualBox

Changeset 81925 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Nov 18, 2019 12:28:12 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134722
Message:

DevPcBios: Set the new-style device flag. Nits. bugref:9218

Location:
trunk/src/VBox/Devices/PC
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevFwCommon.cpp

    r81919 r81925  
    433433 * @param   cCpus               Number of VCPUs.
    434434 * @param   pcbDmiTables        Size of DMI data in bytes.
    435  * @param   pcNumDmiTables      Number of DMI tables.
     435 * @param   pcDmiTables         Number of DMI tables.
    436436 */
    437 int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfg, uint16_t cCpus, uint16_t *pcbDmiTables, uint16_t *pcNumDmiTables)
     437int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfg, uint16_t cCpus,
     438                          uint16_t *pcbDmiTables, uint16_t *pcDmiTables)
    438439{
    439440    PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3;
     
    938939
    939940        /* We currently plant 10 DMI tables. Update this if tables number changed. */
    940         *pcNumDmiTables = 10;
     941        *pcDmiTables = 10;
    941942
    942943        /* If more fields are added here, fix the size check in DMI_READ_CFG_STR */
  • trunk/src/VBox/Devices/PC/DevFwCommon.h

    r76565 r81925  
    2525
    2626/* Plant DMI table */
    27 int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfg, uint16_t cCpus, uint16_t *pcbDmiTables, uint16_t *pcNumDmiTables);
     27int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfg, uint16_t cCpus,
     28                          uint16_t *pcbDmiTables, uint16_t *pcDmiTables);
    2829void FwCommonPlantSmbiosAndDmiHdrs(PPDMDEVINS pDevIns, uint8_t *pHdr, uint16_t cbDmiTables, uint16_t cNumDmiTables);
    2930
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r81920 r81925  
    12021202    return rc;
    12031203}
     1204
    12041205
    12051206/**
     
    16091610
    16101611    uint16_t cbDmiTables = 0;
    1611     uint16_t cNumDmiTables = 0;
     1612    uint16_t cDmiTables = 0;
    16121613    rc = FwCommonPlantDMITable(pDevIns, pThis->au8DMIPage, VBOX_DMI_TABLE_SIZE,
    1613                                &uuid, pCfg, pThis->cCpus, &cbDmiTables, &cNumDmiTables);
     1614                               &uuid, pCfg, pThis->cCpus, &cbDmiTables, &cDmiTables);
    16141615    if (RT_FAILURE(rc))
    16151616        return rc;
    16161617
    16171618    /* Look for _SM_/_DMI_ anchor strings within the BIOS and replace the table headers. */
    1618     for (unsigned i = 0; i < (pThis->cbPcBios - 16); i += 16)
    1619     {
    1620         if (   pThis->pu8PcBios[i + 0x00] == '_'
    1621             && pThis->pu8PcBios[i + 0x01] == 'S'
    1622             && pThis->pu8PcBios[i + 0x02] == 'M'
    1623             && pThis->pu8PcBios[i + 0x03] == '_'
    1624             && pThis->pu8PcBios[i + 0x10] == '_'
    1625             && pThis->pu8PcBios[i + 0x11] == 'D'
    1626             && pThis->pu8PcBios[i + 0x12] == 'M'
    1627             && pThis->pu8PcBios[i + 0x13] == 'I'
    1628             && pThis->pu8PcBios[i + 0x14] == '_')
    1629         {
    1630             FwCommonPlantSmbiosAndDmiHdrs(pDevIns, pThis->pu8PcBios + i, cbDmiTables, cNumDmiTables);
     1619    unsigned       offAnchor  = ~0U;
     1620    unsigned const cbToSearch = pThis->cbPcBios - 32;
     1621    for (unsigned off = 0; off <= cbToSearch; off += 16)
     1622    {
     1623        if (   pThis->pu8PcBios[off + 0x00] != '_'
     1624            || pThis->pu8PcBios[off + 0x01] != 'S'
     1625            || pThis->pu8PcBios[off + 0x02] != 'M'
     1626            || pThis->pu8PcBios[off + 0x03] != '_'
     1627            || pThis->pu8PcBios[off + 0x10] != '_'
     1628            || pThis->pu8PcBios[off + 0x11] != 'D'
     1629            || pThis->pu8PcBios[off + 0x12] != 'M'
     1630            || pThis->pu8PcBios[off + 0x13] != 'I'
     1631            || pThis->pu8PcBios[off + 0x14] != '_')
     1632        { /* likely */ }
     1633        else
     1634        {
     1635            offAnchor = off;
     1636            FwCommonPlantSmbiosAndDmiHdrs(pDevIns, pThis->pu8PcBios + off, cbDmiTables, cDmiTables);
    16311637            break;
    16321638        }
    16331639    }
     1640    AssertLogRel(offAnchor <= cbToSearch);
    16341641
    16351642    if (pThis->u8IOAPIC)
     
    18321839    /* .uReserved0 = */             0,
    18331840    /* .szName = */                 "pcbios",
    1834     /* .fFlags = */                 PDM_DEVREG_FLAGS_DEFAULT_BITS,
     1841    /* .fFlags = */                 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_NEW_STYLE,
    18351842    /* .fClass = */                 PDM_DEVREG_CLASS_ARCH_BIOS,
    18361843    /* .cMaxInstances = */          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