VirtualBox

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


Ignore:
Timestamp:
Jan 11, 2018 6:56:26 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120196
Message:

VMM/HMVMXR0: Enable executing INVPCID in the guest and cause VM-exits when guest attempts to modify CR4.PCIDE bit.

File:
1 edited

Legend:

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

    r70516 r70526  
    25242524        if (pVM->hm.s.fNestedPaging)
    25252525            val |= VMX_VMCS_CTRL_PROC_EXEC2_EPT;                        /* Enable EPT. */
    2526         else
    2527         {
    2528             /*
    2529              * Without Nested Paging, INVPCID should cause a VM-exit. Enabling this bit causes the CPU to refer to
    2530              * VMX_VMCS_CTRL_PROC_EXEC_INVLPG_EXIT when INVPCID is executed by the guest.
    2531              * See Intel spec. 25.4 "Changes to instruction behaviour in VMX non-root operation".
    2532              */
    2533             if (pVM->hm.s.vmx.Msrs.VmxProcCtls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_INVPCID)
    2534                 val |= VMX_VMCS_CTRL_PROC_EXEC2_INVPCID;
    2535         }
     2526
     2527        /*
     2528         * Enable the INVPCID instruction if supported by the hardware and we expose
     2529         * it to the guest. Without this, guest executing INVPCID would cause a #UD.
     2530         */
     2531        if (   (pVM->hm.s.vmx.Msrs.VmxProcCtls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_INVPCID)
     2532            && pVM->cpum.ro.GuestFeatures.fInvpcid)
     2533            val |= VMX_VMCS_CTRL_PROC_EXEC2_INVPCID;
    25362534
    25372535        if (pVM->hm.s.vmx.fVpid)
     
    41424140        if (pVM->cpum.ro.HostFeatures.fXSaveRstor)
    41434141            u32CR4Mask |= X86_CR4_OSXSAVE;
     4142        if (pVM->cpum.ro.GuestFeatures.fPcid)
     4143            u32CR4Mask |= X86_CR4_PCIDE;
    41444144        pVCpu->hm.s.vmx.u32CR4Mask = u32CR4Mask;
    41454145        rc = VMXWriteVmcs32(VMX_VMCS_CTRL_CR4_MASK, u32CR4Mask);
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