VirtualBox

Changeset 66254 in vbox


Ignore:
Timestamp:
Mar 27, 2017 3:18:10 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
114175
Message:

VMM: Nested Hw.virt: SVM: Update EFER and EFER.LMA on VMRUN.

File:
1 edited

Legend:

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

    r66233 r66254  
    315315            }
    316316
     317            /** @todo gPAT MSR validation? */
     318
    317319            /*
    318320             * Copy segments from nested-guest VMCB state to the guest-CPU state.
     
    352354                return HMSvmNstGstVmExit(pVCpu, pCtx, SVM_EXIT_INVALID, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */);
    353355            }
    354             Assert(   !(uValidEfer & MSR_K6_EFER_LME)
    355                    ||  VmcbNstGst.u64CR0 & X86_CR0_PG);
    356356            bool const fSvm                     = RT_BOOL(uValidEfer & MSR_K6_EFER_SVME);
    357357            bool const fLongModeSupported       = RT_BOOL(pVM->cpum.ro.GuestFeatures.fLongMode);
    358             bool const fLongModeActiveOrEnabled = RT_BOOL(uValidEfer & (MSR_K6_EFER_LME | MSR_K6_EFER_LMA));
    359358            bool const fLongModeEnabled         = RT_BOOL(uValidEfer & MSR_K6_EFER_LME);
    360359            bool const fPaging                  = RT_BOOL(VmcbNstGst.u64CR0 & X86_CR0_PG);
     
    363362            bool const fLongModeWithPaging      = fLongModeEnabled && fPaging;
    364363            bool const fLongModeConformCS       = pCtx->cs.Attr.n.u1Long && pCtx->cs.Attr.n.u1DefBig;
     364            /* Adjust EFER.LMA (this is normally done by the CPU when system software writes CR0). */
     365            if (fLongModeWithPaging)
     366                uValidEfer |= MSR_K6_EFER_LMA;
     367            bool const fLongModeActiveOrEnabled = RT_BOOL(uValidEfer & (MSR_K6_EFER_LME | MSR_K6_EFER_LMA));
    365368            if (   !fSvm
    366369                || (!fLongModeSupported && fLongModeActiveOrEnabled)
     
    382385             * nested-guest (or the guest).
    383386             *
    384              *   - VMCPU_FF_INHIBIT_INTERRUPTS needn't be preserved as it's for a single
     387             *   - VMCPU_FF_INHIBIT_INTERRUPTS need not be preserved as it's for a single
    385388             *     instruction which is this VMRUN instruction itself.
    386389             *
     
    419422            pCtx->idtr.cbIdt = VmcbNstGst.IDTR.u32Limit;
    420423            pCtx->idtr.pIdt  = VmcbNstGst.IDTR.u64Base;
    421             pCtx->cr0        = VmcbNstGst.u64CR0;
     424            pCtx->cr0        = VmcbNstGst.u64CR0;   /** @todo What about informing PGM about CR0.WP? */
    422425            pCtx->cr4        = VmcbNstGst.u64CR4;
    423426            pCtx->cr3        = VmcbNstGst.u64CR3;
     
    429432            pCtx->rsp        = VmcbNstGst.u64RSP;
    430433            pCtx->rip        = VmcbNstGst.u64RIP;
     434            pCtx->msrEFER    = uValidEfer;
    431435
    432436            /* Mask DR6, DR7 bits mandatory set/clear bits. */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette