VirtualBox

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

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

Implementing timer syncrhonous virtual clock.

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