summaryrefslogtreecommitdiff
path: root/src/VBox/Devices/VMMDev/VMMDevState.h
blob: 48cdea24b78a060cfdef23f059627b7b575e5293 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
/* $Id$ */
/** @file
 * VMMDev - Guest <-> VMM/Host communication device, internal header.
 */

/*
 * Copyright (C) 2006-2022 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

#ifndef VBOX_INCLUDED_SRC_VMMDev_VMMDevState_h
#define VBOX_INCLUDED_SRC_VMMDev_VMMDevState_h
#ifndef RT_WITHOUT_PRAGMA_ONCE
# pragma once
#endif

#include <VBoxVideo.h>  /* For VBVA definitions. */
#include <VBox/VMMDev.h>
#include <VBox/vmm/pdmdev.h>
#include <VBox/vmm/pdmifs.h>
#ifndef VBOX_WITHOUT_TESTING_FEATURES
# include <VBox/vmm/pdmthread.h>
# include <iprt/test.h>
# include <VBox/VMMDevTesting.h>
#endif

#include <iprt/list.h>
#include <iprt/memcache.h>


#define VMMDEV_WITH_ALT_TIMESYNC

/** Request locking structure (HGCM optimization). */
typedef struct VMMDEVREQLOCK
{
    void          *pvReq;
    PGMPAGEMAPLOCK Lock;
} VMMDEVREQLOCK;
/** Pointer to a request lock structure. */
typedef VMMDEVREQLOCK *PVMMDEVREQLOCK;

typedef struct DISPLAYCHANGEREQUEST
{
    bool fPending;
    bool afAlignment[3];
    VMMDevDisplayDef displayChangeRequest;
    VMMDevDisplayDef lastReadDisplayChangeRequest;
} DISPLAYCHANGEREQUEST;

typedef struct DISPLAYCHANGEDATA
{
    /* Which monitor is being reported to the guest. */
    int32_t iCurrentMonitor;

    /** true if the guest responded to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST at least once */
    bool fGuestSentChangeEventAck;
    bool afAlignment[3];

    DISPLAYCHANGEREQUEST aRequests[VBOX_VIDEO_MAX_SCREENS];
} DISPLAYCHANGEDATA;


/**
 * Credentials for automatic guest logon and host configured logon (?).
 *
 * This is not stored in the same block as the instance data in order to make it
 * harder to access.
 */
typedef struct VMMDEVCREDS
{
    /** credentials for guest logon purposes */
    struct
    {
        char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
        char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
        char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
        bool fAllowInteractiveLogon;
    } Logon;

    /** credentials for verification by guest */
    struct
    {
        char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
        char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
        char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
    } Judge;
} VMMDEVCREDS;


/**
 * Facility status entry.
 */
typedef struct VMMDEVFACILITYSTATUSENTRY
{
    /** The facility (may contain values other than the defined ones). */
    VBoxGuestFacilityType       enmFacility;
    /** The status (may contain values other than the defined ones). */
    VBoxGuestFacilityStatus     enmStatus;
    /** Whether this entry is fixed and cannot be reused when inactive. */
    bool                        fFixed;
    /** Explicit alignment padding / reserved for future use. MBZ. */
    bool                        afPadding[3];
    /** The facility flags (yet to be defined). */
    uint32_t                    fFlags;
    /** Last update timestamp. */
    RTTIMESPEC                  TimeSpecTS;
} VMMDEVFACILITYSTATUSENTRY;
/** Pointer to a facility status entry. */
typedef VMMDEVFACILITYSTATUSENTRY *PVMMDEVFACILITYSTATUSENTRY;


/**
 * State structure for the VMM device.
 */
typedef struct VMMDEV
{
    /** The critical section for this device.
     * @remarks We use this rather than the default one, it's simpler with all
     *          the driver interfaces where we have to waste time digging out the
     *          PDMDEVINS structure. */
    PDMCRITSECT         CritSect;
#if !defined(VBOX_WITHOUT_TESTING_FEATURES) || defined(DOXYGEN_RUNNING)
    /** Read write critical section of lock testing.
     * @remarks At the beginning to satisfy 64 byte alignment requirement.  */
    PDMCRITSECTRW       CritSectRw;
#endif

    /** mouse capabilities of host and guest */
    uint32_t            fMouseCapabilities;
    /** @name Absolute mouse position in pixels
     * @{ */
    int32_t             xMouseAbs;
    int32_t             yMouseAbs;
    /** @} */
    /** Does the guest currently want the host pointer to be shown? */
    uint32_t            fHostCursorRequested;

    /** message buffer for backdoor logging. */
    char                szMsg[512];
    /** message buffer index. */
    uint32_t            offMsg;
    /** Alignment padding. */
    uint32_t            u32Alignment2;

    /** Statistics counter for slow IRQ ACK. */
    STAMCOUNTER         StatSlowIrqAck;
    /** Statistics counter for fast IRQ ACK - R3. */
    STAMCOUNTER         StatFastIrqAckR3;
    /** Statistics counter for fast IRQ ACK - R0 / RC. */
    STAMCOUNTER         StatFastIrqAckRZ;
    /** Current host side event flags - VMMDEV_EVENT_XXX. */
    uint32_t            fHostEventFlags;
    /** Mask of events guest is interested in - VMMDEV_EVENT_XXX.
     * @note The HGCM events are enabled automatically by the VMMDev device when
     *       guest issues HGCM commands. */
    uint32_t            fGuestFilterMask;
    /** Delayed mask of guest events - VMMDEV_EVENT_XXX. */
    uint32_t            fNewGuestFilterMask;
    /** Flag whether fNewGuestFilterMask is valid */
    bool                fNewGuestFilterMaskValid;
    /** Alignment padding. */
    bool                afAlignment3[3];

    /** Information reported by guest via VMMDevReportGuestInfo generic request.
     * Until this information is reported the VMMDev refuses any other requests.
     */
    VBoxGuestInfo       guestInfo;
    /** Information report \#2, chewed a little. */
    struct
    {
        uint32_t            uFullVersion; /**< non-zero if info is present. */
        uint32_t            uRevision;
        uint32_t            fFeatures;
        char                szName[128];
    }                   guestInfo2;

    /** Array of guest facility statuses. */
    VMMDEVFACILITYSTATUSENTRY aFacilityStatuses[32];
    /** The number of valid entries in the facility status array. */
    uint32_t            cFacilityStatuses;

    /** Information reported by guest via VMMDevReportGuestCapabilities - VMMDEV_GUEST_SUPPORTS_XXX. */
    uint32_t            fGuestCaps;

    /** "Additions are Ok" indicator, set to true after processing VMMDevReportGuestInfo,
     * if additions version is compatible. This flag is here to avoid repeated comparing
     * of the version in guestInfo.
     */
    uint32_t            fu32AdditionsOk;

    /** Video acceleration status set by guest. */
    uint32_t            u32VideoAccelEnabled;

    DISPLAYCHANGEDATA   displayChangeData;

    /** memory balloon change request */
    uint32_t            cMbMemoryBalloon;
    /** The last balloon size queried by the guest additions. */
    uint32_t            cMbMemoryBalloonLast;

    /** guest ram size */
    uint64_t            cbGuestRAM;

    /** unique session id; the id will be different after each start, reset or restore of the VM. */
    uint64_t            idSession;

    /** Statistics interval in seconds.  */
    uint32_t            cSecsStatInterval;
    /** The statistics interval last returned to the guest. */
    uint32_t            cSecsLastStatInterval;

    /** Whether seamless is enabled or not. */
    bool                fSeamlessEnabled;
    /** The last fSeamlessEnabled state returned to the guest. */
    bool                fLastSeamlessEnabled;
    bool                afAlignment5[1];

    bool                fVRDPEnabled;
    uint32_t            uVRDPExperienceLevel;

#ifdef VMMDEV_WITH_ALT_TIMESYNC
    uint64_t            msLatchedHostTime;
    bool                fTimesyncBackdoorLo;
    bool                afAlignment6[1];
#else
    bool                afAlignment6[2];
#endif

    /** Set if guest should be allowed to trigger state save and power off.  */
    bool                fAllowGuestToSaveState;
    /** Set if GetHostTime should fail.
     * Loaded from the GetHostTimeDisabled configuration value. */
    bool                fGetHostTimeDisabled;
    /** Set if backdoor logging should be disabled (output will be ignored then) */
    bool                fBackdoorLogDisabled;
    /** Don't clear credentials */
    bool                fKeepCredentials;
    /** Heap enabled. */
    bool                fHeapEnabled;

    /** Guest Core Dumping enabled. */
    bool                fGuestCoreDumpEnabled;
    /** Guest Core Dump location. */
    char                szGuestCoreDumpDir[RTPATH_MAX];
    /** Number of additional cores to keep around. */
    uint32_t            cGuestCoreDumps;

    /** FLag whether CPU hotplug events are monitored */
    bool                fCpuHotPlugEventsEnabled;
    /** Alignment padding. */
    bool                afPadding8[3];
    /** CPU hotplug event */
    VMMDevCpuEventType  enmCpuHotPlugEvent;
    /** Core id of the CPU to change */
    uint32_t            idCpuCore;
    /** Package id of the CPU to change */
    uint32_t            idCpuPackage;

    uint32_t            StatMemBalloonChunks;

    /** @name Heartbeat
     * @{ */
    /** Timestamp of the last heartbeat from guest in nanosec. */
    uint64_t volatile   nsLastHeartbeatTS;
    /** Indicates whether we missed HB from guest on last check. */
    bool volatile       fFlatlined;
    /** Indicates whether heartbeat check is active. */
    bool volatile       fHeartbeatActive;
    /** Alignment padding. */
    bool                afAlignment8[6];
    /** Guest heartbeat interval in nanoseconds.
     * This is the interval the guest is told to produce heartbeats at. */
    uint64_t            cNsHeartbeatInterval;
    /** The amount of time without a heartbeat (nanoseconds) before we
     * conclude the guest is doing a Dixie Flatline (Neuromancer) impression. */
    uint64_t            cNsHeartbeatTimeout;
    /** Timer for signalling a flatlined guest. */
    TMTIMERHANDLE       hFlatlinedTimer;
    /** @} */

    /** @name Testing
     * @{ */
    /** Set if testing is enabled. */
    bool                fTestingEnabled;
    /** Set if testing the MMIO testing range is enabled. */
    bool                fTestingMMIO;
#if defined(VBOX_WITHOUT_TESTING_FEATURES) && !defined(DOXYGEN_RUNNING)
    /** Alignment padding. */
    bool                afPadding9[2];
#else
    /** The amount of readable testing data (for query response). */
    uint16_t            cbReadableTestingData;
    /** The high timestamp value. */
    uint32_t            u32TestingHighTimestamp;
    /** The current testing command (VMMDEV_TESTING_CMD_XXX). */
    uint32_t            u32TestingCmd;
    /** The testing data offset (command specific). */
    uint32_t            offTestingData;
    /** For buffering the what comes in over the testing data port. */
    union
    {
        /** Plain byte view. */
        uint8_t         ab[1024];

        /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
         *  VMMDEV_TESTING_CMD_FAILED. */
        struct
        {
            char        sz[1024];
        } String, Init, SubNew, Failed;

        /** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
        struct
        {
            uint32_t    c;
        } Error, Term, SubDone;

        /** VMMDEV_TESTING_CMD_VALUE. */
        struct
        {
            RTUINT64U   u64Value;
            uint32_t    u32Unit;
            char        szName[1024 - 8 - 4];
        } Value;

        /** A 8-bit VMMDEV_TESTING_QUERY_CFG response. */
        uint8_t         b;
        /** A 32-bit VMMDEV_TESTING_QUERY_CFG response. */
        uint32_t        u32;

        /** The read back register (VMMDEV_TESTING_MMIO_OFF_READBACK,
         *  VMMDEV_TESTING_MMIO_OFF_READBACK_R3). */
        uint8_t         abReadBack[VMMDEV_TESTING_READBACK_SIZE];
    } TestingData;
    /** The locking testing control dword. */
    union
    {
        /** Plain view. */
        uint64_t        u64;
        /** Plain 32-bit view. */
        uint32_t        au32[2];
        struct
        {
            /** bits 15:0: Number of microseconds to hold the lock. */
            uint32_t    cUsHold : 16;
            /** bits 31:16: Number of microseconds to wait before retaking the lock again. */
            uint32_t    cUsBetween : 16;
            /** bits 51:32: Kilo (1024) ticks the EMT should hold the lock for. */
            uint32_t    cKiloTicksEmtHold : 20;
            /** bits 57:52: Reserved MBZ. */
            uint32_t    uReserved : 6;
            /** bit 58: Thread takes lock in shared mode when set, exclusive when clear.  */
            uint32_t    fThreadShared : 1;
            /** bit 59: EMT takes lock in shared mode when set, exclusive when clear.  */
            uint32_t    fEmtShared : 1;
            /** bit 60: Use read/write critical section instead of regular.  */
            uint32_t    fReadWriteSection : 1;
            /** bit 61: EMT passes VINF_SUCCESS as rcBusy if set. */
            uint32_t    fMustSucceed : 1;
            /** bit 62: Thread pokes EMTs before releasing it when set. */
            uint32_t    fPokeBeforeRelease : 1;
            /** bit 63: Enabled/disabled. */
            uint32_t    fEnabled : 1;
        } s;
    } TestingLockControl;
    /** Event semaphore that the locking thread blocks. */
    SUPSEMEVENT         hTestingLockEvt;
# if HC_ARCH_BITS == 32
    uint32_t            uPadding10;
# endif
    /** Handle for the I/O ports used by the testing component. */
    IOMIOPORTHANDLE     hIoPortTesting;
    /** Handle for the MMIO region used by the testing component. */
    IOMMMIOHANDLE       hMmioTesting;
    /** User defined configuration dwords. */
    uint32_t            au32TestingCfgDwords[10];
#endif /* !VBOX_WITHOUT_TESTING_FEATURES || DOXYGEN_RUNNING */
    /** @} */

    /** Handle for the backdoor logging I/O port. */
    IOMIOPORTHANDLE     hIoPortBackdoorLog;
    /** Handle for the alternative timesync I/O port. */
    IOMIOPORTHANDLE     hIoPortAltTimesync;
    /** Handle for the VMM request I/O port (PCI region \#0). */
    IOMIOPORTHANDLE     hIoPortReq;
    /** Handle for the fast VMM request I/O port (PCI region \#0). */
    IOMIOPORTHANDLE     hIoPortFast;
    /** Handle for the VMMDev RAM (PCI region \#1). */
    PGMMMIO2HANDLE      hMmio2VMMDevRAM;
    /** Handle for the VMMDev Heap (PCI region \#2). */
    PGMMMIO2HANDLE      hMmio2Heap;
} VMMDEV;
/** Pointer to the shared VMM device state. */
typedef VMMDEV *PVMMDEV;
AssertCompileMemberAlignment(VMMDEV, CritSect, 8);
AssertCompileMemberAlignment(VMMDEV, StatSlowIrqAck, 8);
AssertCompileMemberAlignment(VMMDEV, cbGuestRAM, 8);
AssertCompileMemberAlignment(VMMDEV, enmCpuHotPlugEvent, 4);
AssertCompileMemberAlignment(VMMDEV, aFacilityStatuses, 8);
#ifndef VBOX_WITHOUT_TESTING_FEATURES
AssertCompileMemberAlignment(VMMDEV, TestingData.Value.u64Value, 8);
AssertCompileMemberAlignment(VMMDEV, CritSectRw, 64);
#endif


/** @name VMMDev/HGCM accounting categories (indexes into VMMDEVR3::aHgcmAcc)
 * @{  */
/** Legacy, VMMDEV_REQUESTOR_USR_NOT_GIVEN, VMMDEV_REQUESTOR_USR_DRV,
 *  VMMDEV_REQUESTOR_USR_DRV_OTHER. */
#define VMMDEV_HGCM_CATEGORY_KERNEL   0
/** VMMDEV_REQUESTOR_USR_ROOT, VMMDEV_REQUESTOR_USR_SYSTEM   */
#define VMMDEV_HGCM_CATEGORY_ROOT     1
/** VMMDEV_REQUESTOR_USR_RESERVED1, VMMDEV_REQUESTOR_USR_USER,
 *  VMMDEV_REQUESTOR_USR_GUEST */
#define VMMDEV_HGCM_CATEGORY_USER     2
/** Array size. */
#define VMMDEV_HGCM_CATEGORY_MAX      3
/** @} */

/**
 * State structure for the VMM device, ring-3 edition.
 */
typedef struct VMMDEVR3
{
    /** LUN\#0 + Status: VMMDev port base interface. */
    PDMIBASE                        IBase;
    /** LUN\#0: VMMDev port interface. */
    PDMIVMMDEVPORT                  IPort;
#ifdef VBOX_WITH_HGCM
    /** LUN\#0: HGCM port interface. */
    PDMIHGCMPORT                    IHGCMPort;
    /** HGCM connector interface */
    R3PTRTYPE(PPDMIHGCMCONNECTOR)   pHGCMDrv;
#endif
    /** Pointer to base interface of the driver. */
    R3PTRTYPE(PPDMIBASE)            pDrvBase;
    /** VMMDev connector interface */
    R3PTRTYPE(PPDMIVMMDEVCONNECTOR) pDrv;
    /** Pointer to the device instance.
     * @note Only for interface methods to get their bearings. */
    PPDMDEVINSR3                    pDevIns;

    /** R3 pointer to VMMDev RAM area */
    R3PTRTYPE(VMMDevMemory *)       pVMMDevRAMR3;

    /** R3 pointer to VMMDev Heap RAM area. */
    R3PTRTYPE(VMMDevMemory *)       pVMMDevHeapR3;

    /** Pointer to the credentials. */
    R3PTRTYPE(VMMDEVCREDS *)        pCredentials;
    /** Set if pCredentials is using the RTMemSafer allocator, clear if heap. */
    bool                            fSaferCredentials;
    bool                            afAlignment[7];

#ifdef VBOX_WITH_HGCM
    /** Critical section to protect the list. */
    RTCRITSECT                      critsectHGCMCmdList;
    /** List of pending HGCM requests (VBOXHGCMCMD). */
    RTLISTANCHORR3                  listHGCMCmd;
    /** Whether the HGCM events are already automatically enabled. */
    uint32_t                        u32HGCMEnabled;
    /** Saved state version of restored commands. */
    uint32_t                        uSavedStateVersion;
    RTMEMCACHE                      hHgcmCmdCache;
    /** Accounting by for each requestor VMMDEV_REQUESTOR_USR_XXX group.
     * Legacy requests ends up with VMMDEV_REQUESTOR_USR_NOT_GIVEN */
    struct
    {
        /** The configured heap budget. */
        uint64_t                    cbHeapBudgetConfig;
        /** The currently available heap budget.   */
        uint64_t                    cbHeapBudget;
        /** Message stats. */
        STAMPROFILE                 StateMsgHeapUsage;
        /** Budget overruns.   */
        STAMCOUNTER                 StatBudgetOverruns;
    } aHgcmAcc[VMMDEV_HGCM_CATEGORY_MAX];
    STAMPROFILE                     StatHgcmCmdArrival;
    STAMPROFILE                     StatHgcmCmdCompletion;
    STAMPROFILE                     StatHgcmCmdTotal;
    STAMCOUNTER                     StatHgcmLargeCmdAllocs;
    STAMCOUNTER                     StatHgcmFailedPageListLocking;
#endif /* VBOX_WITH_HGCM */
    STAMCOUNTER                     StatReqBufAllocs;
    /** Per CPU request 4K sized buffers, allocated as needed. */
    R3PTRTYPE(VMMDevRequestHeader *) apReqBufs[VMM_MAX_CPU_COUNT];

    /** Status LUN: Shared folders LED */
    struct
    {
        /** The LED. */
        PDMLED                          Led;
        /** The LED ports. */
        PDMILEDPORTS                    ILeds;
        /** Partner of ILeds. */
        R3PTRTYPE(PPDMILEDCONNECTORS)   pLedsConnector;
    } SharedFolders;

#ifndef VBOX_WITHOUT_TESTING_FEATURES
    /** The XML output file name (can be a named pipe, doesn't matter to us). */
    R3PTRTYPE(char *)               pszTestingXmlOutput;
    /** Testing instance for dealing with the output. */
    RTTEST                          hTestingTest;
    /** The locking test thread (). */
    PPDMTHREAD                      pTestingLockThread;
#endif
} VMMDEVR3;
/** Pointer to the ring-3 VMM device state. */
typedef VMMDEVR3 *PVMMDEVR3;


/**
 * State structure for the VMM device, ring-0 edition.
 */
typedef struct VMMDEVR0
{
    /** R0 pointer to VMMDev RAM area - first page only, could be NULL! */
    R0PTRTYPE(VMMDevMemory *)   pVMMDevRAMR0;
} VMMDEVR0;
/** Pointer to the ring-0 VMM device state. */
typedef VMMDEVR0 *PVMMDEVR0;


/**
 * State structure for the VMM device, raw-mode edition.
 */
typedef struct VMMDEVRC
{
    /** R0 pointer to VMMDev RAM area - first page only, could be NULL! */
    RCPTRTYPE(VMMDevMemory *)   pVMMDevRAMRC;
} VMMDEVRC;
/** Pointer to the raw-mode VMM device state. */
typedef VMMDEVRC *PVMMDEVRC;


/** @typedef VMMDEVCC
 * The VMMDEV device data for the current context. */
typedef CTX_SUFF(VMMDEV) VMMDEVCC;
/** @typedef PVMMDEVCC
 * Pointer to the VMMDEV device for the current context. */
typedef CTX_SUFF(PVMMDEV) PVMMDEVCC;


void VMMDevNotifyGuest(PPDMDEVINS pDevIns, PVMMDEV pThis, PVMMDEVCC pThisCC, uint32_t fAddEvents);
void VMMDevCtlSetGuestFilterMask(PPDMDEVINS pDevIns, PVMMDEV pThis, PVMMDEVCC pThisCC, uint32_t fOrMask, uint32_t fNotMask);


/** The saved state version. */
#define VMMDEV_SAVED_STATE_VERSION                              VMMDEV_SAVED_STATE_VERSION_DISPLAY_CHANGE_DATA
/** The saved state version with display change data state. */
#define VMMDEV_SAVED_STATE_VERSION_DISPLAY_CHANGE_DATA          18
/** Updated HGCM commands. */
#define VMMDEV_SAVED_STATE_VERSION_HGCM_PARAMS                  17
/** The saved state version with heartbeat state. */
#define VMMDEV_SAVED_STATE_VERSION_HEARTBEAT                    16
/** The saved state version without heartbeat state. */
#define VMMDEV_SAVED_STATE_VERSION_NO_HEARTBEAT                 15
/** The saved state version which is missing the guest facility statuses. */
#define VMMDEV_SAVED_STATE_VERSION_MISSING_FACILITY_STATUSES    14
/** The saved state version which is missing the guestInfo2 bits. */
#define VMMDEV_SAVED_STATE_VERSION_MISSING_GUEST_INFO_2         13
/** The saved state version used by VirtualBox 3.0.
 *  This doesn't have the config part. */
#define VMMDEV_SAVED_STATE_VERSION_VBOX_30                      11

#endif /* !VBOX_INCLUDED_SRC_VMMDev_VMMDevState_h */