儲存庫 vbox 的更動 34900
- 時間撮記:
- 2010-12-9 下午03:24:38 (14 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/PC/DevPit-i8254.cpp
r34896 r34900 356 356 uint32_t period2; 357 357 358 /* Add one to current_time; if we don't, integer truncation will cause 359 * the algorithm to think that at the end of each period, it's still 360 * within the first one instead of at the beginning of the next one. 361 */ 362 d = ASMMultU64ByU32DivByU32(current_time + 1 - s->count_load_time, PIT_FREQ, TMTimerGetFreq(pTimer)); 358 d = ASMMultU64ByU32DivByU32(current_time - s->count_load_time, PIT_FREQ, TMTimerGetFreq(pTimer)); 363 359 switch(s->mode) { 364 360 default: … … 371 367 break; 372 368 /* 373 * Mode 2: The period is count + 1PIT ticks.369 * Mode 2: The period is 'count' PIT ticks. 374 370 * When the counter reaches 1 we set the output low (for channel 0 that 375 371 * means lowering IRQ0). On the next tick, where we should be decrementing … … 377 373 * means raising IRQ0 again and triggering timer interrupt). 378 374 * 379 * In VBox we simplify the tick cycle between 1 and 0 and immediately trigger 380 * the interrupt. We also don't set it until we reach 0, which is a tick late 381 * - will try to fix that later some day. 375 * In VirtualBox we compress the pulse and flip-flop the IRQ line at the 376 * end of the period, which signals an interrupt at the exact same time. 382 377 */ 383 378 case 2: … … 385 380 #ifndef VBOX /* see above */ 386 381 if ((d - base) == 0 && d != 0) 387 next_time = base + s->count ;382 next_time = base + s->count - 1; 388 383 else 389 384 #endif 390 next_time = base + s->count + 1;385 next_time = base + s->count; 391 386 break; 392 387 case 3: … … 413 408 next_time = s->count_load_time + ASMMultU64ByU32DivByU32(next_time, TMTimerGetFreq(pTimer), PIT_FREQ); 414 409 /* fix potential rounding problems */ 415 /* XXX: better solution: use a clock at PIT_FREQ Hz */416 410 if (next_time <= current_time) 417 next_time = current_time + 1; 418 return next_time; 411 next_time = current_time; 412 /* Add one to next_time; if we don't, integer truncation will cause 413 * the algorithm to think that at the end of each period, it's still 414 * within the first one instead of at the beginning of the next one. 415 */ 416 return next_time + 1; 419 417 } 420 418
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器