VirtualBox

source: vbox/trunk/src/VBox/Devices/VMMDev/VMMDevState.h@ 30850

Last change on this file since 30850 was 30850, checked in by vboxsync, 15 years ago

VMMDev: Addressed little paranoia issue introduced by r63480. That change made the VMMDev R0/RC capable which means the instance data would be allocated on the hypervisor heap. That heap theorecially be read by privileged guest code, so we shouldn't store any secrets there. Since the information is accessible via VMMDevReq_QueryCredentials this is mostsly academical paranoia.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.4 KB
Line 
1/* $Id: VMMDevState.h 30850 2010-07-14 17:41:01Z 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/pdmdev.h>
23#include <VBox/pdmifs.h>
24
25#define TIMESYNC_BACKDOOR
26
27typedef struct DISPLAYCHANGEINFO
28{
29 uint32_t xres;
30 uint32_t yres;
31 uint32_t bpp;
32 uint32_t display;
33} DISPLAYCHANGEINFO;
34
35typedef struct DISPLAYCHANGEREQUEST
36{
37 bool fPending;
38 bool afAlignment[3];
39 DISPLAYCHANGEINFO displayChangeRequest;
40 DISPLAYCHANGEINFO lastReadDisplayChangeRequest;
41} DISPLAYCHANGEREQUEST;
42
43typedef 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 */
62typedef struct VMMDEVCREDS
63{
64 /** credentials for guest logon purposes */
65 struct
66 {
67 char szUserName[VMMDEV_CREDENTIALS_STRLEN];
68 char szPassword[VMMDEV_CREDENTIALS_STRLEN];
69 char szDomain[VMMDEV_CREDENTIALS_STRLEN];
70 bool fAllowInteractiveLogon;
71 } Logon;
72
73 /** credentials for verification by guest */
74 struct
75 {
76 char szUserName[VMMDEV_CREDENTIALS_STRLEN];
77 char szPassword[VMMDEV_CREDENTIALS_STRLEN];
78 char szDomain[VMMDEV_CREDENTIALS_STRLEN];
79 } Judge;
80} VMMDEVCREDS;
81
82
83/** device structure containing all state information */
84typedef 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 uint32_t mouseXAbs;
99 uint32_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#ifdef VBOX_WITH_HGCM
224 /** List of pending HGCM requests, used for saving the HGCM state. */
225 R3PTRTYPE(PVBOXHGCMCMD) pHGCMCmdList;
226 /** Critical section to protect the list. */
227 RTCRITSECT critsectHGCMCmdList;
228 /** Whether the HGCM events are already automatically enabled. */
229 uint32_t u32HGCMEnabled;
230 /** Alignment padding. */
231 uint32_t u32Alignment7;
232#endif /* VBOX_WITH_HGCM */
233
234 /** Status LUN: Shared folders LED */
235 struct
236 {
237 /** The LED. */
238 PDMLED Led;
239 /** The LED ports. */
240 PDMILEDPORTS ILeds;
241 /** Partner of ILeds. */
242 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
243 } SharedFolders;
244
245 /** FLag whether CPU hotplug events are monitored */
246 bool fCpuHotPlugEventsEnabled;
247 /** Alignment padding. */
248 bool afPadding8[3];
249 /** CPU hotplug event */
250 VMMDevCpuEventType enmCpuHotPlugEvent;
251 /** Core id of the CPU to change */
252 uint32_t idCpuCore;
253 /** Package id of the CPU to changhe */
254 uint32_t idCpuPackage;
255
256 uint32_t StatMemBalloonChunks;
257
258 /** Set if RC/R0 is enabled. */
259 bool fRZEnabled;
260 /** Set if testing is enabled. */
261 bool fTestingEnabled;
262 /** Alignment padding. */
263 bool afPadding9[HC_ARCH_BITS == 32 ? 2 : 6];
264#ifndef VBOX_WITHOUT_TESTING_FEATURES
265 /** The high timestamp value. */
266 uint32_t u32TestingHighTimestamp;
267 /** The current testing command (VMMDEV_TESTING_CMD_XXX). */
268 uint32_t u32TestingCmd;
269 /** The testing data offset (command specific). */
270 uint32_t offTestingData;
271 /** For buffering the what comes in over the testing data port. */
272 union
273 {
274 char padding[128];
275
276 /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
277 * VMMDEV_TESTING_CMD_FAILED. */
278 struct
279 {
280 char sz[128];
281 } String, Init, SubNew, Failed;
282
283 /** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
284 struct
285 {
286 uint32_t c;
287 } Error, Term, SubDone;
288
289 /** VMMDEV_TESTING_CMD_VALUE. */
290 struct
291 {
292 RTUINT64U u64Value;
293 uint32_t u32Unit;
294 char szName[128 - 8 - 4];
295 } Value;
296 } TestingData;
297#endif /* !VBOX_WITHOUT_TESTING_FEATURES */
298} VMMDevState;
299AssertCompileMemberAlignment(VMMDevState, CritSect, 8);
300AssertCompileMemberAlignment(VMMDevState, cbGuestRAM, 8);
301AssertCompileMemberAlignment(VMMDevState, enmCpuHotPlugEvent, 4);
302#ifndef VBOX_WITHOUT_TESTING_FEATURES
303AssertCompileMemberAlignment(VMMDevState, TestingData.Value.u64Value, 8);
304#endif
305
306
307void VMMDevNotifyGuest (VMMDevState *pVMMDevState, uint32_t u32EventMask);
308void VMMDevCtlSetGuestFilterMask (VMMDevState *pVMMDevState,
309 uint32_t u32OrMask,
310 uint32_t u32NotMask);
311
312#endif /* !___VMMDev_VMMDevState_h */
313
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