VirtualBox

Changeset 76632 in vbox


Ignore:
Timestamp:
Jan 4, 2019 11:59:19 AM (6 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:9180 vmwrite/vmread fixes. Logging.

File:
1 edited

Legend:

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

    r76631 r76632  
    75077507     */
    75087508    uint8_t *pbVmcs;
    7509     if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu))
     7509    if (!IEM_VMX_IS_NON_ROOT_MODE(pVCpu))
     7510        pbVmcs = (uint8_t *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
     7511    else
    75107512        pbVmcs = (uint8_t *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pShadowVmcs);
    7511     else
    7512         pbVmcs = (uint8_t *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
    75137513    Assert(pbVmcs);
    75147514
    75157515    VMXVMCSFIELDENC FieldEnc;
    7516     FieldEnc.u = RT_LO_U32(u64FieldEnc);
    7517     uint8_t  const uWidth     = FieldEnc.n.u2Width;
    7518     uint8_t  const uType      = FieldEnc.n.u2Type;
     7516    FieldEnc.u = u64FieldEnc;
     7517    uint8_t  const uWidth     = RT_BF_GET(FieldEnc.u, VMX_BF_VMCS_ENC_WIDTH);
     7518    uint8_t  const uType      = RT_BF_GET(FieldEnc.u, VMX_BF_VMCS_ENC_TYPE);
    75197519    uint8_t  const uWidthType = (uWidth << 2) | uType;
    7520     uint8_t  const uIndex     = FieldEnc.n.u8Index;
     7520    uint8_t  const uIndex     = RT_BF_GET(FieldEnc.u, VMX_BF_VMCS_ENC_INDEX);
    75217521    AssertReturn(uIndex <= VMX_V_VMCS_MAX_INDEX, VERR_IEM_IPE_2);
    75227522    uint16_t const offField   = g_aoffVmcsMap[uWidthType][uIndex];
     7523    Assert(offField < VMX_V_VMCS_SIZE);
    75237524
    75247525    /*
     
    77657766     */
    77667767    uint8_t *pbVmcs;
    7767     if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu))
     7768    if (!IEM_VMX_IS_NON_ROOT_MODE(pVCpu))
     7769        pbVmcs = (uint8_t *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
     7770    else
    77687771        pbVmcs = (uint8_t *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pShadowVmcs);
    7769     else
    7770         pbVmcs = (uint8_t *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
    77717772    Assert(pbVmcs);
    77727773
    77737774    VMXVMCSFIELDENC FieldEnc;
    7774     FieldEnc.u = RT_LO_U32(u64FieldEnc);
    7775     uint8_t  const uWidth     = FieldEnc.n.u2Width;
    7776     uint8_t  const uType      = FieldEnc.n.u2Type;
     7775    FieldEnc.u = u64FieldEnc;
     7776    uint8_t  const uWidth     = RT_BF_GET(FieldEnc.u, VMX_BF_VMCS_ENC_WIDTH);
     7777    uint8_t  const uType      = RT_BF_GET(FieldEnc.u, VMX_BF_VMCS_ENC_TYPE);
    77777778    uint8_t  const uWidthType = (uWidth << 2) | uType;
    7778     uint8_t  const uIndex     = FieldEnc.n.u8Index;
     7779    uint8_t  const uIndex     = RT_BF_GET(FieldEnc.u, VMX_BF_VMCS_ENC_INDEX);
    77797780    AssertReturn(uIndex <= VMX_V_VMCS_MAX_INDEX, VERR_IEM_IPE_2);
    77807781    uint16_t const offField   = g_aoffVmcsMap[uWidthType][uIndex];
     7782    Assert(offField < VMX_V_VMCS_SIZE);
    77817783
    77827784    /*
     
    80748076        if (VmcsRevId.n.u31RevisionId != VMX_V_VMCS_REVISION_ID)
    80758077        {
    8076             Log(("vmptrld: VMCS revision mismatch, expected %#RX32 got %#RX32 -> VMFail()\n", VMX_V_VMCS_REVISION_ID,
    8077                  VmcsRevId.n.u31RevisionId));
     8078            Log(("vmptrld: VMCS revision mismatch, expected %#RX32 got %#RX32. GCPhysVmcs=%#RX64 -> VMFail()\n",
     8079                 VMX_V_VMCS_REVISION_ID, VmcsRevId.n.u31RevisionId, GCPhysVmcs));
    80788080            pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmptrld_VmcsRevId;
    80798081            iemVmxVmFail(pVCpu, VMXINSTRERR_VMPTRLD_INCORRECT_VMCS_REV);
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