VirtualBox

Changeset 77410 in vbox


Ignore:
Timestamp:
Feb 21, 2019 3:37:11 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128970
Message:

VMM/IEM: Nested VMX: bugref:9180 Set EFER.LMA in VM-entry control on VM-exit only when the VM-entry succeeds.

File:
1 edited

Legend:

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

    r77408 r77410  
    28322832
    28332833    /*
    2834      * If we support storing EFER.LMA into IA32e-mode guest field on VM-exit, we need to do that now.
    2835      * See Intel spec. 27.2 "Recording VM-exit Information And Updating VM-entry Control".
    2836      */
    2837     if (IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fVmxExitSaveEferLma)
    2838     {
    2839         if (pVCpu->cpum.GstCtx.msrEFER & MSR_K6_EFER_LMA)
    2840             pVmcs->u32EntryCtls |= VMX_ENTRY_CTLS_IA32E_MODE_GUEST;
    2841         else
    2842             pVmcs->u32EntryCtls &= ~VMX_ENTRY_CTLS_IA32E_MODE_GUEST;
    2843     }
    2844 
    2845     /*
    28462834     * Save the guest state back into the VMCS.
    28472835     * We only need to save the state when the VM-entry was successful.
     
    28502838    if (!fVmentryFailed)
    28512839    {
     2840        /*
     2841         * If we support storing EFER.LMA into IA32e-mode guest field on VM-exit, we need to do that now.
     2842         * See Intel spec. 27.2 "Recording VM-exit Information And Updating VM-entry Control".
     2843         *
     2844         * It is not clear from the Intel spec. if this is done only when VM-entry succeeds.
     2845         * If a VM-exit happens before loading guest EFER, we risk restoring the host EFER.LMA
     2846         * as guest-CPU state would not been modified. Hence for now, we do this only when
     2847         * the VM-entry succeeded.
     2848         */
     2849        /** @todo r=ramshankar: Figure out if this bit gets set to host EFER.LMA on real
     2850         *        hardware when VM-exit fails during VM-entry (e.g. VERR_VMX_INVALID_GUEST_STATE). */
     2851        if (IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fVmxExitSaveEferLma)
     2852        {
     2853            if (pVCpu->cpum.GstCtx.msrEFER & MSR_K6_EFER_LMA)
     2854                pVmcs->u32EntryCtls |= VMX_ENTRY_CTLS_IA32E_MODE_GUEST;
     2855            else
     2856                pVmcs->u32EntryCtls &= ~VMX_ENTRY_CTLS_IA32E_MODE_GUEST;
     2857        }
     2858
    28522859        /*
    28532860         * The rest of the high bits of the VM-exit reason are only relevant when the VM-exit
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