Changeset 7115 in vbox for trunk/include/VBox
- Timestamp:
- Feb 25, 2008 3:04:06 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 28363
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/tm.h
r7109 r7115 71 71 * @{ 72 72 */ 73 /**74 * Gets the current TMCLOCK_REAL time.75 *76 * @returns Real time.77 * @param pVM The VM handle.78 */79 73 TMDECL(uint64_t) TMRealGet(PVM pVM); 80 81 /**82 * Gets the frequency of the TMCLOCK_REAL clock.83 *84 * @returns frequency.85 * @param pVM The VM handle.86 */87 74 TMDECL(uint64_t) TMRealGetFreq(PVM pVM); 88 75 /** @} */ … … 92 79 * @{ 93 80 */ 94 /**95 * Gets the current TMCLOCK_VIRTUAL time.96 *97 * @returns The timestamp.98 * @param pVM VM handle.99 *100 * @remark While the flow of time will never go backwards, the speed of the101 * progress varies due to inaccurate RTTimeNanoTS and TSC. The latter can be102 * influenced by power saving (SpeedStep, PowerNow!), while the former103 * makes use of TSC and kernel timers.104 */105 81 TMDECL(uint64_t) TMVirtualGet(PVM pVM); 106 107 /**108 * Gets the current TMCLOCK_VIRTUAL time109 *110 * @returns The timestamp.111 * @param pVM VM handle.112 * @param fCheckTimers Check timers or not113 *114 * @remark While the flow of time will never go backwards, the speed of the115 * progress varies due to inaccurate RTTimeNanoTS and TSC. The latter can be116 * influenced by power saving (SpeedStep, PowerNow!), while the former117 * makes use of TSC and kernel timers.118 */119 82 TMDECL(uint64_t) TMVirtualGetEx(PVM pVM, bool fCheckTimers); 120 121 /**122 * Gets the current lag of the synchronous virtual clock (relative to the virtual clock).123 *124 * @return The current lag.125 * @param pVM VM handle.126 */127 83 TMDECL(uint64_t) TMVirtualSyncGetLag(PVM pVM); 128 129 /**130 * Get the current catch-up percent.131 *132 * @return The current catch0up percent. 0 means running at the same speed as the virtual clock.133 * @param pVM VM handle.134 */135 84 TMDECL(uint32_t) TMVirtualSyncGetCatchUpPct(PVM pVM); 136 137 /**138 * Gets the current TMCLOCK_VIRTUAL frequency.139 *140 * @returns The freqency.141 * @param pVM VM handle.142 */143 85 TMDECL(uint64_t) TMVirtualGetFreq(PVM pVM); 144 145 /**146 * Gets the current TMCLOCK_VIRTUAL_SYNC time.147 *148 * @returns The timestamp.149 * @param pVM VM handle.150 * @param fCheckTimers Check timers or not151 * @thread EMT.152 */153 86 TMDECL(uint64_t) TMVirtualSyncGetEx(PVM pVM, bool fCheckTimers); 154 155 /**156 * Gets the current TMCLOCK_VIRTUAL_SYNC time.157 *158 * @returns The timestamp.159 * @param pVM VM handle.160 * @thread EMT.161 */162 87 TMDECL(uint64_t) TMVirtualSyncGet(PVM pVM); 163 164 /**165 * Resumes the virtual clock.166 *167 * @returns VINF_SUCCESS on success.168 * @returns VINF_INTERNAL_ERROR and VBOX_STRICT assertion if called out of order.169 * @param pVM VM handle.170 */171 88 TMDECL(int) TMVirtualResume(PVM pVM); 172 173 /**174 * Pauses the virtual clock.175 *176 * @returns VINF_SUCCESS on success.177 * @returns VINF_INTERNAL_ERROR and VBOX_STRICT assertion if called out of order.178 * @param pVM VM handle.179 */180 89 TMDECL(int) TMVirtualPause(PVM pVM); 181 182 /**183 * Converts from virtual ticks to nanoseconds.184 *185 * @returns nanoseconds.186 * @param pVM The VM handle.187 * @param u64VirtualTicks The virtual ticks to convert.188 * @remark There could be rounding errors here. We just do a simple integere divide189 * without any adjustments.190 */191 90 TMDECL(uint64_t) TMVirtualToNano(PVM pVM, uint64_t u64VirtualTicks); 192 193 /**194 * Converts from virtual ticks to microseconds.195 *196 * @returns microseconds.197 * @param pVM The VM handle.198 * @param u64VirtualTicks The virtual ticks to convert.199 * @remark There could be rounding errors here. We just do a simple integere divide200 * without any adjustments.201 */202 91 TMDECL(uint64_t) TMVirtualToMicro(PVM pVM, uint64_t u64VirtualTicks); 203 204 /**205 * Converts from virtual ticks to milliseconds.206 *207 * @returns milliseconds.208 * @param pVM The VM handle.209 * @param u64VirtualTicks The virtual ticks to convert.210 * @remark There could be rounding errors here. We just do a simple integere divide211 * without any adjustments.212 */213 92 TMDECL(uint64_t) TMVirtualToMilli(PVM pVM, uint64_t u64VirtualTicks); 214 215 /**216 * Converts from nanoseconds to virtual ticks.217 *218 * @returns virtual ticks.219 * @param pVM The VM handle.220 * @param u64NanoTS The nanosecond value ticks to convert.221 * @remark There could be rounding and overflow errors here.222 */223 93 TMDECL(uint64_t) TMVirtualFromNano(PVM pVM, uint64_t u64NanoTS); 224 225 /**226 * Converts from microseconds to virtual ticks.227 *228 * @returns virtual ticks.229 * @param pVM The VM handle.230 * @param u64MicroTS The microsecond value ticks to convert.231 * @remark There could be rounding and overflow errors here.232 */233 94 TMDECL(uint64_t) TMVirtualFromMicro(PVM pVM, uint64_t u64MicroTS); 234 235 /**236 * Converts from milliseconds to virtual ticks.237 *238 * @returns virtual ticks.239 * @param pVM The VM handle.240 * @param u64MilliTS The millisecond value ticks to convert.241 * @remark There could be rounding and overflow errors here.242 */243 95 TMDECL(uint64_t) TMVirtualFromMilli(PVM pVM, uint64_t u64MilliTS); 244 245 /**246 * Gets the current warp drive percent.247 *248 * @returns The warp drive percent.249 * @param pVM The VM handle.250 */251 96 TMDECL(uint32_t) TMVirtualGetWarpDrive(PVM pVM); 252 253 /**254 * Sets the warp drive percent of the virtual time.255 *256 * @returns VBox status code.257 * @param pVM The VM handle.258 * @param u32Percent The new percentage. 100 means normal operation.259 */260 97 TMDECL(int) TMVirtualSetWarpDrive(PVM pVM, uint32_t u32Percent); 261 262 98 /** @} */ 263 99 … … 266 102 * @{ 267 103 */ 268 /**269 * Resumes the CPU timestamp counter ticking.270 *271 * @returns VBox status code.272 * @param pVM The VM to operate on.273 */274 104 TMDECL(int) TMCpuTickResume(PVM pVM); 275 276 /**277 * Pauses the CPU timestamp counter ticking.278 *279 * @returns VBox status code.280 * @param pVM The VM to operate on.281 */282 105 TMDECL(int) TMCpuTickPause(PVM pVM); 283 284 /**285 * Read the current CPU timstamp counter.286 *287 * @returns Gets the CPU tsc.288 * @param pVM The VM to operate on.289 */290 106 TMDECL(uint64_t) TMCpuTickGet(PVM pVM); 291 292 /**293 * Returns the TSC offset (virtual TSC - host TSC)294 *295 * @returns TSC ofset296 * @param pVM The VM to operate on.297 * @todo Remove this when the code has been switched to TMCpuTickCanUseRealTSC.298 */299 TMDECL(uint64_t) TMCpuTickGetOffset(PVM pVM);300 301 /**302 * Checks if AMD-V / VT-x can use an offsetted hardware TSC or not.303 *304 * @returns true/false accordingly.305 * @param pVM The VM handle.306 * @param poffRealTSC The offset against the TSC of the current CPU.307 * Can be NULL.308 * @thread EMT.309 */310 107 TMDECL(bool) TMCpuTickCanUseRealTSC(PVM pVM, uint64_t *poffRealTSC); 311 312 /**313 * Sets the current CPU timestamp counter.314 *315 * @returns VBox status code.316 * @param pVM The VM to operate on.317 * @param u64Tick The new timestamp value.318 */319 108 TMDECL(int) TMCpuTickSet(PVM pVM, uint64_t u64Tick); 320 321 /**322 * Get the timestamp frequency.323 *324 * @returns Number of ticks per second.325 * @param pVM The VM.326 */327 109 TMDECL(uint64_t) TMCpuTicksPerSecond(PVM pVM); 328 329 110 /** @} */ 330 111 … … 383 164 typedef FNTMTIMEREXT *PFNTMTIMEREXT; 384 165 385 386 /**387 * Gets the host context ring-3 pointer of the timer.388 *389 * @returns HC R3 pointer.390 * @param pTimer Timer handle as returned by one of the create functions.391 */392 166 TMDECL(PTMTIMERR3) TMTimerR3Ptr(PTMTIMER pTimer); 393 394 /**395 * Gets the host context ring-0 pointer of the timer.396 *397 * @returns HC R0 pointer.398 * @param pTimer Timer handle as returned by one of the create functions.399 */400 167 TMDECL(PTMTIMERR0) TMTimerR0Ptr(PTMTIMER pTimer); 401 402 /**403 * Gets the GC pointer of the timer.404 *405 * @returns GC pointer.406 * @param pTimer Timer handle as returned by one of the create functions.407 */408 168 TMDECL(PTMTIMERGC) TMTimerGCPtr(PTMTIMER pTimer); 409 410 411 /**412 * Destroy a timer413 *414 * @returns VBox status.415 * @param pTimer Timer handle as returned by one of the create functions.416 */417 169 TMDECL(int) TMTimerDestroy(PTMTIMER pTimer); 418 419 /**420 * Arm a timer with a (new) expire time.421 *422 * @returns VBox status.423 * @param pTimer Timer handle as returned by one of the create functions.424 * @param u64Expire New expire time.425 */426 170 TMDECL(int) TMTimerSet(PTMTIMER pTimer, uint64_t u64Expire); 427 428 /**429 * Arm a timer with a (new) expire time relative to current clock.430 *431 * @returns VBox status.432 * @param pTimer Timer handle as returned by one of the create functions.433 * @param cMilliesToNext Number of millieseconds to the next tick.434 */435 171 TMDECL(int) TMTimerSetMillies(PTMTIMER pTimer, uint32_t cMilliesToNext); 436 172 TMDECL(int) TMTimerSetMicro(PTMTIMER pTimer, uint64_t cMicrosToNext); 437 173 TMDECL(int) TMTimerSetNano(PTMTIMER pTimer, uint64_t cNanosToNext); 438 439 /**440 * Get the current clock time.441 * Handy for calculating the new expire time.442 *443 * @returns Current clock time.444 * @param pTimer Timer handle as returned by one of the create functions.445 */446 174 TMDECL(uint64_t) TMTimerGet(PTMTIMER pTimer); 447 448 /**449 * Get the current clock time as nanoseconds.450 *451 * @returns The timer clock as nanoseconds.452 * @param pTimer Timer handle as returned by one of the create functions.453 */454 175 TMDECL(uint64_t) TMTimerGetNano(PTMTIMER pTimer); 455 456 /**457 * Get the current clock time as microseconds.458 *459 * @returns The timer clock as microseconds.460 * @param pTimer Timer handle as returned by one of the create functions.461 */462 176 TMDECL(uint64_t) TMTimerGetMicro(PTMTIMER pTimer); 463 464 /**465 * Get the current clock time as milliseconds.466 *467 * @returns The timer clock as milliseconds.468 * @param pTimer Timer handle as returned by one of the create functions.469 */470 177 TMDECL(uint64_t) TMTimerGetMilli(PTMTIMER pTimer); 471 472 /**473 * Get the freqency of the timer clock.474 *475 * @returns Clock frequency (as Hz of course).476 * @param pTimer Timer handle as returned by one of the create functions.477 */478 178 TMDECL(uint64_t) TMTimerGetFreq(PTMTIMER pTimer); 479 480 /**481 * Get the expire time of the timer.482 * Only valid for active timers.483 *484 * @returns Expire time of the timer.485 * @param pTimer Timer handle as returned by one of the create functions.486 */487 179 TMDECL(uint64_t) TMTimerGetExpire(PTMTIMER pTimer); 488 489 /**490 * Converts the specified timer clock time to nanoseconds.491 *492 * @returns nanoseconds.493 * @param pTimer Timer handle as returned by one of the create functions.494 * @param u64Ticks The clock ticks.495 * @remark There could be rounding errors here. We just do a simple integere divide496 * without any adjustments.497 */498 180 TMDECL(uint64_t) TMTimerToNano(PTMTIMER pTimer, uint64_t u64Ticks); 499 500 /**501 * Converts the specified timer clock time to microseconds.502 *503 * @returns microseconds.504 * @param pTimer Timer handle as returned by one of the create functions.505 * @param u64Ticks The clock ticks.506 * @remark There could be rounding errors here. We just do a simple integere divide507 * without any adjustments.508 */509 181 TMDECL(uint64_t) TMTimerToMicro(PTMTIMER pTimer, uint64_t u64Ticks); 510 511 /**512 * Converts the specified timer clock time to milliseconds.513 *514 * @returns milliseconds.515 * @param pTimer Timer handle as returned by one of the create functions.516 * @param u64Ticks The clock ticks.517 * @remark There could be rounding errors here. We just do a simple integere divide518 * without any adjustments.519 */520 182 TMDECL(uint64_t) TMTimerToMilli(PTMTIMER pTimer, uint64_t u64Ticks); 521 522 /**523 * Converts the specified nanosecond timestamp to timer clock ticks.524 *525 * @returns timer clock ticks.526 * @param pTimer Timer handle as returned by one of the create functions.527 * @param u64NanoTS The nanosecond value ticks to convert.528 * @remark There could be rounding and overflow errors here.529 */530 183 TMDECL(uint64_t) TMTimerFromNano(PTMTIMER pTimer, uint64_t u64NanoTS); 531 532 /**533 * Converts the specified microsecond timestamp to timer clock ticks.534 *535 * @returns timer clock ticks.536 * @param pTimer Timer handle as returned by one of the create functions.537 * @param u64MicroTS The microsecond value ticks to convert.538 * @remark There could be rounding and overflow errors here.539 */540 184 TMDECL(uint64_t) TMTimerFromMicro(PTMTIMER pTimer, uint64_t u64MicroTS); 541 542 /**543 * Converts the specified millisecond timestamp to timer clock ticks.544 *545 * @returns timer clock ticks.546 * @param pTimer Timer handle as returned by one of the create functions.547 * @param u64MilliTS The millisecond value ticks to convert.548 * @remark There could be rounding and overflow errors here.549 */550 185 TMDECL(uint64_t) TMTimerFromMilli(PTMTIMER pTimer, uint64_t u64MilliTS); 551 552 /**553 * Stop the timer.554 * Use TMR3TimerArm() to "un-stop" the timer.555 *556 * @returns VBox status.557 * @param pTimer Timer handle as returned by one of the create functions.558 */559 186 TMDECL(int) TMTimerStop(PTMTIMER pTimer); 560 561 /**562 * Checks if a timer is active or not.563 *564 * @returns True if active.565 * @returns False if not active.566 * @param pTimer Timer handle as returned by one of the create functions.567 */568 187 TMDECL(bool) TMTimerIsActive(PTMTIMER pTimer); 569 570 /**571 * Set FF if we've passed the next virtual event.572 *573 * This function is called before FFs are checked in the inner execution EM loops.574 *575 * @returns Virtual timer ticks to the next event.576 * @param pVM Pointer to the shared VM structure.577 * @thread The emulation thread.578 */579 188 TMDECL(uint64_t) TMTimerPoll(PVM pVM); 580 581 /**582 * Set FF if we've passed the next virtual event.583 *584 * This function is called before FFs are checked in the inner execution EM loops.585 *586 * @returns The GIP timestamp of the next event.587 * 0 if the next event has already expired.588 * @param pVM Pointer to the shared VM structure.589 * @param pu64Delta Where to store the delta.590 * @thread The emulation thread.591 */592 189 TMDECL(uint64_t) TMTimerPollGIP(PVM pVM, uint64_t *pu64Delta); 593 190 … … 600 197 * @{ 601 198 */ 602 603 /**604 * Initializes the TM.605 *606 * @returns VBox status code.607 * @param pVM The VM to operate on.608 */609 199 TMR3DECL(int) TMR3Init(PVM pVM); 610 611 /**612 * Finalizes the TM initialization.613 *614 * @returns VBox status code.615 * @param pVM The VM to operate on.616 */617 200 TMR3DECL(int) TMR3InitFinalize(PVM pVM); 618 619 /**620 * Applies relocations to data and code managed by this621 * component. This function will be called at init and622 * whenever the VMM need to relocate it self inside the GC.623 *624 * @param pVM The VM.625 * @param offDelta Relocation delta relative to old location.626 */627 201 TMR3DECL(void) TMR3Relocate(PVM pVM, RTGCINTPTR offDelta); 628 629 /**630 * Terminates the TM.631 *632 * Termination means cleaning up and freeing all resources,633 * the VM it self is at this point powered off or suspended.634 *635 * @returns VBox status code.636 * @param pVM The VM to operate on.637 */638 202 TMR3DECL(int) TMR3Term(PVM pVM); 639 640 /**641 * The VM is being reset.642 *643 * For the TM component this means that a rescheduling is preformed,644 * the FF is cleared and but without running the queues. We'll have to645 * check if this makes sense or not, but it seems like a good idea now....646 *647 * @param pVM VM handle.648 */649 203 TMR3DECL(void) TMR3Reset(PVM pVM); 650 651 /**652 * Resolve a builtin GC symbol.653 * Called by PDM when loading or relocating GC modules.654 *655 * @returns VBox status656 * @param pVM VM Handle.657 * @param pszSymbol Symbol to resolv658 * @param pGCPtrValue Where to store the symbol value.659 * @remark This has to work before TMR3Relocate() is called.660 */661 204 TMR3DECL(int) TMR3GetImportGC(PVM pVM, const char *pszSymbol, PRTGCPTR pGCPtrValue); 662 663 /**664 * Creates a device timer.665 *666 * @returns VBox status.667 * @param pVM The VM to create the timer in.668 * @param pDevIns Device instance.669 * @param enmClock The clock to use on this timer.670 * @param pfnCallback Callback function.671 * @param pszDesc Pointer to description string which must stay around672 * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).673 * @param ppTimer Where to store the timer on success.674 */675 205 TMR3DECL(int) TMR3TimerCreateDevice(PVM pVM, PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback, const char *pszDesc, PPTMTIMERR3 ppTimer); 676 677 /**678 * Creates a driver timer.679 *680 * @returns VBox status.681 * @param pVM The VM to create the timer in.682 * @param pDrvIns Driver instance.683 * @param enmClock The clock to use on this timer.684 * @param pfnCallback Callback function.685 * @param pszDesc Pointer to description string which must stay around686 * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).687 * @param ppTimer Where to store the timer on success.688 */689 206 TMR3DECL(int) TMR3TimerCreateDriver(PVM pVM, PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, const char *pszDesc, PPTMTIMERR3 ppTimer); 690 691 /**692 * Creates an internal timer.693 *694 * @returns VBox status.695 * @param pVM The VM to create the timer in.696 * @param enmClock The clock to use on this timer.697 * @param pfnCallback Callback function.698 * @param pvUser User argument to be passed to the callback.699 * @param pszDesc Pointer to description string which must stay around700 * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).701 * @param ppTimer Where to store the timer on success.702 */703 207 TMR3DECL(int) TMR3TimerCreateInternal(PVM pVM, TMCLOCK enmClock, PFNTMTIMERINT pfnCallback, void *pvUser, const char *pszDesc, PPTMTIMERR3 ppTimer); 704 705 /**706 * Creates an external timer.707 *708 * @returns Timer handle on success.709 * @returns NULL on failure.710 * @param pVM The VM to create the timer in.711 * @param enmClock The clock to use on this timer.712 * @param pfnCallback Callback function.713 * @param pvUser User argument.714 * @param pszDesc Pointer to description string which must stay around715 * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).716 */717 208 TMR3DECL(PTMTIMERR3) TMR3TimerCreateExternal(PVM pVM, TMCLOCK enmClock, PFNTMTIMEREXT pfnCallback, void *pvUser, const char *pszDesc); 718 719 /**720 * Destroy all timers owned by a device.721 *722 * @returns VBox status.723 * @param pVM VM handle.724 * @param pDevIns Device which timers should be destroyed.725 */726 209 TMR3DECL(int) TMR3TimerDestroyDevice(PVM pVM, PPDMDEVINS pDevIns); 727 728 /**729 * Destroy all timers owned by a driver.730 *731 * @returns VBox status.732 * @param pVM VM handle.733 * @param pDrvIns Driver which timers should be destroyed.734 */735 210 TMR3DECL(int) TMR3TimerDestroyDriver(PVM pVM, PPDMDRVINS pDrvIns); 736 737 /**738 * Saves the state of a timer to a saved state.739 *740 * @returns VBox status.741 * @param pTimer Timer to save.742 * @param pSSM Save State Manager handle.743 */744 211 TMR3DECL(int) TMR3TimerSave(PTMTIMERR3 pTimer, PSSMHANDLE pSSM); 745 746 /**747 * Loads the state of a timer from a saved state.748 *749 * @returns VBox status.750 * @param pTimer Timer to restore.751 * @param pSSM Save State Manager handle.752 */753 212 TMR3DECL(int) TMR3TimerLoad(PTMTIMERR3 pTimer, PSSMHANDLE pSSM); 754 755 /**756 * Schedules and runs any pending timers.757 *758 * This is normally called from a forced action handler in EMT.759 *760 * @param pVM The VM to run the timers for.761 * @thread The emulation thread.762 */763 213 TMR3DECL(void) TMR3TimerQueuesDo(PVM pVM); 764 765 /**766 * Get the real world UTC time adjusted for VM lag.767 *768 * @returns pTime.769 * @param pVM The VM instance.770 * @param pTime Where to store the time.771 */772 214 TMR3DECL(PRTTIMESPEC) TMR3UTCNow(PVM pVM, PRTTIMESPEC pTime); 773 774 /** @} */ 215 /** @} */ 216 #endif /* IN_RING3 */ 217 218 219 /** @} */ 220 221 __END_DECLS 222 775 223 #endif 776 224 777 778 #ifdef IN_GC779 /** @defgroup grp_tm_gc The TM Guest Context API780 * @ingroup grp_tm781 * @{782 */783 784 785 /** @} */786 #endif787 788 /** @} */789 790 __END_DECLS791 792 #endif793
Note:
See TracChangeset
for help on using the changeset viewer.