VirtualBox

Changeset 93257 in vbox


Ignore:
Timestamp:
Jan 17, 2022 8:03:19 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
149319
Message:

VMM: Nested VMX: bugref:10092 Expose true VMX control MSRs to the guest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r93223 r93257  
    12951295
    12961296    /* Basic information. */
     1297    uint8_t const fTrueVmxMsrs = 1;
    12971298    {
    12981299        uint64_t const u64Basic = RT_BF_MAKE(VMX_BF_BASIC_VMCS_ID,         VMX_V_VMCS_REVISION_ID        )
     
    13021303                                | RT_BF_MAKE(VMX_BF_BASIC_VMCS_MEM_TYPE,   VMX_BASIC_MEM_TYPE_WB         )
    13031304                                | RT_BF_MAKE(VMX_BF_BASIC_VMCS_INS_OUTS,   pGuestFeatures->fVmxInsOutInfo)
    1304                                 | RT_BF_MAKE(VMX_BF_BASIC_TRUE_CTLS,       0                             );
     1305                                | RT_BF_MAKE(VMX_BF_BASIC_TRUE_CTLS,       fTrueVmxMsrs                  );
    13051306        pGuestVmxMsrs->u64Basic = u64Basic;
    13061307    }
     
    13181319                                                         fAllowed0, fAllowed1, fFeatures));
    13191320        pGuestVmxMsrs->PinCtls.u = RT_MAKE_U64(fAllowed0, fAllowed1);
     1321
     1322        /* True pin-based VM-execution controls. */
     1323        if (fTrueVmxMsrs)
     1324        {
     1325            /* VMX_PIN_CTLS_DEFAULT1 contains MB1 reserved bits and must be reserved MB1 in true pin-based controls as well. */
     1326            pGuestVmxMsrs->TruePinCtls.u = RT_MAKE_U64(fAllowed0, fAllowed1);
     1327        }
    13201328    }
    13211329
     
    13491357                                                         fAllowed1, fFeatures));
    13501358        pGuestVmxMsrs->ProcCtls.u = RT_MAKE_U64(fAllowed0, fAllowed1);
     1359
     1360        /* True processor-based VM-execution controls. */
     1361        if (fTrueVmxMsrs)
     1362        {
     1363            /* VMX_PROC_CTLS_DEFAULT1 contains MB1 reserved bits but the following are not really reserved. */
     1364            uint32_t const fTrueAllowed0 = VMX_PROC_CTLS_DEFAULT1 & ~(  VMX_BF_PROC_CTLS_CR3_LOAD_EXIT_MASK
     1365                                                                      | VMX_BF_PROC_CTLS_CR3_STORE_EXIT_MASK);
     1366            uint32_t const fTrueAllowed1 = fFeatures | fTrueAllowed0;
     1367            pGuestVmxMsrs->TruePinCtls.u = RT_MAKE_U64(fTrueAllowed0, fTrueAllowed1);
     1368        }
    13511369    }
    13521370
     
    14071425                                                         fAllowed1, fFeatures));
    14081426        pGuestVmxMsrs->ExitCtls.u = RT_MAKE_U64(fAllowed0, fAllowed1);
     1427
     1428        /* True VM-exit controls. */
     1429        if (fTrueVmxMsrs)
     1430        {
     1431            /* VMX_EXIT_CTLS_DEFAULT1 contains MB1 reserved bits but the following are not really reserved */
     1432            uint32_t const fTrueAllowed0 = VMX_EXIT_CTLS_DEFAULT1 & ~VMX_BF_EXIT_CTLS_SAVE_DEBUG_MASK;
     1433            uint32_t const fTrueAllowed1 = fFeatures | fTrueAllowed0;
     1434            pGuestVmxMsrs->TrueEntryCtls.u = RT_MAKE_U64(fTrueAllowed0, fTrueAllowed1);
     1435        }
    14091436    }
    14101437
     
    14201447                                                         fAllowed1, fFeatures));
    14211448        pGuestVmxMsrs->EntryCtls.u = RT_MAKE_U64(fAllowed0, fAllowed1);
     1449
     1450        /* True VM-entry controls. */
     1451        if (fTrueVmxMsrs)
     1452        {
     1453            /* VMX_ENTRY_CTLS_DEFAULT1 contains MB1 reserved bits but the following are not really reserved */
     1454            uint32_t const fTrueAllowed0 = VMX_ENTRY_CTLS_DEFAULT1 & ~(  VMX_BF_ENTRY_CTLS_LOAD_DEBUG_MASK
     1455                                                                       | VMX_BF_ENTRY_CTLS_IA32E_MODE_GUEST_MASK
     1456                                                                       | VMX_BF_ENTRY_CTLS_ENTRY_SMM_MASK
     1457                                                                       | VMX_BF_ENTRY_CTLS_DEACTIVATE_DUAL_MON_MASK);
     1458            uint32_t const fTrueAllowed1 = fFeatures | fTrueAllowed0;
     1459            pGuestVmxMsrs->TrueEntryCtls.u = RT_MAKE_U64(fTrueAllowed0, fTrueAllowed1);
     1460        }
    14221461    }
    14231462
Note: See TracChangeset for help on using the changeset viewer.

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