VirtualBox

Changeset 73395 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jul 30, 2018 3:19:54 PM (6 years ago)
Author:
vboxsync
Message:

VMM, CPUM: Nested VMX: bugref:9180 Implement Cr0Fixed[0|1] and Cr4Fixed[0|1] MSRs, nits.

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

Legend:

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

    r73389 r73395  
    12951295    if (pGuestFeatures->fVmx)
    12961296    {
    1297         *puValue = RT_BF_MAKE(VMX_BF_BASIC_VMCS_ID,       VMX_VMCS_REVISION_ID          )
     1297        *puValue = RT_BF_MAKE(VMX_BF_BASIC_VMCS_ID,       VMX_E_VMCS_REVISION_ID        )
    12981298                 | RT_BF_MAKE(VMX_BF_BASIC_DUAL_MON,      0                             )
    12991299                 | RT_BF_MAKE(VMX_BF_BASIC_VMCS_MEM_TYPE, VMX_BASIC_MEM_TYPE_WB         )
     
    14371437static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxCr0Fixed0(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
    14381438{
    1439     RT_NOREF_PV(pVCpu); RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange);
    1440     *puValue = 0;
     1439    RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange);
     1440    PCCPUMFEATURES pGuestFeatures = &pVCpu->CTX_SUFF(pVM)->cpum.s.GuestFeatures;
     1441    if (pGuestFeatures->fVmx)
     1442        *puValue = VMX_E_CR0_FIXED0;
     1443    else
     1444        *puValue = 0;
    14411445    return VINF_SUCCESS;
    14421446}
     
    14461450static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxCr0Fixed1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
    14471451{
    1448     RT_NOREF_PV(pVCpu); RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange);
    1449     *puValue = 0;
     1452    RT_NOREF_PV(pRange);
     1453    PCCPUMFEATURES pGuestFeatures = &pVCpu->CTX_SUFF(pVM)->cpum.s.GuestFeatures;
     1454    if (pGuestFeatures->fVmx)
     1455    {
     1456        int rc = HMVmxGetHostMsr(pVCpu->CTX_SUFF(pVM), idMsr, puValue);
     1457        AssertRCReturn(rc, rc);
     1458        *puValue |= VMX_E_CR0_FIXED0;   /* Make sure the CR0 MB1 bits are not clear. */
     1459    }
     1460    else
     1461        *puValue = 0;
    14501462    return VINF_SUCCESS;
    14511463}
     
    14551467static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxCr4Fixed0(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
    14561468{
    1457     RT_NOREF_PV(pVCpu); RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange);
    1458     *puValue = 0;
     1469    RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange);
     1470    PCCPUMFEATURES pGuestFeatures = &pVCpu->CTX_SUFF(pVM)->cpum.s.GuestFeatures;
     1471    if (pGuestFeatures->fVmx)
     1472        *puValue = VMX_E_CR4_FIXED0;
     1473    else
     1474        *puValue = 0;
    14591475    return VINF_SUCCESS;
    14601476}
     
    14641480static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxCr4Fixed1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
    14651481{
    1466     RT_NOREF_PV(pVCpu); RT_NOREF_PV(idMsr); RT_NOREF_PV(pRange);
    1467     *puValue = 0;
     1482    RT_NOREF_PV(pRange);
     1483    PCCPUMFEATURES pGuestFeatures = &pVCpu->CTX_SUFF(pVM)->cpum.s.GuestFeatures;
     1484    if (pGuestFeatures->fVmx)
     1485    {
     1486        int rc = HMVmxGetHostMsr(pVCpu->CTX_SUFF(pVM), idMsr, puValue);
     1487        AssertRCReturn(rc, rc);
     1488        *puValue |= VMX_E_CR4_FIXED0;   /* Make sure the CR4 MB1 bits are not clear. */
     1489    }
     1490    else
     1491        *puValue = 0;
    14681492    return VINF_SUCCESS;
    14691493}
  • trunk/src/VBox/VMM/VMMAll/HMAll.cpp

    r73389 r73395  
    581581
    582582
    583 #if 0 /** @todo Update comment hm_vmx.h VMXMSRS struct if this is removed. */
    584583/**
    585584 * Gets the specified VMX host MSR that was read by HM during ring-0
     
    633632    return VINF_SUCCESS;
    634633}
    635 #endif
    636634
    637635
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