Changeset 42561 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Aug 2, 2012 10:34:05 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevHPET.cpp
r42555 r42561 266 266 } 267 267 268 DECLINLINE(uint32_t) hpetTimeAfter32(uint64_t a, uint64_t b)269 {270 return ((int32_t)(b) - (int32_t)(a) <= 0);271 }272 273 DECLINLINE(uint32_t) hpetTimeAfter64(uint64_t a, uint64_t b)274 {275 return ((int64_t)(b) - (int64_t)(a) <= 0);276 }277 278 268 DECLINLINE(uint64_t) hpetTicksToNs(HpetState *pThis, uint64_t value) 279 269 { … … 347 337 static void hpetAdjustComparator(HpetTimer *pHpetTimer, uint64_t u64Now) 348 338 { 349 uint64_t u64Period = pHpetTimer->u64Period; 350 if ( (pHpetTimer->u64Config & HPET_TN_PERIODIC) 351 && u64Period != 0) 352 { 353 /* While loop is suboptimal */ 354 if (hpet32bitTimer(pHpetTimer)) 355 { 356 while (hpetTimeAfter32(u64Now, pHpetTimer->u64Cmp)) 357 pHpetTimer->u64Cmp = (uint32_t)(pHpetTimer->u64Cmp + u64Period); 358 } 359 else 360 { 361 while (hpetTimeAfter64(u64Now, pHpetTimer->u64Cmp)) 362 pHpetTimer->u64Cmp += u64Period; 363 } 364 } 339 uint64_t u64Period = pHpetTimer->u64Period; 340 341 if ((pHpetTimer->u64Config & HPET_TN_PERIODIC) && u64Period) 342 { 343 uint64_t cPeriods = (u64Now - pHpetTimer->u64Cmp) / u64Period; 344 345 pHpetTimer->u64Cmp += (cPeriods + 1) * u64Period; 346 } 365 347 } 366 348 … … 571 553 572 554 if (pHpetTimer->u64Config & HPET_TN_PERIODIC) 573 {574 u32NewValue &= hpetInvalidValue(pHpetTimer) >> 1; /** @todo check this in the docs and add a not why? */575 555 pHpetTimer->u64Period = RT_MAKE_U64(u32NewValue, RT_HI_U32(pHpetTimer->u64Period)); 576 }577 556 pHpetTimer->u64Cmp = RT_MAKE_U64(u32NewValue, RT_HI_U32(pHpetTimer->u64Cmp)); 578 557 pHpetTimer->u64Config &= ~HPET_TN_SETVAL;
Note:
See TracChangeset
for help on using the changeset viewer.