Changeset 57059 in vbox for trunk/include/VBox
- Timestamp:
- Jul 23, 2015 1:18:14 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101780
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/sup.h
r57006 r57059 555 555 * Worker for SUPIsTscFreqCompatible(). 556 556 * 557 * @param uBaseCpuHz The reference CPU frequency of the system. 558 * @param uCpuHz The CPU frequency to compare with the base. 557 * @param uBaseCpuHz The reference CPU frequency of the system. 558 * @param uCpuHz The CPU frequency to compare with the base. 559 * @param fRelax Whether to use a more relaxed threshold (like 560 * for when running in a virtualized environment). 559 561 * 560 562 * @returns true if it's compatible, false otherwise. 561 563 * @remarks Don't use directly, use SUPIsTscFreqCompatible() instead. This is 562 * to be used by tstGIP-2 (or the like).563 */ 564 DECLINLINE(bool) SUPIsTscFreqCompatibleEx(uint64_t uBaseCpuHz, uint64_t uCpuHz )564 * to be used by tstGIP-2 or the like. 565 */ 566 DECLINLINE(bool) SUPIsTscFreqCompatibleEx(uint64_t uBaseCpuHz, uint64_t uCpuHz, bool fRelax) 565 567 { 566 568 if (uBaseCpuHz != uCpuHz) … … 568 570 /* Arbitrary tolerance threshold, tweak later if required, perhaps 569 571 more tolerance on lower frequencies and less tolerance on higher. */ 570 uint64_t uLo = (uBaseCpuHz << 11) / 2049; 571 uint64_t uHi = uBaseCpuHz + (uBaseCpuHz - uLo); 572 uint16_t uThr = !fRelax ? 666 /* 0.15% */ : 125 /* 0.8% */; 573 uint64_t uLo = uBaseCpuHz / uThr; 574 uint64_t uHi = uBaseCpuHz + (uBaseCpuHz - uLo); 572 575 if ( uCpuHz < uLo 573 576 || uCpuHz > uHi) … … 583 586 * 584 587 * @param u64CpuHz The TSC frequency to check. 588 * @param fRelax Whether to use a more relaxed threshold (like 589 * for when running in a virtualized environment). 585 590 * 586 591 * @returns true if it's compatible, false otherwise. 587 592 */ 588 DECLINLINE(bool) SUPIsTscFreqCompatible(uint64_t u64CpuHz )593 DECLINLINE(bool) SUPIsTscFreqCompatible(uint64_t u64CpuHz, bool fRelax) 589 594 { 590 595 PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage; 591 596 if ( pGip 592 597 && pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC) 593 return SUPIsTscFreqCompatibleEx(pGip->u64CpuHz, u64CpuHz );598 return SUPIsTscFreqCompatibleEx(pGip->u64CpuHz, u64CpuHz, fRelax); 594 599 return false; 595 600 }
Note:
See TracChangeset
for help on using the changeset viewer.