VirtualBox

source: vbox/trunk/src/VBox/VMM/TMInternal.h@ 19486

Last change on this file since 19486 was 19486, checked in by vboxsync, 16 years ago

TM: Added lock stubbing for debugging purposes (disabled).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 21.4 KB
Line 
1/* $Id: TMInternal.h 19486 2009-05-07 12:57:32Z vboxsync $ */
2/** @file
3 * TM - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ___TMInternal_h
23#define ___TMInternal_h
24
25#include <VBox/cdefs.h>
26#include <VBox/types.h>
27#include <iprt/time.h>
28#include <iprt/timer.h>
29#include <VBox/stam.h>
30#include <VBox/pdmcritsect.h>
31
32__BEGIN_DECLS
33
34
35/** @defgroup grp_tm_int Internal
36 * @ingroup grp_tm
37 * @internal
38 * @{
39 */
40
41/** Frequency of the real clock. */
42#define TMCLOCK_FREQ_REAL UINT32_C(1000)
43/** Frequency of the virtual clock. */
44#define TMCLOCK_FREQ_VIRTUAL UINT32_C(1000000000)
45
46
47/**
48 * Timer type.
49 */
50typedef enum TMTIMERTYPE
51{
52 /** Device timer. */
53 TMTIMERTYPE_DEV = 1,
54 /** Driver timer. */
55 TMTIMERTYPE_DRV,
56 /** Internal timer . */
57 TMTIMERTYPE_INTERNAL,
58 /** External timer. */
59 TMTIMERTYPE_EXTERNAL
60} TMTIMERTYPE;
61
62/**
63 * Timer state
64 */
65typedef enum TMTIMERSTATE
66{
67 /** Timer is stopped. */
68 TMTIMERSTATE_STOPPED = 1,
69 /** Timer is active. */
70 TMTIMERSTATE_ACTIVE,
71 /** Timer is expired, is being delivered. */
72 TMTIMERSTATE_EXPIRED,
73
74 /** Timer is stopped but still in the active list.
75 * Currently in the ScheduleTimers list. */
76 TMTIMERSTATE_PENDING_STOP,
77 /** Timer is stopped but needs unlinking from the ScheduleTimers list.
78 * Currently in the ScheduleTimers list. */
79 TMTIMERSTATE_PENDING_STOP_SCHEDULE,
80 /** Timer is being modified and will soon be pending scheduling.
81 * Currently in the ScheduleTimers list. */
82 TMTIMERSTATE_PENDING_SCHEDULE_SET_EXPIRE,
83 /** Timer is pending scheduling.
84 * Currently in the ScheduleTimers list. */
85 TMTIMERSTATE_PENDING_SCHEDULE,
86 /** Timer is being modified and will soon be pending rescheduling.
87 * Currently in the ScheduleTimers list and the active list. */
88 TMTIMERSTATE_PENDING_RESCHEDULE_SET_EXPIRE,
89 /** Timer is modified and is now pending rescheduling.
90 * Currently in the ScheduleTimers list and the active list. */
91 TMTIMERSTATE_PENDING_RESCHEDULE,
92 /** Timer is destroyed but needs to be replaced from the
93 * active to the free list.
94 * Currently in the ScheduleTimers list and the active list. */
95 TMTIMERSTATE_PENDING_STOP_DESTROY,
96 /** Timer is destroyed but needs moving to the free list.
97 * Currently in the ScheduleTimers list. */
98 TMTIMERSTATE_PENDING_DESTROY,
99 /** Timer is free. */
100 TMTIMERSTATE_FREE
101} TMTIMERSTATE;
102
103
104/**
105 * Internal representation of a timer.
106 *
107 * For correct serialization (without the use of semaphores and
108 * other blocking/slow constructs) certain rules applies to updating
109 * this structure:
110 * - For thread other than EMT only u64Expire, enmState and pScheduleNext*
111 * are changeable. Everything else is out of bounds.
112 * - Updating of u64Expire timer can only happen in the TMTIMERSTATE_STOPPED
113 * and TMTIMERSTATE_PENDING_RESCHEDULING_SET_EXPIRE states.
114 * - Timers in the TMTIMERSTATE_EXPIRED state are only accessible from EMT.
115 * - Actual destruction of a timer can only be done at scheduling time.
116 */
117typedef struct TMTIMER
118{
119 /** Expire time. */
120 volatile uint64_t u64Expire;
121 /** Clock to apply to u64Expire. */
122 TMCLOCK enmClock;
123 /** Timer callback type. */
124 TMTIMERTYPE enmType;
125 /** Type specific data. */
126 union
127 {
128 /** TMTIMERTYPE_DEV. */
129 struct
130 {
131 /** Callback. */
132 R3PTRTYPE(PFNTMTIMERDEV) pfnTimer;
133 /** Device instance. */
134 PPDMDEVINSR3 pDevIns;
135 } Dev;
136
137 /** TMTIMERTYPE_DRV. */
138 struct
139 {
140 /** Callback. */
141 R3PTRTYPE(PFNTMTIMERDRV) pfnTimer;
142 /** Device instance. */
143 R3PTRTYPE(PPDMDRVINS) pDrvIns;
144 } Drv;
145
146 /** TMTIMERTYPE_INTERNAL. */
147 struct
148 {
149 /** Callback. */
150 R3PTRTYPE(PFNTMTIMERINT) pfnTimer;
151 /** User argument. */
152 RTR3PTR pvUser;
153 } Internal;
154
155 /** TMTIMERTYPE_EXTERNAL. */
156 struct
157 {
158 /** Callback. */
159 R3PTRTYPE(PFNTMTIMEREXT) pfnTimer;
160 /** User data. */
161 RTR3PTR pvUser;
162 } External;
163 } u;
164
165 /** Timer state. */
166 volatile TMTIMERSTATE enmState;
167 /** Timer relative offset to the next timer in the schedule list. */
168 int32_t offScheduleNext;
169
170 /** Timer relative offset to the next timer in the chain. */
171 int32_t offNext;
172 /** Timer relative offset to the previous timer in the chain. */
173 int32_t offPrev;
174
175 /** Pointer to the next timer in the list of created or free timers. (TM::pTimers or TM::pFree) */
176 PTMTIMERR3 pBigNext;
177 /** Pointer to the previous timer in the list of all created timers. (TM::pTimers) */
178 PTMTIMERR3 pBigPrev;
179 /** Pointer to the timer description. */
180 R3PTRTYPE(const char *) pszDesc;
181 /** Pointer to the VM the timer belongs to - R3 Ptr. */
182 PVMR3 pVMR3;
183 /** Pointer to the VM the timer belongs to - R0 Ptr. */
184 PVMR0 pVMR0;
185 /** Pointer to the VM the timer belongs to - RC Ptr. */
186 PVMRC pVMRC;
187#if HC_ARCH_BITS == 64
188 RTRCPTR padding0; /**< pad structure to multiple of 8 bytes. */
189#endif
190} TMTIMER;
191
192
193/**
194 * Updates a timer state in the correct atomic manner.
195 */
196#if 1
197# define TM_SET_STATE(pTimer, state) \
198 ASMAtomicXchgSize(&(pTimer)->enmState, state)
199#else
200# define TM_SET_STATE(pTimer, state) \
201 do { Log(("%s: %p: %d -> %d\n", __FUNCTION__, (pTimer), (pTimer)->enmState, state)); \
202 ASMAtomicXchgSize(&(pTimer)->enmState, state);\
203 } while (0)
204#endif
205
206/**
207 * Tries to updates a timer state in the correct atomic manner.
208 */
209#if 1
210# define TM_TRY_SET_STATE(pTimer, StateNew, StateOld, fRc) \
211 ASMAtomicCmpXchgSize(&(pTimer)->enmState, StateNew, StateOld, fRc)
212#else
213# define TM_TRY_SET_STATE(pTimer, StateNew, StateOld, fRc) \
214 do { ASMAtomicCmpXchgSize(&(pTimer)->enmState, StateNew, StateOld, fRc); \
215 Log(("%s: %p: %d -> %d %RTbool\n", __FUNCTION__, (pTimer), StateOld, StateNew, fRc)); \
216 } while (0)
217#endif
218
219/** Get the previous timer. */
220#define TMTIMER_GET_PREV(pTimer) ((PTMTIMER)((pTimer)->offPrev ? (intptr_t)(pTimer) + (pTimer)->offPrev : 0))
221/** Get the next timer. */
222#define TMTIMER_GET_NEXT(pTimer) ((PTMTIMER)((pTimer)->offNext ? (intptr_t)(pTimer) + (pTimer)->offNext : 0))
223/** Set the previous timer link. */
224#define TMTIMER_SET_PREV(pTimer, pPrev) ((pTimer)->offPrev = (pPrev) ? (intptr_t)(pPrev) - (intptr_t)(pTimer) : 0)
225/** Set the next timer link. */
226#define TMTIMER_SET_NEXT(pTimer, pNext) ((pTimer)->offNext = (pNext) ? (intptr_t)(pNext) - (intptr_t)(pTimer) : 0)
227
228
229/**
230 * A timer queue.
231 *
232 * This is allocated on the hyper heap.
233 */
234typedef struct TMTIMERQUEUE
235{
236 /** The cached expire time for this queue.
237 * Updated by EMT when scheduling the queue or modifying the head timer.
238 * Assigned UINT64_MAX when there is no head timer. */
239 uint64_t u64Expire;
240 /** Doubly linked list of active timers.
241 *
242 * When no scheduling is pending, this list is will be ordered by expire time (ascending).
243 * Access is serialized by only letting the emulation thread (EMT) do changes.
244 *
245 * The offset is relative to the queue structure.
246 */
247 int32_t offActive;
248 /** List of timers pending scheduling of some kind.
249 *
250 * Timer stats allowed in the list are TMTIMERSTATE_PENDING_STOPPING,
251 * TMTIMERSTATE_PENDING_DESTRUCTION, TMTIMERSTATE_PENDING_STOPPING_DESTRUCTION,
252 * TMTIMERSTATE_PENDING_RESCHEDULING and TMTIMERSTATE_PENDING_SCHEDULE.
253 *
254 * The offset is relative to the queue structure.
255 */
256 int32_t volatile offSchedule;
257 /** The clock for this queue. */
258 TMCLOCK enmClock;
259 /** Pad the structure up to 32 bytes. */
260 uint32_t au32Padding[3];
261} TMTIMERQUEUE;
262
263/** Pointer to a timer queue. */
264typedef TMTIMERQUEUE *PTMTIMERQUEUE;
265
266/** Get the head of the active timer list. */
267#define TMTIMER_GET_HEAD(pQueue) ((PTMTIMER)((pQueue)->offActive ? (intptr_t)(pQueue) + (pQueue)->offActive : 0))
268/** Set the head of the active timer list. */
269#define TMTIMER_SET_HEAD(pQueue, pHead) ((pQueue)->offActive = pHead ? (intptr_t)pHead - (intptr_t)(pQueue) : 0)
270
271
272/**
273 * Converts a TM pointer into a VM pointer.
274 * @returns Pointer to the VM structure the TM is part of.
275 * @param pTM Pointer to TM instance data.
276 */
277#define TM2VM(pTM) ( (PVM)((char*)pTM - pTM->offVM) )
278
279
280/**
281 * TM VM Instance data.
282 * Changes to this must checked against the padding of the cfgm union in VM!
283 */
284typedef struct TM
285{
286 /** Offset to the VM structure.
287 * See TM2VM(). */
288 RTUINT offVM;
289
290 /** Set if we fully virtualize the TSC, i.e. intercept all rdtsc instructions.
291 * Config variable: TSCVirtualized (bool) */
292 bool fTSCVirtualized;
293 /** Set if we use the real TSC as time source or if we use the virtual clock.
294 * If fTSCVirtualized is set we maintain a offset to the TSC and pausing/resuming the
295 * ticking. fTSCVirtualized = false implies fTSCUseRealTSC = true.
296 * Config variable: TSCUseRealTSC (bool) */
297 bool fTSCUseRealTSC;
298 /** Flag indicating that the host TSC is suitable for use in AMD-V and VT-x mode.
299 * Config variable: MaybeUseOffsettedHostTSC (boolean) */
300 bool fMaybeUseOffsettedHostTSC;
301 /** Whether the TSC is tied to the execution of code.
302 * Config variable: TSCTiedToExecution (bool) */
303 bool fTSCTiedToExecution;
304 /** Modifier for fTSCTiedToExecution which pauses the TSC while halting if true.
305 * Config variable: TSCNotTiedToHalt (bool) */
306 bool fTSCNotTiedToHalt;
307 bool afAlignment0[6]; /**< alignment padding */
308 /** The number of CPU clock ticks per second (TMCLOCK_TSC).
309 * Config variable: TSCTicksPerSecond (64-bit unsigned int)
310 * The config variable implies fTSCVirtualized = true and fTSCUseRealTSC = false. */
311 uint64_t cTSCTicksPerSecond;
312
313 /** Virtual time ticking enabled indicator (counter for each VCPU). (TMCLOCK_VIRTUAL) */
314 uint32_t volatile cVirtualTicking;
315 /** Virtual time is not running at 100%. */
316 bool fVirtualWarpDrive;
317 /** Virtual timer synchronous time ticking enabled indicator (bool). (TMCLOCK_VIRTUAL_SYNC) */
318 bool volatile fVirtualSyncTicking;
319 /** Virtual timer synchronous time catch-up active. */
320 bool volatile fVirtualSyncCatchUp;
321 bool afAlignment[5]; /**< alignment padding */
322 /** WarpDrive percentage.
323 * 100% is normal (fVirtualSyncNormal == true). When other than 100% we apply
324 * this percentage to the raw time source for the period it's been valid in,
325 * i.e. since u64VirtualWarpDriveStart. */
326 uint32_t u32VirtualWarpDrivePercentage;
327
328 /** The offset of the virtual clock relative to it's timesource.
329 * Only valid if fVirtualTicking is set. */
330 uint64_t u64VirtualOffset;
331 /** The guest virtual time when fVirtualTicking is cleared. */
332 uint64_t u64Virtual;
333 /** When the Warp drive was started or last adjusted.
334 * Only valid when fVirtualWarpDrive is set. */
335 uint64_t u64VirtualWarpDriveStart;
336 /** The previously returned nano TS.
337 * This handles TSC drift on SMP systems and expired interval.
338 * This is a valid range u64NanoTS to u64NanoTS + 1000000000 (ie. 1sec). */
339 uint64_t volatile u64VirtualRawPrev;
340 /** The ring-3 data structure for the RTTimeNanoTS workers used by tmVirtualGetRawNanoTS. */
341 RTTIMENANOTSDATAR3 VirtualGetRawDataR3;
342 /** The ring-0 data structure for the RTTimeNanoTS workers used by tmVirtualGetRawNanoTS. */
343 RTTIMENANOTSDATAR0 VirtualGetRawDataR0;
344 /** The ring-0 data structure for the RTTimeNanoTS workers used by tmVirtualGetRawNanoTS. */
345 RTTIMENANOTSDATARC VirtualGetRawDataRC;
346 /** Pointer to the ring-3 tmVirtualGetRawNanoTS worker function. */
347 R3PTRTYPE(PFNTIMENANOTSINTERNAL) pfnVirtualGetRawR3;
348 /** Pointer to the ring-3 tmVirtualGetRawNanoTS worker function. */
349 R0PTRTYPE(PFNTIMENANOTSINTERNAL) pfnVirtualGetRawR0;
350 /** Pointer to the ring-3 tmVirtualGetRawNanoTS worker function. */
351 RCPTRTYPE(PFNTIMENANOTSINTERNAL) pfnVirtualGetRawRC;
352 /** Alignment. */
353 RTRCPTR AlignmentRCPtr;
354 /** The guest virtual timer synchronous time when fVirtualSyncTicking is cleared. */
355 uint64_t volatile u64VirtualSync;
356 /** The offset of the timer synchronous virtual clock (TMCLOCK_VIRTUAL_SYNC) relative
357 * to the virtual clock (TMCLOCK_VIRTUAL).
358 * (This is accessed by the timer thread and must be updated atomically.) */
359 uint64_t volatile offVirtualSync;
360 /** The offset into offVirtualSync that's been irrevocably given up by failed catch-up attempts.
361 * Thus the current lag is offVirtualSync - offVirtualSyncGivenUp. */
362 uint64_t offVirtualSyncGivenUp;
363 /** The TMCLOCK_VIRTUAL at the previous TMVirtualGetSync call when catch-up is active. */
364 uint64_t volatile u64VirtualSyncCatchUpPrev;
365 /** The current catch-up percentage. */
366 uint32_t volatile u32VirtualSyncCatchUpPercentage;
367 /** How much slack when processing timers. */
368 uint32_t u32VirtualSyncScheduleSlack;
369 /** When to stop catch-up. */
370 uint64_t u64VirtualSyncCatchUpStopThreshold;
371 /** When to give up catch-up. */
372 uint64_t u64VirtualSyncCatchUpGiveUpThreshold;
373/** @def TM_MAX_CATCHUP_PERIODS
374 * The number of catchup rates. */
375#define TM_MAX_CATCHUP_PERIODS 10
376 /** The agressivness of the catch-up relative to how far we've lagged behind.
377 * The idea is to have increasing catch-up percentage as the lag increases. */
378 struct TMCATCHUPPERIOD
379 {
380 uint64_t u64Start; /**< When this period starts. (u64VirtualSyncOffset). */
381 uint32_t u32Percentage; /**< The catch-up percent to apply. */
382 uint32_t u32Alignment; /**< Structure alignment */
383 } aVirtualSyncCatchUpPeriods[TM_MAX_CATCHUP_PERIODS];
384
385 /** The UTC offset in ns.
386 * This is *NOT* for converting UTC to local time. It is for converting real
387 * world UTC time to VM UTC time. This feature is indented for doing date
388 * testing of software and similar.
389 * @todo Implement warpdrive on UTC. */
390 int64_t offUTC;
391
392 /** Timer queues for the different clock types - R3 Ptr */
393 R3PTRTYPE(PTMTIMERQUEUE) paTimerQueuesR3;
394 /** Timer queues for the different clock types - R0 Ptr */
395 R0PTRTYPE(PTMTIMERQUEUE) paTimerQueuesR0;
396 /** Timer queues for the different clock types - RC Ptr */
397 RCPTRTYPE(PTMTIMERQUEUE) paTimerQueuesRC;
398
399 /** Pointer to our RC mapping of the GIP. */
400 RCPTRTYPE(void *) pvGIPRC;
401 /** Pointer to our R3 mapping of the GIP. */
402 R3PTRTYPE(void *) pvGIPR3;
403
404 /** Pointer to a singly linked list of free timers.
405 * This chain is using the TMTIMER::pBigNext members.
406 * Only accessible from the emulation thread. */
407 PTMTIMERR3 pFree;
408
409 /** Pointer to a doubly linked list of created timers.
410 * This chain is using the TMTIMER::pBigNext and TMTIMER::pBigPrev members.
411 * Only accessible from the emulation thread. */
412 PTMTIMERR3 pCreated;
413
414 /** The schedulation timer timer handle (runtime timer).
415 * This timer will do freqent check on pending queue schedulations and
416 * raise VM_FF_TIMER to pull EMTs attention to them.
417 */
418 R3PTRTYPE(PRTTIMER) pTimer;
419 /** Interval in milliseconds of the pTimer timer. */
420 uint32_t u32TimerMillies;
421
422 /** Makes sure only one EMT is running the queues. */
423 bool volatile fRunningQueues;
424
425 /** Lock serializing EMT access to TM. */
426 PDMCRITSECT EmtLock;
427
428 /** TMR3TimerQueuesDo
429 * @{ */
430 STAMPROFILE StatDoQueues;
431 STAMPROFILEADV StatDoQueuesSchedule;
432 STAMPROFILEADV StatDoQueuesRun;
433 /** @} */
434 /** tmSchedule
435 * @{ */
436 STAMPROFILE StatScheduleOneRZ;
437 STAMPROFILE StatScheduleOneR3;
438 STAMCOUNTER StatScheduleSetFF;
439 STAMCOUNTER StatPostponedR3;
440 STAMCOUNTER StatPostponedRZ;
441 /** @} */
442 /** Read the time
443 * @{ */
444 STAMCOUNTER StatVirtualGet;
445 STAMCOUNTER StatVirtualGetSetFF;
446 STAMCOUNTER StatVirtualGetSync;
447 STAMCOUNTER StatVirtualGetSyncSetFF;
448 STAMCOUNTER StatVirtualPause;
449 STAMCOUNTER StatVirtualResume;
450 /* @} */
451 /** TMTimerPoll
452 * @{ */
453 STAMCOUNTER StatPollAlreadySet;
454 STAMCOUNTER StatPollVirtual;
455 STAMCOUNTER StatPollVirtualSync;
456 STAMCOUNTER StatPollMiss;
457 /** @} */
458 /** TMTimerSet
459 * @{ */
460 STAMPROFILE StatTimerSetRZ;
461 STAMPROFILE StatTimerSetR3;
462 /** @} */
463 /** TMTimerStop
464 * @{ */
465 STAMPROFILE StatTimerStopRZ;
466 STAMPROFILE StatTimerStopR3;
467 /** @} */
468 /** VirtualSync - Running and Catching Up
469 * @{ */
470 STAMCOUNTER StatVirtualSyncRun;
471 STAMCOUNTER StatVirtualSyncRunRestart;
472 STAMPROFILE StatVirtualSyncRunSlack;
473 STAMCOUNTER StatVirtualSyncRunStop;
474 STAMCOUNTER StatVirtualSyncRunStoppedAlready;
475 STAMCOUNTER StatVirtualSyncGiveUp;
476 STAMCOUNTER StatVirtualSyncGiveUpBeforeStarting;
477 STAMPROFILEADV StatVirtualSyncCatchup;
478 STAMCOUNTER aStatVirtualSyncCatchupInitial[TM_MAX_CATCHUP_PERIODS];
479 STAMCOUNTER aStatVirtualSyncCatchupAdjust[TM_MAX_CATCHUP_PERIODS];
480 /** @} */
481 /** The timer callback. */
482 STAMCOUNTER StatTimerCallbackSetFF;
483
484 /** @name Reasons for refusing TSC offsetting in TMCpuTickCanUseRealTSC.
485 * @{ */
486 STAMCOUNTER StatTSCNotFixed;
487 STAMCOUNTER StatTSCNotTicking;
488 STAMCOUNTER StatTSCCatchupLE010;
489 STAMCOUNTER StatTSCCatchupLE025;
490 STAMCOUNTER StatTSCCatchupLE100;
491 STAMCOUNTER StatTSCCatchupOther;
492 STAMCOUNTER StatTSCWarp;
493 STAMCOUNTER StatTSCSyncNotTicking;
494 /** @} */
495} TM;
496/** Pointer to TM VM instance data. */
497typedef TM *PTM;
498
499/**
500 * TM VMCPU Instance data.
501 * Changes to this must checked against the padding of the tm union in VM!
502 */
503typedef struct TMCPU
504{
505 /** Offset to the VMCPU structure.
506 * See TMCPU2VM(). */
507 RTUINT offVMCPU;
508
509 /** CPU timestamp ticking enabled indicator (bool). (RDTSC) */
510 bool fTSCTicking;
511 bool afAlignment0[3]; /**< alignment padding */
512
513 /** The offset between the host TSC and the Guest TSC.
514 * Only valid if fTicking is set and and fTSCUseRealTSC is clear. */
515 uint64_t u64TSCOffset;
516
517 /** The guest TSC when fTicking is cleared. */
518 uint64_t u64TSC;
519
520} TMCPU;
521/** Pointer to TM VMCPU instance data. */
522typedef TMCPU *PTMCPU;
523
524#if 0 /* enable this to rule out locking bugs on single cpu guests. */
525# define tmLock(pVM) VINF_SUCCESS
526# define tmTryLock(pVM) VINF_SUCCESS
527# define tmUnlock(pVM) ((void)0)
528# define TM_ASSERT_EMT_LOCK(pVM) VM_ASSERT_EMT(pVM)
529#else
530int tmLock(PVM pVM);
531int tmTryLock(PVM pVM);
532void tmUnlock(PVM pVM);
533/** Checks that the caller owns the EMT lock. */
534#define TM_ASSERT_EMT_LOCK(pVM) Assert(PDMCritSectIsOwner(&pVM->tm.s.EmtLock))
535#endif
536
537const char *tmTimerState(TMTIMERSTATE enmState);
538void tmTimerQueueSchedule(PVM pVM, PTMTIMERQUEUE pQueue);
539#ifdef VBOX_STRICT
540void tmTimerQueuesSanityChecks(PVM pVM, const char *pszWhere);
541#endif
542
543int tmCpuTickPause(PVM pVM, PVMCPU pVCpu);
544int tmCpuTickResume(PVM pVM, PVMCPU pVCpu);
545
546DECLEXPORT(void) tmVirtualNanoTSBad(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS);
547DECLEXPORT(uint64_t) tmVirtualNanoTSRediscover(PRTTIMENANOTSDATA pData);
548
549
550/** @} */
551
552__END_DECLS
553
554#endif
555
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