VirtualBox

Changeset 71813 in vbox for trunk


Ignore:
Timestamp:
Apr 11, 2018 4:42:38 AM (7 years ago)
Author:
vboxsync
Message:

VMM: Nested Hw.virt: Avoid calling ASM helpers for modifying the MSR bitmaps.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplSvmInstr.cpp.h

    r71755 r71813  
    11161116        uint8_t *pbMsrpm = (uint8_t *)pCtx->hwvirt.svm.CTX_SUFF(pvMsrBitmap);
    11171117        pbMsrpm += offMsrpm;
    1118         if (ASMBitTest(pbMsrpm, uMsrpmBit))
     1118        if (*pbMsrpm & RT_BIT(uMsrpmBit))
    11191119        {
    11201120            IEM_SVM_UPDATE_NRIP(pVCpu);
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r71801 r71813  
    839839    pbMsrBitmap += offMsrpm;
    840840    if (enmRead == SVMMSREXIT_INTERCEPT_READ)
    841         ASMBitSet(pbMsrBitmap, uMsrpmBit);
     841        *pbMsrBitmap |= RT_BIT(uMsrpmBit);
    842842    else
    843843    {
    844844        if (!fInNestedGuestMode)
    845             ASMBitClear(pbMsrBitmap, uMsrpmBit);
     845            *pbMsrBitmap &= ~RT_BIT(uMsrpmBit);
    846846#ifdef VBOX_WITH_NESTED_HWVIRT
    847847        else
     
    850850            uint8_t const *pbNstGstMsrBitmap = (uint8_t *)pCtx->hwvirt.svm.CTX_SUFF(pvMsrBitmap);
    851851            pbNstGstMsrBitmap += offMsrpm;
    852             if (!ASMBitTest(pbNstGstMsrBitmap, uMsrpmBit))
    853                 ASMBitClear(pbMsrBitmap, uMsrpmBit);
     852            if (!(*pbNstGstMsrBitmap & RT_BIT(uMsrpmBit)))
     853                *pbMsrBitmap &= ~RT_BIT(uMsrpmBit);
    854854            else
    855                 Assert(ASMBitTest(pbMsrBitmap, uMsrpmBit));
     855                Assert(*pbMsrBitmap & RT_BIT(uMsrpmBit));
    856856        }
    857857#endif
     
    859859
    860860    if (enmWrite == SVMMSREXIT_INTERCEPT_WRITE)
    861         ASMBitSet(pbMsrBitmap, uMsrpmBit + 1);
     861        *pbMsrBitmap |= RT_BIT(uMsrpmBit + 1);
    862862    else
    863863    {
    864864        if (!fInNestedGuestMode)
    865             ASMBitClear(pbMsrBitmap, uMsrpmBit + 1);
     865            *pbMsrBitmap &= ~RT_BIT(uMsrpmBit + 1);
    866866#ifdef VBOX_WITH_NESTED_HWVIRT
    867867        else
     
    870870            uint8_t const *pbNstGstMsrBitmap = (uint8_t *)pCtx->hwvirt.svm.CTX_SUFF(pvMsrBitmap);
    871871            pbNstGstMsrBitmap += offMsrpm;
    872             if (!ASMBitTest(pbNstGstMsrBitmap, uMsrpmBit + 1))
    873                 ASMBitClear(pbMsrBitmap, uMsrpmBit + 1);
     872            if (!(*pbNstGstMsrBitmap & RT_BIT(uMsrpmBit + 1)))
     873                *pbMsrBitmap &= ~RT_BIT(uMsrpmBit + 1);
    874874            else
    875                 Assert(ASMBitTest(pbMsrBitmap, uMsrpmBit + 1));
     875                Assert(*pbMsrBitmap & RT_BIT(uMsrpmBit + 1));
    876876        }
    877877#endif
     
    51715171                    uint8_t const *pbMsrBitmap = (uint8_t const *)pCtx->hwvirt.svm.CTX_SUFF(pvMsrBitmap);
    51725172                    pbMsrBitmap               += offMsrpm;
    5173                     bool const fInterceptRead  = ASMBitTest(pbMsrBitmap, uMsrpmBit);
    5174                     bool const fInterceptWrite = ASMBitTest(pbMsrBitmap, uMsrpmBit + 1);
     5173                    bool const fInterceptRead  = *pbMsrBitmap & RT_BIT(uMsrpmBit);
     5174                    bool const fInterceptWrite = *pbMsrBitmap & RT_BIT(uMsrpmBit + 1);
    51755175
    51765176                    if (   (fInterceptWrite && pVmcbNstGstCtrl->u64ExitInfo1 == SVM_EXIT1_MSR_WRITE)
     
    73227322    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitPause);
    73237323    hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2);
    7324 
    73257324    /** @todo The guest has likely hit a contended spinlock. We might want to
    73267325     *        poke a schedule different guest VCPU. */
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