VirtualBox

Changeset 89366 in vbox for trunk


Ignore:
Timestamp:
May 28, 2021 4:09:15 PM (3 years ago)
Author:
vboxsync
Message:

Intel IOMMU: bugref:9967 Since there's no level skipping we can compute the level shift instead of indexing an array.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp

    r89365 r89366  
    19301930{
    19311931    PCDMAR pThis = PDMDEVINS_2_DATA(pDevIns, PCDMAR);
    1932     static uint8_t const  s_acLevelShifts[] = { 12, 21, 30, 39, 48 };
    1933     static uint64_t const s_auLevelMasks[]  = { UINT64_C(0x00000000001ff000),
    1934                                                 UINT64_C(0x000000003fe00000),
    1935                                                 UINT64_C(0x0000007fc0000000),
    1936                                                 UINT64_C(0x0000ff8000000000),
    1937                                                 UINT64_C(0x01ff000000000000) };
    1938     AssertCompile(RT_ELEMENTS(s_acLevelShifts) == RT_ELEMENTS(s_auLevelMasks));
    1939     Assert(uPagingLevel >= 3 && uPagingLevel <= RT_ELEMENTS(s_auLevelMasks));
     1932    Assert(uPagingLevel >= 3 && uPagingLevel <= 5);
    19401933
    19411934    /*
     
    19501943        /* Read the paging entry for the current level. */
    19511944        {
    1952             uint16_t const idxPte         = (uDmaAddr >> s_acLevelShifts[iLevel]) & UINT64_C(0x1ff);
     1945            uint8_t const  cShift         = 12 + ((iLevel - 1) * 9);
     1946            uint16_t const idxPte         = (uDmaAddr >> cShift) & UINT64_C(0x1ff);
    19531947            uint64_t const offPte         = idxPte << 3;
    19541948            RTGCPHYS const GCPhysPtEntity = (uPtEntity & fHawMask) | offPte;
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