VirtualBox

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


Ignore:
Timestamp:
Feb 24, 2010 10:22:51 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57977
Message:

BIOS/DMI: fixed a bug where structures without strings were not properly terminated and increase the limit for DMI strings a little bit

Location:
trunk/src/VBox/Devices
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/DevEFI.cpp

    r26601 r26728  
    480480                               &pThis->aUuid,
    481481                               pDevIns->pCfg,
    482                                true /* fPutSmbiosHeaders */);
     482                               /*fPutSmbiosHeaders=*/true);
    483483    Assert(RT_SUCCESS(rc));
    484484
    485485    if (pThis->u8IOAPIC)
    486486        FwCommonPlantMpsTable(pDevIns,
    487                           pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE,
    488                           pThis->cCpus);
     487                              pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE,
     488                              _4K - VBOX_DMI_TABLE_SIZE,
     489                              pThis->cCpus);
    489490    rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, _4K, pThis->au8DMIPage,
    490491                              PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "DMI tables");
     
    11451146    pThis->u64TscFrequency = RTMpGetMaxFrequency(0) * 1024 * 1024;// TMCpuTicksPerSecond(PDMDevHlpGetVM(pDevIns));
    11461147    if (pThis->u64TscFrequency == 0)
    1147         pThis->u64TscFrequency = 2500000000;
     1148        pThis->u64TscFrequency = UINT64_C(2500000000);
    11481149    /* Multiplier is read from MSR_IA32_PERF_STATUS, and now is hardcoded as 4 */
    11491150    pThis->u64FsbFrequency = pThis->u64TscFrequency / 4;
  • trunk/src/VBox/Devices/PC/DevFwCommon.cpp

    r26617 r26728  
    338338 * @param   pDevIns             The device instance.
    339339 * @param   pTable              Where to create the DMI table.
    340  * @param   cbMax               The max size of the DMI table.
     340 * @param   cbMax               The maximum size of the DMI table.
    341341 * @param   pUuid               Pointer to the UUID to use if the DmiUuid
    342342 *                              configuration string isn't present.
     
    344344 * @param   fPutSmbiosHeaders   Plant SMBIOS headers if true.
    345345 */
    346 int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfg, bool fPutSmbiosHeaders)
     346int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid,
     347                          PCFGMNODE pCfg, bool fPutSmbiosHeaders)
    347348{
    348349#define CHECKSIZE(cbWant) \
     
    418419    }
    419420
     421#define TERM_STRUCT \
     422    { \
     423        *pszStr++                    = '\0'; /* terminate set of text strings */ \
     424        if (iStrNr == 1) \
     425            *pszStr++                = '\0'; /* terminate a structure without strings */ \
     426    }
     427
    420428    bool fForceDefault = false;
    421429#ifdef VBOX_BIOS_DMI_FALLBACK
     
    528536                                         /* any more?? */
    529537                                         ;
    530         *pszStr++                    = '\0';
     538        TERM_STRUCT;
    531539
    532540        /***********************************
     
    569577        pSystemInf->u8SKUNumber      = 0;
    570578        READCFGSTR(pSystemInf->u8Family, DmiSystemFamily);
    571         *pszStr++                    = '\0';
     579        TERM_STRUCT;
    572580
    573581        /********************************************
     
    602610        pChassis->u8ContElemRecLen   = 0; /* no contained elements */
    603611# endif
    604         *pszStr++                    = '\0';
     612        TERM_STRUCT;
    605613
    606614        /*****************************
     
    626634        RTStrPrintf(szTmp, sizeof(szTmp), "vboxRev_%u", RTBldCfgRevision());
    627635        READCFGSTRDEF(pOEMStrings->u8VBoxRevision, "DmiOEMVBoxRev", szTmp);
    628         *pszStr++                    = '\0';
     636        TERM_STRUCT;
    629637
    630638        /* End-of-table marker - includes padding to account for fixed table size. */
     
    709717 *
    710718 * @param   pDevIns    The device instance data.
    711  * @param   addr       physical address in guest memory.
     719 * @param   pTable     Where to write the table.
     720 * @param   cbMax      The maximum size of the MPS table.
     721 * @param   cCpus      The number of guest CPUs.
    712722 */
    713 void FwCommonPlantMpsTable(PPDMDEVINS pDevIns, uint8_t *pTable, uint16_t cCpus)
     723void FwCommonPlantMpsTable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, uint16_t cCpus)
    714724{
    715725    /* configuration table */
     
    792802    pCfgTab->u8Checksum            = fwCommonChecksum(pTable, pCfgTab->u16Length);
    793803
    794     AssertMsg(pCfgTab->u16Length < 0x1000 - 0x100,
     804    AssertMsg(pCfgTab->u16Length < cbMax,
    795805              ("VBOX_MPS_TABLE_SIZE=%d, maximum allowed size is %d",
    796               pCfgTab->u16Length, 0x1000-0x100));
     806              pCfgTab->u16Length, cbMax));
    797807
    798808    MPSFLOATPTR floatPtr;
  • trunk/src/VBox/Devices/PC/DevFwCommon.h

    r26173 r26728  
    3232
    3333/* Plant DMI table */
    34 int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfg, bool fPutSmbiosHeaders);
     34int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid,
     35                          PCFGMNODE pCfg, bool fPutSmbiosHeaders);
    3536
    3637/* Plant MPS table */
    37 void FwCommonPlantMpsTable(PPDMDEVINS pDevIns, uint8_t *pTable, uint16_t cCpus);
     38void FwCommonPlantMpsTable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, uint16_t cCpus);
    3839
    3940#endif
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r26601 r26728  
    747747
    748748    if (pThis->u8IOAPIC)
    749         FwCommonPlantMpsTable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE, pThis->cCpus);
     749        FwCommonPlantMpsTable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE,
     750                              _4K - VBOX_DMI_TABLE_SIZE, pThis->cCpus);
    750751
    751752    /*
     
    10221023    uuid.Gen.u16TimeMid = RT_H2BE_U16(uuid.Gen.u16TimeMid);
    10231024    uuid.Gen.u16TimeHiAndVersion = RT_H2BE_U16(uuid.Gen.u16TimeHiAndVersion);
    1024     rc = FwCommonPlantDMITable(pDevIns, pThis->au8DMIPage, VBOX_DMI_TABLE_SIZE, &uuid, pCfg, false /*fPutSmbiosHeaders*/);
     1025    rc = FwCommonPlantDMITable(pDevIns, pThis->au8DMIPage,
     1026                               VBOX_DMI_TABLE_SIZE, &uuid, pCfg, /*fPutSmbiosHeaders=*/false);
    10251027    if (RT_FAILURE(rc))
    10261028        return rc;
    10271029    if (pThis->u8IOAPIC)
    1028         FwCommonPlantMpsTable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE, pThis->cCpus);
     1030        FwCommonPlantMpsTable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE,
     1031                              _4K - VBOX_DMI_TABLE_SIZE, pThis->cCpus);
    10291032
    10301033    rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, _4K, pThis->au8DMIPage,
  • trunk/src/VBox/Devices/PC/DevPcBios.h

    r24707 r26728  
    2727#define VBOX_DMI_TABLE_VER           0x25
    2828#define VBOX_DMI_TABLE_ENTR          5
    29 #define VBOX_DMI_TABLE_SIZE          0x100
     29
     30/** def VBOX_DMI_TABLE_SIZE
     31 *
     32 * Must not be bigger than the minimal size of the DMI tables + 255 because
     33 * the length field of the the DMI end-of-table marker is 8 bits only. And
     34 * the size should be at least 16-byte aligned for a proper alignment of
     35 * the MPS table.
     36 */
     37#define VBOX_DMI_TABLE_SIZE          352
    3038
    3139/** @def VBOX_VMI_BIOS_BASE
     
    3846
    3947/** @def VBOX_LANBOOT_SEG
     48 *
     49 * Should usually start right after the DMI BIOS page
    4050 */
    4151#define VBOX_LANBOOT_SEG             0xe200
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