VirtualBox

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


Ignore:
Timestamp:
Jul 9, 2012 12:52:22 PM (12 years ago)
Author:
vboxsync
Message:

VMM/HWVMXR0: Save/restore IA32_TSC_AUX MSR across VMX non-root ops.

File:
1 edited

Legend:

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

    r42046 r42056  
    30983098
    30993099    TMNotifyStartOfExecution(pVCpu);
     3100
     3101    /*
     3102     * Save the current Host TSC_AUX and write the guest TSC_AUX to the host, so that
     3103     * RDTSCPs (that don't cause exits) reads the guest MSR. See @bugref{3324}.
     3104     */
     3105    if (    (pVCpu->hwaccm.s.vmx.proc_ctls2 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP)
     3106        && !(pVCpu->hwaccm.s.vmx.proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDTSC_EXIT))
     3107    {
     3108        pVCpu->hwaccm.s.vmx.u64HostTSCAux = ASMRdMsr(MSR_K8_TSC_AUX);
     3109        uint64_t u64GuestTSCAux = 0;
     3110        rc2 = CPUMQueryGuestMsr(pVCpu, MSR_K8_TSC_AUX, &u64GuestTSCAux);
     3111        AssertRC(rc2);
     3112        ASMWrMsr(MSR_K8_TSC_AUX, u64GuestTSCAux);
     3113    }
     3114
    31003115#ifdef VBOX_WITH_KERNEL_USING_XMM
    31013116    rc = hwaccmR0VMXStartVMWrapXMM(pVCpu->hwaccm.s.fResumeVM, pCtx, &pVCpu->hwaccm.s.vmx.VMCSCache, pVM, pVCpu, pVCpu->hwaccm.s.vmx.pfnStartVM);
     
    31053120    ASMAtomicWriteBool(&pVCpu->hwaccm.s.fCheckedTLBFlush, false);
    31063121    ASMAtomicIncU32(&pVCpu->hwaccm.s.cWorldSwitchExits);
     3122
     3123    /*
     3124     * Restore host's TSC_AUX.
     3125     */
     3126    if (    (pVCpu->hwaccm.s.vmx.proc_ctls2 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP)
     3127        && !(pVCpu->hwaccm.s.vmx.proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDTSC_EXIT))
     3128    {
     3129        ASMWrMsr(MSR_K8_TSC_AUX, pVCpu->hwaccm.s.vmx.u64HostTSCAux);
     3130    }
     3131
    31073132    /* Possibly the last TSC value seen by the guest (too high) (only when we're in TSC offset mode). */
    31083133    if (!(pVCpu->hwaccm.s.vmx.proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDTSC_EXIT))
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