VirtualBox

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

Last change on this file since 4878 was 4787, checked in by vboxsync, 17 years ago

Eliminated HCPTRTYPE and replaced with R3R0PTRTYPE where necessary.

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