VirtualBox

Changeset 59602 in vbox


Ignore:
Timestamp:
Feb 8, 2016 2:17:50 PM (9 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Add missing VMCS fields for newer CPUs, renamed some existing ones for consistency.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/hm_vmx.h

    r58978 r59602  
    11601160 * @{
    11611161 */
    1162 #define VMX_VMCS16_GUEST_FIELD_VPID                             0x0
    1163 #define VMX_VMCS16_GUEST_FIELD_ES                               0x800
    1164 #define VMX_VMCS16_GUEST_FIELD_CS                               0x802
    1165 #define VMX_VMCS16_GUEST_FIELD_SS                               0x804
    1166 #define VMX_VMCS16_GUEST_FIELD_DS                               0x806
    1167 #define VMX_VMCS16_GUEST_FIELD_FS                               0x808
    1168 #define VMX_VMCS16_GUEST_FIELD_GS                               0x80A
    1169 #define VMX_VMCS16_GUEST_FIELD_LDTR                             0x80C
    1170 #define VMX_VMCS16_GUEST_FIELD_TR                               0x80E
     1162#define VMX_VMCS16_VPID                                         0x000
     1163#define VMX_VMCS16_POSTED_INTR_NOTIF_VECTOR                     0x002
     1164#define VMX_VMCS16_EPTP_INDEX                                   0x004
     1165#define VMX_VMCS16_GUEST_ES_SEL                                 0x800
     1166#define VMX_VMCS16_GUEST_CS_SEL                                 0x802
     1167#define VMX_VMCS16_GUEST_SS_SEL                                 0x804
     1168#define VMX_VMCS16_GUEST_DS_SEL                                 0x806
     1169#define VMX_VMCS16_GUEST_FS_SEL                                 0x808
     1170#define VMX_VMCS16_GUEST_GS_SEL                                 0x80A
     1171#define VMX_VMCS16_GUEST_LDTR_SEL                               0x80C
     1172#define VMX_VMCS16_GUEST_TR_SEL                                 0x80E
     1173#define VMX_VMCS16_GUEST_INTR_STATUS                            0x810
    11711174/** @} */
    11721175
     
    11741177 * @{
    11751178 */
    1176 #define VMX_VMCS16_HOST_FIELD_ES                                0xC00
    1177 #define VMX_VMCS16_HOST_FIELD_CS                                0xC02
    1178 #define VMX_VMCS16_HOST_FIELD_SS                                0xC04
    1179 #define VMX_VMCS16_HOST_FIELD_DS                                0xC06
    1180 #define VMX_VMCS16_HOST_FIELD_FS                                0xC08
    1181 #define VMX_VMCS16_HOST_FIELD_GS                                0xC0A
    1182 #define VMX_VMCS16_HOST_FIELD_TR                                0xC0C
     1179#define VMX_VMCS16_HOST_ES_SEL                                  0xC00
     1180#define VMX_VMCS16_HOST_CS_SEL                                  0xC02
     1181#define VMX_VMCS16_HOST_SS_SEL                                  0xC04
     1182#define VMX_VMCS16_HOST_DS_SEL                                  0xC06
     1183#define VMX_VMCS16_HOST_FS_SEL                                  0xC08
     1184#define VMX_VMCS16_HOST_GS_SEL                                  0xC0A
     1185#define VMX_VMCS16_HOST_TR_SEL                                  0xC0C
    11831186/** @}          */
    11841187
     
    11861189 * @{
    11871190 */
    1188 #define VMX_VMCS64_HOST_FIELD_PAT_FULL                          0x2C00
    1189 #define VMX_VMCS64_HOST_FIELD_PAT_HIGH                          0x2C01
    1190 #define VMX_VMCS64_HOST_FIELD_EFER_FULL                         0x2C02
    1191 #define VMX_VMCS64_HOST_FIELD_EFER_HIGH                         0x2C03
     1191#define VMX_VMCS64_HOST_PAT_FULL                                0x2C00
     1192#define VMX_VMCS64_HOST_PAT_HIGH                                0x2C01
     1193#define VMX_VMCS64_HOST_EFER_FULL                               0x2C02
     1194#define VMX_VMCS64_HOST_EFER_HIGH                               0x2C03
    11921195#define VMX_VMCS64_HOST_PERF_GLOBAL_CTRL_FULL                   0x2C04      /**< MSR IA32_PERF_GLOBAL_CTRL */
    11931196#define VMX_VMCS64_HOST_PERF_GLOBAL_CTRL_HIGH                   0x2C05      /**< MSR IA32_PERF_GLOBAL_CTRL */
     
    12301233
    12311234/** Optional (VMX_VMCS_CTRL_PROC_EXEC2_VMFUNC) */
     1235#define VMX_VMCS64_CTRL_POSTED_INTR_DESC_FULL                   0x2016
     1236#define VMX_VMCS64_CTRL_POSTED_INTR_DESC_HIGH                   0x2017
     1237
     1238/** Optional (VMX_VMCS_CTRL_PROC_EXEC2_VMFUNC) */
    12321239#define VMX_VMCS64_CTRL_VMFUNC_CTRLS_FULL                       0x2018
    12331240#define VMX_VMCS64_CTRL_VMFUNC_CTRLS_HIGH                       0x2019
    12341241
    12351242/** Extended page table pointer. */
    1236 #define VMX_VMCS64_CTRL_EPTP_FULL                               0x201a
    1237 #define VMX_VMCS64_CTRL_EPTP_HIGH                               0x201b
     1243#define VMX_VMCS64_CTRL_EPTP_FULL                               0x201A
     1244#define VMX_VMCS64_CTRL_EPTP_HIGH                               0x201B
     1245
     1246/** EOI-exit bitmap 0. */
     1247#define VMX_VMCS64_CTRL_EOI_BITMAP_0_FULL                       0x201C
     1248#define VMX_VMCS64_CTRL_EOI_BITMAP_0_HIGH                       0x201D
     1249
     1250/** EOI-exit bitmap 1. */
     1251#define VMX_VMCS64_CTRL_EOI_BITMAP_1_FULL                       0x201E
     1252#define VMX_VMCS64_CTRL_EOI_BITMAP_1_HIGH                       0x201F
     1253
     1254/** EOI-exit bitmap 2. */
     1255#define VMX_VMCS64_CTRL_EOI_BITMAP_2_FULL                       0x2020
     1256#define VMX_VMCS64_CTRL_EOI_BITMAP_2_HIGH                       0x2021
     1257
     1258/** EOI-exit bitmap 3. */
     1259#define VMX_VMCS64_CTRL_EOI_BITMAP_3_FULL                       0x2022
     1260#define VMX_VMCS64_CTRL_EOI_BITMAP_3_HIGH                       0x2023
    12381261
    12391262/** Extended page table pointer lists. */
    12401263#define VMX_VMCS64_CTRL_EPTP_LIST_FULL                          0x2024
    12411264#define VMX_VMCS64_CTRL_EPTP_LIST_HIGH                          0x2025
     1265
     1266/** VM-read bitmap. */
     1267#define VMX_VMCS64_CTRL_VMREAD_BITMAP_FULL                      0x2026
     1268#define VMX_VMCS64_CTRL_VMREAD_BITMAP_HIGH                      0x2027
     1269
     1270/** VM-write bitmap. */
     1271#define VMX_VMCS64_CTRL_VMWRITE_BITMAP_FULL                     0x2028
     1272#define VMX_VMCS64_CTRL_VMWRITE_BITMAP_HIGH                     0x2029
     1273
     1274/** Virtualization-exception information address. */
     1275#define VMX_VMCS64_CTRL_VIRTXCPT_INFO_ADDR_FULL                 0x202A
     1276#define VMX_VMCS64_CTRL_VIRTXCPT_INFO_ADDR_HIGH                 0x202B
     1277
     1278/** XSS-exiting bitmap. */
     1279#define VMX_VMCS64_CTRL_XSS_EXITING_BITMAP_FULL                 0x202C
     1280#define VMX_VMCS64_CTRL_XSS_EXITING_BITMAP_HIGH                 0x202D
     1281
     1282/** TSC multiplier. */
     1283#define VMX_VMCS64_CTRL_TSC_MULTIPLIER_FULL                     0x2032
     1284#define VMX_VMCS64_CTRL_TSC_MULTIPLIER_HIGH                     0x2033
    12421285
    12431286/** VM-exit guest physical address. */
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r59214 r59602  
    16651665    {
    16661666        uint64_t u64Val;
    1667         int rc = VMXReadVmcs64(VMX_VMCS64_HOST_FIELD_EFER_FULL, &u64Val);
     1667        int rc = VMXReadVmcs64(VMX_VMCS64_HOST_EFER_FULL, &u64Val);
    16681668        AssertRC(rc);
    16691669
     
    20012001
    20022002    /* Update VMCS with the VPID. */
    2003     int rc  = VMXWriteVmcs32(VMX_VMCS16_GUEST_FIELD_VPID, pVCpu->hm.s.uCurrentAsid);
     2003    int rc  = VMXWriteVmcs32(VMX_VMCS16_VPID, pVCpu->hm.s.uCurrentAsid);
    20042004    AssertRC(rc);
    20052005
     
    21382138              ("Cpu[%u] pVCpu->uCurrentAsid=%u\n", pCpu->idCpu, pVCpu->hm.s.uCurrentAsid));
    21392139
    2140     int rc  = VMXWriteVmcs32(VMX_VMCS16_GUEST_FIELD_VPID, pVCpu->hm.s.uCurrentAsid);
     2140    int rc  = VMXWriteVmcs32(VMX_VMCS16_VPID, pVCpu->hm.s.uCurrentAsid);
    21412141    AssertRC(rc);
    21422142}
     
    29272927
    29282928    /* Write these host selector fields into the host-state area in the VMCS. */
    2929     rc  = VMXWriteVmcs32(VMX_VMCS16_HOST_FIELD_CS, uSelCS);
    2930     rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_FIELD_SS, uSelSS);
     2929    rc  = VMXWriteVmcs32(VMX_VMCS16_HOST_CS_SEL, uSelCS);
     2930    rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_SS_SEL, uSelSS);
    29312931#if HC_ARCH_BITS == 64
    2932     rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_FIELD_DS, uSelDS);
    2933     rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_FIELD_ES, uSelES);
    2934     rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_FIELD_FS, uSelFS);
    2935     rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_FIELD_GS, uSelGS);
     2932    rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_DS_SEL, uSelDS);
     2933    rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_ES_SEL, uSelES);
     2934    rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_FS_SEL, uSelFS);
     2935    rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_GS_SEL, uSelGS);
    29362936#else
    29372937    NOREF(uSelDS);
     
    29402940    NOREF(uSelGS);
    29412941#endif
    2942     rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_FIELD_TR, uSelTR);
     2942    rc |= VMXWriteVmcs32(VMX_VMCS16_HOST_TR_SEL, uSelTR);
    29432943    AssertRCReturn(rc, rc);
    29442944
     
    30933093    if (pVM->hm.s.vmx.fSupportsVmcsEfer)
    30943094    {
    3095         rc = VMXWriteVmcs64(VMX_VMCS64_HOST_FIELD_EFER_FULL, pVM->hm.s.vmx.u64HostEfer);
     3095        rc = VMXWriteVmcs64(VMX_VMCS64_HOST_EFER_FULL, pVM->hm.s.vmx.u64HostEfer);
    30963096        AssertRCReturn(rc, rc);
    30973097    }
     
    44304430        }
    44314431#endif
    4432         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_CS, VMX_VMCS32_GUEST_CS_LIMIT, VMX_VMCS_GUEST_CS_BASE,
     4432        rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_CS_SEL, VMX_VMCS32_GUEST_CS_LIMIT, VMX_VMCS_GUEST_CS_BASE,
    44334433                                     VMX_VMCS32_GUEST_CS_ACCESS_RIGHTS, &pMixedCtx->cs);
    44344434        AssertRCReturn(rc, rc);
    4435         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_SS, VMX_VMCS32_GUEST_SS_LIMIT, VMX_VMCS_GUEST_SS_BASE,
     4435        rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_SS_SEL, VMX_VMCS32_GUEST_SS_LIMIT, VMX_VMCS_GUEST_SS_BASE,
    44364436                                     VMX_VMCS32_GUEST_SS_ACCESS_RIGHTS, &pMixedCtx->ss);
    44374437        AssertRCReturn(rc, rc);
    4438         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_DS, VMX_VMCS32_GUEST_DS_LIMIT, VMX_VMCS_GUEST_DS_BASE,
     4438        rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_DS_SEL, VMX_VMCS32_GUEST_DS_LIMIT, VMX_VMCS_GUEST_DS_BASE,
    44394439                                     VMX_VMCS32_GUEST_DS_ACCESS_RIGHTS, &pMixedCtx->ds);
    44404440        AssertRCReturn(rc, rc);
    4441         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_ES, VMX_VMCS32_GUEST_ES_LIMIT, VMX_VMCS_GUEST_ES_BASE,
     4441        rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_ES_SEL, VMX_VMCS32_GUEST_ES_LIMIT, VMX_VMCS_GUEST_ES_BASE,
    44424442                                     VMX_VMCS32_GUEST_ES_ACCESS_RIGHTS, &pMixedCtx->es);
    44434443        AssertRCReturn(rc, rc);
    4444         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_FS, VMX_VMCS32_GUEST_FS_LIMIT, VMX_VMCS_GUEST_FS_BASE,
     4444        rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FS_SEL, VMX_VMCS32_GUEST_FS_LIMIT, VMX_VMCS_GUEST_FS_BASE,
    44454445                                     VMX_VMCS32_GUEST_FS_ACCESS_RIGHTS, &pMixedCtx->fs);
    44464446        AssertRCReturn(rc, rc);
    4447         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_GS, VMX_VMCS32_GUEST_GS_LIMIT, VMX_VMCS_GUEST_GS_BASE,
     4447        rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_GS_SEL, VMX_VMCS32_GUEST_GS_LIMIT, VMX_VMCS_GUEST_GS_BASE,
    44484448                                     VMX_VMCS32_GUEST_GS_ACCESS_RIGHTS, &pMixedCtx->gs);
    44494449        AssertRCReturn(rc, rc);
     
    45164516               || (u32AccessRights & RT_BIT(15)));              /* Granularity MB1. */
    45174517
    4518         rc  = VMXWriteVmcs32(VMX_VMCS16_GUEST_FIELD_TR,         u16Sel);
     4518        rc  = VMXWriteVmcs32(VMX_VMCS16_GUEST_TR_SEL,           u16Sel);
    45194519        rc |= VMXWriteVmcs32(VMX_VMCS32_GUEST_TR_LIMIT,         u32Limit);
    45204520        rc |= VMXWriteVmcsGstN(VMX_VMCS_GUEST_TR_BASE,          u64Base);
     
    45544554            u32Access = pMixedCtx->ldtr.Attr.u;
    45554555
    4556         rc  = VMXWriteVmcs32(VMX_VMCS16_GUEST_FIELD_LDTR,         pMixedCtx->ldtr.Sel);
     4556        rc  = VMXWriteVmcs32(VMX_VMCS16_GUEST_LDTR_SEL,           pMixedCtx->ldtr.Sel);
    45574557        rc |= VMXWriteVmcs32(VMX_VMCS32_GUEST_LDTR_LIMIT,         pMixedCtx->ldtr.u32Limit);
    45584558        rc |= VMXWriteVmcsGstN(VMX_VMCS_GUEST_LDTR_BASE,          pMixedCtx->ldtr.u64Base);
     
    49254925                rc = VMXReadVmcs32(VMX_VMCS_GUEST_RFLAGS, &u32Val);         AssertRC(rc);
    49264926                Log4(("Old Guest Rflags %#RX32 New %#RX32\n", pCtx->eflags.u32, u32Val));
    4927                 rc = VMXReadVmcs32(VMX_VMCS16_GUEST_FIELD_VPID, &u32Val);   AssertRC(rc);
    4928                 Log4(("VMX_VMCS16_GUEST_FIELD_VPID             %u\n", u32Val));
     4927                rc = VMXReadVmcs32(VMX_VMCS16_VPID, &u32Val);               AssertRC(rc);
     4928                Log4(("VMX_VMCS16_VPID  %u\n", u32Val));
    49294929
    49304930                /* Host bits. */
     
    49394939                PCX86DESCHC pDesc;
    49404940                ASMGetGDTR(&HostGdtr);
    4941                 rc = VMXReadVmcs32(VMX_VMCS16_HOST_FIELD_CS, &u32Val);      AssertRC(rc);
     4941                rc = VMXReadVmcs32(VMX_VMCS16_HOST_CS_SEL, &u32Val);      AssertRC(rc);
    49424942                Log4(("Host CS %#08x\n", u32Val));
    49434943                if (u32Val < HostGdtr.cbGdt)
     
    49474947                }
    49484948
    4949                 rc = VMXReadVmcs32(VMX_VMCS16_HOST_FIELD_DS, &u32Val);      AssertRC(rc);
     4949                rc = VMXReadVmcs32(VMX_VMCS16_HOST_DS_SEL, &u32Val);      AssertRC(rc);
    49504950                Log4(("Host DS %#08x\n", u32Val));
    49514951                if (u32Val < HostGdtr.cbGdt)
     
    49554955                }
    49564956
    4957                 rc = VMXReadVmcs32(VMX_VMCS16_HOST_FIELD_ES, &u32Val);      AssertRC(rc);
     4957                rc = VMXReadVmcs32(VMX_VMCS16_HOST_ES_SEL, &u32Val);      AssertRC(rc);
    49584958                Log4(("Host ES %#08x\n", u32Val));
    49594959                if (u32Val < HostGdtr.cbGdt)
     
    49634963                }
    49644964
    4965                 rc = VMXReadVmcs32(VMX_VMCS16_HOST_FIELD_FS, &u32Val);      AssertRC(rc);
     4965                rc = VMXReadVmcs32(VMX_VMCS16_HOST_FS_SEL, &u32Val);      AssertRC(rc);
    49664966                Log4(("Host FS %#08x\n", u32Val));
    49674967                if (u32Val < HostGdtr.cbGdt)
     
    49714971                }
    49724972
    4973                 rc = VMXReadVmcs32(VMX_VMCS16_HOST_FIELD_GS, &u32Val);      AssertRC(rc);
     4973                rc = VMXReadVmcs32(VMX_VMCS16_HOST_GS_SEL, &u32Val);      AssertRC(rc);
    49744974                Log4(("Host GS %#08x\n", u32Val));
    49754975                if (u32Val < HostGdtr.cbGdt)
     
    49794979                }
    49804980
    4981                 rc = VMXReadVmcs32(VMX_VMCS16_HOST_FIELD_SS, &u32Val);      AssertRC(rc);
     4981                rc = VMXReadVmcs32(VMX_VMCS16_HOST_SS_SEL, &u32Val);      AssertRC(rc);
    49824982                Log4(("Host SS %#08x\n", u32Val));
    49834983                if (u32Val < HostGdtr.cbGdt)
     
    49874987                }
    49884988
    4989                 rc = VMXReadVmcs32(VMX_VMCS16_HOST_FIELD_TR,  &u32Val);     AssertRC(rc);
     4989                rc = VMXReadVmcs32(VMX_VMCS16_HOST_TR_SEL,  &u32Val);     AssertRC(rc);
    49904990                Log4(("Host TR %#08x\n", u32Val));
    49914991                if (u32Val < HostGdtr.cbGdt)
     
    63496349    if (pSelReg->Attr.u & X86DESCATTR_UNUSABLE)
    63506350    {
    6351         Assert(idxSel != VMX_VMCS16_GUEST_FIELD_TR);          /* TR is the only selector that can never be unusable. */
     6351        Assert(idxSel != VMX_VMCS16_GUEST_TR_SEL);          /* TR is the only selector that can never be unusable. */
    63526352
    63536353        /* Masking off: X86DESCATTR_P, X86DESCATTR_LIMIT_HIGH, and X86DESCATTR_AVL. The latter two are really irrelevant. */
     
    63686368#ifdef VMX_USE_CACHED_VMCS_ACCESSES
    63696369# define VMXLOCAL_READ_SEG(Sel, CtxSel) \
    6370     hmR0VmxReadSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_##Sel, VMX_VMCS32_GUEST_##Sel##_LIMIT, \
     6370    hmR0VmxReadSegmentReg(pVCpu, VMX_VMCS16_GUEST_##Sel##_SEL, VMX_VMCS32_GUEST_##Sel##_LIMIT, \
    63716371                          VMX_VMCS_GUEST_##Sel##_BASE_CACHE_IDX, VMX_VMCS32_GUEST_##Sel##_ACCESS_RIGHTS, &pMixedCtx->CtxSel)
    63726372#else
    63736373# define VMXLOCAL_READ_SEG(Sel, CtxSel) \
    6374     hmR0VmxReadSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_##Sel, VMX_VMCS32_GUEST_##Sel##_LIMIT, \
     6374    hmR0VmxReadSegmentReg(pVCpu, VMX_VMCS16_GUEST_##Sel##_SEL, VMX_VMCS32_GUEST_##Sel##_LIMIT, \
    63756375                          VMX_VMCS_GUEST_##Sel##_BASE, VMX_VMCS32_GUEST_##Sel##_ACCESS_RIGHTS, &pMixedCtx->CtxSel)
    63766376#endif
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