VirtualBox

source: vbox/trunk/include/VBox/tm.h@ 2464

Last change on this file since 2464 was 2464, checked in by vboxsync, 18 years ago

Added TMR3UCTNow, exported it as a DevHlp and made VMMDev use it as time source. TMR3UCTNow adjust for lag we intend to catchup so the guest time wont run ahead of real-world time.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.8 KB
Line 
1/** @file
2 * TM - Time Monitor.
3 */
4
5/*
6 * Copyright (C) 2006 InnoTek Systemberatung GmbH
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License as published by the Free Software Foundation,
12 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13 * distribution. VirtualBox OSE is distributed in the hope that it will
14 * be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * If you received this file as part of a commercial VirtualBox
17 * distribution, then only the terms of your commercial VirtualBox
18 * license agreement apply instead of the previous paragraph.
19 */
20
21
22#ifndef __VBox_tm_h__
23#define __VBox_tm_h__
24
25#include <VBox/cdefs.h>
26#include <VBox/types.h>
27#ifdef IN_RING3
28# include <iprt/time.h>
29#endif
30
31__BEGIN_DECLS
32
33/** @defgroup grp_tm The Time Monitor API
34 * @{
35 */
36
37/** Enable a timer hack which improves the timer response/resolution a bit. */
38#define VBOX_HIGH_RES_TIMERS_HACK
39
40
41/**
42 * Clock type.
43 */
44typedef enum TMCLOCK
45{
46 /** Real host time.
47 * This clock ticks all the time, so use with care. */
48 TMCLOCK_REAL = 0,
49 /** Virtual guest time.
50 * This clock only ticks when the guest is running. It's implemented
51 * as an offset to real time. */
52 TMCLOCK_VIRTUAL,
53 /** Virtual guest synchronized timer time.
54 * This is a special clock and timer queue for synchronizing virtual timers and
55 * virtual time sources. This clock is trying to keep up with TMCLOCK_VIRTUAL,
56 * but will wait for timers to be executed. If it lags too far behind TMCLOCK_VIRTUAL,
57 * it will try speed up to close the distance. */
58 TMCLOCK_VIRTUAL_SYNC,
59 /** Virtual CPU timestamp. (Running only when we're executing guest code.) */
60 TMCLOCK_TSC,
61 /** Number of clocks. */
62 TMCLOCK_MAX
63} TMCLOCK;
64
65
66
67/** @name Real Clock Methods
68 * @{
69 */
70/**
71 * Gets the current TMCLOCK_REAL time.
72 *
73 * @returns Real time.
74 * @param pVM The VM handle.
75 */
76TMDECL(uint64_t) TMRealGet(PVM pVM);
77
78/**
79 * Gets the frequency of the TMCLOCK_REAL clock.
80 *
81 * @returns frequency.
82 * @param pVM The VM handle.
83 */
84TMDECL(uint64_t) TMRealGetFreq(PVM pVM);
85/** @} */
86
87
88/** @name Virtual Clock Methods
89 * @{
90 */
91/**
92 * Gets the current TMCLOCK_VIRTUAL time.
93 *
94 * @returns The timestamp.
95 * @param pVM VM handle.
96 *
97 * @remark While the flow of time will never go backwards, the speed of the
98 * progress varies due to inaccurate RTTimeNanoTS and TSC. The latter can be
99 * influenced by power saving (SpeedStep, PowerNow!), while the former
100 * makes use of TSC and kernel timers.
101 */
102TMDECL(uint64_t) TMVirtualGet(PVM pVM);
103
104/**
105 * Gets the current TMCLOCK_VIRTUAL time
106 *
107 * @returns The timestamp.
108 * @param pVM VM handle.
109 * @param fCheckTimers Check timers or not
110 *
111 * @remark While the flow of time will never go backwards, the speed of the
112 * progress varies due to inaccurate RTTimeNanoTS and TSC. The latter can be
113 * influenced by power saving (SpeedStep, PowerNow!), while the former
114 * makes use of TSC and kernel timers.
115 */
116TMDECL(uint64_t) TMVirtualGetEx(PVM pVM, bool fCheckTimers);
117
118/**
119 * Gets the current lag of the synchronous virtual clock (relative to the virtual clock).
120 *
121 * @return The current lag.
122 * @param pVM VM handle.
123 */
124TMDECL(uint64_t) TMVirtualSyncGetLag(PVM pVM);
125
126/**
127 * Get the current catch-up percent.
128 *
129 * @return The current catch0up percent. 0 means running at the same speed as the virtual clock.
130 * @param pVM VM handle.
131 */
132TMDECL(uint32_t) TMVirtualSyncGetCatchUpPct(PVM pVM);
133
134/**
135 * Gets the current TMCLOCK_VIRTUAL frequency.
136 *
137 * @returns The freqency.
138 * @param pVM VM handle.
139 */
140TMDECL(uint64_t) TMVirtualGetFreq(PVM pVM);
141
142/**
143 * Gets the current TMCLOCK_VIRTUAL_SYNC time.
144 *
145 * @returns The timestamp.
146 * @param pVM VM handle.
147 * @thread EMT.
148 */
149TMDECL(uint64_t) TMVirtualSyncGet(PVM pVM);
150
151/**
152 * Resumes the virtual clock.
153 *
154 * @returns VINF_SUCCESS on success.
155 * @returns VINF_INTERNAL_ERROR and VBOX_STRICT assertion if called out of order.
156 * @param pVM VM handle.
157 */
158TMDECL(int) TMVirtualResume(PVM pVM);
159
160/**
161 * Pauses the virtual clock.
162 *
163 * @returns VINF_SUCCESS on success.
164 * @returns VINF_INTERNAL_ERROR and VBOX_STRICT assertion if called out of order.
165 * @param pVM VM handle.
166 */
167TMDECL(int) TMVirtualPause(PVM pVM);
168
169/**
170 * Converts from virtual ticks to nanoseconds.
171 *
172 * @returns nanoseconds.
173 * @param pVM The VM handle.
174 * @param u64VirtualTicks The virtual ticks to convert.
175 * @remark There could be rounding errors here. We just do a simple integere divide
176 * without any adjustments.
177 */
178TMDECL(uint64_t) TMVirtualToNano(PVM pVM, uint64_t u64VirtualTicks);
179
180/**
181 * Converts from virtual ticks to microseconds.
182 *
183 * @returns microseconds.
184 * @param pVM The VM handle.
185 * @param u64VirtualTicks The virtual ticks to convert.
186 * @remark There could be rounding errors here. We just do a simple integere divide
187 * without any adjustments.
188 */
189TMDECL(uint64_t) TMVirtualToMicro(PVM pVM, uint64_t u64VirtualTicks);
190
191/**
192 * Converts from virtual ticks to milliseconds.
193 *
194 * @returns milliseconds.
195 * @param pVM The VM handle.
196 * @param u64VirtualTicks The virtual ticks to convert.
197 * @remark There could be rounding errors here. We just do a simple integere divide
198 * without any adjustments.
199 */
200TMDECL(uint64_t) TMVirtualToMilli(PVM pVM, uint64_t u64VirtualTicks);
201
202/**
203 * Converts from nanoseconds to virtual ticks.
204 *
205 * @returns virtual ticks.
206 * @param pVM The VM handle.
207 * @param u64NanoTS The nanosecond value ticks to convert.
208 * @remark There could be rounding and overflow errors here.
209 */
210TMDECL(uint64_t) TMVirtualFromNano(PVM pVM, uint64_t u64NanoTS);
211
212/**
213 * Converts from microseconds to virtual ticks.
214 *
215 * @returns virtual ticks.
216 * @param pVM The VM handle.
217 * @param u64MicroTS The microsecond value ticks to convert.
218 * @remark There could be rounding and overflow errors here.
219 */
220TMDECL(uint64_t) TMVirtualFromMicro(PVM pVM, uint64_t u64MicroTS);
221
222/**
223 * Converts from milliseconds to virtual ticks.
224 *
225 * @returns virtual ticks.
226 * @param pVM The VM handle.
227 * @param u64MilliTS The millisecond value ticks to convert.
228 * @remark There could be rounding and overflow errors here.
229 */
230TMDECL(uint64_t) TMVirtualFromMilli(PVM pVM, uint64_t u64MilliTS);
231
232/**
233 * Gets the current warp drive percent.
234 *
235 * @returns The warp drive percent.
236 * @param pVM The VM handle.
237 */
238TMDECL(uint32_t) TMVirtualGetWarpDrive(PVM pVM);
239
240/**
241 * Sets the warp drive percent of the virtual time.
242 *
243 * @returns VBox status code.
244 * @param pVM The VM handle.
245 * @param u32Percent The new percentage. 100 means normal operation.
246 */
247TMDECL(int) TMVirtualSetWarpDrive(PVM pVM, uint32_t u32Percent);
248
249/** @} */
250
251
252/** @name CPU Clock Methods
253 * @{
254 */
255/**
256 * Resumes the CPU timestamp counter ticking.
257 *
258 * @returns VBox status code.
259 * @param pVM The VM to operate on.
260 */
261TMDECL(int) TMCpuTickResume(PVM pVM);
262
263/**
264 * Pauses the CPU timestamp counter ticking.
265 *
266 * @returns VBox status code.
267 * @param pVM The VM to operate on.
268 */
269TMDECL(int) TMCpuTickPause(PVM pVM);
270
271/**
272 * Read the current CPU timstamp counter.
273 *
274 * @returns Gets the CPU tsc.
275 * @param pVM The VM to operate on.
276 */
277TMDECL(uint64_t) TMCpuTickGet(PVM pVM);
278
279/**
280 * Returns the TSC offset (virtual TSC - host TSC)
281 *
282 * @returns TSC ofset
283 * @param pVM The VM to operate on.
284 */
285TMDECL(uint64_t) TMCpuTickGetOffset(PVM pVM);
286
287/**
288 * Sets the current CPU timestamp counter.
289 *
290 * @returns VBox status code.
291 * @param pVM The VM to operate on.
292 * @param u64Tick The new timestamp value.
293 */
294TMDECL(int) TMCpuTickSet(PVM pVM, uint64_t u64Tick);
295
296/**
297 * Get the timestamp frequency.
298 *
299 * @returns Number of ticks per second.
300 * @param pVM The VM.
301 */
302TMDECL(uint64_t) TMCpuTicksPerSecond(PVM pVM);
303
304/** @} */
305
306
307/** @name Timer Methods
308 * @{
309 */
310/**
311 * Device timer callback function.
312 *
313 * @param pDevIns Device instance of the device which registered the timer.
314 * @param pTimer The timer handle.
315 */
316typedef DECLCALLBACK(void) FNTMTIMERDEV(PPDMDEVINS pDevIns, PTMTIMER pTimer);
317/** Pointer to a device timer callback function. */
318typedef FNTMTIMERDEV *PFNTMTIMERDEV;
319
320/**
321 * Driver timer callback function.
322 *
323 * @param pDrvIns Device instance of the device which registered the timer.
324 * @param pTimer The timer handle.
325 */
326typedef DECLCALLBACK(void) FNTMTIMERDRV(PPDMDRVINS pDrvIns, PTMTIMER pTimer);
327/** Pointer to a driver timer callback function. */
328typedef FNTMTIMERDRV *PFNTMTIMERDRV;
329
330/**
331 * Service timer callback function.
332 *
333 * @param pSrvIns Service instance of the device which registered the timer.
334 * @param pTimer The timer handle.
335 */
336typedef DECLCALLBACK(void) FNTMTIMERSRV(PPDMSRVINS pSrvIns, PTMTIMER pTimer);
337/** Pointer to a service timer callback function. */
338typedef FNTMTIMERSRV *PFNTMTIMERSRV;
339
340/**
341 * Internal timer callback function.
342 *
343 * @param pVM The VM.
344 * @param pTimer The timer handle.
345 * @param pvUser User argument specified upon timer creation.
346 */
347typedef DECLCALLBACK(void) FNTMTIMERINT(PVM pVM, PTMTIMER pTimer, void *pvUser);
348/** Pointer to internal timer callback function. */
349typedef FNTMTIMERINT *PFNTMTIMERINT;
350
351/**
352 * External timer callback function.
353 *
354 * @param pvUser User argument as specified when the timer was created.
355 */
356typedef DECLCALLBACK(void) FNTMTIMEREXT(void *pvUser);
357/** Pointer to an external timer callback function. */
358typedef FNTMTIMEREXT *PFNTMTIMEREXT;
359
360
361/**
362 * Gets the host context ring-3 pointer of the timer.
363 *
364 * @returns HC R3 pointer.
365 * @param pTimer Timer handle as returned by one of the create functions.
366 */
367TMDECL(PTMTIMERR3) TMTimerR3Ptr(PTMTIMER pTimer);
368
369/**
370 * Gets the host context ring-0 pointer of the timer.
371 *
372 * @returns HC R0 pointer.
373 * @param pTimer Timer handle as returned by one of the create functions.
374 */
375TMDECL(PTMTIMERR0) TMTimerR0Ptr(PTMTIMER pTimer);
376
377/**
378 * Gets the GC pointer of the timer.
379 *
380 * @returns GC pointer.
381 * @param pTimer Timer handle as returned by one of the create functions.
382 */
383TMDECL(PTMTIMERGC) TMTimerGCPtr(PTMTIMER pTimer);
384
385/**
386 * Gets the GC pointer of the timer.
387 *
388 * @returns GC pointer.
389 * @param pTimer Timer handle as returned by one of the create functions.
390 * @deprecated
391 */
392DECLINLINE(PTMTIMERHC) TMTimerHCPtr(PTMTIMER pTimer)
393{
394 return (PTMTIMERHC)TMTimerR3Ptr(pTimer);
395}
396
397/**
398 * Destroy a timer
399 *
400 * @returns VBox status.
401 * @param pTimer Timer handle as returned by one of the create functions.
402 */
403TMDECL(int) TMTimerDestroy(PTMTIMER pTimer);
404
405/**
406 * Arm a timer with a (new) expire time.
407 *
408 * @returns VBox status.
409 * @param pTimer Timer handle as returned by one of the create functions.
410 * @param u64Expire New expire time.
411 */
412TMDECL(int) TMTimerSet(PTMTIMER pTimer, uint64_t u64Expire);
413
414/**
415 * Arm a timer with a (new) expire time relative to current clock.
416 *
417 * @returns VBox status.
418 * @param pTimer Timer handle as returned by one of the create functions.
419 * @param cMilliesToNext Number of millieseconds to the next tick.
420 */
421TMDECL(int) TMTimerSetMillies(PTMTIMER pTimer, uint32_t cMilliesToNext);
422
423/**
424 * Get the current clock time.
425 * Handy for calculating the new expire time.
426 *
427 * @returns Current clock time.
428 * @param pTimer Timer handle as returned by one of the create functions.
429 */
430TMDECL(uint64_t) TMTimerGet(PTMTIMER pTimer);
431
432/**
433 * Get the current clock time as nanoseconds.
434 *
435 * @returns The timer clock as nanoseconds.
436 * @param pTimer Timer handle as returned by one of the create functions.
437 */
438TMDECL(uint64_t) TMTimerGetNano(PTMTIMER pTimer);
439
440/**
441 * Get the current clock time as microseconds.
442 *
443 * @returns The timer clock as microseconds.
444 * @param pTimer Timer handle as returned by one of the create functions.
445 */
446TMDECL(uint64_t) TMTimerGetMicro(PTMTIMER pTimer);
447
448/**
449 * Get the current clock time as milliseconds.
450 *
451 * @returns The timer clock as milliseconds.
452 * @param pTimer Timer handle as returned by one of the create functions.
453 */
454TMDECL(uint64_t) TMTimerGetMilli(PTMTIMER pTimer);
455
456/**
457 * Get the freqency of the timer clock.
458 *
459 * @returns Clock frequency (as Hz of course).
460 * @param pTimer Timer handle as returned by one of the create functions.
461 */
462TMDECL(uint64_t) TMTimerGetFreq(PTMTIMER pTimer);
463
464/**
465 * Get the expire time of the timer.
466 * Only valid for active timers.
467 *
468 * @returns Expire time of the timer.
469 * @param pTimer Timer handle as returned by one of the create functions.
470 */
471TMDECL(uint64_t) TMTimerGetExpire(PTMTIMER pTimer);
472
473/**
474 * Converts the specified timer clock time to nanoseconds.
475 *
476 * @returns nanoseconds.
477 * @param pTimer Timer handle as returned by one of the create functions.
478 * @param u64Ticks The clock ticks.
479 * @remark There could be rounding errors here. We just do a simple integere divide
480 * without any adjustments.
481 */
482TMDECL(uint64_t) TMTimerToNano(PTMTIMER pTimer, uint64_t u64Ticks);
483
484/**
485 * Converts the specified timer clock time to microseconds.
486 *
487 * @returns microseconds.
488 * @param pTimer Timer handle as returned by one of the create functions.
489 * @param u64Ticks The clock ticks.
490 * @remark There could be rounding errors here. We just do a simple integere divide
491 * without any adjustments.
492 */
493TMDECL(uint64_t) TMTimerToMicro(PTMTIMER pTimer, uint64_t u64Ticks);
494
495/**
496 * Converts the specified timer clock time to milliseconds.
497 *
498 * @returns milliseconds.
499 * @param pTimer Timer handle as returned by one of the create functions.
500 * @param u64Ticks The clock ticks.
501 * @remark There could be rounding errors here. We just do a simple integere divide
502 * without any adjustments.
503 */
504TMDECL(uint64_t) TMTimerToMilli(PTMTIMER pTimer, uint64_t u64Ticks);
505
506/**
507 * Converts the specified nanosecond timestamp to timer clock ticks.
508 *
509 * @returns timer clock ticks.
510 * @param pTimer Timer handle as returned by one of the create functions.
511 * @param u64NanoTS The nanosecond value ticks to convert.
512 * @remark There could be rounding and overflow errors here.
513 */
514TMDECL(uint64_t) TMTimerFromNano(PTMTIMER pTimer, uint64_t u64NanoTS);
515
516/**
517 * Converts the specified microsecond timestamp to timer clock ticks.
518 *
519 * @returns timer clock ticks.
520 * @param pTimer Timer handle as returned by one of the create functions.
521 * @param u64MicroTS The microsecond value ticks to convert.
522 * @remark There could be rounding and overflow errors here.
523 */
524TMDECL(uint64_t) TMTimerFromMicro(PTMTIMER pTimer, uint64_t u64MicroTS);
525
526/**
527 * Converts the specified millisecond timestamp to timer clock ticks.
528 *
529 * @returns timer clock ticks.
530 * @param pTimer Timer handle as returned by one of the create functions.
531 * @param u64MilliTS The millisecond value ticks to convert.
532 * @remark There could be rounding and overflow errors here.
533 */
534TMDECL(uint64_t) TMTimerFromMilli(PTMTIMER pTimer, uint64_t u64MilliTS);
535
536
537/**
538 * Stop the timer.
539 * Use TMR3TimerArm() to "un-stop" the timer.
540 *
541 * @returns VBox status.
542 * @param pTimer Timer handle as returned by one of the create functions.
543 */
544TMDECL(int) TMTimerStop(PTMTIMER pTimer);
545
546/**
547 * Checks if a timer is active or not.
548 *
549 * @returns True if active.
550 * @returns False if not active.
551 * @param pTimer Timer handle as returned by one of the create functions.
552 */
553TMDECL(bool) TMTimerIsActive(PTMTIMER pTimer);
554
555/**
556 * Set FF if we've passed the next virtual event.
557 *
558 * This function is called before FFs are checked in the inner execution EM loops.
559 *
560 * @returns Virtual timer ticks to the next event.
561 * @thread The emulation thread.
562 */
563TMDECL(uint64_t) TMTimerPoll(PVM pVM);
564
565/** @} */
566
567
568#ifdef IN_RING3
569/** @defgroup grp_tm_r3 The TM Host Context Ring-3 API
570 * @ingroup grp_tm
571 * @{
572 */
573
574/**
575 * Initializes the TM.
576 *
577 * @returns VBox status code.
578 * @param pVM The VM to operate on.
579 */
580TMR3DECL(int) TMR3Init(PVM pVM);
581
582/**
583 * Applies relocations to data and code managed by this
584 * component. This function will be called at init and
585 * whenever the VMM need to relocate it self inside the GC.
586 *
587 * @param pVM The VM.
588 * @param offDelta Relocation delta relative to old location.
589 */
590TMR3DECL(void) TMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
591
592/**
593 * Terminates the TM.
594 *
595 * Termination means cleaning up and freeing all resources,
596 * the VM it self is at this point powered off or suspended.
597 *
598 * @returns VBox status code.
599 * @param pVM The VM to operate on.
600 */
601TMR3DECL(int) TMR3Term(PVM pVM);
602
603/**
604 * The VM is being reset.
605 *
606 * For the TM component this means that a rescheduling is preformed,
607 * the FF is cleared and but without running the queues. We'll have to
608 * check if this makes sense or not, but it seems like a good idea now....
609 *
610 * @param pVM VM handle.
611 */
612TMR3DECL(void) TMR3Reset(PVM pVM);
613
614/**
615 * Resolve a builtin GC symbol.
616 * Called by PDM when loading or relocating GC modules.
617 *
618 * @returns VBox status
619 * @param pVM VM Handle.
620 * @param pszSymbol Symbol to resolv
621 * @param pGCPtrValue Where to store the symbol value.
622 * @remark This has to work before TMR3Relocate() is called.
623 */
624TMR3DECL(int) TMR3GetImportGC(PVM pVM, const char *pszSymbol, PRTGCPTR pGCPtrValue);
625
626/**
627 * Creates a device timer.
628 *
629 * @returns VBox status.
630 * @param pVM The VM to create the timer in.
631 * @param pDevIns Device instance.
632 * @param enmClock The clock to use on this timer.
633 * @param pfnCallback Callback function.
634 * @param pszDesc Pointer to description string which must stay around
635 * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
636 * @param ppTimer Where to store the timer on success.
637 */
638TMR3DECL(int) TMR3TimerCreateDevice(PVM pVM, PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback, const char *pszDesc, PPTMTIMERHC ppTimer);
639
640/**
641 * Creates a driver timer.
642 *
643 * @returns VBox status.
644 * @param pVM The VM to create the timer in.
645 * @param pDrvIns Driver instance.
646 * @param enmClock The clock to use on this timer.
647 * @param pfnCallback Callback function.
648 * @param pszDesc Pointer to description string which must stay around
649 * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
650 * @param ppTimer Where to store the timer on success.
651 */
652TMR3DECL(int) TMR3TimerCreateDriver(PVM pVM, PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, const char *pszDesc, PPTMTIMERHC ppTimer);
653
654/**
655 * Creates an internal timer.
656 *
657 * @returns VBox status.
658 * @param pVM The VM to create the timer in.
659 * @param enmClock The clock to use on this timer.
660 * @param pfnCallback Callback function.
661 * @param pvUser User argument to be passed to the callback.
662 * @param pszDesc Pointer to description string which must stay around
663 * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
664 * @param ppTimer Where to store the timer on success.
665 */
666TMR3DECL(int) TMR3TimerCreateInternal(PVM pVM, TMCLOCK enmClock, PFNTMTIMERINT pfnCallback, void *pvUser, const char *pszDesc, PPTMTIMERHC ppTimer);
667
668/**
669 * Creates an external timer.
670 *
671 * @returns Timer handle on success.
672 * @returns NULL on failure.
673 * @param pVM The VM to create the timer in.
674 * @param enmClock The clock to use on this timer.
675 * @param pfnCallback Callback function.
676 * @param pvUser User argument.
677 * @param pszDesc Pointer to description string which must stay around
678 * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
679 */
680TMR3DECL(PTMTIMERHC) TMR3TimerCreateExternal(PVM pVM, TMCLOCK enmClock, PFNTMTIMEREXT pfnCallback, void *pvUser, const char *pszDesc);
681
682/**
683 * Destroy all timers owned by a device.
684 *
685 * @returns VBox status.
686 * @param pVM VM handle.
687 * @param pDevIns Device which timers should be destroyed.
688 */
689TMR3DECL(int) TMR3TimerDestroyDevice(PVM pVM, PPDMDEVINS pDevIns);
690
691/**
692 * Destroy all timers owned by a driver.
693 *
694 * @returns VBox status.
695 * @param pVM VM handle.
696 * @param pDrvIns Driver which timers should be destroyed.
697 */
698TMR3DECL(int) TMR3TimerDestroyDriver(PVM pVM, PPDMDRVINS pDrvIns);
699
700/**
701 * Saves the state of a timer to a saved state.
702 *
703 * @returns VBox status.
704 * @param pTimer Timer to save.
705 * @param pSSM Save State Manager handle.
706 */
707TMR3DECL(int) TMR3TimerSave(PTMTIMERHC pTimer, PSSMHANDLE pSSM);
708
709/**
710 * Loads the state of a timer from a saved state.
711 *
712 * @returns VBox status.
713 * @param pTimer Timer to restore.
714 * @param pSSM Save State Manager handle.
715 */
716TMR3DECL(int) TMR3TimerLoad(PTMTIMERHC pTimer, PSSMHANDLE pSSM);
717
718/**
719 * Schedules and runs any pending timers.
720 *
721 * This is normally called from a forced action handler in EMT.
722 *
723 * @param pVM The VM to run the timers for.
724 * @thread The emulation thread.
725 */
726TMR3DECL(void) TMR3TimerQueuesDo(PVM pVM);
727
728/**
729 * Get the real world UCT time adjusted for VM lag.
730 *
731 * @returns pTime.
732 * @param pVM The VM instance.
733 * @param pTime Where to store the time.
734 */
735TMR3DECL(PRTTIMESPEC) TMR3UCTNow(PVM pVM, PRTTIMESPEC pTime);
736
737/** @} */
738#endif
739
740
741#ifdef IN_GC
742/** @defgroup grp_tm_gc The TM Guest Context API
743 * @ingroup grp_tm
744 * @{
745 */
746
747
748/** @} */
749#endif
750
751/** @} */
752
753__END_DECLS
754
755#endif
756
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette