VirtualBox

Changeset 76741 in vbox for trunk


Ignore:
Timestamp:
Jan 9, 2019 2:39:14 PM (6 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:9180 The array index has the VMCS fields in increments of 1, don't confuse with the source (encoding value) which has the alternate, matching indices.

File:
1 edited

Legend:

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

    r76738 r76741  
    745745    uint8_t  const  uType      = VMX_VMCS_ENC_TYPE_HOST_STATE;
    746746    uint8_t  const  uWidthType = (uWidth << 2) | uType;
    747     uint8_t  const  uIndex     = (iSegReg << 1) + RT_BF_GET(VMX_VMCS16_GUEST_ES_SEL, VMX_BF_VMCS_ENC_INDEX);
     747    uint8_t  const  uIndex     = iSegReg + RT_BF_GET(VMX_VMCS16_HOST_ES_SEL, VMX_BF_VMCS_ENC_INDEX);
    748748    Assert(uIndex <= VMX_V_VMCS_MAX_INDEX);
    749749    uint16_t const  offField   = g_aoffVmcsMap[uWidthType][uIndex];
     
    772772        uint8_t  const  uType      = VMX_VMCS_ENC_TYPE_GUEST_STATE;
    773773        uint8_t  const  uWidthType = (uWidth << 2) | uType;
    774         uint8_t  const  uIndex     = (iSegReg << 1) + RT_BF_GET(VMX_VMCS16_GUEST_ES_SEL, VMX_BF_VMCS_ENC_INDEX);
     774        uint8_t  const  uIndex     = iSegReg + RT_BF_GET(VMX_VMCS16_GUEST_ES_SEL, VMX_BF_VMCS_ENC_INDEX);
    775775        Assert(uIndex <= VMX_V_VMCS_MAX_INDEX);
    776776        uint16_t const  offField   = g_aoffVmcsMap[uWidthType][uIndex];
     
    785785        uint8_t  const  uType      = VMX_VMCS_ENC_TYPE_GUEST_STATE;
    786786        uint8_t  const  uWidthType = (uWidth << 2) | uType;
    787         uint8_t  const  uIndex     = (iSegReg << 1) + RT_BF_GET(VMX_VMCS32_GUEST_ES_LIMIT, VMX_BF_VMCS_ENC_INDEX);
     787        uint8_t  const  uIndex     = iSegReg + RT_BF_GET(VMX_VMCS32_GUEST_ES_LIMIT, VMX_BF_VMCS_ENC_INDEX);
    788788        Assert(uIndex <= VMX_V_VMCS_MAX_INDEX);
    789789        uint16_t const  offField   = g_aoffVmcsMap[uWidthType][uIndex];
     
    798798        uint8_t  const  uType      = VMX_VMCS_ENC_TYPE_GUEST_STATE;
    799799        uint8_t  const  uWidthType = (uWidth << 2) | uType;
    800         uint8_t  const  uIndex     = (iSegReg << 1) + RT_BF_GET(VMX_VMCS_GUEST_ES_BASE, VMX_BF_VMCS_ENC_INDEX);
     800        uint8_t  const  uIndex     = iSegReg + RT_BF_GET(VMX_VMCS_GUEST_ES_BASE, VMX_BF_VMCS_ENC_INDEX);
    801801        Assert(uIndex <= VMX_V_VMCS_MAX_INDEX);
    802802        uint16_t const  offField   = g_aoffVmcsMap[uWidthType][uIndex];
     
    814814        uint8_t  const  uType      = VMX_VMCS_ENC_TYPE_GUEST_STATE;
    815815        uint8_t  const  uWidthType = (uWidth << 2) | uType;
    816         uint8_t  const  uIndex     = (iSegReg << 1) + RT_BF_GET(VMX_VMCS32_GUEST_ES_ACCESS_RIGHTS, VMX_BF_VMCS_ENC_INDEX);
     816        uint8_t  const  uIndex     = iSegReg + RT_BF_GET(VMX_VMCS32_GUEST_ES_ACCESS_RIGHTS, VMX_BF_VMCS_ENC_INDEX);
    817817        Assert(uIndex <= VMX_V_VMCS_MAX_INDEX);
    818818        uint16_t const  offField   = g_aoffVmcsMap[uWidthType][uIndex];
     
    847847        uint8_t  const  uType      = VMX_VMCS_ENC_TYPE_GUEST_STATE;
    848848        uint8_t  const  uWidthType = (uWidth << 2) | uType;
    849         uint8_t  const  uIndex     = (iSegReg << 1) + RT_BF_GET(VMX_VMCS16_GUEST_ES_SEL, VMX_BF_VMCS_ENC_INDEX);
     849        uint8_t  const  uIndex     = iSegReg + RT_BF_GET(VMX_VMCS16_GUEST_ES_SEL, VMX_BF_VMCS_ENC_INDEX);
    850850        AssertReturn(uIndex <= VMX_V_VMCS_MAX_INDEX, VERR_IEM_IPE_3);
    851851        uint16_t const  offField   = g_aoffVmcsMap[uWidthType][uIndex];
     
    861861        uint8_t  const  uType      = VMX_VMCS_ENC_TYPE_GUEST_STATE;
    862862        uint8_t  const  uWidthType = (uWidth << 2) | uType;
    863         uint8_t  const  uIndex     = (iSegReg << 1) + RT_BF_GET(VMX_VMCS32_GUEST_ES_LIMIT, VMX_BF_VMCS_ENC_INDEX);
     863        uint8_t  const  uIndex     = iSegReg + RT_BF_GET(VMX_VMCS32_GUEST_ES_LIMIT, VMX_BF_VMCS_ENC_INDEX);
    864864        AssertReturn(uIndex <= VMX_V_VMCS_MAX_INDEX, VERR_IEM_IPE_3);
    865865        uint16_t const  offField   = g_aoffVmcsMap[uWidthType][uIndex];
     
    875875        uint8_t  const  uType      = VMX_VMCS_ENC_TYPE_GUEST_STATE;
    876876        uint8_t  const  uWidthType = (uWidth << 2) | uType;
    877         uint8_t  const  uIndex     = (iSegReg << 1) + RT_BF_GET(VMX_VMCS_GUEST_ES_BASE, VMX_BF_VMCS_ENC_INDEX);
     877        uint8_t  const  uIndex     = iSegReg + RT_BF_GET(VMX_VMCS_GUEST_ES_BASE, VMX_BF_VMCS_ENC_INDEX);
    878878        AssertReturn(uIndex <= VMX_V_VMCS_MAX_INDEX, VERR_IEM_IPE_3);
    879879        uint16_t const  offField   = g_aoffVmcsMap[uWidthType][uIndex];
     
    890890        uint8_t  const  uType      = VMX_VMCS_ENC_TYPE_GUEST_STATE;
    891891        uint8_t  const  uWidthType = (uWidth << 2) | uType;
    892         uint8_t  const  uIndex     = (iSegReg << 1) + RT_BF_GET(VMX_VMCS32_GUEST_ES_ACCESS_RIGHTS, VMX_BF_VMCS_ENC_INDEX);
     892        uint8_t  const  uIndex     = iSegReg + RT_BF_GET(VMX_VMCS32_GUEST_ES_ACCESS_RIGHTS, VMX_BF_VMCS_ENC_INDEX);
    893893        AssertReturn(uIndex <= VMX_V_VMCS_MAX_INDEX, VERR_IEM_IPE_3);
    894894        uint16_t const  offField   = g_aoffVmcsMap[uWidthType][uIndex];
     
    922922    uint8_t  const  uType          = VMX_VMCS_ENC_TYPE_CONTROL;
    923923    uint8_t  const  uWidthType     = (uWidth << 2) | uType;
    924     uint8_t  const  uIndex         = (idxCr3Target << 1) + RT_BF_GET(VMX_VMCS_CTRL_CR3_TARGET_VAL0, VMX_BF_VMCS_ENC_INDEX);
     924    uint8_t  const  uIndex         = idxCr3Target + RT_BF_GET(VMX_VMCS_CTRL_CR3_TARGET_VAL0, VMX_BF_VMCS_ENC_INDEX);
    925925    Assert(uIndex <= VMX_V_VMCS_MAX_INDEX);
    926926    uint16_t const  offField       = g_aoffVmcsMap[uWidthType][uIndex];
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