VirtualBox

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

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

TMR3TimerDestroy: rewrite to ring-3 only.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 21.4 KB
Line 
1/* $Id: TMInternal.h 19537 2009-05-08 18:09:57Z 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 <iprt/assert.h>
30#include <VBox/stam.h>
31#include <VBox/pdmcritsect.h>
32
33__BEGIN_DECLS
34
35
36/** @defgroup grp_tm_int Internal
37 * @ingroup grp_tm
38 * @internal
39 * @{
40 */
41
42/** Frequency of the real clock. */
43#define TMCLOCK_FREQ_REAL UINT32_C(1000)
44/** Frequency of the virtual clock. */
45#define TMCLOCK_FREQ_VIRTUAL UINT32_C(1000000000)
46
47
48/**
49 * Timer type.
50 */
51typedef enum TMTIMERTYPE
52{
53 /** Device timer. */
54 TMTIMERTYPE_DEV = 1,
55 /** Driver timer. */
56 TMTIMERTYPE_DRV,
57 /** Internal timer . */
58 TMTIMERTYPE_INTERNAL,
59 /** External timer. */
60 TMTIMERTYPE_EXTERNAL
61} TMTIMERTYPE;
62
63/**
64 * Timer state
65 */
66typedef enum TMTIMERSTATE
67{
68 /** Timer is stopped. */
69 TMTIMERSTATE_STOPPED = 1,
70 /** Timer is active. */
71 TMTIMERSTATE_ACTIVE,
72 /** Timer is expired, is being delivered. */
73 TMTIMERSTATE_EXPIRED,
74
75 /** Timer is stopped but still in the active list.
76 * Currently in the ScheduleTimers list. */
77 TMTIMERSTATE_PENDING_STOP,
78 /** Timer is stopped but needs unlinking from the ScheduleTimers list.
79 * Currently in the ScheduleTimers list. */
80 TMTIMERSTATE_PENDING_STOP_SCHEDULE,
81 /** Timer is being modified and will soon be pending scheduling.
82 * Currently in the ScheduleTimers list. */
83 TMTIMERSTATE_PENDING_SCHEDULE_SET_EXPIRE,
84 /** Timer is pending scheduling.
85 * Currently in the ScheduleTimers list. */
86 TMTIMERSTATE_PENDING_SCHEDULE,
87 /** Timer is being modified and will soon be pending rescheduling.
88 * Currently in the ScheduleTimers list and the active list. */
89 TMTIMERSTATE_PENDING_RESCHEDULE_SET_EXPIRE,
90 /** Timer is modified and is now pending rescheduling.
91 * Currently in the ScheduleTimers list and the active list. */
92 TMTIMERSTATE_PENDING_RESCHEDULE,
93 /** Timer is being destroyed. */
94 TMTIMERSTATE_DESTROY,
95 /** Timer is free. */
96 TMTIMERSTATE_FREE
97} TMTIMERSTATE;
98
99
100/**
101 * Internal representation of a timer.
102 *
103 * For correct serialization (without the use of semaphores and
104 * other blocking/slow constructs) certain rules applies to updating
105 * this structure:
106 * - For thread other than EMT only u64Expire, enmState and pScheduleNext*
107 * are changeable. Everything else is out of bounds.
108 * - Updating of u64Expire timer can only happen in the TMTIMERSTATE_STOPPED
109 * and TMTIMERSTATE_PENDING_RESCHEDULING_SET_EXPIRE states.
110 * - Timers in the TMTIMERSTATE_EXPIRED state are only accessible from EMT.
111 * - Actual destruction of a timer can only be done at scheduling time.
112 */
113typedef struct TMTIMER
114{
115 /** Expire time. */
116 volatile uint64_t u64Expire;
117 /** Clock to apply to u64Expire. */
118 TMCLOCK enmClock;
119 /** Timer callback type. */
120 TMTIMERTYPE enmType;
121 /** Type specific data. */
122 union
123 {
124 /** TMTIMERTYPE_DEV. */
125 struct
126 {
127 /** Callback. */
128 R3PTRTYPE(PFNTMTIMERDEV) pfnTimer;
129 /** Device instance. */
130 PPDMDEVINSR3 pDevIns;
131 } Dev;
132
133 /** TMTIMERTYPE_DRV. */
134 struct
135 {
136 /** Callback. */
137 R3PTRTYPE(PFNTMTIMERDRV) pfnTimer;
138 /** Device instance. */
139 R3PTRTYPE(PPDMDRVINS) pDrvIns;
140 } Drv;
141
142 /** TMTIMERTYPE_INTERNAL. */
143 struct
144 {
145 /** Callback. */
146 R3PTRTYPE(PFNTMTIMERINT) pfnTimer;
147 /** User argument. */
148 RTR3PTR pvUser;
149 } Internal;
150
151 /** TMTIMERTYPE_EXTERNAL. */
152 struct
153 {
154 /** Callback. */
155 R3PTRTYPE(PFNTMTIMEREXT) pfnTimer;
156 /** User data. */
157 RTR3PTR pvUser;
158 } External;
159 } u;
160
161 /** Timer state. */
162 volatile TMTIMERSTATE enmState;
163 /** Timer relative offset to the next timer in the schedule list. */
164 int32_t volatile offScheduleNext;
165
166 /** Timer relative offset to the next timer in the chain. */
167 int32_t offNext;
168 /** Timer relative offset to the previous timer in the chain. */
169 int32_t offPrev;
170
171 /** Pointer to the next timer in the list of created or free timers. (TM::pTimers or TM::pFree) */
172 PTMTIMERR3 pBigNext;
173 /** Pointer to the previous timer in the list of all created timers. (TM::pTimers) */
174 PTMTIMERR3 pBigPrev;
175 /** Pointer to the timer description. */
176 R3PTRTYPE(const char *) pszDesc;
177 /** Pointer to the VM the timer belongs to - R3 Ptr. */
178 PVMR3 pVMR3;
179 /** Pointer to the VM the timer belongs to - R0 Ptr. */
180 PVMR0 pVMR0;
181 /** Pointer to the VM the timer belongs to - RC Ptr. */
182 PVMRC pVMRC;
183#if HC_ARCH_BITS == 64
184 RTRCPTR padding0; /**< pad structure to multiple of 8 bytes. */
185#endif
186} TMTIMER;
187AssertCompileMemberSize(TMTIMER, enmState, sizeof(uint32_t));
188
189
190/**
191 * Updates a timer state in the correct atomic manner.
192 */
193#if 1
194# define TM_SET_STATE(pTimer, state) \
195 ASMAtomicWriteU32((uint32_t volatile *)&(pTimer)->enmState, state)
196#else
197# define TM_SET_STATE(pTimer, state) \
198 do { \
199 uint32_t uOld1 = (pTimer)->enmState; \
200 Log(("%s: %p: %d -> %d\n", __FUNCTION__, (pTimer), (pTimer)->enmState, state)); \
201 uint32_t uOld2 = ASMAtomicXchgU32((uint32_t volatile *)&(pTimer)->enmState, state); \
202 Assert(uOld1 == uOld2); \
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 (fRc) = ASMAtomicCmpXchgU32((uint32_t volatile *)&(pTimer)->enmState, StateNew, StateOld)
212#else
213# define TM_TRY_SET_STATE(pTimer, StateNew, StateOld, fRc) \
214 do { (fRc) = ASMAtomicCmpXchgU32((uint32_t volatile *)&(pTimer)->enmState, StateNew, StateOld); \
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