1 | /** @file
|
---|
2 | * Virtual Device for Guest <-> VMM/Host communication (ADD,DEV).
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | *
|
---|
25 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
26 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
27 | * additional information or have any questions.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef ___VBox_VMMDev_h
|
---|
31 | #define ___VBox_VMMDev_h
|
---|
32 |
|
---|
33 | #include <VBox/cdefs.h>
|
---|
34 | #include <VBox/param.h> /* for the PCI IDs. */
|
---|
35 | #include <VBox/types.h>
|
---|
36 | #include <VBox/err.h>
|
---|
37 | #include <VBox/ostypes.h>
|
---|
38 | #include <iprt/assert.h>
|
---|
39 |
|
---|
40 |
|
---|
41 | RT_C_DECLS_BEGIN
|
---|
42 |
|
---|
43 | /** @defgroup grp_vmmdev VMM Device
|
---|
44 | *
|
---|
45 | * Note! This interface cannot be changed, it can only be extended!
|
---|
46 | *
|
---|
47 | * @{
|
---|
48 | */
|
---|
49 |
|
---|
50 | /** @name Mouse capability bits
|
---|
51 | * @{ */
|
---|
52 | /** the guest requests absolute mouse coordinates (guest additions installed) */
|
---|
53 | #define VMMDEV_MOUSEGUESTWANTSABS RT_BIT(0)
|
---|
54 | /** the host wants to send absolute mouse coordinates (input not captured) */
|
---|
55 | #define VMMDEV_MOUSEHOSTWANTSABS RT_BIT(1)
|
---|
56 | /** the guest needs a hardware cursor on host. When guest additions are installed
|
---|
57 | * and the host has promised to display the cursor itself, the guest installs a
|
---|
58 | * hardware mouse driver. Don't ask the guest to switch to a software cursor then. */
|
---|
59 | #define VMMDEV_MOUSEGUESTNEEDSHOSTCUR RT_BIT(2)
|
---|
60 | /** the host is NOT able to draw the cursor itself (e.g. L4 console) */
|
---|
61 | #define VMMDEV_MOUSEHOSTCANNOTHWPOINTER RT_BIT(3)
|
---|
62 | /** The guest can read VMMDev events to find out about pointer movement */
|
---|
63 | #define VMMDEV_MOUSEGUESTUSESVMMDEV RT_BIT(4)
|
---|
64 | /** @} */
|
---|
65 |
|
---|
66 | /** @name Flags for pfnSetCredentials
|
---|
67 | * @{ */
|
---|
68 | /** the guest should perform a logon with the credentials */
|
---|
69 | #define VMMDEV_SETCREDENTIALS_GUESTLOGON RT_BIT(0)
|
---|
70 | /** the guest should prevent local logons */
|
---|
71 | #define VMMDEV_SETCREDENTIALS_NOLOCALLOGON RT_BIT(1)
|
---|
72 | /** the guest should verify the credentials */
|
---|
73 | #define VMMDEV_SETCREDENTIALS_JUDGE RT_BIT(15)
|
---|
74 | /** @} */
|
---|
75 |
|
---|
76 | /** @name Guest capability bits.
|
---|
77 | * VMMDevReq_ReportGuestCapabilities, VMMDevReq_SetGuestCapabilities
|
---|
78 | * @{ */
|
---|
79 | /** the guest supports seamless display rendering */
|
---|
80 | #define VMMDEV_GUEST_SUPPORTS_SEAMLESS RT_BIT(0)
|
---|
81 | /** the guest supports mapping guest to host windows */
|
---|
82 | #define VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING RT_BIT(1)
|
---|
83 | /** the guest graphical additions are active - used for fast activation
|
---|
84 | * and deactivation of certain graphical operations (e.g. resizing & seamless).
|
---|
85 | * The legacy VMMDevReq_ReportGuestCapabilities request sets this
|
---|
86 | * automatically, but VMMDevReq_SetGuestCapabilities does not. */
|
---|
87 | #define VMMDEV_GUEST_SUPPORTS_GRAPHICS RT_BIT(2)
|
---|
88 | /** @} */
|
---|
89 |
|
---|
90 | /** Size of VMMDev RAM region accessible by guest.
|
---|
91 | * Must be big enough to contain VMMDevMemory structure (see VBoxGuest.h)
|
---|
92 | * For now: 4 megabyte.
|
---|
93 | */
|
---|
94 | #define VMMDEV_RAM_SIZE (4 * 256 * PAGE_SIZE)
|
---|
95 |
|
---|
96 | /** Size of VMMDev heap region accessible by guest.
|
---|
97 | * (Must be a power of two (pci range).)
|
---|
98 | */
|
---|
99 | #define VMMDEV_HEAP_SIZE (4 * PAGE_SIZE)
|
---|
100 |
|
---|
101 |
|
---|
102 | /** @name VBoxGuest port definitions
|
---|
103 | * @{
|
---|
104 | */
|
---|
105 |
|
---|
106 | /** guest can (== wants to) handle absolute coordinates */
|
---|
107 | #define VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE RT_BIT(0)
|
---|
108 | /** host can (== wants to) send absolute coordinates */
|
---|
109 | #define VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE RT_BIT(1)
|
---|
110 | /** guest can *NOT* switch to software cursor and therefore depends on the host cursor */
|
---|
111 | #define VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR RT_BIT(2)
|
---|
112 | /** host does NOT provide support for drawing the cursor itself (e.g. L4 console) */
|
---|
113 | #define VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER RT_BIT(3)
|
---|
114 | /** The guest can read VMMDev events to find out about pointer movement */
|
---|
115 | #define VBOXGUEST_MOUSE_GUEST_USES_VMMDEV RT_BIT(4)
|
---|
116 |
|
---|
117 | /** fictive start address of the hypervisor physical memory for MmMapIoSpace */
|
---|
118 | #define HYPERVISOR_PHYSICAL_START 0xf8000000
|
---|
119 |
|
---|
120 | /*
|
---|
121 | * VMMDev Generic Request Interface
|
---|
122 | */
|
---|
123 |
|
---|
124 | /** port for generic request interface */
|
---|
125 | #define PORT_VMMDEV_REQUEST_OFFSET 0
|
---|
126 |
|
---|
127 | /** Current version of the VMMDev interface.
|
---|
128 | *
|
---|
129 | * Additions are allowed to work only if
|
---|
130 | * additions_major == vmmdev_current && additions_minor <= vmmdev_current.
|
---|
131 | * Additions version is reported to host (VMMDev) by VMMDevReq_ReportGuestInfo.
|
---|
132 | *
|
---|
133 | * @remark These defines also live in the 16-bit and assembly versions of this header.
|
---|
134 | */
|
---|
135 | #define VMMDEV_VERSION 0x00010004
|
---|
136 | #define VMMDEV_VERSION_MAJOR (VMMDEV_VERSION >> 16)
|
---|
137 | #define VMMDEV_VERSION_MINOR (VMMDEV_VERSION & 0xffff)
|
---|
138 |
|
---|
139 | /* Maximum request packet size */
|
---|
140 | #define VMMDEV_MAX_VMMDEVREQ_SIZE _1M
|
---|
141 |
|
---|
142 | /**
|
---|
143 | * VMMDev request types.
|
---|
144 | * @note when updating this, adjust vmmdevGetRequestSize() as well
|
---|
145 | */
|
---|
146 | typedef enum
|
---|
147 | {
|
---|
148 | VMMDevReq_InvalidRequest = 0,
|
---|
149 | VMMDevReq_GetMouseStatus = 1,
|
---|
150 | VMMDevReq_SetMouseStatus = 2,
|
---|
151 | VMMDevReq_SetPointerShape = 3,
|
---|
152 | /** @todo implement on host side */
|
---|
153 | VMMDevReq_GetHostVersion = 4,
|
---|
154 | VMMDevReq_Idle = 5,
|
---|
155 | VMMDevReq_GetHostTime = 10,
|
---|
156 | VMMDevReq_GetHypervisorInfo = 20,
|
---|
157 | VMMDevReq_SetHypervisorInfo = 21,
|
---|
158 | VMMDevReq_SetPowerStatus = 30,
|
---|
159 | VMMDevReq_AcknowledgeEvents = 41,
|
---|
160 | VMMDevReq_CtlGuestFilterMask = 42,
|
---|
161 | VMMDevReq_ReportGuestInfo = 50,
|
---|
162 | VMMDevReq_GetDisplayChangeRequest = 51,
|
---|
163 | VMMDevReq_VideoModeSupported = 52,
|
---|
164 | VMMDevReq_GetHeightReduction = 53,
|
---|
165 | VMMDevReq_GetDisplayChangeRequest2 = 54,
|
---|
166 | VMMDevReq_ReportGuestCapabilities = 55,
|
---|
167 | VMMDevReq_SetGuestCapabilities = 56,
|
---|
168 | #ifdef VBOX_WITH_HGCM
|
---|
169 | VMMDevReq_HGCMConnect = 60,
|
---|
170 | VMMDevReq_HGCMDisconnect = 61,
|
---|
171 | #ifdef VBOX_WITH_64_BITS_GUESTS
|
---|
172 | VMMDevReq_HGCMCall32 = 62,
|
---|
173 | VMMDevReq_HGCMCall64 = 63,
|
---|
174 | #else
|
---|
175 | VMMDevReq_HGCMCall = 62,
|
---|
176 | #endif /* VBOX_WITH_64_BITS_GUESTS */
|
---|
177 | VMMDevReq_HGCMCancel = 64,
|
---|
178 | #endif
|
---|
179 | VMMDevReq_VideoAccelEnable = 70,
|
---|
180 | VMMDevReq_VideoAccelFlush = 71,
|
---|
181 | VMMDevReq_VideoSetVisibleRegion = 72,
|
---|
182 | VMMDevReq_GetSeamlessChangeRequest = 73,
|
---|
183 | VMMDevReq_QueryCredentials = 100,
|
---|
184 | VMMDevReq_ReportCredentialsJudgement = 101,
|
---|
185 | VMMDevReq_ReportGuestStats = 110,
|
---|
186 | VMMDevReq_GetMemBalloonChangeRequest = 111,
|
---|
187 | VMMDevReq_GetStatisticsChangeRequest = 112,
|
---|
188 | VMMDevReq_ChangeMemBalloon = 113,
|
---|
189 | VMMDevReq_GetVRDPChangeRequest = 150,
|
---|
190 | VMMDevReq_LogString = 200,
|
---|
191 | VMMDevReq_SizeHack = 0x7fffffff
|
---|
192 | } VMMDevRequestType;
|
---|
193 |
|
---|
194 | #ifdef VBOX_WITH_64_BITS_GUESTS
|
---|
195 | /*
|
---|
196 | * Constants and structures are redefined for the guest.
|
---|
197 | *
|
---|
198 | * Host code MUST always use either *32 or *64 variant explicitely.
|
---|
199 | * Host source code will use VBOX_HGCM_HOST_CODE define to catch undefined
|
---|
200 | * data types and constants.
|
---|
201 | *
|
---|
202 | * This redefinition means that the new additions builds will use
|
---|
203 | * the *64 or *32 variants depending on the current architecture bit count (ARCH_BITS).
|
---|
204 | */
|
---|
205 | # ifndef VBOX_HGCM_HOST_CODE
|
---|
206 | # if ARCH_BITS == 64
|
---|
207 | # define VMMDevReq_HGCMCall VMMDevReq_HGCMCall64
|
---|
208 | # elif ARCH_BITS == 32
|
---|
209 | # define VMMDevReq_HGCMCall VMMDevReq_HGCMCall32
|
---|
210 | # else
|
---|
211 | # error "Unsupported ARCH_BITS"
|
---|
212 | # endif
|
---|
213 | # endif /* !VBOX_HGCM_HOST_CODE */
|
---|
214 | #endif /* VBOX_WITH_64_BITS_GUESTS */
|
---|
215 |
|
---|
216 | /** Version of VMMDevRequestHeader structure. */
|
---|
217 | #define VMMDEV_REQUEST_HEADER_VERSION (0x10001)
|
---|
218 |
|
---|
219 | #pragma pack(4)
|
---|
220 | /** generic VMMDev request header */
|
---|
221 | typedef struct
|
---|
222 | {
|
---|
223 | /** size of the structure in bytes (including body). Filled by caller */
|
---|
224 | uint32_t size;
|
---|
225 | /** version of the structure. Filled by caller */
|
---|
226 | uint32_t version;
|
---|
227 | /** type of the request */
|
---|
228 | VMMDevRequestType requestType;
|
---|
229 | /** return code. Filled by VMMDev */
|
---|
230 | int32_t rc;
|
---|
231 | /** reserved fields */
|
---|
232 | uint32_t reserved1;
|
---|
233 | uint32_t reserved2;
|
---|
234 | } VMMDevRequestHeader;
|
---|
235 | AssertCompileSize(VMMDevRequestHeader, 24);
|
---|
236 |
|
---|
237 | /** mouse status request structure */
|
---|
238 | typedef struct
|
---|
239 | {
|
---|
240 | /** header */
|
---|
241 | VMMDevRequestHeader header;
|
---|
242 | /** mouse feature mask */
|
---|
243 | uint32_t mouseFeatures;
|
---|
244 | /** mouse x position */
|
---|
245 | uint32_t pointerXPos;
|
---|
246 | /** mouse y position */
|
---|
247 | uint32_t pointerYPos;
|
---|
248 | } VMMDevReqMouseStatus;
|
---|
249 |
|
---|
250 | /** Note VBOX_MOUSE_POINTER_* flags are used in guest video driver,
|
---|
251 | * values must be <= 0x8000 and must not be changed.
|
---|
252 | */
|
---|
253 |
|
---|
254 | /** pointer is visible */
|
---|
255 | #define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
|
---|
256 | /** pointer has alpha channel */
|
---|
257 | #define VBOX_MOUSE_POINTER_ALPHA (0x0002)
|
---|
258 | /** pointerData contains new pointer shape */
|
---|
259 | #define VBOX_MOUSE_POINTER_SHAPE (0x0004)
|
---|
260 |
|
---|
261 | /** mouse pointer shape/visibility change request */
|
---|
262 | typedef struct
|
---|
263 | {
|
---|
264 | /** header */
|
---|
265 | VMMDevRequestHeader header;
|
---|
266 | /** VBOX_MOUSE_POINTER_* bit flags */
|
---|
267 | uint32_t fFlags;
|
---|
268 | /** x coordinate of hot spot */
|
---|
269 | uint32_t xHot;
|
---|
270 | /** y coordinate of hot spot */
|
---|
271 | uint32_t yHot;
|
---|
272 | /** width of the pointer in pixels */
|
---|
273 | uint32_t width;
|
---|
274 | /** height of the pointer in scanlines */
|
---|
275 | uint32_t height;
|
---|
276 | /** Pointer data.
|
---|
277 | *
|
---|
278 | ****
|
---|
279 | * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
|
---|
280 | *
|
---|
281 | * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
|
---|
282 | * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
|
---|
283 | *
|
---|
284 | * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
|
---|
285 | * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
|
---|
286 | * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
|
---|
287 | *
|
---|
288 | * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
|
---|
289 | * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
|
---|
290 | * end of any scanline are undefined.
|
---|
291 | *
|
---|
292 | * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
|
---|
293 | * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
|
---|
294 | * Bytes in the gap between the AND and the XOR mask are undefined.
|
---|
295 | * XOR mask scanlines have no gap between them and size of XOR mask is:
|
---|
296 | * cXor = width * 4 * height.
|
---|
297 | ****
|
---|
298 | *
|
---|
299 | * Preallocate 4 bytes for accessing actual data as p->pointerData
|
---|
300 | */
|
---|
301 | char pointerData[4];
|
---|
302 | } VMMDevReqMousePointer;
|
---|
303 |
|
---|
304 | /** string log request structure */
|
---|
305 | typedef struct
|
---|
306 | {
|
---|
307 | /** header */
|
---|
308 | VMMDevRequestHeader header;
|
---|
309 | /** variable length string data */
|
---|
310 | char szString[1];
|
---|
311 | } VMMDevReqLogString;
|
---|
312 |
|
---|
313 | /** host version request structure */
|
---|
314 | typedef struct
|
---|
315 | {
|
---|
316 | /** header */
|
---|
317 | VMMDevRequestHeader header;
|
---|
318 | /** major version */
|
---|
319 | uint32_t major;
|
---|
320 | /** minor version */
|
---|
321 | uint32_t minor;
|
---|
322 | /** build number */
|
---|
323 | uint32_t build;
|
---|
324 | } VMMDevReqHostVersion;
|
---|
325 |
|
---|
326 | /** guest capabilites structure */
|
---|
327 | typedef struct
|
---|
328 | {
|
---|
329 | /** header */
|
---|
330 | VMMDevRequestHeader header;
|
---|
331 | /** capabilities (VMMDEV_GUEST_*) */
|
---|
332 | uint32_t caps;
|
---|
333 | } VMMDevReqGuestCapabilities;
|
---|
334 |
|
---|
335 | /** guest capabilites structure */
|
---|
336 | typedef struct
|
---|
337 | {
|
---|
338 | /** header */
|
---|
339 | VMMDevRequestHeader header;
|
---|
340 | /** mask of capabilities to be added */
|
---|
341 | uint32_t u32OrMask;
|
---|
342 | /** mask of capabilities to be removed */
|
---|
343 | uint32_t u32NotMask;
|
---|
344 | } VMMDevReqGuestCapabilities2;
|
---|
345 |
|
---|
346 | /** idle request structure */
|
---|
347 | typedef struct
|
---|
348 | {
|
---|
349 | /** header */
|
---|
350 | VMMDevRequestHeader header;
|
---|
351 | } VMMDevReqIdle;
|
---|
352 |
|
---|
353 | /** host time request structure */
|
---|
354 | typedef struct
|
---|
355 | {
|
---|
356 | /** header */
|
---|
357 | VMMDevRequestHeader header;
|
---|
358 | /** time in milliseconds since unix epoch. Filled by VMMDev. */
|
---|
359 | uint64_t time;
|
---|
360 | } VMMDevReqHostTime;
|
---|
361 |
|
---|
362 | /** hypervisor info structure */
|
---|
363 | typedef struct
|
---|
364 | {
|
---|
365 | /** header */
|
---|
366 | VMMDevRequestHeader header;
|
---|
367 | /** guest virtual address of proposed hypervisor start */
|
---|
368 | /** TODO: Make this 64-bit compatible */
|
---|
369 | RTGCPTR32 hypervisorStart;
|
---|
370 | /** hypervisor size in bytes */
|
---|
371 | uint32_t hypervisorSize;
|
---|
372 | } VMMDevReqHypervisorInfo;
|
---|
373 |
|
---|
374 | /** system power requests */
|
---|
375 | typedef enum
|
---|
376 | {
|
---|
377 | VMMDevPowerState_Invalid = 0,
|
---|
378 | VMMDevPowerState_Pause = 1,
|
---|
379 | VMMDevPowerState_PowerOff = 2,
|
---|
380 | VMMDevPowerState_SaveState = 3,
|
---|
381 | VMMDevPowerState_SizeHack = 0x7fffffff
|
---|
382 | } VMMDevPowerState;
|
---|
383 |
|
---|
384 | /** system power status structure */
|
---|
385 | typedef struct
|
---|
386 | {
|
---|
387 | /** header */
|
---|
388 | VMMDevRequestHeader header;
|
---|
389 | /** power state request */
|
---|
390 | VMMDevPowerState powerState;
|
---|
391 | } VMMDevPowerStateRequest;
|
---|
392 |
|
---|
393 | /** pending events structure */
|
---|
394 | typedef struct
|
---|
395 | {
|
---|
396 | /** header */
|
---|
397 | VMMDevRequestHeader header;
|
---|
398 | /** pending event bitmap */
|
---|
399 | uint32_t events;
|
---|
400 | } VMMDevEvents;
|
---|
401 |
|
---|
402 | /** guest filter mask control */
|
---|
403 | typedef struct
|
---|
404 | {
|
---|
405 | /** header */
|
---|
406 | VMMDevRequestHeader header;
|
---|
407 | /** mask of events to be added to filter */
|
---|
408 | uint32_t u32OrMask;
|
---|
409 | /** mask of events to be removed from filter */
|
---|
410 | uint32_t u32NotMask;
|
---|
411 | } VMMDevCtlGuestFilterMask;
|
---|
412 |
|
---|
413 | /** guest information structure */
|
---|
414 | typedef struct VBoxGuestInfo
|
---|
415 | {
|
---|
416 | /** The VMMDev interface version expected by additions. */
|
---|
417 | uint32_t additionsVersion;
|
---|
418 | /** guest OS type */
|
---|
419 | VBOXOSTYPE osType;
|
---|
420 | /** @todo */
|
---|
421 | } VBoxGuestInfo;
|
---|
422 |
|
---|
423 | /** guest information structure */
|
---|
424 | typedef struct
|
---|
425 | {
|
---|
426 | /** header */
|
---|
427 | VMMDevRequestHeader header;
|
---|
428 | /** Guest information. */
|
---|
429 | VBoxGuestInfo guestInfo;
|
---|
430 | } VMMDevReportGuestInfo;
|
---|
431 |
|
---|
432 | /** guest statistics values */
|
---|
433 | #define VBOX_GUEST_STAT_CPU_LOAD_IDLE RT_BIT(0)
|
---|
434 | #define VBOX_GUEST_STAT_CPU_LOAD_KERNEL RT_BIT(1)
|
---|
435 | #define VBOX_GUEST_STAT_CPU_LOAD_USER RT_BIT(2)
|
---|
436 | #define VBOX_GUEST_STAT_THREADS RT_BIT(3)
|
---|
437 | #define VBOX_GUEST_STAT_PROCESSES RT_BIT(4)
|
---|
438 | #define VBOX_GUEST_STAT_HANDLES RT_BIT(5)
|
---|
439 | #define VBOX_GUEST_STAT_MEMORY_LOAD RT_BIT(6)
|
---|
440 | #define VBOX_GUEST_STAT_PHYS_MEM_TOTAL RT_BIT(7)
|
---|
441 | #define VBOX_GUEST_STAT_PHYS_MEM_AVAIL RT_BIT(8)
|
---|
442 | #define VBOX_GUEST_STAT_PHYS_MEM_BALLOON RT_BIT(9)
|
---|
443 | #define VBOX_GUEST_STAT_MEM_COMMIT_TOTAL RT_BIT(10)
|
---|
444 | #define VBOX_GUEST_STAT_MEM_KERNEL_TOTAL RT_BIT(11)
|
---|
445 | #define VBOX_GUEST_STAT_MEM_KERNEL_PAGED RT_BIT(12)
|
---|
446 | #define VBOX_GUEST_STAT_MEM_KERNEL_NONPAGED RT_BIT(13)
|
---|
447 | #define VBOX_GUEST_STAT_MEM_SYSTEM_CACHE RT_BIT(14)
|
---|
448 | #define VBOX_GUEST_STAT_PAGE_FILE_SIZE RT_BIT(15)
|
---|
449 |
|
---|
450 |
|
---|
451 | /** guest statistics structure */
|
---|
452 | typedef struct VBoxGuestStatistics
|
---|
453 | {
|
---|
454 | /** Virtual CPU id */
|
---|
455 | uint32_t u32CpuId;
|
---|
456 | /** Reported statistics */
|
---|
457 | uint32_t u32StatCaps;
|
---|
458 | /** Idle CPU load (0-100) for last interval */
|
---|
459 | uint32_t u32CpuLoad_Idle;
|
---|
460 | /** Kernel CPU load (0-100) for last interval */
|
---|
461 | uint32_t u32CpuLoad_Kernel;
|
---|
462 | /** User CPU load (0-100) for last interval */
|
---|
463 | uint32_t u32CpuLoad_User;
|
---|
464 | /** Nr of threads */
|
---|
465 | uint32_t u32Threads;
|
---|
466 | /** Nr of processes */
|
---|
467 | uint32_t u32Processes;
|
---|
468 | /** Nr of handles */
|
---|
469 | uint32_t u32Handles;
|
---|
470 | /** Memory load (0-100) */
|
---|
471 | uint32_t u32MemoryLoad;
|
---|
472 | /** Page size of guest system */
|
---|
473 | uint32_t u32PageSize;
|
---|
474 | /** Total physical memory (in 4kb pages) */
|
---|
475 | uint32_t u32PhysMemTotal;
|
---|
476 | /** Available physical memory (in 4kb pages) */
|
---|
477 | uint32_t u32PhysMemAvail;
|
---|
478 | /** Ballooned physical memory (in 4kb pages) */
|
---|
479 | uint32_t u32PhysMemBalloon;
|
---|
480 | /** Total number of committed memory (which is not necessarily in-use) (in 4kb pages) */
|
---|
481 | uint32_t u32MemCommitTotal;
|
---|
482 | /** Total amount of memory used by the kernel (in 4kb pages) */
|
---|
483 | uint32_t u32MemKernelTotal;
|
---|
484 | /** Total amount of paged memory used by the kernel (in 4kb pages) */
|
---|
485 | uint32_t u32MemKernelPaged;
|
---|
486 | /** Total amount of nonpaged memory used by the kernel (in 4kb pages) */
|
---|
487 | uint32_t u32MemKernelNonPaged;
|
---|
488 | /** Total amount of memory used for the system cache (in 4kb pages) */
|
---|
489 | uint32_t u32MemSystemCache;
|
---|
490 | /** Pagefile size (in 4kb pages) */
|
---|
491 | uint32_t u32PageFileSize;
|
---|
492 | } VBoxGuestStatistics;
|
---|
493 |
|
---|
494 | /** guest statistics command structure */
|
---|
495 | typedef struct
|
---|
496 | {
|
---|
497 | /** header */
|
---|
498 | VMMDevRequestHeader header;
|
---|
499 | /** Guest information. */
|
---|
500 | VBoxGuestStatistics guestStats;
|
---|
501 | } VMMDevReportGuestStats;
|
---|
502 |
|
---|
503 | /** memory balloon change request structure */
|
---|
504 | #define VMMDEV_MAX_MEMORY_BALLOON(PhysMemTotal) ((90*PhysMemTotal)/100)
|
---|
505 |
|
---|
506 | typedef struct
|
---|
507 | {
|
---|
508 | /** header */
|
---|
509 | VMMDevRequestHeader header;
|
---|
510 | uint32_t u32BalloonSize; /* balloon size in megabytes */
|
---|
511 | uint32_t u32PhysMemSize; /* guest ram size in megabytes */
|
---|
512 | uint32_t eventAck;
|
---|
513 | } VMMDevGetMemBalloonChangeRequest;
|
---|
514 |
|
---|
515 | /** inflate/deflate memory balloon structure */
|
---|
516 | #define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES (_1M/4096)
|
---|
517 | #define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE (VMMDEV_MEMORY_BALLOON_CHUNK_PAGES*4096)
|
---|
518 |
|
---|
519 | typedef struct
|
---|
520 | {
|
---|
521 | /** header */
|
---|
522 | VMMDevRequestHeader header;
|
---|
523 | uint32_t cPages;
|
---|
524 | uint32_t fInflate; /* true = inflate, false = defalte */
|
---|
525 | /** Physical address (RTGCPHYS) of each page, variable size. */
|
---|
526 | RTGCPHYS aPhysPage[1];
|
---|
527 | } VMMDevChangeMemBalloon;
|
---|
528 |
|
---|
529 | /** guest statistics interval change request structure */
|
---|
530 | typedef struct
|
---|
531 | {
|
---|
532 | /** header */
|
---|
533 | VMMDevRequestHeader header;
|
---|
534 | uint32_t u32StatInterval; /* interval in seconds */
|
---|
535 | uint32_t eventAck;
|
---|
536 | } VMMDevGetStatisticsChangeRequest;
|
---|
537 |
|
---|
538 | /** display change request structure */
|
---|
539 | typedef struct
|
---|
540 | {
|
---|
541 | /** header */
|
---|
542 | VMMDevRequestHeader header;
|
---|
543 | /** horizontal pixel resolution (0 = do not change) */
|
---|
544 | uint32_t xres;
|
---|
545 | /** vertical pixel resolution (0 = do not change) */
|
---|
546 | uint32_t yres;
|
---|
547 | /** bits per pixel (0 = do not change) */
|
---|
548 | uint32_t bpp;
|
---|
549 | /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
|
---|
550 | * Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
|
---|
551 | */
|
---|
552 | uint32_t eventAck;
|
---|
553 | } VMMDevDisplayChangeRequest;
|
---|
554 |
|
---|
555 | typedef struct
|
---|
556 | {
|
---|
557 | /** header */
|
---|
558 | VMMDevRequestHeader header;
|
---|
559 | /** horizontal pixel resolution (0 = do not change) */
|
---|
560 | uint32_t xres;
|
---|
561 | /** vertical pixel resolution (0 = do not change) */
|
---|
562 | uint32_t yres;
|
---|
563 | /** bits per pixel (0 = do not change) */
|
---|
564 | uint32_t bpp;
|
---|
565 | /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
|
---|
566 | * Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
|
---|
567 | */
|
---|
568 | uint32_t eventAck;
|
---|
569 | /** 0 for primary display, 1 for the first secondary, etc. */
|
---|
570 | uint32_t display;
|
---|
571 | } VMMDevDisplayChangeRequest2;
|
---|
572 |
|
---|
573 | /** video mode supported request structure */
|
---|
574 | typedef struct
|
---|
575 | {
|
---|
576 | /** header */
|
---|
577 | VMMDevRequestHeader header;
|
---|
578 | /** horizontal pixel resolution (input) */
|
---|
579 | uint32_t width;
|
---|
580 | /** vertical pixel resolution (input) */
|
---|
581 | uint32_t height;
|
---|
582 | /** bits per pixel (input) */
|
---|
583 | uint32_t bpp;
|
---|
584 | /** supported flag (output) */
|
---|
585 | bool fSupported;
|
---|
586 | } VMMDevVideoModeSupportedRequest;
|
---|
587 |
|
---|
588 | /** video modes height reduction request structure */
|
---|
589 | typedef struct
|
---|
590 | {
|
---|
591 | /** header */
|
---|
592 | VMMDevRequestHeader header;
|
---|
593 | /** height reduction in pixels (output) */
|
---|
594 | uint32_t heightReduction;
|
---|
595 | } VMMDevGetHeightReductionRequest;
|
---|
596 |
|
---|
597 | #define VRDP_EXPERIENCE_LEVEL_ZERO 0 /* Theming disabled. */
|
---|
598 | #define VRDP_EXPERIENCE_LEVEL_LOW 1 /* Full window dragging and desktop wallpaper disabled. */
|
---|
599 | #define VRDP_EXPERIENCE_LEVEL_MEDIUM 2 /* Font smoothing, gradients. */
|
---|
600 | #define VRDP_EXPERIENCE_LEVEL_HIGH 3 /* Animation effects disabled. */
|
---|
601 | #define VRDP_EXPERIENCE_LEVEL_FULL 4 /* Everything enabled. */
|
---|
602 |
|
---|
603 | typedef struct
|
---|
604 | {
|
---|
605 | /** header */
|
---|
606 | VMMDevRequestHeader header;
|
---|
607 | /** Whether VRDP is active or not */
|
---|
608 | uint8_t u8VRDPActive;
|
---|
609 | /** The configured experience level for active VRDP. */
|
---|
610 | uint32_t u32VRDPExperienceLevel;
|
---|
611 | } VMMDevVRDPChangeRequest;
|
---|
612 |
|
---|
613 |
|
---|
614 |
|
---|
615 | #pragma pack()
|
---|
616 |
|
---|
617 | #ifdef VBOX_WITH_HGCM
|
---|
618 |
|
---|
619 | /** HGCM flags.
|
---|
620 | * @{
|
---|
621 | */
|
---|
622 | #define VBOX_HGCM_REQ_DONE (0x1)
|
---|
623 | #define VBOX_HGCM_REQ_CANCELLED (0x2)
|
---|
624 | /** @} */
|
---|
625 |
|
---|
626 | #pragma pack(4)
|
---|
627 | typedef struct _VMMDevHGCMRequestHeader
|
---|
628 | {
|
---|
629 | /** Request header. */
|
---|
630 | VMMDevRequestHeader header;
|
---|
631 |
|
---|
632 | /** HGCM flags. */
|
---|
633 | uint32_t fu32Flags;
|
---|
634 |
|
---|
635 | /** Result code. */
|
---|
636 | int32_t result;
|
---|
637 | } VMMDevHGCMRequestHeader;
|
---|
638 | AssertCompileSize(VMMDevHGCMRequestHeader, 24+8);
|
---|
639 |
|
---|
640 | /** HGCM service location types. */
|
---|
641 | typedef enum
|
---|
642 | {
|
---|
643 | VMMDevHGCMLoc_Invalid = 0,
|
---|
644 | VMMDevHGCMLoc_LocalHost = 1,
|
---|
645 | VMMDevHGCMLoc_LocalHost_Existing = 2,
|
---|
646 | VMMDevHGCMLoc_SizeHack = 0x7fffffff
|
---|
647 | } HGCMServiceLocationType;
|
---|
648 |
|
---|
649 | typedef struct
|
---|
650 | {
|
---|
651 | char achName[128]; /**< This is really szName. */
|
---|
652 | } HGCMServiceLocationHost;
|
---|
653 |
|
---|
654 | typedef struct HGCMSERVICELOCATION
|
---|
655 | {
|
---|
656 | /** Type of the location. */
|
---|
657 | HGCMServiceLocationType type;
|
---|
658 |
|
---|
659 | union
|
---|
660 | {
|
---|
661 | HGCMServiceLocationHost host;
|
---|
662 | } u;
|
---|
663 | } HGCMServiceLocation;
|
---|
664 |
|
---|
665 | typedef struct
|
---|
666 | {
|
---|
667 | /* request header */
|
---|
668 | VMMDevHGCMRequestHeader header;
|
---|
669 |
|
---|
670 | /** IN: Description of service to connect to. */
|
---|
671 | HGCMServiceLocation loc;
|
---|
672 |
|
---|
673 | /** OUT: Client identifier assigned by local instance of HGCM. */
|
---|
674 | uint32_t u32ClientID;
|
---|
675 | } VMMDevHGCMConnect;
|
---|
676 |
|
---|
677 | typedef struct
|
---|
678 | {
|
---|
679 | /* request header */
|
---|
680 | VMMDevHGCMRequestHeader header;
|
---|
681 |
|
---|
682 | /** IN: Client identifier. */
|
---|
683 | uint32_t u32ClientID;
|
---|
684 | } VMMDevHGCMDisconnect;
|
---|
685 |
|
---|
686 | typedef enum
|
---|
687 | {
|
---|
688 | VMMDevHGCMParmType_Invalid = 0,
|
---|
689 | VMMDevHGCMParmType_32bit = 1,
|
---|
690 | VMMDevHGCMParmType_64bit = 2,
|
---|
691 | VMMDevHGCMParmType_PhysAddr = 3,
|
---|
692 | VMMDevHGCMParmType_LinAddr = 4, /**< In and Out */
|
---|
693 | VMMDevHGCMParmType_LinAddr_In = 5, /**< In (read; host<-guest) */
|
---|
694 | VMMDevHGCMParmType_LinAddr_Out = 6, /**< Out (write; host->guest) */
|
---|
695 | VMMDevHGCMParmType_LinAddr_Locked = 7, /**< Locked In and Out */
|
---|
696 | VMMDevHGCMParmType_LinAddr_Locked_In = 8, /**< Locked In (read; host<-guest) */
|
---|
697 | VMMDevHGCMParmType_LinAddr_Locked_Out = 9, /**< Locked Out (write; host->guest) */
|
---|
698 | VMMDevHGCMParmType_SizeHack = 0x7fffffff
|
---|
699 | } HGCMFunctionParameterType;
|
---|
700 |
|
---|
701 | #ifdef VBOX_WITH_64_BITS_GUESTS
|
---|
702 | typedef struct _HGCMFUNCTIONPARAMETER32
|
---|
703 | {
|
---|
704 | HGCMFunctionParameterType type;
|
---|
705 | union
|
---|
706 | {
|
---|
707 | uint32_t value32;
|
---|
708 | uint64_t value64;
|
---|
709 | struct
|
---|
710 | {
|
---|
711 | uint32_t size;
|
---|
712 |
|
---|
713 | union
|
---|
714 | {
|
---|
715 | RTGCPHYS32 physAddr;
|
---|
716 | RTGCPTR32 linearAddr;
|
---|
717 | } u;
|
---|
718 | } Pointer;
|
---|
719 | } u;
|
---|
720 | #ifdef __cplusplus
|
---|
721 | void SetUInt32(uint32_t u32)
|
---|
722 | {
|
---|
723 | type = VMMDevHGCMParmType_32bit;
|
---|
724 | u.value64 = 0; /* init unused bits to 0 */
|
---|
725 | u.value32 = u32;
|
---|
726 | }
|
---|
727 |
|
---|
728 | int GetUInt32(uint32_t *pu32)
|
---|
729 | {
|
---|
730 | if (type == VMMDevHGCMParmType_32bit)
|
---|
731 | {
|
---|
732 | *pu32 = u.value32;
|
---|
733 | return VINF_SUCCESS;
|
---|
734 | }
|
---|
735 | return VERR_INVALID_PARAMETER;
|
---|
736 | }
|
---|
737 |
|
---|
738 | void SetUInt64(uint64_t u64)
|
---|
739 | {
|
---|
740 | type = VMMDevHGCMParmType_64bit;
|
---|
741 | u.value64 = u64;
|
---|
742 | }
|
---|
743 |
|
---|
744 | int GetUInt64(uint64_t *pu64)
|
---|
745 | {
|
---|
746 | if (type == VMMDevHGCMParmType_64bit)
|
---|
747 | {
|
---|
748 | *pu64 = u.value64;
|
---|
749 | return VINF_SUCCESS;
|
---|
750 | }
|
---|
751 | return VERR_INVALID_PARAMETER;
|
---|
752 | }
|
---|
753 |
|
---|
754 | void SetPtr(void *pv, uint32_t cb)
|
---|
755 | {
|
---|
756 | type = VMMDevHGCMParmType_LinAddr;
|
---|
757 | u.Pointer.size = cb;
|
---|
758 | u.Pointer.u.linearAddr = (RTGCPTR32)(uintptr_t)pv;
|
---|
759 | }
|
---|
760 | #endif
|
---|
761 | } HGCMFunctionParameter32;
|
---|
762 |
|
---|
763 | typedef struct _HGCMFUNCTIONPARAMETER64
|
---|
764 | {
|
---|
765 | HGCMFunctionParameterType type;
|
---|
766 | union
|
---|
767 | {
|
---|
768 | uint32_t value32;
|
---|
769 | uint64_t value64;
|
---|
770 | struct
|
---|
771 | {
|
---|
772 | uint32_t size;
|
---|
773 |
|
---|
774 | union
|
---|
775 | {
|
---|
776 | RTGCPHYS64 physAddr;
|
---|
777 | RTGCPTR64 linearAddr;
|
---|
778 | } u;
|
---|
779 | } Pointer;
|
---|
780 | } u;
|
---|
781 | #ifdef __cplusplus
|
---|
782 | void SetUInt32(uint32_t u32)
|
---|
783 | {
|
---|
784 | type = VMMDevHGCMParmType_32bit;
|
---|
785 | u.value64 = 0; /* init unused bits to 0 */
|
---|
786 | u.value32 = u32;
|
---|
787 | }
|
---|
788 |
|
---|
789 | int GetUInt32(uint32_t *pu32)
|
---|
790 | {
|
---|
791 | if (type == VMMDevHGCMParmType_32bit)
|
---|
792 | {
|
---|
793 | *pu32 = u.value32;
|
---|
794 | return VINF_SUCCESS;
|
---|
795 | }
|
---|
796 | return VERR_INVALID_PARAMETER;
|
---|
797 | }
|
---|
798 |
|
---|
799 | void SetUInt64(uint64_t u64)
|
---|
800 | {
|
---|
801 | type = VMMDevHGCMParmType_64bit;
|
---|
802 | u.value64 = u64;
|
---|
803 | }
|
---|
804 |
|
---|
805 | int GetUInt64(uint64_t *pu64)
|
---|
806 | {
|
---|
807 | if (type == VMMDevHGCMParmType_64bit)
|
---|
808 | {
|
---|
809 | *pu64 = u.value64;
|
---|
810 | return VINF_SUCCESS;
|
---|
811 | }
|
---|
812 | return VERR_INVALID_PARAMETER;
|
---|
813 | }
|
---|
814 |
|
---|
815 | void SetPtr(void *pv, uint32_t cb)
|
---|
816 | {
|
---|
817 | type = VMMDevHGCMParmType_LinAddr;
|
---|
818 | u.Pointer.size = cb;
|
---|
819 | u.Pointer.u.linearAddr = (uintptr_t)pv;
|
---|
820 | }
|
---|
821 | #endif
|
---|
822 | } HGCMFunctionParameter64;
|
---|
823 | #else /* !VBOX_WITH_64_BITS_GUESTS */
|
---|
824 | typedef struct _HGCMFUNCTIONPARAMETER
|
---|
825 | {
|
---|
826 | HGCMFunctionParameterType type;
|
---|
827 | union
|
---|
828 | {
|
---|
829 | uint32_t value32;
|
---|
830 | uint64_t value64;
|
---|
831 | struct
|
---|
832 | {
|
---|
833 | uint32_t size;
|
---|
834 |
|
---|
835 | union
|
---|
836 | {
|
---|
837 | RTGCPHYS32 physAddr;
|
---|
838 | RTGCPTR32 linearAddr;
|
---|
839 | } u;
|
---|
840 | } Pointer;
|
---|
841 | } u;
|
---|
842 | #ifdef __cplusplus
|
---|
843 | void SetUInt32(uint32_t u32)
|
---|
844 | {
|
---|
845 | type = VMMDevHGCMParmType_32bit;
|
---|
846 | u.value64 = 0; /* init unused bits to 0 */
|
---|
847 | u.value32 = u32;
|
---|
848 | }
|
---|
849 |
|
---|
850 | int GetUInt32(uint32_t *pu32)
|
---|
851 | {
|
---|
852 | if (type == VMMDevHGCMParmType_32bit)
|
---|
853 | {
|
---|
854 | *pu32 = u.value32;
|
---|
855 | return VINF_SUCCESS;
|
---|
856 | }
|
---|
857 | return VERR_INVALID_PARAMETER;
|
---|
858 | }
|
---|
859 |
|
---|
860 | void SetUInt64(uint64_t u64)
|
---|
861 | {
|
---|
862 | type = VMMDevHGCMParmType_64bit;
|
---|
863 | u.value64 = u64;
|
---|
864 | }
|
---|
865 |
|
---|
866 | int GetUInt64(uint64_t *pu64)
|
---|
867 | {
|
---|
868 | if (type == VMMDevHGCMParmType_64bit)
|
---|
869 | {
|
---|
870 | *pu64 = u.value64;
|
---|
871 | return VINF_SUCCESS;
|
---|
872 | }
|
---|
873 | return VERR_INVALID_PARAMETER;
|
---|
874 | }
|
---|
875 |
|
---|
876 | void SetPtr(void *pv, uint32_t cb)
|
---|
877 | {
|
---|
878 | type = VMMDevHGCMParmType_LinAddr;
|
---|
879 | u.Pointer.size = cb;
|
---|
880 | u.Pointer.u.linearAddr = (uintptr_t)pv;
|
---|
881 | }
|
---|
882 | #endif
|
---|
883 | } HGCMFunctionParameter;
|
---|
884 | #endif /* !VBOX_WITH_64_BITS_GUESTS */
|
---|
885 |
|
---|
886 |
|
---|
887 | #ifdef VBOX_WITH_64_BITS_GUESTS
|
---|
888 | /* Redefine the structure type for the guest code. */
|
---|
889 | # ifndef VBOX_HGCM_HOST_CODE
|
---|
890 | # if ARCH_BITS == 64
|
---|
891 | # define HGCMFunctionParameter HGCMFunctionParameter64
|
---|
892 | # elif ARCH_BITS == 32
|
---|
893 | # define HGCMFunctionParameter HGCMFunctionParameter32
|
---|
894 | # else
|
---|
895 | # error "Unsupported sizeof (void *)"
|
---|
896 | # endif
|
---|
897 | # endif /* !VBOX_HGCM_HOST_CODE */
|
---|
898 | #endif /* VBOX_WITH_64_BITS_GUESTS */
|
---|
899 |
|
---|
900 | typedef struct
|
---|
901 | {
|
---|
902 | /* request header */
|
---|
903 | VMMDevHGCMRequestHeader header;
|
---|
904 |
|
---|
905 | /** IN: Client identifier. */
|
---|
906 | uint32_t u32ClientID;
|
---|
907 | /** IN: Service function number. */
|
---|
908 | uint32_t u32Function;
|
---|
909 | /** IN: Number of parameters. */
|
---|
910 | uint32_t cParms;
|
---|
911 | /** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
|
---|
912 | } VMMDevHGCMCall;
|
---|
913 | #pragma pack()
|
---|
914 |
|
---|
915 | #define VMMDEV_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
|
---|
916 | #define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
|
---|
917 |
|
---|
918 | #ifdef VBOX_WITH_64_BITS_GUESTS
|
---|
919 | /* Explicit defines for the host code. */
|
---|
920 | # ifdef VBOX_HGCM_HOST_CODE
|
---|
921 | # define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
|
---|
922 | # define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
|
---|
923 | # endif /* VBOX_HGCM_HOST_CODE */
|
---|
924 | #endif /* VBOX_WITH_64_BITS_GUESTS */
|
---|
925 |
|
---|
926 | #define VBOX_HGCM_MAX_PARMS 32
|
---|
927 |
|
---|
928 | /* The Cancel request is issued using the same physical memory address
|
---|
929 | * as was used for the corresponding initial HGCMCall.
|
---|
930 | */
|
---|
931 | typedef struct
|
---|
932 | {
|
---|
933 | /* request header */
|
---|
934 | VMMDevHGCMRequestHeader header;
|
---|
935 | } VMMDevHGCMCancel;
|
---|
936 |
|
---|
937 | #endif /* VBOX_WITH_HGCM */
|
---|
938 |
|
---|
939 |
|
---|
940 | #define VBVA_F_STATUS_ACCEPTED (0x01)
|
---|
941 | #define VBVA_F_STATUS_ENABLED (0x02)
|
---|
942 |
|
---|
943 | #pragma pack(4)
|
---|
944 |
|
---|
945 | typedef struct _VMMDevVideoAccelEnable
|
---|
946 | {
|
---|
947 | /* request header */
|
---|
948 | VMMDevRequestHeader header;
|
---|
949 |
|
---|
950 | /** 0 - disable, !0 - enable. */
|
---|
951 | uint32_t u32Enable;
|
---|
952 |
|
---|
953 | /** The size of VBVAMEMORY::au8RingBuffer expected by driver.
|
---|
954 | * The host will refuse to enable VBVA if the size is not equal to
|
---|
955 | * VBVA_RING_BUFFER_SIZE.
|
---|
956 | */
|
---|
957 | uint32_t cbRingBuffer;
|
---|
958 |
|
---|
959 | /** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
|
---|
960 | uint32_t fu32Status;
|
---|
961 |
|
---|
962 | } VMMDevVideoAccelEnable;
|
---|
963 |
|
---|
964 | typedef struct _VMMDevVideoAccelFlush
|
---|
965 | {
|
---|
966 | /* request header */
|
---|
967 | VMMDevRequestHeader header;
|
---|
968 |
|
---|
969 | } VMMDevVideoAccelFlush;
|
---|
970 |
|
---|
971 |
|
---|
972 | typedef struct _VMMDevVideoSetVisibleRegion
|
---|
973 | {
|
---|
974 | /* request header */
|
---|
975 | VMMDevRequestHeader header;
|
---|
976 |
|
---|
977 | /** Number of rectangles */
|
---|
978 | uint32_t cRect;
|
---|
979 |
|
---|
980 | /** Rectangle array */
|
---|
981 | RTRECT Rect;
|
---|
982 | } VMMDevVideoSetVisibleRegion;
|
---|
983 |
|
---|
984 |
|
---|
985 | /** Seamless mode */
|
---|
986 | typedef enum
|
---|
987 | {
|
---|
988 | VMMDev_Seamless_Disabled = 0, /* normal mode; entire guest desktop displayed */
|
---|
989 | VMMDev_Seamless_Visible_Region = 1, /* visible region mode; only top-level guest windows displayed */
|
---|
990 | VMMDev_Seamless_Host_Window = 2 /* windowed mode; each top-level guest window is represented in a host window */
|
---|
991 | } VMMDevSeamlessMode;
|
---|
992 |
|
---|
993 | typedef struct
|
---|
994 | {
|
---|
995 | /** header */
|
---|
996 | VMMDevRequestHeader header;
|
---|
997 |
|
---|
998 | /** New seamless mode */
|
---|
999 | VMMDevSeamlessMode mode;
|
---|
1000 | /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST.
|
---|
1001 | * Values: 0 - just querying, VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST - event acknowledged.
|
---|
1002 | */
|
---|
1003 | uint32_t eventAck;
|
---|
1004 | } VMMDevSeamlessChangeRequest;
|
---|
1005 |
|
---|
1006 | #pragma pack()
|
---|
1007 |
|
---|
1008 | #pragma pack(1)
|
---|
1009 | /** VBVA command header. */
|
---|
1010 | typedef struct _VBVACMDHDR
|
---|
1011 | {
|
---|
1012 | /** Coordinates of affected rectangle. */
|
---|
1013 | int16_t x;
|
---|
1014 | int16_t y;
|
---|
1015 | uint16_t w;
|
---|
1016 | uint16_t h;
|
---|
1017 | } VBVACMDHDR;
|
---|
1018 | #pragma pack()
|
---|
1019 |
|
---|
1020 | /* The VBVA ring buffer is suitable for transferring large (< 2gb) amount of data.
|
---|
1021 | * For example big bitmaps which do not fit to the buffer.
|
---|
1022 | *
|
---|
1023 | * Guest starts writing to the buffer by initializing a record entry in the
|
---|
1024 | * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
|
---|
1025 | * written. As data is written to the ring buffer, the guest increases off32End
|
---|
1026 | * for the record.
|
---|
1027 | *
|
---|
1028 | * The host reads the aRecords on flushes and processes all completed records.
|
---|
1029 | * When host encounters situation when only a partial record presents and
|
---|
1030 | * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE - VBVA_RING_BUFFER_THRESHOLD,
|
---|
1031 | * the host fetched all record data and updates off32Head. After that on each flush
|
---|
1032 | * the host continues fetching the data until the record is completed.
|
---|
1033 | *
|
---|
1034 | */
|
---|
1035 |
|
---|
1036 | #define VBVA_RING_BUFFER_SIZE (_4M - _1K)
|
---|
1037 | #define VBVA_RING_BUFFER_THRESHOLD (4 * _1K)
|
---|
1038 |
|
---|
1039 | #define VBVA_MAX_RECORDS (64)
|
---|
1040 |
|
---|
1041 | #define VBVA_F_MODE_ENABLED (0x00000001)
|
---|
1042 | #define VBVA_F_MODE_VRDP (0x00000002)
|
---|
1043 | #define VBVA_F_MODE_VRDP_RESET (0x00000004)
|
---|
1044 | #define VBVA_F_MODE_VRDP_ORDER_MASK (0x00000008)
|
---|
1045 |
|
---|
1046 | #define VBVA_F_RECORD_PARTIAL (0x80000000)
|
---|
1047 |
|
---|
1048 | #pragma pack(1)
|
---|
1049 | typedef struct _VBVARECORD
|
---|
1050 | {
|
---|
1051 | /** The length of the record. Changed by guest. */
|
---|
1052 | uint32_t cbRecord;
|
---|
1053 | } VBVARECORD;
|
---|
1054 |
|
---|
1055 | typedef struct _VBVAMEMORY
|
---|
1056 | {
|
---|
1057 | /** VBVA_F_MODE_* */
|
---|
1058 | uint32_t fu32ModeFlags;
|
---|
1059 |
|
---|
1060 | /** The offset where the data start in the buffer. */
|
---|
1061 | uint32_t off32Data;
|
---|
1062 | /** The offset where next data must be placed in the buffer. */
|
---|
1063 | uint32_t off32Free;
|
---|
1064 |
|
---|
1065 | /** The ring buffer for data. */
|
---|
1066 | uint8_t au8RingBuffer[VBVA_RING_BUFFER_SIZE];
|
---|
1067 |
|
---|
1068 | /** The queue of record descriptions. */
|
---|
1069 | VBVARECORD aRecords[VBVA_MAX_RECORDS];
|
---|
1070 | uint32_t indexRecordFirst;
|
---|
1071 | uint32_t indexRecordFree;
|
---|
1072 |
|
---|
1073 | /* RDP orders supported by the client. The guest reports only them
|
---|
1074 | * and falls back to DIRTY rects for not supported ones.
|
---|
1075 | *
|
---|
1076 | * (1 << VBVA_VRDP_*)
|
---|
1077 | */
|
---|
1078 | uint32_t fu32SupportedOrders;
|
---|
1079 |
|
---|
1080 | } VBVAMEMORY;
|
---|
1081 | #pragma pack()
|
---|
1082 |
|
---|
1083 | /** @} */
|
---|
1084 |
|
---|
1085 |
|
---|
1086 | /**
|
---|
1087 | * VMMDev RAM
|
---|
1088 | * @{
|
---|
1089 | */
|
---|
1090 |
|
---|
1091 | #pragma pack(1)
|
---|
1092 | /** Layout of VMMDEV RAM region that contains information for guest */
|
---|
1093 | typedef struct
|
---|
1094 | {
|
---|
1095 | /** size */
|
---|
1096 | uint32_t u32Size;
|
---|
1097 | /** version */
|
---|
1098 | uint32_t u32Version;
|
---|
1099 |
|
---|
1100 | union {
|
---|
1101 | /** Flag telling that VMMDev set the IRQ and acknowlegment is required */
|
---|
1102 | struct {
|
---|
1103 | bool fHaveEvents;
|
---|
1104 | } V1_04;
|
---|
1105 |
|
---|
1106 | struct {
|
---|
1107 | /** Pending events flags, set by host. */
|
---|
1108 | uint32_t u32HostEvents;
|
---|
1109 | /** Mask of events the guest wants to see, set by guest. */
|
---|
1110 | uint32_t u32GuestEventMask;
|
---|
1111 | } V1_03;
|
---|
1112 | } V;
|
---|
1113 |
|
---|
1114 | VBVAMEMORY vbvaMemory;
|
---|
1115 |
|
---|
1116 | } VMMDevMemory;
|
---|
1117 | #pragma pack()
|
---|
1118 |
|
---|
1119 | /** Version of VMMDevMemory structure. */
|
---|
1120 | #define VMMDEV_MEMORY_VERSION (1)
|
---|
1121 |
|
---|
1122 | /** @} */
|
---|
1123 |
|
---|
1124 |
|
---|
1125 | /**
|
---|
1126 | * VMMDev events.
|
---|
1127 | * @{
|
---|
1128 | */
|
---|
1129 |
|
---|
1130 | /** Host mouse capabilities has been changed. */
|
---|
1131 | #define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED RT_BIT(0)
|
---|
1132 | /** HGCM event. */
|
---|
1133 | #define VMMDEV_EVENT_HGCM RT_BIT(1)
|
---|
1134 | /** A display change request has been issued. */
|
---|
1135 | #define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST RT_BIT(2)
|
---|
1136 | /** Credentials are available for judgement. */
|
---|
1137 | #define VMMDEV_EVENT_JUDGE_CREDENTIALS RT_BIT(3)
|
---|
1138 | /** The guest has been restored. */
|
---|
1139 | #define VMMDEV_EVENT_RESTORED RT_BIT(4)
|
---|
1140 | /** Seamless mode state changed */
|
---|
1141 | #define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST RT_BIT(5)
|
---|
1142 | /** Memory balloon size changed */
|
---|
1143 | #define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST RT_BIT(6)
|
---|
1144 | /** Statistics interval changed */
|
---|
1145 | #define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST RT_BIT(7)
|
---|
1146 | /** VRDP status changed. */
|
---|
1147 | #define VMMDEV_EVENT_VRDP RT_BIT(8)
|
---|
1148 | /** New mouse position data available */
|
---|
1149 | #define VMMDEV_EVENT_MOUSE_POSITION_CHANGED RT_BIT(9)
|
---|
1150 |
|
---|
1151 | /** @} */
|
---|
1152 |
|
---|
1153 |
|
---|
1154 | /*
|
---|
1155 | * Credentials request flags and structure
|
---|
1156 | */
|
---|
1157 |
|
---|
1158 | #define VMMDEV_CREDENTIALS_STRLEN 128
|
---|
1159 |
|
---|
1160 | /** query from host whether credentials are present */
|
---|
1161 | #define VMMDEV_CREDENTIALS_QUERYPRESENCE RT_BIT(1)
|
---|
1162 | /** read credentials from host (can be combined with clear) */
|
---|
1163 | #define VMMDEV_CREDENTIALS_READ RT_BIT(2)
|
---|
1164 | /** clear credentials on host (can be combined with read) */
|
---|
1165 | #define VMMDEV_CREDENTIALS_CLEAR RT_BIT(3)
|
---|
1166 | /** read credentials for judgement in the guest */
|
---|
1167 | #define VMMDEV_CREDENTIALS_READJUDGE RT_BIT(8)
|
---|
1168 | /** clear credentials for judegement on the host */
|
---|
1169 | #define VMMDEV_CREDENTIALS_CLEARJUDGE RT_BIT(9)
|
---|
1170 | /** report credentials acceptance by guest */
|
---|
1171 | #define VMMDEV_CREDENTIALS_JUDGE_OK RT_BIT(10)
|
---|
1172 | /** report credentials denial by guest */
|
---|
1173 | #define VMMDEV_CREDENTIALS_JUDGE_DENY RT_BIT(11)
|
---|
1174 | /** report that no judgement could be made by guest */
|
---|
1175 | #define VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT RT_BIT(12)
|
---|
1176 |
|
---|
1177 | /** flag telling the guest that credentials are present */
|
---|
1178 | #define VMMDEV_CREDENTIALS_PRESENT RT_BIT(16)
|
---|
1179 | /** flag telling guest that local logons should be prohibited */
|
---|
1180 | #define VMMDEV_CREDENTIALS_NOLOCALLOGON RT_BIT(17)
|
---|
1181 |
|
---|
1182 | /** credentials request structure */
|
---|
1183 | #pragma pack(4)
|
---|
1184 | typedef struct _VMMDevCredentials
|
---|
1185 | {
|
---|
1186 | /* request header */
|
---|
1187 | VMMDevRequestHeader header;
|
---|
1188 | /* request flags (in/out) */
|
---|
1189 | uint32_t u32Flags;
|
---|
1190 | /* user name (UTF-8) (out) */
|
---|
1191 | char szUserName[VMMDEV_CREDENTIALS_STRLEN];
|
---|
1192 | /* password (UTF-8) (out) */
|
---|
1193 | char szPassword[VMMDEV_CREDENTIALS_STRLEN];
|
---|
1194 | /* domain name (UTF-8) (out) */
|
---|
1195 | char szDomain[VMMDEV_CREDENTIALS_STRLEN];
|
---|
1196 | } VMMDevCredentials;
|
---|
1197 | #pragma pack()
|
---|
1198 |
|
---|
1199 |
|
---|
1200 | /**
|
---|
1201 | * Inline helper to determine the request size for the given operation.
|
---|
1202 | *
|
---|
1203 | * @returns Size.
|
---|
1204 | * @param requestType The VMMDev request type.
|
---|
1205 | */
|
---|
1206 | DECLINLINE(size_t) vmmdevGetRequestSize(VMMDevRequestType requestType)
|
---|
1207 | {
|
---|
1208 | switch (requestType)
|
---|
1209 | {
|
---|
1210 | case VMMDevReq_GetMouseStatus:
|
---|
1211 | case VMMDevReq_SetMouseStatus:
|
---|
1212 | return sizeof(VMMDevReqMouseStatus);
|
---|
1213 | case VMMDevReq_SetPointerShape:
|
---|
1214 | return sizeof(VMMDevReqMousePointer);
|
---|
1215 | case VMMDevReq_GetHostVersion:
|
---|
1216 | return sizeof(VMMDevReqHostVersion);
|
---|
1217 | case VMMDevReq_Idle:
|
---|
1218 | return sizeof(VMMDevReqIdle);
|
---|
1219 | case VMMDevReq_GetHostTime:
|
---|
1220 | return sizeof(VMMDevReqHostTime);
|
---|
1221 | case VMMDevReq_GetHypervisorInfo:
|
---|
1222 | case VMMDevReq_SetHypervisorInfo:
|
---|
1223 | return sizeof(VMMDevReqHypervisorInfo);
|
---|
1224 | case VMMDevReq_SetPowerStatus:
|
---|
1225 | return sizeof(VMMDevPowerStateRequest);
|
---|
1226 | case VMMDevReq_AcknowledgeEvents:
|
---|
1227 | return sizeof(VMMDevEvents);
|
---|
1228 | case VMMDevReq_ReportGuestInfo:
|
---|
1229 | return sizeof(VMMDevReportGuestInfo);
|
---|
1230 | case VMMDevReq_GetDisplayChangeRequest:
|
---|
1231 | return sizeof(VMMDevDisplayChangeRequest);
|
---|
1232 | case VMMDevReq_GetDisplayChangeRequest2:
|
---|
1233 | return sizeof(VMMDevDisplayChangeRequest2);
|
---|
1234 | case VMMDevReq_VideoModeSupported:
|
---|
1235 | return sizeof(VMMDevVideoModeSupportedRequest);
|
---|
1236 | case VMMDevReq_GetHeightReduction:
|
---|
1237 | return sizeof(VMMDevGetHeightReductionRequest);
|
---|
1238 | case VMMDevReq_ReportGuestCapabilities:
|
---|
1239 | return sizeof(VMMDevReqGuestCapabilities);
|
---|
1240 | case VMMDevReq_SetGuestCapabilities:
|
---|
1241 | return sizeof(VMMDevReqGuestCapabilities2);
|
---|
1242 | #ifdef VBOX_WITH_HGCM
|
---|
1243 | case VMMDevReq_HGCMConnect:
|
---|
1244 | return sizeof(VMMDevHGCMConnect);
|
---|
1245 | case VMMDevReq_HGCMDisconnect:
|
---|
1246 | return sizeof(VMMDevHGCMDisconnect);
|
---|
1247 | #ifdef VBOX_WITH_64_BITS_GUESTS
|
---|
1248 | case VMMDevReq_HGCMCall32:
|
---|
1249 | return sizeof(VMMDevHGCMCall);
|
---|
1250 | case VMMDevReq_HGCMCall64:
|
---|
1251 | return sizeof(VMMDevHGCMCall);
|
---|
1252 | #else
|
---|
1253 | case VMMDevReq_HGCMCall:
|
---|
1254 | return sizeof(VMMDevHGCMCall);
|
---|
1255 | #endif /* VBOX_WITH_64_BITS_GUESTS */
|
---|
1256 | case VMMDevReq_HGCMCancel:
|
---|
1257 | return sizeof(VMMDevHGCMCancel);
|
---|
1258 | #endif /* VBOX_WITH_HGCM */
|
---|
1259 | case VMMDevReq_VideoAccelEnable:
|
---|
1260 | return sizeof(VMMDevVideoAccelEnable);
|
---|
1261 | case VMMDevReq_VideoAccelFlush:
|
---|
1262 | return sizeof(VMMDevVideoAccelFlush);
|
---|
1263 | case VMMDevReq_VideoSetVisibleRegion:
|
---|
1264 | return sizeof(VMMDevVideoSetVisibleRegion);
|
---|
1265 | case VMMDevReq_GetSeamlessChangeRequest:
|
---|
1266 | return sizeof(VMMDevSeamlessChangeRequest);
|
---|
1267 | case VMMDevReq_QueryCredentials:
|
---|
1268 | return sizeof(VMMDevCredentials);
|
---|
1269 | case VMMDevReq_ReportGuestStats:
|
---|
1270 | return sizeof(VMMDevReportGuestStats);
|
---|
1271 | case VMMDevReq_GetMemBalloonChangeRequest:
|
---|
1272 | return sizeof(VMMDevGetMemBalloonChangeRequest);
|
---|
1273 | case VMMDevReq_GetStatisticsChangeRequest:
|
---|
1274 | return sizeof(VMMDevGetStatisticsChangeRequest);
|
---|
1275 | case VMMDevReq_ChangeMemBalloon:
|
---|
1276 | return sizeof(VMMDevChangeMemBalloon);
|
---|
1277 | case VMMDevReq_GetVRDPChangeRequest:
|
---|
1278 | return sizeof(VMMDevVRDPChangeRequest);
|
---|
1279 | case VMMDevReq_LogString:
|
---|
1280 | return sizeof(VMMDevReqLogString);
|
---|
1281 | default:
|
---|
1282 | return 0;
|
---|
1283 | }
|
---|
1284 | }
|
---|
1285 |
|
---|
1286 |
|
---|
1287 | /**
|
---|
1288 | * Initializes a request structure.
|
---|
1289 | *
|
---|
1290 | * @returns VBox status code.
|
---|
1291 | * @param req The request structure to initialize.
|
---|
1292 | * @param type The request type.
|
---|
1293 | */
|
---|
1294 | DECLINLINE(int) vmmdevInitRequest(VMMDevRequestHeader *req, VMMDevRequestType type)
|
---|
1295 | {
|
---|
1296 | uint32_t requestSize;
|
---|
1297 | if (!req)
|
---|
1298 | return VERR_INVALID_PARAMETER;
|
---|
1299 | requestSize = (uint32_t)vmmdevGetRequestSize(type);
|
---|
1300 | if (!requestSize)
|
---|
1301 | return VERR_INVALID_PARAMETER;
|
---|
1302 | req->size = requestSize;
|
---|
1303 | req->version = VMMDEV_REQUEST_HEADER_VERSION;
|
---|
1304 | req->requestType = type;
|
---|
1305 | req->rc = VERR_GENERAL_FAILURE;
|
---|
1306 | req->reserved1 = 0;
|
---|
1307 | req->reserved2 = 0;
|
---|
1308 | return VINF_SUCCESS;
|
---|
1309 | }
|
---|
1310 |
|
---|
1311 | /** @} */
|
---|
1312 | RT_C_DECLS_END
|
---|
1313 |
|
---|
1314 | #endif
|
---|
1315 |
|
---|