Changeset 53269 in vbox for trunk/include/VBox
- Timestamp:
- Nov 7, 2014 5:41:01 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 96841
- Location:
- trunk/include/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/sup.h
r53214 r53269 310 310 /** The timestamp of the last time we update the update frequency. */ 311 311 volatile uint64_t u64NanoTSLastUpdateHz; 312 /** The TSC frequency of the system. */ 313 uint64_t u64CpuHz; 312 314 /** The set of online CPUs. */ 313 315 RTCPUSET OnlineCpuSet; … … 322 324 /** The highest number of CPUs possible. */ 323 325 uint16_t cPossibleCpus; 324 /** The highest number of CPUs possible. */325 326 uint16_t u16Padding0; 326 327 /** The max CPU ID (RTMpGetMaxCpuId). */ … … 328 329 329 330 /** Padding / reserved space for future data. */ 330 uint32_t au32Padding1[2 9];331 uint32_t au32Padding1[27]; 331 332 332 333 /** Table indexed by the CPU APIC ID to get the CPU table index. */ … … 360 361 * Upper 16 bits is the major version. Major version is only changed with 361 362 * incompatible changes in the GIP. */ 362 #define SUPGLOBALINFOPAGE_VERSION 0x000 40000363 #define SUPGLOBALINFOPAGE_VERSION 0x00050000 363 364 364 365 /** … … 1467 1468 1468 1469 /** 1470 * Gets the GIP mode name given the GIP mode. 1471 * 1472 * @returns The name 1473 * @param enmGipMode The GIP mode. 1474 */ 1475 DECLINLINE(const char *) SUPGetGIPModeName(PSUPGLOBALINFOPAGE pGip) 1476 { 1477 Assert(pGip); 1478 switch (pGip->u32Mode) 1479 { 1480 /* case SUPGIPMODE_INVARIANT_TSC: return "Invariant"; */ 1481 case SUPGIPMODE_SYNC_TSC: return "Synchronous"; 1482 case SUPGIPMODE_ASYNC_TSC: return "Asynchronous"; 1483 case SUPGIPMODE_INVALID: return "Invalid"; 1484 default: return "???"; 1485 } 1486 } 1487 1488 1489 /** 1490 * Checks if the provided TSC frequency is close enough to the computed TSC 1491 * frequency of the host. 1492 * 1493 * @returns true if it's compatible, false otherwise. 1494 */ 1495 DECLINLINE(bool) SUPIsTscFreqCompatible(uint64_t u64CpuHz) 1496 { 1497 PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage; 1498 if ( pGip 1499 && pGip->u32Mode == SUPGIPMODE_SYNC_TSC) /** @todo use INVARIANT_TSC */ 1500 { 1501 uint64_t uLo; 1502 uint64_t uHi; 1503 1504 if (pGip->u64CpuHz == u64CpuHz) 1505 return true; 1506 1507 /* Arbitrary tolerance threshold, tweak later if required, perhaps 1508 more tolerance on higher frequencies and less tolerance on lower. */ 1509 uLo = (pGip->u64CpuHz << 10) / 1025; 1510 uHi = pGip->u64CpuHz + (pGip->u64CpuHz - uLo); 1511 if ( u64CpuHz < uLo 1512 || u64CpuHz > uHi) 1513 { 1514 return false; 1515 } 1516 return true; 1517 } 1518 return false; 1519 } 1520 1521 1522 1523 /** 1469 1524 * Applies the TSC delta to the supplied raw TSC value. 1470 1525 * … … 1478 1533 * @remarks Maybe called with interrupts disabled! 1479 1534 */ 1480 DECLINLINE(int) SUPTscDeltaApply(PSUPGLOBALINFOPAGE pGip, uint64_t *puTsc, uint16_t idApic, bool * fDeltaApplied)1535 DECLINLINE(int) SUPTscDeltaApply(PSUPGLOBALINFOPAGE pGip, uint64_t *puTsc, uint16_t idApic, bool *pfDeltaApplied) 1481 1536 { 1482 1537 PSUPGIPCPU pGipCpu; … … 1487 1542 Assert(pGip); 1488 1543 1544 AssertMsgReturn(idApic < RT_ELEMENTS(pGip->aiCpuFromApicId), ("idApic=%u\n", idApic), VERR_INVALID_CPU_ID); 1489 1545 iCpu = pGip->aiCpuFromApicId[idApic]; 1490 1546 AssertMsgReturn(iCpu < pGip->cCpus, ("iCpu=%u cCpus=%u\n", iCpu, pGip->cCpus), VERR_INVALID_CPU_INDEX); … … 1495 1551 { 1496 1552 *puTsc -= pGipCpu->i64TSCDelta; 1497 if ( fDeltaApplied)1498 * fDeltaApplied = true;1553 if (pfDeltaApplied) 1554 *pfDeltaApplied = true; 1499 1555 } 1500 else if ( fDeltaApplied)1501 * fDeltaApplied = false;1556 else if (pfDeltaApplied) 1557 *pfDeltaApplied = false; 1502 1558 1503 1559 return VINF_SUCCESS; -
trunk/include/VBox/sup.mac
r52618 r53269 58 58 .u32UpdateIntervalNS resd 1 59 59 .u64NanoTSLastUpdateHz resq 1 60 .u64CpuHz resq 1 60 61 .OnlineCpuSet resq 4 61 62 .PresentCpuSet resq 4 … … 66 67 .u16Padding0 resw 1 67 68 .idCpuMax resd 1 68 .au32Padding1 resd 2 969 .au32Padding1 resd 27 69 70 .aiCpuFromApicId resw 256 70 71 .aiCpuFromCpuSetIdx resw 256
Note:
See TracChangeset
for help on using the changeset viewer.