1 | /* $Id: VMMDevState.h 39890 2012-01-26 19:42:19Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VMMDev - Guest <-> VMM/Host communication device, internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Oracle Corporation
|
---|
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 |
|
---|
18 | #ifndef ___VMMDev_VMMDevState_h
|
---|
19 | #define ___VMMDev_VMMDevState_h
|
---|
20 |
|
---|
21 | #include <VBox/VMMDev.h>
|
---|
22 | #include <VBox/vmm/pdmdev.h>
|
---|
23 | #include <VBox/vmm/pdmifs.h>
|
---|
24 |
|
---|
25 | #define TIMESYNC_BACKDOOR
|
---|
26 |
|
---|
27 | typedef struct DISPLAYCHANGEINFO
|
---|
28 | {
|
---|
29 | uint32_t xres;
|
---|
30 | uint32_t yres;
|
---|
31 | uint32_t bpp;
|
---|
32 | uint32_t display;
|
---|
33 | } DISPLAYCHANGEINFO;
|
---|
34 |
|
---|
35 | typedef struct DISPLAYCHANGEREQUEST
|
---|
36 | {
|
---|
37 | bool fPending;
|
---|
38 | bool afAlignment[3];
|
---|
39 | DISPLAYCHANGEINFO displayChangeRequest;
|
---|
40 | DISPLAYCHANGEINFO lastReadDisplayChangeRequest;
|
---|
41 | } DISPLAYCHANGEREQUEST;
|
---|
42 |
|
---|
43 | typedef struct DISPLAYCHANGEDATA
|
---|
44 | {
|
---|
45 | /* Which monitor is being reported to the guest. */
|
---|
46 | int iCurrentMonitor;
|
---|
47 |
|
---|
48 | /** true if the guest responded to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST at least once */
|
---|
49 | bool fGuestSentChangeEventAck;
|
---|
50 | bool afAlignment[3];
|
---|
51 |
|
---|
52 | DISPLAYCHANGEREQUEST aRequests[64]; // @todo maxMonitors
|
---|
53 | } DISPLAYCHANGEDATA;
|
---|
54 |
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Credentials for automatic guest logon and host configured logon (?).
|
---|
58 | *
|
---|
59 | * This is not stored in the same block as the instance data in order to make it
|
---|
60 | * harder to access.
|
---|
61 | */
|
---|
62 | typedef struct VMMDEVCREDS
|
---|
63 | {
|
---|
64 | /** credentials for guest logon purposes */
|
---|
65 | struct
|
---|
66 | {
|
---|
67 | char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
68 | char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
69 | char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
70 | bool fAllowInteractiveLogon;
|
---|
71 | } Logon;
|
---|
72 |
|
---|
73 | /** credentials for verification by guest */
|
---|
74 | struct
|
---|
75 | {
|
---|
76 | char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
77 | char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
78 | char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
79 | } Judge;
|
---|
80 | } VMMDEVCREDS;
|
---|
81 |
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * Facility status entry.
|
---|
85 | */
|
---|
86 | typedef struct VMMDEVFACILITYSTATUSENTRY
|
---|
87 | {
|
---|
88 | /** The facility, see VBoxGuestFacilityType. */
|
---|
89 | uint32_t uFacility;
|
---|
90 | /** The status, see VBoxGuestFacilityStatus. */
|
---|
91 | uint16_t uStatus;
|
---|
92 | /** Whether this entry is fixed and cannot be reused when inactive. */
|
---|
93 | bool fFixed;
|
---|
94 | /** Explicit alignment padding / reserved for future use. MBZ. */
|
---|
95 | bool fPadding;
|
---|
96 | /** The facility flags (yet to be defined). */
|
---|
97 | uint32_t fFlags;
|
---|
98 | /** Explicit alignment padding / reserved for future use. MBZ. */
|
---|
99 | uint32_t uPadding;
|
---|
100 | /** Last update timestamp. */
|
---|
101 | RTTIMESPEC TimeSpecTS;
|
---|
102 | } VMMDEVFACILITYSTATUSENTRY;
|
---|
103 | /** Pointer to a facility status entry. */
|
---|
104 | typedef VMMDEVFACILITYSTATUSENTRY *PVMMDEVFACILITYSTATUSENTRY;
|
---|
105 |
|
---|
106 |
|
---|
107 | /** device structure containing all state information */
|
---|
108 | typedef struct VMMDevState
|
---|
109 | {
|
---|
110 | /** The PCI device structure. */
|
---|
111 | PCIDevice dev;
|
---|
112 |
|
---|
113 | /** The critical section for this device. */
|
---|
114 | PDMCRITSECT CritSect;
|
---|
115 |
|
---|
116 | /** hypervisor address space size */
|
---|
117 | uint32_t hypervisorSize;
|
---|
118 |
|
---|
119 | /** mouse capabilities of host and guest */
|
---|
120 | uint32_t mouseCapabilities;
|
---|
121 | /** absolute mouse position in pixels */
|
---|
122 | int32_t mouseXAbs;
|
---|
123 | int32_t mouseYAbs;
|
---|
124 | /** Does the guest currently want the host pointer to be shown? */
|
---|
125 | uint32_t fHostCursorRequested;
|
---|
126 |
|
---|
127 | /** Alignment padding. */
|
---|
128 | uint32_t u32Alignment0;
|
---|
129 |
|
---|
130 | /** Pointer to device instance. */
|
---|
131 | PPDMDEVINSR3 pDevIns;
|
---|
132 | /** LUN\#0 + Status: VMMDev port base interface. */
|
---|
133 | PDMIBASE IBase;
|
---|
134 | /** LUN\#0: VMMDev port interface. */
|
---|
135 | PDMIVMMDEVPORT IPort;
|
---|
136 | #ifdef VBOX_WITH_HGCM
|
---|
137 | /** LUN\#0: HGCM port interface. */
|
---|
138 | PDMIHGCMPORT IHGCMPort;
|
---|
139 | #endif
|
---|
140 | /** Pointer to base interface of the driver. */
|
---|
141 | R3PTRTYPE(PPDMIBASE) pDrvBase;
|
---|
142 | /** VMMDev connector interface */
|
---|
143 | R3PTRTYPE(PPDMIVMMDEVCONNECTOR) pDrv;
|
---|
144 | #ifdef VBOX_WITH_HGCM
|
---|
145 | /** HGCM connector interface */
|
---|
146 | R3PTRTYPE(PPDMIHGCMCONNECTOR) pHGCMDrv;
|
---|
147 | #endif
|
---|
148 | /** Alignment padding. */
|
---|
149 | RTR3PTR PtrR3Alignment1;
|
---|
150 | /** message buffer for backdoor logging. */
|
---|
151 | char szMsg[512];
|
---|
152 | /** message buffer index. */
|
---|
153 | uint32_t iMsg;
|
---|
154 | /** Base port in the assigned I/O space. */
|
---|
155 | RTIOPORT PortBase;
|
---|
156 | /** Alignment padding. */
|
---|
157 | RTIOPORT PortAlignment2;
|
---|
158 |
|
---|
159 | /** IRQ number assigned to the device */
|
---|
160 | uint32_t irq;
|
---|
161 | /** Current host side event flags */
|
---|
162 | uint32_t u32HostEventFlags;
|
---|
163 | /** Mask of events guest is interested in. Note that the HGCM events
|
---|
164 | * are enabled automatically by the VMMDev device when guest issues
|
---|
165 | * HGCM commands.
|
---|
166 | */
|
---|
167 | uint32_t u32GuestFilterMask;
|
---|
168 | /** Delayed mask of guest events */
|
---|
169 | uint32_t u32NewGuestFilterMask;
|
---|
170 | /** Flag whether u32NewGuestFilterMask is valid */
|
---|
171 | bool fNewGuestFilterMask;
|
---|
172 | /** Alignment padding. */
|
---|
173 | bool afAlignment3[3];
|
---|
174 |
|
---|
175 | /** GC physical address of VMMDev RAM area */
|
---|
176 | RTGCPHYS32 GCPhysVMMDevRAM;
|
---|
177 | /** R3 pointer to VMMDev RAM area */
|
---|
178 | R3PTRTYPE(VMMDevMemory *) pVMMDevRAMR3;
|
---|
179 |
|
---|
180 | /** R3 pointer to VMMDev Heap RAM area
|
---|
181 | */
|
---|
182 | R3PTRTYPE(VMMDevMemory *) pVMMDevHeapR3;
|
---|
183 | /** GC physical address of VMMDev Heap RAM area */
|
---|
184 | RTGCPHYS32 GCPhysVMMDevHeap;
|
---|
185 |
|
---|
186 | /** Information reported by guest via VMMDevReportGuestInfo generic request.
|
---|
187 | * Until this information is reported the VMMDev refuses any other requests.
|
---|
188 | */
|
---|
189 | VBoxGuestInfo guestInfo;
|
---|
190 | /** Information report \#2, chewed a litte. */
|
---|
191 | struct
|
---|
192 | {
|
---|
193 | uint32_t uFullVersion; /**< non-zero if info is present. */
|
---|
194 | uint32_t uRevision;
|
---|
195 | uint32_t fFeatures;
|
---|
196 | char szName[128];
|
---|
197 | } guestInfo2;
|
---|
198 |
|
---|
199 | /** Array of guest facility statuses. */
|
---|
200 | VMMDEVFACILITYSTATUSENTRY aFacilityStatuses[32];
|
---|
201 | /** The number of valid entries in the facility status array. */
|
---|
202 | uint32_t cFacilityStatuses;
|
---|
203 |
|
---|
204 | /** Information reported by guest via VMMDevReportGuestCapabilities. */
|
---|
205 | uint32_t guestCaps;
|
---|
206 |
|
---|
207 | /** "Additions are Ok" indicator, set to true after processing VMMDevReportGuestInfo,
|
---|
208 | * if additions version is compatible. This flag is here to avoid repeated comparing
|
---|
209 | * of the version in guestInfo.
|
---|
210 | */
|
---|
211 | uint32_t fu32AdditionsOk;
|
---|
212 |
|
---|
213 | /** Video acceleration status set by guest. */
|
---|
214 | uint32_t u32VideoAccelEnabled;
|
---|
215 |
|
---|
216 | DISPLAYCHANGEDATA displayChangeData;
|
---|
217 |
|
---|
218 | /** Pointer to the credentials. */
|
---|
219 | R3PTRTYPE(VMMDEVCREDS *) pCredentials;
|
---|
220 |
|
---|
221 | bool afAlignment4[HC_ARCH_BITS == 32 ? 3 : 7];
|
---|
222 |
|
---|
223 | /* memory balloon change request */
|
---|
224 | uint32_t u32MemoryBalloonSize, u32LastMemoryBalloonSize;
|
---|
225 |
|
---|
226 | /* guest ram size */
|
---|
227 | uint64_t cbGuestRAM;
|
---|
228 |
|
---|
229 | /* unique session id; the id will be different after each start, reset or restore of the VM. */
|
---|
230 | uint64_t idSession;
|
---|
231 |
|
---|
232 | /* statistics interval change request */
|
---|
233 | uint32_t u32StatIntervalSize, u32LastStatIntervalSize;
|
---|
234 |
|
---|
235 | /* seamless mode change request */
|
---|
236 | bool fLastSeamlessEnabled, fSeamlessEnabled;
|
---|
237 | bool afAlignment5[1];
|
---|
238 |
|
---|
239 | bool fVRDPEnabled;
|
---|
240 | uint32_t u32VRDPExperienceLevel;
|
---|
241 |
|
---|
242 | #ifdef TIMESYNC_BACKDOOR
|
---|
243 | uint64_t hostTime;
|
---|
244 | bool fTimesyncBackdoorLo;
|
---|
245 | bool afAlignment6[3];
|
---|
246 | #endif
|
---|
247 | /** Set if GetHostTime should fail.
|
---|
248 | * Loaded from the GetHostTimeDisabled configuration value. */
|
---|
249 | bool fGetHostTimeDisabled;
|
---|
250 |
|
---|
251 | /** Set if backdoor logging should be disabled (output will be ignored then) */
|
---|
252 | bool fBackdoorLogDisabled;
|
---|
253 |
|
---|
254 | /** Don't clear credentials */
|
---|
255 | bool fKeepCredentials;
|
---|
256 |
|
---|
257 | /** Heap enabled. */
|
---|
258 | bool fHeapEnabled;
|
---|
259 |
|
---|
260 | /** Guest Core Dumping enabled. */
|
---|
261 | bool fGuestCoreDumpEnabled;
|
---|
262 |
|
---|
263 | /** Guest Core Dump location. */
|
---|
264 | char szGuestCoreDumpDir[RTPATH_MAX];
|
---|
265 |
|
---|
266 | /** Number of additional cores to keep around. */
|
---|
267 | uint32_t cGuestCoreDumps;
|
---|
268 |
|
---|
269 | bool afAlignment7[1];
|
---|
270 |
|
---|
271 | #ifdef VBOX_WITH_HGCM
|
---|
272 | /** List of pending HGCM requests, used for saving the HGCM state. */
|
---|
273 | R3PTRTYPE(PVBOXHGCMCMD) pHGCMCmdList;
|
---|
274 | /** Critical section to protect the list. */
|
---|
275 | RTCRITSECT critsectHGCMCmdList;
|
---|
276 | /** Whether the HGCM events are already automatically enabled. */
|
---|
277 | uint32_t u32HGCMEnabled;
|
---|
278 | /** Alignment padding. */
|
---|
279 | uint32_t u32Alignment7;
|
---|
280 | #endif /* VBOX_WITH_HGCM */
|
---|
281 |
|
---|
282 | /** Status LUN: Shared folders LED */
|
---|
283 | struct
|
---|
284 | {
|
---|
285 | /** The LED. */
|
---|
286 | PDMLED Led;
|
---|
287 | /** The LED ports. */
|
---|
288 | PDMILEDPORTS ILeds;
|
---|
289 | /** Partner of ILeds. */
|
---|
290 | R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
|
---|
291 | } SharedFolders;
|
---|
292 |
|
---|
293 | /** FLag whether CPU hotplug events are monitored */
|
---|
294 | bool fCpuHotPlugEventsEnabled;
|
---|
295 | /** Alignment padding. */
|
---|
296 | bool afPadding8[3];
|
---|
297 | /** CPU hotplug event */
|
---|
298 | VMMDevCpuEventType enmCpuHotPlugEvent;
|
---|
299 | /** Core id of the CPU to change */
|
---|
300 | uint32_t idCpuCore;
|
---|
301 | /** Package id of the CPU to change */
|
---|
302 | uint32_t idCpuPackage;
|
---|
303 |
|
---|
304 | uint32_t StatMemBalloonChunks;
|
---|
305 |
|
---|
306 | /** Set if RC/R0 is enabled. */
|
---|
307 | bool fRZEnabled;
|
---|
308 | /** Set if testing is enabled. */
|
---|
309 | bool fTestingEnabled;
|
---|
310 | /** Alignment padding. */
|
---|
311 | bool afPadding9[HC_ARCH_BITS == 32 ? 2 : 6];
|
---|
312 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
313 | /** The high timestamp value. */
|
---|
314 | uint32_t u32TestingHighTimestamp;
|
---|
315 | /** The current testing command (VMMDEV_TESTING_CMD_XXX). */
|
---|
316 | uint32_t u32TestingCmd;
|
---|
317 | /** The testing data offset (command specific). */
|
---|
318 | uint32_t offTestingData;
|
---|
319 | /** For buffering the what comes in over the testing data port. */
|
---|
320 | union
|
---|
321 | {
|
---|
322 | char padding[1024];
|
---|
323 |
|
---|
324 | /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
|
---|
325 | * VMMDEV_TESTING_CMD_FAILED. */
|
---|
326 | struct
|
---|
327 | {
|
---|
328 | char sz[1024];
|
---|
329 | } String, Init, SubNew, Failed;
|
---|
330 |
|
---|
331 | /** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
|
---|
332 | struct
|
---|
333 | {
|
---|
334 | uint32_t c;
|
---|
335 | } Error, Term, SubDone;
|
---|
336 |
|
---|
337 | /** VMMDEV_TESTING_CMD_VALUE. */
|
---|
338 | struct
|
---|
339 | {
|
---|
340 | RTUINT64U u64Value;
|
---|
341 | uint32_t u32Unit;
|
---|
342 | char szName[1024 - 8 - 4];
|
---|
343 | } Value;
|
---|
344 | } TestingData;
|
---|
345 | #endif /* !VBOX_WITHOUT_TESTING_FEATURES */
|
---|
346 | } VMMDevState;
|
---|
347 | AssertCompileMemberAlignment(VMMDevState, CritSect, 8);
|
---|
348 | AssertCompileMemberAlignment(VMMDevState, cbGuestRAM, 8);
|
---|
349 | AssertCompileMemberAlignment(VMMDevState, enmCpuHotPlugEvent, 4);
|
---|
350 | AssertCompileMemberAlignment(VMMDevState, aFacilityStatuses, 8);
|
---|
351 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
352 | AssertCompileMemberAlignment(VMMDevState, TestingData.Value.u64Value, 8);
|
---|
353 | #endif
|
---|
354 |
|
---|
355 |
|
---|
356 | void VMMDevNotifyGuest (VMMDevState *pVMMDevState, uint32_t u32EventMask);
|
---|
357 | void VMMDevCtlSetGuestFilterMask (VMMDevState *pVMMDevState,
|
---|
358 | uint32_t u32OrMask,
|
---|
359 | uint32_t u32NotMask);
|
---|
360 |
|
---|
361 | #endif /* !___VMMDev_VMMDevState_h */
|
---|
362 |
|
---|