- Timestamp:
- Nov 14, 2014 1:46:38 PM (10 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/TMAllCpu.cpp
r53235 r53325 267 267 /* The source is the real TSC. */ 268 268 if (pVM->tm.s.fTSCVirtualized) 269 *poffRealTSC = pVCpu->tm.s.offTSCRawSrc;269 *poffRealTSC = 0 - pVCpu->tm.s.offTSCRawSrc; 270 270 else 271 271 *poffRealTSC = 0; … … 365 365 /* The source is the real TSC. */ 366 366 if (pVM->tm.s.fTSCVirtualized) 367 *poffRealTSC = pVCpu->tm.s.offTSCRawSrc;367 *poffRealTSC = 0 - pVCpu->tm.s.offTSCRawSrc; 368 368 else 369 369 *poffRealTSC = 0; -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r53235 r53325 2263 2263 uint64_t u64LastTick = TMCpuTickGetLastSeen(pVCpu); 2264 2264 2265 if (u64CurTSC -pVmcb->ctrl.u64TSCOffset >= TMCpuTickGetLastSeen(pVCpu))2265 if (u64CurTSC + pVmcb->ctrl.u64TSCOffset >= TMCpuTickGetLastSeen(pVCpu)) 2266 2266 { 2267 2267 pVmcb->ctrl.u32InterceptCtrl1 &= ~SVM_CTRL1_INTERCEPT_RDTSC; … … 3199 3199 } 3200 3200 3201 /** @todo Last-seen-tick shouldn't be necessary when TM supports invariant 3202 * mode. */ 3201 3203 if (!(pVmcb->ctrl.u32InterceptCtrl1 & SVM_CTRL1_INTERCEPT_RDTSC)) 3202 { 3203 /** @todo Find a way to fix hardcoding a guestimate. */ 3204 TMCpuTickSetLastSeen(pVCpu, ASMReadTSC() - pVmcb->ctrl.u64TSCOffset - 0x400); 3205 } 3204 TMCpuTickSetLastSeen(pVCpu, ASMReadTSC() + pVmcb->ctrl.u64TSCOffset); 3206 3205 3207 3206 STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatInGC, &pVCpu->hm.s.StatExit1, x); -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r53235 r53325 5630 5630 { 5631 5631 uint64_t u64CurTSC = ASMReadTSC(); 5632 if (u64CurTSC -pVCpu->hm.s.vmx.u64TSCOffset >= TMCpuTickGetLastSeen(pVCpu))5632 if (u64CurTSC + pVCpu->hm.s.vmx.u64TSCOffset >= TMCpuTickGetLastSeen(pVCpu)) 5633 5633 { 5634 5634 /* Note: VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT takes precedence over TSC_OFFSET, applies to RDTSCP too. */ 5635 rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_TSC_OFFSET_FULL, 0 - pVCpu->hm.s.vmx.u64TSCOffset);AssertRC(rc);5635 rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_TSC_OFFSET_FULL, pVCpu->hm.s.vmx.u64TSCOffset); AssertRC(rc); 5636 5636 5637 5637 pVCpu->hm.s.vmx.u32ProcCtls &= ~VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT; … … 8707 8707 pVmxTransient->fVectoringDoublePF = false; /* Vectoring double page-fault needs to be determined later. */ 8708 8708 8709 /** @todo Last-seen-tick shouldn't be necessary when TM supports invariant 8710 * mode. */ 8709 8711 if (!(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT)) 8710 { 8711 /** @todo Find a way to fix hardcoding a guestimate. */ 8712 TMCpuTickSetLastSeen(pVCpu, ASMReadTSC() - pVCpu->hm.s.vmx.u64TSCOffset 8713 - 0x400 /* guestimate of world switch overhead in clock ticks */); 8714 } 8712 TMCpuTickSetLastSeen(pVCpu, ASMReadTSC() + pVCpu->hm.s.vmx.u64TSCOffset); 8715 8713 8716 8714 STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatInGC, &pVCpu->hm.s.StatExit1, x);
Note:
See TracChangeset
for help on using the changeset viewer.