VirtualBox

Changeset 90904 in vbox


Ignore:
Timestamp:
Aug 26, 2021 9:49:06 AM (3 years ago)
Author:
vboxsync
Message:

Devices/Security/DevTpm: Allow unaligned reads, Windows loves to access the FIFO status register unaligned, bugref:10075

Location:
trunk/src/VBox/Devices/Security
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Security/DevTpm.cpp

    r90903 r90904  
    11291129    RT_NOREF(pvUser);
    11301130
    1131     Assert(!(off & (cb - 1)));
     1131    RTGCPHYS offAligned = off & ~UINT64_C(0x3);
     1132    uint8_t cBitsShift  = (off & 0x3) * 8;
    11321133
    11331134    VBOXSTRICTRC rc = VINF_SUCCESS;
    1134     uint32_t uReg = tpmGetRegisterFromOffset(off);
    1135     uint8_t bLoc = tpmGetLocalityFromOffset(off);
     1135    uint32_t uReg = tpmGetRegisterFromOffset(offAligned);
     1136    uint8_t bLoc = tpmGetLocalityFromOffset(offAligned);
    11361137    PDEVTPMLOCALITY pLoc = &pThis->aLoc[bLoc];
    11371138
     
    11481149        switch (cb)
    11491150        {
    1150             case 1: *(uint8_t *)pv = (uint8_t)u64; break;
    1151             case 2: *(uint16_t *)pv = (uint16_t)u64; break;
    1152             case 4: *(uint32_t *)pv = (uint32_t)u64; break;
     1151            case 1: *(uint8_t *)pv = (uint8_t)(u64 >> cBitsShift); break;
     1152            case 2: *(uint16_t *)pv = (uint16_t)(u64 >> cBitsShift); break;
     1153            case 4: *(uint32_t *)pv = (uint32_t)(u64 >> cBitsShift); break;
    11531154            case 8: *(uint64_t *)pv = u64; break;
    11541155            default: AssertFailedBreakStmt(rc = VERR_INTERNAL_ERROR);
  • trunk/src/VBox/Devices/Security/DrvTpmEmu.cpp

    r90587 r90904  
    617617
    618618
    619 /** @interface_method_impl{PDMITPMCONNECTOR,pfnGetEstablishedFlag} */
     619/** @interface_method_impl{PDMITPMCONNECTOR,pfnResetEstablishedFlag} */
    620620static DECLCALLBACK(int) drvTpmEmuResetEstablishedFlag(PPDMITPMCONNECTOR pInterface, uint8_t bLoc)
    621621{
Note: See TracChangeset for help on using the changeset viewer.

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