VirtualBox

Changeset 75199 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Oct 31, 2018 9:03:20 AM (6 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Save FS, GS before reading the FS/GS base MSRs and also only when the MSR read/write needs them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r75160 r75199  
    1193511935     * MSRs required.  That would require changes to IEM and possibly CPUM too.
    1193611936     * (Should probably do it lazy fashion from CPUMAllMsrs.cpp). */
    11937     uint32_t const idMsr = pVCpu->cpum.GstCtx.ecx;  NOREF(idMsr); /* Save it. */
     11937    uint32_t const idMsr = pVCpu->cpum.GstCtx.ecx;
    1193811938    int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
    1193911939    rc    |= HMVMX_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_EXEC_DECODED_NO_MEM_MASK | CPUMCTX_EXTRN_ALL_MSRS);
     11940    switch (idMsr)
     11941    {
     11942        /* The FS and GS base MSRs are not part of the above all MSRs mask. */
     11943        case MSR_K8_FS_BASE: rc |= HMVMX_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_FS); break;
     11944        case MSR_K8_GS_BASE: rc |= HMVMX_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_GS); break;
     11945    }
    1194011946    AssertRCReturn(rc, rc);
    1194111947
     
    1199412000     * MSRs required.  That would require changes to IEM and possibly CPUM too.
    1199512001     * (Should probably do it lazy fashion from CPUMAllMsrs.cpp). */
    11996     uint32_t const idMsr = pVCpu->cpum.GstCtx.ecx; /* Save it. */
     12002    uint32_t const idMsr = pVCpu->cpum.GstCtx.ecx;
    1199712003    int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
    1199812004    rc    |= HMVMX_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_EXEC_DECODED_NO_MEM_MASK
    11999                                              | CPUMCTX_EXTRN_ALL_MSRS | CPUMCTX_EXTRN_FS | CPUMCTX_EXTRN_GS);
     12005                                             | CPUMCTX_EXTRN_ALL_MSRS);
     12006    switch (idMsr)
     12007    {
     12008        /*
     12009         * The FS and GS base MSRs are not part of the above all MSRs mask.
     12010         *
     12011         * Although we don't need to fetch the base as it will be overwritten shortly, while
     12012         * loading guest-state we would also load the entire segment register including limit
     12013         * and attributes and thus we need to load them here.
     12014         */
     12015        case MSR_K8_FS_BASE: rc |= HMVMX_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_FS); break;
     12016        case MSR_K8_GS_BASE: rc |= HMVMX_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_GS); break;
     12017    }
    1200012018    AssertRCReturn(rc, rc);
    1200112019
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