VirtualBox

Ignore:
Timestamp:
Oct 3, 2019 9:23:00 PM (5 years ago)
Author:
vboxsync
Message:

IPRT,SUP,*: Some GIP related fixes for supporting APIC IDs over 256 and more than 256 CPUs. bugref:9501

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r77816 r81106  
    17621762    for (uint32_t idxGroup = 0; idxGroup < cGroups; idxGroup++)
    17631763    {
    1764         uint32_t cActive  = 0;
    1765         uint32_t cMax     = RTMpGetCpuGroupCounts(idxGroup, &cActive);
    1766         uint32_t cbNeeded = RT_UOFFSETOF_DYN(SUPGIPCPUGROUP, aiCpuSetIdxs[cMax]);
     1764        uint32_t        cActive  = 0;
     1765        uint32_t  const cMax     = RTMpGetCpuGroupCounts(idxGroup, &cActive);
     1766        uint32_t  const cbNeeded = RT_UOFFSETOF_DYN(SUPGIPCPUGROUP, aiCpuSetIdxs[cMax]);
     1767        uintptr_t const offGroup = (uintptr_t)pGroup - (uintptr_t)pGip;
    17671768        AssertReturn(cbNeeded <= cbGipCpuGroups, VERR_INTERNAL_ERROR_3);
    17681769        AssertReturn(cActive <= cMax, VERR_INTERNAL_ERROR_4);
    1769 
    1770         pGip->aoffCpuGroup[idxGroup] = (uint16_t)((uintptr_t)pGroup - (uintptr_t)pGip);
     1770        AssertReturn(offGroup == (uint32_t)offGroup, VERR_INTERNAL_ERROR_5);
     1771
     1772        pGip->aoffCpuGroup[idxGroup] = offGroup;
    17711773        pGroup->cMembers    = cActive;
    17721774        pGroup->cMaxMembers = cMax;
     
    18131815     */
    18141816    for (uint32_t idxGroup = 0; idxGroup < pGip->cPossibleCpuGroups; idxGroup++)
    1815         if (pGip->aoffCpuGroup[idxGroup] != UINT16_MAX)
    1816         {
    1817             PSUPGIPCPUGROUP pGroup = (PSUPGIPCPUGROUP)((uintptr_t)pGip + pGip->aoffCpuGroup[idxGroup]);
    1818 
    1819             uint32_t cActive  = 0;
    1820             uint32_t cMax     = RTMpGetCpuGroupCounts(idxGroup, &cActive);
     1817    {
     1818        uint32_t offGroup = pGip->aoffCpuGroup[idxGroup];
     1819        if (offGroup != UINT32_MAX)
     1820        {
     1821            PSUPGIPCPUGROUP pGroup   = (PSUPGIPCPUGROUP)((uintptr_t)pGip + offGroup);
     1822            uint32_t        cActive  = 0;
     1823            uint32_t        cMax     = RTMpGetCpuGroupCounts(idxGroup, &cActive);
     1824
    18211825            AssertStmt(cMax == pGroup->cMaxMembers, cMax = pGroup->cMaxMembers);
    18221826            AssertStmt(cActive <= cMax, cActive = cMax);
    18231827            if (pGroup->cMembers != cActive)
    1824                 pGroup->cMembers = cActive;
     1828                ASMAtomicWriteU16(&pGroup->cMembers, cActive);
    18251829
    18261830            for (uint32_t idxMember = 0; idxMember < cMax; idxMember++)
     
    18311835
    18321836                if (pGroup->aiCpuSetIdxs[idxMember] != idxCpuSet)
    1833                     pGroup->aiCpuSetIdxs[idxMember] = idxCpuSet;
    1834             }
    1835         }
     1837                    ASMAtomicWriteS16(&pGroup->aiCpuSetIdxs[idxMember], idxCpuSet);
     1838            }
     1839        }
     1840    }
    18361841}
    18371842
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