Changeset 72079 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 2, 2018 5:15:20 AM (7 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/HMSVMAll.cpp
r72065 r72079 210 210 * using hardware-assisted SVM. 211 211 * 212 * @sa CPUMApplyNestedGuestTscOffset. 212 * @note If you make any changes to this function, please check if 213 * hmR0SvmNstGstUndoTscOffset() needs adjusting. 214 * 215 * @sa CPUMApplyNestedGuestTscOffset(), hmR0SvmNstGstUndoTscOffset(). 213 216 */ 214 217 VMM_INT_DECL(uint64_t) HMSvmNstGstApplyTscOffset(PVMCPU pVCpu, uint64_t uTicks) -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r72066 r72079 4470 4470 } 4471 4471 4472 4472 4473 #ifdef VBOX_WITH_NESTED_HWVIRT 4474 /** 4475 * Undoes the TSC offset applied for an SVM nested-guest and returns the TSC 4476 * value for the guest. 4477 * 4478 * @returns The TSC offset after undoing any nested-guest TSC offset. 4479 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 4480 * @param uTicks The nested-guest TSC. 4481 * 4482 * @note If you make any changes to this function, please check if 4483 * hmR0SvmNstGstUndoTscOffset() needs adjusting. 4484 * 4485 * @sa HMSvmNstGstApplyTscOffset(). 4486 */ 4487 DECLINLINE(uint64_t) hmR0SvmNstGstUndoTscOffset(PVMCPU pVCpu, PCPUMCTX pCtx, uint64_t uTicks) 4488 { 4489 Assert(pCtx->hwvirt.svm.fHMCachedVmcb); RT_NOREF(pCtx); 4490 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache; 4491 return uTicks - pVmcbNstGstCache->u64TSCOffset; 4492 } 4493 4494 4473 4495 /** 4474 4496 * Wrapper for running the nested-guest code in AMD-V. … … 4530 4552 else 4531 4553 { 4532 /* 4533 * Undo what we did in hmR0SvmUpdateTscOffsetting() and HMSvmNstGstApplyTscOffset() 4534 * but don't restore the nested-guest VMCB TSC offset here. It shall eventually be 4535 * restored on #VMEXIT in HMSvmNstGstVmExitNotify(). 4536 */ 4537 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = hmR0SvmGetNestedVmcbCache(pVCpu, pMixedCtx); 4538 TMCpuTickSetLastSeen(pVCpu, uHostTsc + pVmcbCtrl->u64TSCOffset - pVmcbNstGstCache->u64TSCOffset); 4554 /* The nested-guest VMCB TSC offset shall eventually be restored on #VMEXIT via HMSvmNstGstVmExitNotify(). */ 4555 uint64_t const uGstTsc = hmR0SvmNstGstUndoTscOffset(pVCpu, pMixedCtx, uHostTsc + pVmcbCtrl->u64TSCOffset); 4556 TMCpuTickSetLastSeen(pVCpu, uGstTsc); 4539 4557 } 4540 4558 }
Note:
See TracChangeset
for help on using the changeset viewer.