VirtualBox

Changeset 10832 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jul 23, 2008 2:18:23 PM (17 years ago)
Author:
vboxsync
Message:

TPR shadow changes.

File:
1 edited

Legend:

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

    r10828 r10832  
    280280    /** @note VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_MWAIT_EXIT might cause a vmlaunch failure with an invalid control fields error. (combined with some other exit reasons) */
    281281
    282 #if HC_ARCH_BITS == 64
    283     if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW)
    284     {
    285         /* CR8 reads from the APIC shadow page; writes cause an exit is they lower the TPR below the threshold */
    286         val |= VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW;
    287         Assert(pVM->hwaccm.s.vmx.pAPIC);
    288     }
    289     else
    290         /* Exit on CR8 reads & writes in case the TPR shadow feature isn't present. */
    291         val |= VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_STORE_EXIT | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_LOAD_EXIT;
    292 #endif
    293282    /* Mask away the bits that the CPU doesn't support */
    294283    /** @todo make sure they don't conflict with the above requirements. */
     
    1002991        rc = VMXWriteVMCS(VMX_VMCS_GUEST_GS_BASE, pCtx->gsHid.u64Base);
    1003992        AssertRC(rc);
     993
     994#if HC_ARCH_BITS == 64
     995        if (!(pVM->hwaccm.s.vmx.proc_ctls & (VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_STORE_EXIT | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_LOAD_EXIT)))
     996        {
     997            if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW)
     998            {
     999                /* CR8 reads from the APIC shadow page; writes cause an exit is they lower the TPR below the threshold */
     1000                pVM->hwaccm.s.vmx.proc_ctls |= VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW;
     1001                Assert(pVM->hwaccm.s.vmx.pAPIC);
     1002            }
     1003            else
     1004                /* Exit on CR8 reads & writes in case the TPR shadow feature isn't present. */
     1005                pVM->hwaccm.s.vmx.proc_ctls |= VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_STORE_EXIT | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_LOAD_EXIT;
     1006
     1007            rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVM->hwaccm.s.vmx.proc_ctls);
     1008            AssertRC(rc);
     1009        }
     1010#endif
     1011
    10041012    }
    10051013    else
    10061014    {
     1015#if HC_ARCH_BITS == 64
     1016        if (pVM->hwaccm.s.vmx.proc_ctls & (VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_STORE_EXIT | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_LOAD_EXIT))
     1017        {
     1018            pVM->hwaccm.s.vmx.proc_ctls &= ~(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_TPR_SHADOW | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_STORE_EXIT | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_LOAD_EXIT);
     1019
     1020            rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVM->hwaccm.s.vmx.proc_ctls);
     1021            AssertRC(rc);
     1022        }
     1023#endif
    10071024        pVM->hwaccm.s.vmx.pfnStartVM  = VMXR0StartVM32;
    10081025    }
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