VirtualBox

Changeset 91304 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Sep 17, 2021 8:43:17 PM (3 years ago)
Author:
vboxsync
Message:

VMM/CPUM,++: Moved the nested VT-X MSR permission bitmap allocations into CPUMCTX. bugref:10093

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r91297 r91304  
    21272127 *
    21282128 * @returns @c true if the MSR is intercepted, @c false otherwise.
    2129  * @param   pvMsrBitmap     The MSR bitmap.
     2129 * @param   pbMsrBitmap     The MSR bitmap.
    21302130 * @param   offMsr          The MSR byte offset.
    21312131 * @param   iBit            The bit offset from the byte offset.
    21322132 */
    2133 DECLINLINE(bool) hmR0VmxIsMsrBitSet(const void *pvMsrBitmap, uint16_t offMsr, int32_t iBit)
    2134 {
    2135     uint8_t const * const pbMsrBitmap = (uint8_t const * const)pvMsrBitmap;
    2136     Assert(pbMsrBitmap);
     2133DECLINLINE(bool) hmR0VmxIsMsrBitSet(uint8_t const *pbMsrBitmap, uint16_t offMsr, int32_t iBit)
     2134{
    21372135    Assert(offMsr + (iBit >> 3) <= X86_PAGE_4K_SIZE);
    21382136    return ASMBitTest(pbMsrBitmap + offMsr, iBit);
     
    22042202#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
    22052203        bool const fClear = !fIsNstGstVmcs ? true
    2206                           : !hmR0VmxIsMsrBitSet(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap), offMsrRead, iBit);
     2204                          : !hmR0VmxIsMsrBitSet(pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap, offMsrRead, iBit);
    22072205#else
    22082206        RT_NOREF2(pVCpu, fIsNstGstVmcs);
     
    22242222#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
    22252223        bool const fClear = !fIsNstGstVmcs ? true
    2226                           : !hmR0VmxIsMsrBitSet(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap), offMsrWrite, iBit);
     2224                          : !hmR0VmxIsMsrBitSet(pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap, offMsrWrite, iBit);
    22272225#else
    22282226        RT_NOREF2(pVCpu, fIsNstGstVmcs);
     
    28402838                     * allow passthrough too.
    28412839                     */
    2842                     void const *pvMsrBitmapNstGst = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap);
     2840                    void const *pvMsrBitmapNstGst = pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap;
    28432841                    Assert(pvMsrBitmapNstGst);
    28442842                    uint32_t const fMsrpmNstGst = CPUMGetVmxMsrPermission(pvMsrBitmapNstGst, pGuestMsrLoad->u32Msr);
     
    1042210420    if (pVmcsNstGst->u32ProcCtls & VMX_PROC_CTLS_USE_MSR_BITMAPS)
    1042310421    {
    10424         uint64_t const *pu64MsrBitmapNstGst = (uint64_t const *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap);
     10422        uint64_t const *pu64MsrBitmapNstGst = (uint64_t const *)&pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap[0];
    1042510423        uint64_t const *pu64MsrBitmapGst    = (uint64_t const *)pVmcsInfoGst->pvMsrBitmap;
    1042610424        Assert(pu64MsrBitmapNstGst);
     
    1732517323    uint32_t fMsrpm;
    1732617324    if (CPUMIsGuestVmxProcCtlsSet(&pVCpu->cpum.GstCtx, VMX_PROC_CTLS_USE_MSR_BITMAPS))
    17327         fMsrpm = CPUMGetVmxMsrPermission(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap), pVCpu->cpum.GstCtx.ecx);
     17325        fMsrpm = CPUMGetVmxMsrPermission(pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap, pVCpu->cpum.GstCtx.ecx);
    1732817326    else
    1732917327        fMsrpm = VMXMSRPM_EXIT_RD;
     
    1734717345    uint32_t fMsrpm;
    1734817346    if (CPUMIsGuestVmxProcCtlsSet(&pVCpu->cpum.GstCtx, VMX_PROC_CTLS_USE_MSR_BITMAPS))
    17349         fMsrpm = CPUMGetVmxMsrPermission(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap), pVCpu->cpum.GstCtx.ecx);
     17347        fMsrpm = CPUMGetVmxMsrPermission(pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap, pVCpu->cpum.GstCtx.ecx);
    1735017348    else
    1735117349        fMsrpm = VMXMSRPM_EXIT_WR;
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