Changeset 53196 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Nov 4, 2014 12:52:21 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r53193 r53196 5620 5620 fOffsettedTsc = TMCpuTickCanUseRealTSC(pVCpu, &pVCpu->hm.s.vmx.u64TSCOffset, &fParavirtTsc); 5621 5621 5622 #if 15623 5622 if (fParavirtTsc) 5624 5623 { 5625 #if 1 5624 /** @todo this is a hack until TM switches to pure-offsetting mode. */ 5626 5625 uint64_t const u64CurTsc = ASMReadTSC(); 5627 5626 uint64_t const u64LastTick = TMCpuTickGetLastSeen(pVCpu); 5628 if (u64CurTsc +pVCpu->hm.s.vmx.u64TSCOffset < u64LastTick)5629 { 5630 pVCpu->hm.s.vmx.u64TSCOffset = (u64LastTick - u64CurTsc);5627 if (u64CurTsc - pVCpu->hm.s.vmx.u64TSCOffset < u64LastTick) 5628 { 5629 pVCpu->hm.s.vmx.u64TSCOffset = u64CurTsc - u64LastTick; 5631 5630 STAM_COUNTER_INC(&pVCpu->hm.s.StatTscOffsetAdjusted); 5632 5631 } 5633 5632 5634 Assert(u64CurTsc + pVCpu->hm.s.vmx.u64TSCOffset >= u64LastTick); 5635 #endif 5633 Assert(u64CurTsc - pVCpu->hm.s.vmx.u64TSCOffset >= u64LastTick); 5636 5634 rc = GIMR0UpdateParavirtTsc(pVM, pVCpu->hm.s.vmx.u64TSCOffset); 5637 5635 AssertRC(rc); … … 5643 5641 STAM_COUNTER_INC(&pVCpu->hm.s.StatTscParavirt); 5644 5642 } 5645 else 5646 #else 5647 if (fParavirtTsc) 5648 STAM_COUNTER_INC(&pVCpu->hm.s.StatTscParavirt); 5649 #endif 5650 if (fOffsettedTsc) 5643 else if (fOffsettedTsc) 5651 5644 { 5652 5645 uint64_t u64CurTSC = ASMReadTSC(); 5653 if (u64CurTSC +pVCpu->hm.s.vmx.u64TSCOffset >= TMCpuTickGetLastSeen(pVCpu))5646 if (u64CurTSC - pVCpu->hm.s.vmx.u64TSCOffset >= TMCpuTickGetLastSeen(pVCpu)) 5654 5647 { 5655 5648 /* Note: VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT takes precedence over TSC_OFFSET, applies to RDTSCP too. */ 5656 rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_TSC_OFFSET_FULL, pVCpu->hm.s.vmx.u64TSCOffset);AssertRC(rc);5649 rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_TSC_OFFSET_FULL, -pVCpu->hm.s.vmx.u64TSCOffset); AssertRC(rc); 5657 5650 5658 5651 pVCpu->hm.s.vmx.u32ProcCtls &= ~VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT; … … 8731 8724 { 8732 8725 /** @todo Find a way to fix hardcoding a guestimate. */ 8733 TMCpuTickSetLastSeen(pVCpu, ASMReadTSC() 8734 + pVCpu->hm.s.vmx.u64TSCOffset - 0x400/* guestimate of world switch overhead in clock ticks */);8726 TMCpuTickSetLastSeen(pVCpu, ASMReadTSC() - pVCpu->hm.s.vmx.u64TSCOffset 8727 - 0x400 /* guestimate of world switch overhead in clock ticks */); 8735 8728 } 8736 8729
Note:
See TracChangeset
for help on using the changeset viewer.