Changeset 56952 in vbox
- Timestamp:
- Jul 16, 2015 12:57:28 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101661
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/sup.h
r56817 r56952 552 552 553 553 554 #if 0 /* Not used anywhere. Unsure where this would be useful. */ 554 /** 555 * Worker for SUPIsTscFreqCompatible(). 556 * 557 * @param uBaseCpuHz The reference CPU frequency of the system. 558 * @param uCpuHz The CPU frequency to compare with the base. 559 * 560 * @returns true if it's compatible, false otherwise. 561 * @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) 565 { 566 if (uBaseCpuHz != uCpuHz) 567 { 568 /* Arbitrary tolerance threshold, tweak later if required, perhaps 569 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 if ( uCpuHz < uLo 573 || uCpuHz > uHi) 574 return false; 575 } 576 return true; 577 } 578 579 555 580 /** 556 581 * Checks if the provided TSC frequency is close enough to the computed TSC 557 582 * frequency of the host. 583 * 584 * @param u64CpuHz The TSC frequency to check. 558 585 * 559 586 * @returns true if it's compatible, false otherwise. … … 564 591 if ( pGip 565 592 && pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC) 566 { 567 if (pGip->u64CpuHz != u64CpuHz) 568 { 569 /* Arbitrary tolerance threshold, tweak later if required, perhaps 570 more tolerance on lower frequencies and less tolerance on higher. */ 571 uint64_t uLo = (pGip->u64CpuHz << 10) / 1025; 572 uint64_t uHi = pGip->u64CpuHz + (pGip->u64CpuHz - uLo); 573 if ( u64CpuHz < uLo 574 || u64CpuHz > uHi) 575 return false; 576 } 577 return true; 578 } 593 return SUPIsTscFreqCompatibleEx(pGip->u64CpuHz, u64CpuHz); 579 594 return false; 580 595 } 581 #endif 596 582 597 583 598 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
Note:
See TracChangeset
for help on using the changeset viewer.