1 | /* $Id: VMMDevState.h 35989 2011-02-15 19:55:27Z 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 | /** device structure containing all state information */
|
---|
84 | typedef struct VMMDevState
|
---|
85 | {
|
---|
86 | /** The PCI device structure. */
|
---|
87 | PCIDevice dev;
|
---|
88 |
|
---|
89 | /** The critical section for this device. */
|
---|
90 | PDMCRITSECT CritSect;
|
---|
91 |
|
---|
92 | /** hypervisor address space size */
|
---|
93 | uint32_t hypervisorSize;
|
---|
94 |
|
---|
95 | /** mouse capabilities of host and guest */
|
---|
96 | uint32_t mouseCapabilities;
|
---|
97 | /** absolute mouse position in pixels */
|
---|
98 | int32_t mouseXAbs;
|
---|
99 | int32_t mouseYAbs;
|
---|
100 | /** Does the guest currently want the host pointer to be shown? */
|
---|
101 | uint32_t fHostCursorRequested;
|
---|
102 |
|
---|
103 | /** Alignment padding. */
|
---|
104 | uint32_t u32Alignment0;
|
---|
105 |
|
---|
106 | /** Pointer to device instance. */
|
---|
107 | PPDMDEVINSR3 pDevIns;
|
---|
108 | /** LUN\#0 + Status: VMMDev port base interface. */
|
---|
109 | PDMIBASE IBase;
|
---|
110 | /** LUN\#0: VMMDev port interface. */
|
---|
111 | PDMIVMMDEVPORT IPort;
|
---|
112 | #ifdef VBOX_WITH_HGCM
|
---|
113 | /** LUN\#0: HGCM port interface. */
|
---|
114 | PDMIHGCMPORT IHGCMPort;
|
---|
115 | #endif
|
---|
116 | /** Pointer to base interface of the driver. */
|
---|
117 | R3PTRTYPE(PPDMIBASE) pDrvBase;
|
---|
118 | /** VMMDev connector interface */
|
---|
119 | R3PTRTYPE(PPDMIVMMDEVCONNECTOR) pDrv;
|
---|
120 | #ifdef VBOX_WITH_HGCM
|
---|
121 | /** HGCM connector interface */
|
---|
122 | R3PTRTYPE(PPDMIHGCMCONNECTOR) pHGCMDrv;
|
---|
123 | #endif
|
---|
124 | /** Alignment padding. */
|
---|
125 | RTR3PTR PtrR3Alignment1;
|
---|
126 | /** message buffer for backdoor logging. */
|
---|
127 | char szMsg[512];
|
---|
128 | /** message buffer index. */
|
---|
129 | uint32_t iMsg;
|
---|
130 | /** Base port in the assigned I/O space. */
|
---|
131 | RTIOPORT PortBase;
|
---|
132 | /** Alignment padding. */
|
---|
133 | RTIOPORT PortAlignment2;
|
---|
134 |
|
---|
135 | /** IRQ number assigned to the device */
|
---|
136 | uint32_t irq;
|
---|
137 | /** Current host side event flags */
|
---|
138 | uint32_t u32HostEventFlags;
|
---|
139 | /** Mask of events guest is interested in. Note that the HGCM events
|
---|
140 | * are enabled automatically by the VMMDev device when guest issues
|
---|
141 | * HGCM commands.
|
---|
142 | */
|
---|
143 | uint32_t u32GuestFilterMask;
|
---|
144 | /** Delayed mask of guest events */
|
---|
145 | uint32_t u32NewGuestFilterMask;
|
---|
146 | /** Flag whether u32NewGuestFilterMask is valid */
|
---|
147 | bool fNewGuestFilterMask;
|
---|
148 | /** Alignment padding. */
|
---|
149 | bool afAlignment3[3];
|
---|
150 |
|
---|
151 | /** GC physical address of VMMDev RAM area */
|
---|
152 | RTGCPHYS32 GCPhysVMMDevRAM;
|
---|
153 | /** R3 pointer to VMMDev RAM area */
|
---|
154 | R3PTRTYPE(VMMDevMemory *) pVMMDevRAMR3;
|
---|
155 |
|
---|
156 | /** R3 pointer to VMMDev Heap RAM area
|
---|
157 | */
|
---|
158 | R3PTRTYPE(VMMDevMemory *) pVMMDevHeapR3;
|
---|
159 | /** GC physical address of VMMDev Heap RAM area */
|
---|
160 | RTGCPHYS32 GCPhysVMMDevHeap;
|
---|
161 |
|
---|
162 | /** Information reported by guest via VMMDevReportGuestInfo generic request.
|
---|
163 | * Until this information is reported the VMMDev refuses any other requests.
|
---|
164 | */
|
---|
165 | VBoxGuestInfo guestInfo;
|
---|
166 |
|
---|
167 | /** Information reported by guest via VMMDevReportGuestCapabilities. */
|
---|
168 | uint32_t guestCaps;
|
---|
169 |
|
---|
170 | /** "Additions are Ok" indicator, set to true after processing VMMDevReportGuestInfo,
|
---|
171 | * if additions version is compatible. This flag is here to avoid repeated comparing
|
---|
172 | * of the version in guestInfo.
|
---|
173 | */
|
---|
174 | uint32_t fu32AdditionsOk;
|
---|
175 |
|
---|
176 | /** Video acceleration status set by guest. */
|
---|
177 | uint32_t u32VideoAccelEnabled;
|
---|
178 |
|
---|
179 | DISPLAYCHANGEDATA displayChangeData;
|
---|
180 |
|
---|
181 | /** Pointer to the credentials. */
|
---|
182 | R3PTRTYPE(VMMDEVCREDS *) pCredentials;
|
---|
183 |
|
---|
184 | bool afAlignment4[HC_ARCH_BITS == 32 ? 3 : 7];
|
---|
185 |
|
---|
186 | /* memory balloon change request */
|
---|
187 | uint32_t u32MemoryBalloonSize, u32LastMemoryBalloonSize;
|
---|
188 |
|
---|
189 | /* guest ram size */
|
---|
190 | uint64_t cbGuestRAM;
|
---|
191 |
|
---|
192 | /* unique session id; the id will be different after each start, reset or restore of the VM. */
|
---|
193 | uint64_t idSession;
|
---|
194 |
|
---|
195 | /* statistics interval change request */
|
---|
196 | uint32_t u32StatIntervalSize, u32LastStatIntervalSize;
|
---|
197 |
|
---|
198 | /* seamless mode change request */
|
---|
199 | bool fLastSeamlessEnabled, fSeamlessEnabled;
|
---|
200 | bool afAlignment5[1];
|
---|
201 |
|
---|
202 | bool fVRDPEnabled;
|
---|
203 | uint32_t u32VRDPExperienceLevel;
|
---|
204 |
|
---|
205 | #ifdef TIMESYNC_BACKDOOR
|
---|
206 | uint64_t hostTime;
|
---|
207 | bool fTimesyncBackdoorLo;
|
---|
208 | bool afAlignment6[3];
|
---|
209 | #endif
|
---|
210 | /** Set if GetHostTime should fail.
|
---|
211 | * Loaded from the GetHostTimeDisabled configuration value. */
|
---|
212 | bool fGetHostTimeDisabled;
|
---|
213 |
|
---|
214 | /** Set if backdoor logging should be disabled (output will be ignored then) */
|
---|
215 | bool fBackdoorLogDisabled;
|
---|
216 |
|
---|
217 | /** Don't clear credentials */
|
---|
218 | bool fKeepCredentials;
|
---|
219 |
|
---|
220 | /** Heap enabled. */
|
---|
221 | bool fHeapEnabled;
|
---|
222 |
|
---|
223 | /** Guest Core Dumping enabled. */
|
---|
224 | bool fGuestCoreDumpEnabled;
|
---|
225 |
|
---|
226 | /** Guest Core Dump location. */
|
---|
227 | char szGuestCoreDumpDir[RTPATH_MAX];
|
---|
228 |
|
---|
229 | /** Number of additional cores to keep around. */
|
---|
230 | uint32_t cGuestCoreDumps;
|
---|
231 |
|
---|
232 | bool afAlignment7[1];
|
---|
233 |
|
---|
234 | #ifdef VBOX_WITH_HGCM
|
---|
235 | /** List of pending HGCM requests, used for saving the HGCM state. */
|
---|
236 | R3PTRTYPE(PVBOXHGCMCMD) pHGCMCmdList;
|
---|
237 | /** Critical section to protect the list. */
|
---|
238 | RTCRITSECT critsectHGCMCmdList;
|
---|
239 | /** Whether the HGCM events are already automatically enabled. */
|
---|
240 | uint32_t u32HGCMEnabled;
|
---|
241 | /** Alignment padding. */
|
---|
242 | uint32_t u32Alignment7;
|
---|
243 | #endif /* VBOX_WITH_HGCM */
|
---|
244 |
|
---|
245 | /** Status LUN: Shared folders LED */
|
---|
246 | struct
|
---|
247 | {
|
---|
248 | /** The LED. */
|
---|
249 | PDMLED Led;
|
---|
250 | /** The LED ports. */
|
---|
251 | PDMILEDPORTS ILeds;
|
---|
252 | /** Partner of ILeds. */
|
---|
253 | R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
|
---|
254 | } SharedFolders;
|
---|
255 |
|
---|
256 | /** FLag whether CPU hotplug events are monitored */
|
---|
257 | bool fCpuHotPlugEventsEnabled;
|
---|
258 | /** Alignment padding. */
|
---|
259 | bool afPadding8[3];
|
---|
260 | /** CPU hotplug event */
|
---|
261 | VMMDevCpuEventType enmCpuHotPlugEvent;
|
---|
262 | /** Core id of the CPU to change */
|
---|
263 | uint32_t idCpuCore;
|
---|
264 | /** Package id of the CPU to change */
|
---|
265 | uint32_t idCpuPackage;
|
---|
266 |
|
---|
267 | uint32_t StatMemBalloonChunks;
|
---|
268 |
|
---|
269 | /** Set if RC/R0 is enabled. */
|
---|
270 | bool fRZEnabled;
|
---|
271 | /** Set if testing is enabled. */
|
---|
272 | bool fTestingEnabled;
|
---|
273 | /** Alignment padding. */
|
---|
274 | bool afPadding9[HC_ARCH_BITS == 32 ? 2 : 6];
|
---|
275 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
276 | /** The high timestamp value. */
|
---|
277 | uint32_t u32TestingHighTimestamp;
|
---|
278 | /** The current testing command (VMMDEV_TESTING_CMD_XXX). */
|
---|
279 | uint32_t u32TestingCmd;
|
---|
280 | /** The testing data offset (command specific). */
|
---|
281 | uint32_t offTestingData;
|
---|
282 | /** For buffering the what comes in over the testing data port. */
|
---|
283 | union
|
---|
284 | {
|
---|
285 | char padding[1024];
|
---|
286 |
|
---|
287 | /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
|
---|
288 | * VMMDEV_TESTING_CMD_FAILED. */
|
---|
289 | struct
|
---|
290 | {
|
---|
291 | char sz[1024];
|
---|
292 | } String, Init, SubNew, Failed;
|
---|
293 |
|
---|
294 | /** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
|
---|
295 | struct
|
---|
296 | {
|
---|
297 | uint32_t c;
|
---|
298 | } Error, Term, SubDone;
|
---|
299 |
|
---|
300 | /** VMMDEV_TESTING_CMD_VALUE. */
|
---|
301 | struct
|
---|
302 | {
|
---|
303 | RTUINT64U u64Value;
|
---|
304 | uint32_t u32Unit;
|
---|
305 | char szName[1024 - 8 - 4];
|
---|
306 | } Value;
|
---|
307 | } TestingData;
|
---|
308 | #endif /* !VBOX_WITHOUT_TESTING_FEATURES */
|
---|
309 | } VMMDevState;
|
---|
310 | AssertCompileMemberAlignment(VMMDevState, CritSect, 8);
|
---|
311 | AssertCompileMemberAlignment(VMMDevState, cbGuestRAM, 8);
|
---|
312 | AssertCompileMemberAlignment(VMMDevState, enmCpuHotPlugEvent, 4);
|
---|
313 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
314 | AssertCompileMemberAlignment(VMMDevState, TestingData.Value.u64Value, 8);
|
---|
315 | #endif
|
---|
316 |
|
---|
317 |
|
---|
318 | void VMMDevNotifyGuest (VMMDevState *pVMMDevState, uint32_t u32EventMask);
|
---|
319 | void VMMDevCtlSetGuestFilterMask (VMMDevState *pVMMDevState,
|
---|
320 | uint32_t u32OrMask,
|
---|
321 | uint32_t u32NotMask);
|
---|
322 |
|
---|
323 | #endif /* !___VMMDev_VMMDevState_h */
|
---|
324 |
|
---|