VirtualBox

source: vbox/trunk/include/VBox/VMMDev.h@ 77713

Last change on this file since 77713 was 77243, checked in by vboxsync, 6 years ago

HGCM,SharedFolders: Added new variation on the HGCM page list type that does not use a bounce buffer. bugref:9172

  • Added VMMDevHGCMParmType_NoBouncePageList.
  • Made VMMDevHGCMParmType_Embedded
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 64.1 KB
Line 
1/** @file
2 * Virtual Device for Guest <-> VMM/Host communication (ADD,DEV).
3 */
4
5/*
6 * Copyright (C) 2006-2019 Oracle Corporation
7 *
8 * Permission is hereby granted, free of charge, to any person
9 * obtaining a copy of this software and associated documentation
10 * files (the "Software"), to deal in the Software without
11 * restriction, including without limitation the rights to use,
12 * copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following
15 * conditions:
16 *
17 * The above copyright notice and this permission notice shall be
18 * included in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 * OTHER DEALINGS IN THE SOFTWARE.
28 */
29
30#ifndef VBOX_INCLUDED_VMMDev_h
31#define VBOX_INCLUDED_VMMDev_h
32#ifndef RT_WITHOUT_PRAGMA_ONCE
33# pragma once
34#endif
35
36#include <VBox/cdefs.h>
37#include <VBox/param.h> /* for the PCI IDs. */
38#include <VBox/types.h>
39#include <VBox/ostypes.h>
40#include <VBox/VMMDevCoreTypes.h>
41#include <iprt/assertcompile.h>
42#include <iprt/errcore.h>
43
44
45#pragma pack(4) /* force structure dword packing here. */
46RT_C_DECLS_BEGIN
47
48
49/** @defgroup grp_vmmdev VMM Device
50 *
51 * @note This interface cannot be changed, it can only be extended!
52 *
53 * @{
54 */
55
56
57/** Size of VMMDev RAM region accessible by guest.
58 * Must be big enough to contain VMMDevMemory structure (see further down).
59 * For now: 4 megabyte.
60 */
61#define VMMDEV_RAM_SIZE (4 * 256 * PAGE_SIZE)
62
63/** Size of VMMDev heap region accessible by guest.
64 * (Must be a power of two (pci range).)
65 */
66#define VMMDEV_HEAP_SIZE (4 * PAGE_SIZE)
67
68/** Port for generic request interface (relative offset). */
69#define VMMDEV_PORT_OFF_REQUEST 0
70/** Port for requests that can be handled w/o going to ring-3 (relative offset).
71 * This works like VMMDevReq_AcknowledgeEvents when read. */
72#define VMMDEV_PORT_OFF_REQUEST_FAST 8
73
74
75/** @defgroup grp_vmmdev_req VMMDev Generic Request Interface
76 * @{
77 */
78
79/** @name Current version of the VMMDev interface.
80 *
81 * Additions are allowed to work only if
82 * additions_major == vmmdev_current && additions_minor <= vmmdev_current.
83 * Additions version is reported to host (VMMDev) by VMMDevReq_ReportGuestInfo.
84 *
85 * @remarks These defines also live in the 16-bit and assembly versions of this
86 * header.
87 */
88#define VMMDEV_VERSION 0x00010004
89#define VMMDEV_VERSION_MAJOR (VMMDEV_VERSION >> 16)
90#define VMMDEV_VERSION_MINOR (VMMDEV_VERSION & 0xffff)
91/** @} */
92
93/** Maximum request packet size. */
94#define VMMDEV_MAX_VMMDEVREQ_SIZE _1M
95/** Maximum number of HGCM parameters.
96 * @note This used to be 1024, which is kind of insane. Was changed to 32,
97 * given that (guest) user land can only pass 61 anyway.
98 * See comments on VBGLIOCHGCMCALL::cParms. */
99#define VMMDEV_MAX_HGCM_PARMS 32
100/** Maximum total size of hgcm buffers in one call.
101 * @note Used to be 2G, since reduced to 128MB. */
102#define VMMDEV_MAX_HGCM_DATA_SIZE _128M
103
104/**
105 * VMMDev request types.
106 * @note when updating this, adjust vmmdevGetRequestSize() as well
107 */
108typedef enum VMMDevRequestType
109{
110 VMMDevReq_InvalidRequest = 0,
111 VMMDevReq_GetMouseStatus = 1,
112 VMMDevReq_SetMouseStatus = 2,
113 VMMDevReq_SetPointerShape = 3,
114 VMMDevReq_GetHostVersion = 4,
115 VMMDevReq_Idle = 5,
116 VMMDevReq_GetHostTime = 10,
117 VMMDevReq_GetHypervisorInfo = 20,
118 VMMDevReq_SetHypervisorInfo = 21,
119 VMMDevReq_RegisterPatchMemory = 22, /**< @since version 3.0.6 */
120 VMMDevReq_DeregisterPatchMemory = 23, /**< @since version 3.0.6 */
121 VMMDevReq_SetPowerStatus = 30,
122 VMMDevReq_AcknowledgeEvents = 41,
123 VMMDevReq_CtlGuestFilterMask = 42,
124 VMMDevReq_ReportGuestInfo = 50,
125 VMMDevReq_ReportGuestInfo2 = 58, /**< @since version 3.2.0 */
126 VMMDevReq_ReportGuestStatus = 59, /**< @since version 3.2.8 */
127 VMMDevReq_ReportGuestUserState = 74, /**< @since version 4.3 */
128 /**
129 * Retrieve a display resize request sent by the host using
130 * @a IDisplay:setVideoModeHint. Deprecated.
131 *
132 * Similar to @a VMMDevReq_GetDisplayChangeRequest2, except that it only
133 * considers host requests sent for the first virtual display. This guest
134 * request should not be used in new guest code, and the results are
135 * undefined if a guest mixes calls to this and
136 * @a VMMDevReq_GetDisplayChangeRequest2.
137 */
138 VMMDevReq_GetDisplayChangeRequest = 51,
139 VMMDevReq_VideoModeSupported = 52,
140 VMMDevReq_GetHeightReduction = 53,
141 /**
142 * Retrieve a display resize request sent by the host using
143 * @a IDisplay:setVideoModeHint.
144 *
145 * Queries a display resize request sent from the host. If the
146 * @a eventAck member is sent to true and there is an unqueried
147 * request available for one of the virtual display then that request will
148 * be returned. If several displays have unqueried requests the lowest
149 * numbered display will be chosen first. Only the most recent unseen
150 * request for each display is remembered.
151 * If @a eventAck is set to false, the last host request queried with
152 * @a eventAck set is resent, or failing that the most recent received from
153 * the host. If no host request was ever received then all zeros are
154 * returned.
155 */
156 VMMDevReq_GetDisplayChangeRequest2 = 54,
157 VMMDevReq_ReportGuestCapabilities = 55,
158 VMMDevReq_SetGuestCapabilities = 56,
159 VMMDevReq_VideoModeSupported2 = 57, /**< @since version 3.2.0 */
160 VMMDevReq_GetDisplayChangeRequestEx = 80, /**< @since version 4.2.4 */
161 VMMDevReq_GetDisplayChangeRequestMulti = 81,
162#ifdef VBOX_WITH_HGCM
163 VMMDevReq_HGCMConnect = 60,
164 VMMDevReq_HGCMDisconnect = 61,
165 VMMDevReq_HGCMCall32 = 62,
166 VMMDevReq_HGCMCall64 = 63,
167# ifdef IN_GUEST
168# if ARCH_BITS == 64
169 VMMDevReq_HGCMCall = VMMDevReq_HGCMCall64,
170# elif ARCH_BITS == 32 || ARCH_BITS == 16
171 VMMDevReq_HGCMCall = VMMDevReq_HGCMCall32,
172# else
173# error "Unsupported ARCH_BITS"
174# endif
175# endif
176 VMMDevReq_HGCMCancel = 64,
177 VMMDevReq_HGCMCancel2 = 65,
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_GetCpuHotPlugRequest = 210,
192 VMMDevReq_SetCpuHotPlugStatus = 211,
193 VMMDevReq_RegisterSharedModule = 212,
194 VMMDevReq_UnregisterSharedModule = 213,
195 VMMDevReq_CheckSharedModules = 214,
196 VMMDevReq_GetPageSharingStatus = 215,
197 VMMDevReq_DebugIsPageShared = 216,
198 VMMDevReq_GetSessionId = 217, /**< @since version 3.2.8 */
199 VMMDevReq_WriteCoreDump = 218,
200 VMMDevReq_GuestHeartbeat = 219,
201 VMMDevReq_HeartbeatConfigure = 220,
202 VMMDevReq_NtBugCheck = 221,
203 VMMDevReq_SizeHack = 0x7fffffff
204} VMMDevRequestType;
205
206/** Version of VMMDevRequestHeader structure. */
207#define VMMDEV_REQUEST_HEADER_VERSION (0x10001)
208
209
210/**
211 * Generic VMMDev request header.
212 *
213 * This structure is copied/mirrored by VBGLREQHDR in the VBoxGuest I/O control
214 * interface. Changes there needs to be mirrored in it.
215 *
216 * @sa VBGLREQHDR
217 */
218typedef struct VMMDevRequestHeader
219{
220 /** IN: Size of the structure in bytes (including body).
221 * (VBGLREQHDR uses this for input size and output if reserved1 is zero). */
222 uint32_t size;
223 /** IN: Version of the structure. */
224 uint32_t version;
225 /** IN: Type of the request.
226 * @note VBGLREQHDR uses this for optional output size. */
227 VMMDevRequestType requestType;
228 /** OUT: VBox status code. */
229 int32_t rc;
230 /** Reserved field no.1. MBZ.
231 * @note VBGLREQHDR uses this for optional output size, however never for a
232 * real VMMDev request, only in the I/O control interface. */
233 uint32_t reserved1;
234 /** IN: Requestor information (VMMDEV_REQUESTOR_XXX) when
235 * VBOXGSTINFO2_F_REQUESTOR_INFO is set, otherwise ignored by the host. */
236 uint32_t fRequestor;
237} VMMDevRequestHeader;
238AssertCompileSize(VMMDevRequestHeader, 24);
239
240/** @name VMMDEV_REQUESTOR_XXX - Requestor information.
241 *
242 * This is information provided to the host by the VBoxGuest device driver, so
243 * the host can implemented fine grained access to functionality if it likes.
244 * @bugref{9105}
245 *
246 * @{ */
247/** Requestor user not given. */
248#define VMMDEV_REQUESTOR_USR_NOT_GIVEN UINT32_C(0x00000000)
249/** The kernel driver (VBoxGuest) is the requestor. */
250#define VMMDEV_REQUESTOR_USR_DRV UINT32_C(0x00000001)
251/** Some other kernel driver is the requestor. */
252#define VMMDEV_REQUESTOR_USR_DRV_OTHER UINT32_C(0x00000002)
253/** The root or a admin user is the requestor. */
254#define VMMDEV_REQUESTOR_USR_ROOT UINT32_C(0x00000003)
255/** Requestor is the windows system user (SID S-1-5-18). */
256#define VMMDEV_REQUESTOR_USR_SYSTEM UINT32_C(0x00000004)
257/** Reserved requestor user \#1, treat like VMMDEV_REQUESTOR_USR_USER. */
258#define VMMDEV_REQUESTOR_USR_RESERVED1 UINT32_C(0x00000005)
259/** Regular joe user is making the request. */
260#define VMMDEV_REQUESTOR_USR_USER UINT32_C(0x00000006)
261/** Requestor is a guest user (or in a guest user group). */
262#define VMMDEV_REQUESTOR_USR_GUEST UINT32_C(0x00000007)
263/** User classification mask. */
264#define VMMDEV_REQUESTOR_USR_MASK UINT32_C(0x00000007)
265
266/** Kernel mode request.
267 * @note This is zero, so test for VMMDEV_REQUESTOR_USERMODE instead. */
268#define VMMDEV_REQUESTOR_KERNEL UINT32_C(0x00000000)
269/** User mode request. */
270#define VMMDEV_REQUESTOR_USERMODE UINT32_C(0x00000008)
271
272/** Don't know the physical console association of the requestor. */
273#define VMMDEV_REQUESTOR_CON_DONT_KNOW UINT32_C(0x00000000)
274/** The request originates with a process that is NOT associated with the
275 * physical console. */
276#define VMMDEV_REQUESTOR_CON_NO UINT32_C(0x00000010)
277/** Requestor process DOES is associated with the physical console. */
278#define VMMDEV_REQUESTOR_CON_YES UINT32_C(0x00000020)
279/** Requestor process belongs to user on the physical console, but cannot
280 * ascertain that it is associated with that login. */
281#define VMMDEV_REQUESTOR_CON_USER UINT32_C(0x00000030)
282/** Requestor process belongs to user on the physical console, but cannot
283 * ascertain that it is associated with that login. */
284#define VMMDEV_REQUESTOR_CON_MASK UINT32_C(0x00000040)
285
286/** Requestor is member of special VirtualBox user group (not on windows). */
287#define VMMDEV_REQUESTOR_GRP_VBOX UINT32_C(0x00000080)
288/** Requestor is member of wheel / administrators group (SID S-1-5-32-544). */
289#define VMMDEV_REQUESTOR_GRP_WHEEL UINT32_C(0x00000100)
290
291/** Requestor trust level: Unspecified */
292#define VMMDEV_REQUESTOR_TRUST_NOT_GIVEN UINT32_C(0x00000000)
293/** Requestor trust level: Untrusted (SID S-1-16-0) */
294#define VMMDEV_REQUESTOR_TRUST_UNTRUSTED UINT32_C(0x00001000)
295/** Requestor trust level: Untrusted (SID S-1-16-4096) */
296#define VMMDEV_REQUESTOR_TRUST_LOW UINT32_C(0x00002000)
297/** Requestor trust level: Medium (SID S-1-16-8192) */
298#define VMMDEV_REQUESTOR_TRUST_MEDIUM UINT32_C(0x00003000)
299/** Requestor trust level: Medium plus (SID S-1-16-8448) */
300#define VMMDEV_REQUESTOR_TRUST_MEDIUM_PLUS UINT32_C(0x00004000)
301/** Requestor trust level: High (SID S-1-16-12288) */
302#define VMMDEV_REQUESTOR_TRUST_HIGH UINT32_C(0x00005000)
303/** Requestor trust level: System (SID S-1-16-16384) */
304#define VMMDEV_REQUESTOR_TRUST_SYSTEM UINT32_C(0x00006000)
305/** Requestor trust level: Protected or higher (SID S-1-16-20480, S-1-16-28672)
306 * @note To avoid wasting an unnecessary bit, we combine the two top most
307 * mandatory security labels on Windows (protected and secure). */
308#define VMMDEV_REQUESTOR_TRUST_PROTECTED UINT32_C(0x00007000)
309/** Requestor trust level mask.
310 * The higher the value, the more the guest trusts the process. */
311#define VMMDEV_REQUESTOR_TRUST_MASK UINT32_C(0x00007000)
312
313/** Requestor is using the less trusted user device node (/dev/vboxuser). */
314#define VMMDEV_REQUESTOR_USER_DEVICE UINT32_C(0x00008000)
315/** There is no user device node (/dev/vboxuser). */
316#define VMMDEV_REQUESTOR_NO_USER_DEVICE UINT32_C(0x00010000)
317
318/** Legacy value for when VBOXGSTINFO2_F_REQUESTOR_INFO is clear.
319 * @internal Host only. */
320#define VMMDEV_REQUESTOR_LEGACY UINT32_MAX
321/** Lowest conceivable trust level, for error situations of getters.
322 * @internal Host only. */
323#define VMMDEV_REQUESTOR_LOWEST ( VMMDEV_REQUESTOR_TRUST_UNTRUSTED | VMMDEV_REQUESTOR_USER_DEVICE \
324 | VMMDEV_REQUESTOR_CON_NO | VMMDEV_REQUESTOR_USERMODE \
325 | VMMDEV_REQUESTOR_USR_GUEST)
326/** Used on the host to check whether a requestor value is present or not. */
327#define VMMDEV_REQUESTOR_IS_PRESENT(a_fRequestor) ((a_fRequestor) != VMMDEV_REQUESTOR_LEGACY)
328/** @} */
329
330/** Initialize a VMMDevRequestHeader structure.
331 * Same as VBGLREQHDR_INIT_VMMDEV(). */
332#define VMMDEV_REQ_HDR_INIT(a_pHdr, a_cb, a_enmType) \
333 do { \
334 (a_pHdr)->size = (a_cb); \
335 (a_pHdr)->version = VMMDEV_REQUEST_HEADER_VERSION; \
336 (a_pHdr)->requestType = (a_enmType); \
337 (a_pHdr)->rc = VERR_INTERNAL_ERROR; \
338 (a_pHdr)->reserved1 = 0; \
339 (a_pHdr)->fRequestor = 0; \
340 } while (0)
341
342
343/**
344 * Mouse status request structure.
345 *
346 * Used by VMMDevReq_GetMouseStatus and VMMDevReq_SetMouseStatus.
347 */
348typedef struct
349{
350 /** header */
351 VMMDevRequestHeader header;
352 /** Mouse feature mask. See VMMDEV_MOUSE_*. */
353 uint32_t mouseFeatures;
354 /** Mouse x position. */
355 int32_t pointerXPos;
356 /** Mouse y position. */
357 int32_t pointerYPos;
358} VMMDevReqMouseStatus;
359AssertCompileSize(VMMDevReqMouseStatus, 24+12);
360
361/** @name Mouse capability bits (VMMDevReqMouseStatus::mouseFeatures).
362 * @{ */
363/** The guest can (== wants to) handle absolute coordinates. */
364#define VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE RT_BIT(0)
365/** The host can (== wants to) send absolute coordinates.
366 * (Input not captured.) */
367#define VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE RT_BIT(1)
368/** The guest can *NOT* switch to software cursor and therefore depends on the
369 * host cursor.
370 *
371 * When guest additions are installed and the host has promised to display the
372 * cursor itself, the guest installs a hardware mouse driver. Don't ask the
373 * guest to switch to a software cursor then. */
374#define VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR RT_BIT(2)
375/** The host does NOT provide support for drawing the cursor itself. */
376#define VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER RT_BIT(3)
377/** The guest can read VMMDev events to find out about pointer movement */
378#define VMMDEV_MOUSE_NEW_PROTOCOL RT_BIT(4)
379/** If the guest changes the status of the
380 * VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR bit, the host will honour this */
381#define VMMDEV_MOUSE_HOST_RECHECKS_NEEDS_HOST_CURSOR RT_BIT(5)
382/** The host supplies an absolute pointing device. The Guest Additions may
383 * wish to use this to decide whether to install their own driver */
384#define VMMDEV_MOUSE_HOST_HAS_ABS_DEV RT_BIT(6)
385/** The mask of all VMMDEV_MOUSE_* flags */
386#define VMMDEV_MOUSE_MASK UINT32_C(0x0000007f)
387/** The mask of guest capability changes for which notification events should
388 * be sent */
389#define VMMDEV_MOUSE_NOTIFY_HOST_MASK \
390 (VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE | VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR)
391/** The mask of all capabilities which the guest can legitimately change */
392#define VMMDEV_MOUSE_GUEST_MASK \
393 (VMMDEV_MOUSE_NOTIFY_HOST_MASK | VMMDEV_MOUSE_NEW_PROTOCOL)
394/** The mask of host capability changes for which notification events should
395 * be sent */
396#define VMMDEV_MOUSE_NOTIFY_GUEST_MASK \
397 VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE
398/** The mask of all capabilities which the host can legitimately change */
399#define VMMDEV_MOUSE_HOST_MASK \
400 ( VMMDEV_MOUSE_NOTIFY_GUEST_MASK \
401 | VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER \
402 | VMMDEV_MOUSE_HOST_RECHECKS_NEEDS_HOST_CURSOR \
403 | VMMDEV_MOUSE_HOST_HAS_ABS_DEV)
404/** @} */
405
406/** @name Absolute mouse reporting range
407 * @{ */
408/** @todo Should these be here? They are needed by both host and guest. */
409/** The minumum value our pointing device can return. */
410#define VMMDEV_MOUSE_RANGE_MIN 0
411/** The maximum value our pointing device can return. */
412#define VMMDEV_MOUSE_RANGE_MAX 0xFFFF
413/** The full range our pointing device can return. */
414#define VMMDEV_MOUSE_RANGE (VMMDEV_MOUSE_RANGE_MAX - VMMDEV_MOUSE_RANGE_MIN)
415/** @} */
416
417
418/**
419 * Mouse pointer shape/visibility change request.
420 *
421 * Used by VMMDevReq_SetPointerShape. The size is variable.
422 */
423typedef struct VMMDevReqMousePointer
424{
425 /** Header. */
426 VMMDevRequestHeader header;
427 /** VBOX_MOUSE_POINTER_* bit flags from VBox/Graphics/VBoxVideo.h. */
428 uint32_t fFlags;
429 /** x coordinate of hot spot. */
430 uint32_t xHot;
431 /** y coordinate of hot spot. */
432 uint32_t yHot;
433 /** Width of the pointer in pixels. */
434 uint32_t width;
435 /** Height of the pointer in scanlines. */
436 uint32_t height;
437 /** Pointer data.
438 *
439 ****
440 * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
441 *
442 * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
443 * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
444 *
445 * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
446 * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
447 * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
448 *
449 * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
450 * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
451 * end of any scanline are undefined.
452 *
453 * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
454 * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
455 * Bytes in the gap between the AND and the XOR mask are undefined.
456 * XOR mask scanlines have no gap between them and size of XOR mask is:
457 * cXor = width * 4 * height.
458 ****
459 *
460 * Preallocate 4 bytes for accessing actual data as p->pointerData.
461 */
462 char pointerData[4];
463} VMMDevReqMousePointer;
464AssertCompileSize(VMMDevReqMousePointer, 24+24);
465
466/**
467 * Get the size that a VMMDevReqMousePointer request should have for a given
468 * size of cursor, including the trailing cursor image and mask data.
469 * @note an "empty" request still has the four preallocated bytes of data
470 *
471 * @returns the size
472 * @param width the cursor width
473 * @param height the cursor height
474 */
475DECLINLINE(size_t) vmmdevGetMousePointerReqSize(uint32_t width, uint32_t height)
476{
477 size_t cbBase = RT_UOFFSETOF(VMMDevReqMousePointer, pointerData[0]);
478 size_t cbMask = (width + 7) / 8 * height;
479 size_t cbArgb = width * height * 4;
480 return RT_MAX(cbBase + ((cbMask + 3) & ~3) + cbArgb,
481 sizeof(VMMDevReqMousePointer));
482}
483
484
485/**
486 * String log request structure.
487 *
488 * Used by VMMDevReq_LogString.
489 * @deprecated Use the IPRT logger or VbglR3WriteLog instead.
490 */
491typedef struct
492{
493 /** header */
494 VMMDevRequestHeader header;
495 /** variable length string data */
496 char szString[1];
497} VMMDevReqLogString;
498AssertCompileSize(VMMDevReqLogString, 24+4);
499
500
501/**
502 * VirtualBox host version request structure.
503 *
504 * Used by VMMDevReq_GetHostVersion.
505 *
506 * @remarks VBGL uses this to detect the precense of new features in the
507 * interface.
508 */
509typedef struct
510{
511 /** Header. */
512 VMMDevRequestHeader header;
513 /** Major version. */
514 uint16_t major;
515 /** Minor version. */
516 uint16_t minor;
517 /** Build number. */
518 uint32_t build;
519 /** SVN revision. */
520 uint32_t revision;
521 /** Feature mask. */
522 uint32_t features;
523} VMMDevReqHostVersion;
524AssertCompileSize(VMMDevReqHostVersion, 24+16);
525
526/** @name VMMDEV_HVF_XXX - VMMDevReqHostVersion::features
527 * @{ */
528/** Physical page lists are supported by HGCM. */
529#define VMMDEV_HVF_HGCM_PHYS_PAGE_LIST RT_BIT_32(0)
530/** HGCM supports the embedded buffer parameter type. */
531#define VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS RT_BIT_32(1)
532/** HGCM supports the contiguous page list parameter type. */
533#define VMMDEV_HVF_HGCM_CONTIGUOUS_PAGE_LIST RT_BIT_32(2)
534/** HGCM supports the no-bounce page list parameter type. */
535#define VMMDEV_HVF_HGCM_NO_BOUNCE_PAGE_LIST RT_BIT_32(3)
536/** VMMDev supports fast IRQ acknowledgements. */
537#define VMMDEV_HVF_FAST_IRQ_ACK RT_BIT_32(31)
538/** @} */
539
540
541/**
542 * Guest capabilities structure.
543 *
544 * Used by VMMDevReq_ReportGuestCapabilities.
545 */
546typedef struct
547{
548 /** Header. */
549 VMMDevRequestHeader header;
550 /** Capabilities (VMMDEV_GUEST_*). */
551 uint32_t caps;
552} VMMDevReqGuestCapabilities;
553AssertCompileSize(VMMDevReqGuestCapabilities, 24+4);
554
555
556/**
557 * Guest capabilities structure, version 2.
558 *
559 * Used by VMMDevReq_SetGuestCapabilities.
560 */
561typedef struct
562{
563 /** Header. */
564 VMMDevRequestHeader header;
565 /** Mask of capabilities to be added. */
566 uint32_t u32OrMask;
567 /** Mask of capabilities to be removed. */
568 uint32_t u32NotMask;
569} VMMDevReqGuestCapabilities2;
570AssertCompileSize(VMMDevReqGuestCapabilities2, 24+8);
571
572
573/**
574 * Idle request structure.
575 *
576 * Used by VMMDevReq_Idle.
577 */
578typedef struct
579{
580 /** Header. */
581 VMMDevRequestHeader header;
582} VMMDevReqIdle;
583AssertCompileSize(VMMDevReqIdle, 24);
584
585
586/**
587 * Host time request structure.
588 *
589 * Used by VMMDevReq_GetHostTime.
590 */
591typedef struct
592{
593 /** Header */
594 VMMDevRequestHeader header;
595 /** OUT: Time in milliseconds since unix epoch. */
596 uint64_t time;
597} VMMDevReqHostTime;
598AssertCompileSize(VMMDevReqHostTime, 24+8);
599
600
601/**
602 * Hypervisor info structure.
603 *
604 * Used by VMMDevReq_GetHypervisorInfo and VMMDevReq_SetHypervisorInfo.
605 */
606typedef struct
607{
608 /** Header. */
609 VMMDevRequestHeader header;
610 /** Guest virtual address of proposed hypervisor start.
611 * Not used by VMMDevReq_GetHypervisorInfo.
612 * @todo Make this 64-bit compatible? */
613 RTGCPTR32 hypervisorStart;
614 /** Hypervisor size in bytes. */
615 uint32_t hypervisorSize;
616} VMMDevReqHypervisorInfo;
617AssertCompileSize(VMMDevReqHypervisorInfo, 24+8);
618
619/** @name Default patch memory size .
620 * Used by VMMDevReq_RegisterPatchMemory and VMMDevReq_DeregisterPatchMemory.
621 * @{ */
622#define VMMDEV_GUEST_DEFAULT_PATCHMEM_SIZE 8192
623/** @} */
624
625/**
626 * Patching memory structure. (locked executable & read-only page from the guest's perspective)
627 *
628 * Used by VMMDevReq_RegisterPatchMemory and VMMDevReq_DeregisterPatchMemory
629 */
630typedef struct
631{
632 /** Header. */
633 VMMDevRequestHeader header;
634 /** Guest virtual address of the patching page(s). */
635 RTGCPTR64 pPatchMem;
636 /** Patch page size in bytes. */
637 uint32_t cbPatchMem;
638} VMMDevReqPatchMemory;
639AssertCompileSize(VMMDevReqPatchMemory, 24+12);
640
641
642/**
643 * Guest power requests.
644 *
645 * See VMMDevReq_SetPowerStatus and VMMDevPowerStateRequest.
646 */
647typedef enum
648{
649 VMMDevPowerState_Invalid = 0,
650 VMMDevPowerState_Pause = 1,
651 VMMDevPowerState_PowerOff = 2,
652 VMMDevPowerState_SaveState = 3,
653 VMMDevPowerState_SizeHack = 0x7fffffff
654} VMMDevPowerState;
655AssertCompileSize(VMMDevPowerState, 4);
656
657/**
658 * VM power status structure.
659 *
660 * Used by VMMDevReq_SetPowerStatus.
661 */
662typedef struct
663{
664 /** Header. */
665 VMMDevRequestHeader header;
666 /** Power state request. */
667 VMMDevPowerState powerState;
668} VMMDevPowerStateRequest;
669AssertCompileSize(VMMDevPowerStateRequest, 24+4);
670
671
672/**
673 * Pending events structure.
674 *
675 * Used by VMMDevReq_AcknowledgeEvents.
676 */
677typedef struct
678{
679 /** Header. */
680 VMMDevRequestHeader header;
681 /** OUT: Pending event mask. */
682 uint32_t events;
683} VMMDevEvents;
684AssertCompileSize(VMMDevEvents, 24+4);
685
686
687/**
688 * Guest event filter mask control.
689 *
690 * Used by VMMDevReq_CtlGuestFilterMask.
691 */
692typedef struct
693{
694 /** Header. */
695 VMMDevRequestHeader header;
696 /** Mask of events to be added to the filter. */
697 uint32_t u32OrMask;
698 /** Mask of events to be removed from the filter. */
699 uint32_t u32NotMask;
700} VMMDevCtlGuestFilterMask;
701AssertCompileSize(VMMDevCtlGuestFilterMask, 24+8);
702
703
704/**
705 * Guest information structure.
706 *
707 * Used by VMMDevReportGuestInfo and PDMIVMMDEVCONNECTOR::pfnUpdateGuestVersion.
708 */
709typedef struct VBoxGuestInfo
710{
711 /** The VMMDev interface version expected by additions.
712 * *Deprecated*, do not use anymore! Will be removed. */
713 uint32_t interfaceVersion;
714 /** Guest OS type. */
715 VBOXOSTYPE osType;
716} VBoxGuestInfo;
717AssertCompileSize(VBoxGuestInfo, 8);
718
719/**
720 * Guest information report.
721 *
722 * Used by VMMDevReq_ReportGuestInfo.
723 */
724typedef struct
725{
726 /** Header. */
727 VMMDevRequestHeader header;
728 /** Guest information. */
729 VBoxGuestInfo guestInfo;
730} VMMDevReportGuestInfo;
731AssertCompileSize(VMMDevReportGuestInfo, 24+8);
732
733
734/**
735 * Guest information structure, version 2.
736 *
737 * Used by VMMDevReportGuestInfo2 and PDMIVMMDEVCONNECTOR::pfnUpdateGuestVersion2.
738 */
739typedef struct VBoxGuestInfo2
740{
741 /** Major version. */
742 uint16_t additionsMajor;
743 /** Minor version. */
744 uint16_t additionsMinor;
745 /** Build number. */
746 uint32_t additionsBuild;
747 /** SVN revision. */
748 uint32_t additionsRevision;
749 /** Feature mask, VBOXGSTINFO2_F_XXX. */
750 uint32_t additionsFeatures;
751 /** The intentional meaning of this field was:
752 * Some additional information, for example 'Beta 1' or something like that.
753 *
754 * The way it was implemented was implemented: VBOX_VERSION_STRING.
755 *
756 * This means the first three members are duplicated in this field (if the guest
757 * build config is sane). So, the user must check this and chop it off before
758 * usage. There is, because of the Main code's blind trust in the field's
759 * content, no way back. */
760 char szName[128];
761} VBoxGuestInfo2;
762AssertCompileSize(VBoxGuestInfo2, 144);
763
764/** @name VBOXGSTINFO2_F_XXX - Features
765 * @{ */
766/** Request header carries requestor information. */
767#define VBOXGSTINFO2_F_REQUESTOR_INFO RT_BIT_32(0)
768/** @} */
769
770
771/**
772 * Guest information report, version 2.
773 *
774 * Used by VMMDevReq_ReportGuestInfo2.
775 */
776typedef struct
777{
778 /** Header. */
779 VMMDevRequestHeader header;
780 /** Guest information. */
781 VBoxGuestInfo2 guestInfo;
782} VMMDevReportGuestInfo2;
783AssertCompileSize(VMMDevReportGuestInfo2, 24+144);
784
785
786/**
787 * The facility class.
788 *
789 * This needs to be kept in sync with AdditionsFacilityClass of the Main API!
790 */
791typedef enum
792{
793 VBoxGuestFacilityClass_None = 0,
794 VBoxGuestFacilityClass_Driver = 10,
795 VBoxGuestFacilityClass_Service = 30,
796 VBoxGuestFacilityClass_Program = 50,
797 VBoxGuestFacilityClass_Feature = 100,
798 VBoxGuestFacilityClass_ThirdParty = 999,
799 VBoxGuestFacilityClass_All = 0x7ffffffe,
800 VBoxGuestFacilityClass_SizeHack = 0x7fffffff
801} VBoxGuestFacilityClass;
802AssertCompileSize(VBoxGuestFacilityClass, 4);
803
804/**
805 * Guest status structure.
806 *
807 * Used by VMMDevReqGuestStatus.
808 */
809typedef struct VBoxGuestStatus
810{
811 /** Facility the status is indicated for. */
812 VBoxGuestFacilityType facility;
813 /** Current guest status. */
814 VBoxGuestFacilityStatus status;
815 /** Flags, not used at the moment. */
816 uint32_t flags;
817} VBoxGuestStatus;
818AssertCompileSize(VBoxGuestStatus, 12);
819
820/**
821 * Guest Additions status structure.
822 *
823 * Used by VMMDevReq_ReportGuestStatus.
824 */
825typedef struct
826{
827 /** Header. */
828 VMMDevRequestHeader header;
829 /** Guest information. */
830 VBoxGuestStatus guestStatus;
831} VMMDevReportGuestStatus;
832AssertCompileSize(VMMDevReportGuestStatus, 24+12);
833
834
835/**
836 * Guest user status updates.
837 */
838typedef struct VBoxGuestUserStatus
839{
840 /** The guest user state to send. */
841 VBoxGuestUserState state;
842 /** Size (in bytes) of szUser. */
843 uint32_t cbUser;
844 /** Size (in bytes) of szDomain. */
845 uint32_t cbDomain;
846 /** Size (in bytes) of aDetails. */
847 uint32_t cbDetails;
848 /** Note: Here begins the dynamically
849 * allocated region. */
850 /** Guest user to report state for. */
851 char szUser[1];
852 /** Domain the guest user is bound to. */
853 char szDomain[1];
854 /** Optional details of the state. */
855 uint8_t aDetails[1];
856} VBoxGuestUserStatus;
857AssertCompileSize(VBoxGuestUserStatus, 20);
858
859
860/**
861 * Guest user status structure.
862 *
863 * Used by VMMDevReq_ReportGuestUserStatus.
864 */
865typedef struct
866{
867 /** Header. */
868 VMMDevRequestHeader header;
869 /** Guest user status. */
870 VBoxGuestUserStatus status;
871} VMMDevReportGuestUserState;
872AssertCompileSize(VMMDevReportGuestUserState, 24+20);
873
874
875/**
876 * Guest statistics structure.
877 *
878 * Used by VMMDevReportGuestStats and PDMIVMMDEVCONNECTOR::pfnReportStatistics.
879 */
880typedef struct VBoxGuestStatistics
881{
882 /** Virtual CPU ID. */
883 uint32_t u32CpuId;
884 /** Reported statistics. */
885 uint32_t u32StatCaps;
886 /** Idle CPU load (0-100) for last interval. */
887 uint32_t u32CpuLoad_Idle;
888 /** Kernel CPU load (0-100) for last interval. */
889 uint32_t u32CpuLoad_Kernel;
890 /** User CPU load (0-100) for last interval. */
891 uint32_t u32CpuLoad_User;
892 /** Nr of threads. */
893 uint32_t u32Threads;
894 /** Nr of processes. */
895 uint32_t u32Processes;
896 /** Nr of handles. */
897 uint32_t u32Handles;
898 /** Memory load (0-100). */
899 uint32_t u32MemoryLoad;
900 /** Page size of guest system. */
901 uint32_t u32PageSize;
902 /** Total physical memory (in 4KB pages). */
903 uint32_t u32PhysMemTotal;
904 /** Available physical memory (in 4KB pages). */
905 uint32_t u32PhysMemAvail;
906 /** Ballooned physical memory (in 4KB pages). */
907 uint32_t u32PhysMemBalloon;
908 /** Total number of committed memory (which is not necessarily in-use) (in 4KB pages). */
909 uint32_t u32MemCommitTotal;
910 /** Total amount of memory used by the kernel (in 4KB pages). */
911 uint32_t u32MemKernelTotal;
912 /** Total amount of paged memory used by the kernel (in 4KB pages). */
913 uint32_t u32MemKernelPaged;
914 /** Total amount of nonpaged memory used by the kernel (in 4KB pages). */
915 uint32_t u32MemKernelNonPaged;
916 /** Total amount of memory used for the system cache (in 4KB pages). */
917 uint32_t u32MemSystemCache;
918 /** Pagefile size (in 4KB pages). */
919 uint32_t u32PageFileSize;
920} VBoxGuestStatistics;
921AssertCompileSize(VBoxGuestStatistics, 19*4);
922
923/** @name Guest statistics values (VBoxGuestStatistics::u32StatCaps).
924 * @{ */
925#define VBOX_GUEST_STAT_CPU_LOAD_IDLE RT_BIT(0)
926#define VBOX_GUEST_STAT_CPU_LOAD_KERNEL RT_BIT(1)
927#define VBOX_GUEST_STAT_CPU_LOAD_USER RT_BIT(2)
928#define VBOX_GUEST_STAT_THREADS RT_BIT(3)
929#define VBOX_GUEST_STAT_PROCESSES RT_BIT(4)
930#define VBOX_GUEST_STAT_HANDLES RT_BIT(5)
931#define VBOX_GUEST_STAT_MEMORY_LOAD RT_BIT(6)
932#define VBOX_GUEST_STAT_PHYS_MEM_TOTAL RT_BIT(7)
933#define VBOX_GUEST_STAT_PHYS_MEM_AVAIL RT_BIT(8)
934#define VBOX_GUEST_STAT_PHYS_MEM_BALLOON RT_BIT(9)
935#define VBOX_GUEST_STAT_MEM_COMMIT_TOTAL RT_BIT(10)
936#define VBOX_GUEST_STAT_MEM_KERNEL_TOTAL RT_BIT(11)
937#define VBOX_GUEST_STAT_MEM_KERNEL_PAGED RT_BIT(12)
938#define VBOX_GUEST_STAT_MEM_KERNEL_NONPAGED RT_BIT(13)
939#define VBOX_GUEST_STAT_MEM_SYSTEM_CACHE RT_BIT(14)
940#define VBOX_GUEST_STAT_PAGE_FILE_SIZE RT_BIT(15)
941/** @} */
942
943/**
944 * Guest statistics command structure.
945 *
946 * Used by VMMDevReq_ReportGuestStats.
947 */
948typedef struct
949{
950 /** Header. */
951 VMMDevRequestHeader header;
952 /** Guest information. */
953 VBoxGuestStatistics guestStats;
954} VMMDevReportGuestStats;
955AssertCompileSize(VMMDevReportGuestStats, 24+19*4);
956
957
958/** Memory balloon change request structure. */
959#define VMMDEV_MAX_MEMORY_BALLOON(PhysMemTotal) ( (9 * (PhysMemTotal)) / 10 )
960
961/**
962 * Poll for ballooning change request.
963 *
964 * Used by VMMDevReq_GetMemBalloonChangeRequest.
965 */
966typedef struct
967{
968 /** Header. */
969 VMMDevRequestHeader header;
970 /** Balloon size in megabytes. */
971 uint32_t cBalloonChunks;
972 /** Guest ram size in megabytes. */
973 uint32_t cPhysMemChunks;
974 /** Setting this to VMMDEV_EVENT_BALLOON_CHANGE_REQUEST indicates that the
975 * request is a response to that event.
976 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
977 uint32_t eventAck;
978} VMMDevGetMemBalloonChangeRequest;
979AssertCompileSize(VMMDevGetMemBalloonChangeRequest, 24+12);
980
981
982/**
983 * Change the size of the balloon.
984 *
985 * Used by VMMDevReq_ChangeMemBalloon.
986 */
987typedef struct
988{
989 /** Header. */
990 VMMDevRequestHeader header;
991 /** The number of pages in the array. */
992 uint32_t cPages;
993 /** true = inflate, false = deflate. */
994 uint32_t fInflate;
995 /** Physical address (RTGCPHYS) of each page, variable size. */
996 RTGCPHYS aPhysPage[1];
997} VMMDevChangeMemBalloon;
998AssertCompileSize(VMMDevChangeMemBalloon, 24+16);
999
1000
1001/**
1002 * Guest statistics interval change request structure.
1003 *
1004 * Used by VMMDevReq_GetStatisticsChangeRequest.
1005 */
1006typedef struct
1007{
1008 /** Header. */
1009 VMMDevRequestHeader header;
1010 /** The interval in seconds. */
1011 uint32_t u32StatInterval;
1012 /** Setting this to VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST indicates
1013 * that the request is a response to that event.
1014 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1015 uint32_t eventAck;
1016} VMMDevGetStatisticsChangeRequest;
1017AssertCompileSize(VMMDevGetStatisticsChangeRequest, 24+8);
1018
1019
1020/** The size of a string field in the credentials request (including '\\0').
1021 * @see VMMDevCredentials */
1022#define VMMDEV_CREDENTIALS_SZ_SIZE 128
1023
1024/**
1025 * Credentials request structure.
1026 *
1027 * Used by VMMDevReq_QueryCredentials.
1028 */
1029typedef struct
1030{
1031 /** Header. */
1032 VMMDevRequestHeader header;
1033 /** IN/OUT: Request flags. */
1034 uint32_t u32Flags;
1035 /** OUT: User name (UTF-8). */
1036 char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
1037 /** OUT: Password (UTF-8). */
1038 char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
1039 /** OUT: Domain name (UTF-8). */
1040 char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
1041} VMMDevCredentials;
1042AssertCompileSize(VMMDevCredentials, 24+4+3*128);
1043
1044/** @name Credentials request flag (VMMDevCredentials::u32Flags)
1045 * @{ */
1046/** query from host whether credentials are present */
1047#define VMMDEV_CREDENTIALS_QUERYPRESENCE RT_BIT(1)
1048/** read credentials from host (can be combined with clear) */
1049#define VMMDEV_CREDENTIALS_READ RT_BIT(2)
1050/** clear credentials on host (can be combined with read) */
1051#define VMMDEV_CREDENTIALS_CLEAR RT_BIT(3)
1052/** read credentials for judgement in the guest */
1053#define VMMDEV_CREDENTIALS_READJUDGE RT_BIT(8)
1054/** clear credentials for judegement on the host */
1055#define VMMDEV_CREDENTIALS_CLEARJUDGE RT_BIT(9)
1056/** report credentials acceptance by guest */
1057#define VMMDEV_CREDENTIALS_JUDGE_OK RT_BIT(10)
1058/** report credentials denial by guest */
1059#define VMMDEV_CREDENTIALS_JUDGE_DENY RT_BIT(11)
1060/** report that no judgement could be made by guest */
1061#define VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT RT_BIT(12)
1062
1063/** flag telling the guest that credentials are present */
1064#define VMMDEV_CREDENTIALS_PRESENT RT_BIT(16)
1065/** flag telling guest that local logons should be prohibited */
1066#define VMMDEV_CREDENTIALS_NOLOCALLOGON RT_BIT(17)
1067/** @} */
1068
1069
1070/**
1071 * Seamless mode change request structure.
1072 *
1073 * Used by VMMDevReq_GetSeamlessChangeRequest.
1074 */
1075typedef struct
1076{
1077 /** Header. */
1078 VMMDevRequestHeader header;
1079
1080 /** New seamless mode. */
1081 VMMDevSeamlessMode mode;
1082 /** Setting this to VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST indicates
1083 * that the request is a response to that event.
1084 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1085 uint32_t eventAck;
1086} VMMDevSeamlessChangeRequest;
1087AssertCompileSize(VMMDevSeamlessChangeRequest, 24+8);
1088AssertCompileMemberOffset(VMMDevSeamlessChangeRequest, eventAck, 24+4);
1089
1090
1091/**
1092 * Display change request structure.
1093 *
1094 * Used by VMMDevReq_GetDisplayChangeRequest.
1095 */
1096typedef struct
1097{
1098 /** Header. */
1099 VMMDevRequestHeader header;
1100 /** Horizontal pixel resolution (0 = do not change). */
1101 uint32_t xres;
1102 /** Vertical pixel resolution (0 = do not change). */
1103 uint32_t yres;
1104 /** Bits per pixel (0 = do not change). */
1105 uint32_t bpp;
1106 /** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
1107 * that the request is a response to that event.
1108 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1109 uint32_t eventAck;
1110} VMMDevDisplayChangeRequest;
1111AssertCompileSize(VMMDevDisplayChangeRequest, 24+16);
1112
1113
1114/**
1115 * Display change request structure, version 2.
1116 *
1117 * Used by VMMDevReq_GetDisplayChangeRequest2.
1118 */
1119typedef struct
1120{
1121 /** Header. */
1122 VMMDevRequestHeader header;
1123 /** Horizontal pixel resolution (0 = do not change). */
1124 uint32_t xres;
1125 /** Vertical pixel resolution (0 = do not change). */
1126 uint32_t yres;
1127 /** Bits per pixel (0 = do not change). */
1128 uint32_t bpp;
1129 /** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
1130 * that the request is a response to that event.
1131 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1132 uint32_t eventAck;
1133 /** 0 for primary display, 1 for the first secondary, etc. */
1134 uint32_t display;
1135} VMMDevDisplayChangeRequest2;
1136AssertCompileSize(VMMDevDisplayChangeRequest2, 24+20);
1137
1138
1139/**
1140 * Display change request structure, version Extended.
1141 *
1142 * Used by VMMDevReq_GetDisplayChangeRequestEx.
1143 */
1144typedef struct
1145{
1146 /** Header. */
1147 VMMDevRequestHeader header;
1148 /** Horizontal pixel resolution (0 = do not change). */
1149 uint32_t xres;
1150 /** Vertical pixel resolution (0 = do not change). */
1151 uint32_t yres;
1152 /** Bits per pixel (0 = do not change). */
1153 uint32_t bpp;
1154 /** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
1155 * that the request is a response to that event.
1156 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1157 uint32_t eventAck;
1158 /** 0 for primary display, 1 for the first secondary, etc. */
1159 uint32_t display;
1160 /** New OriginX of secondary virtual screen */
1161 uint32_t cxOrigin;
1162 /** New OriginY of secondary virtual screen */
1163 uint32_t cyOrigin;
1164 /** Change in origin of the secondary virtaul scree is
1165 * required */
1166 bool fChangeOrigin;
1167 /** secondary virtual screen enabled or disabled */
1168 bool fEnabled;
1169} VMMDevDisplayChangeRequestEx;
1170AssertCompileSize(VMMDevDisplayChangeRequestEx, 24+32);
1171
1172
1173/** Flags for VMMDevDisplayDef::fDisplayFlags */
1174#define VMMDEV_DISPLAY_PRIMARY UINT32_C(0x00000001) /**< Primary display. */
1175#define VMMDEV_DISPLAY_DISABLED UINT32_C(0x00000002) /**< Display is disabled. */
1176#define VMMDEV_DISPLAY_ORIGIN UINT32_C(0x00000004) /**< Change position of the diplay. */
1177#define VMMDEV_DISPLAY_CX UINT32_C(0x00000008) /**< Change the horizontal resolution of the display. */
1178#define VMMDEV_DISPLAY_CY UINT32_C(0x00000010) /**< Change the vertical resolution of the display. */
1179#define VMMDEV_DISPLAY_BPP UINT32_C(0x00000020) /**< Change the color depth of the display. */
1180
1181/** Definition of one monitor. Used by VMMDevReq_GetDisplayChangeRequestMulti. */
1182typedef struct VMMDevDisplayDef
1183{
1184 uint32_t fDisplayFlags; /**< VMMDEV_DISPLAY_* flags. */
1185 uint32_t idDisplay; /**< The display number. */
1186 int32_t xOrigin; /**< New OriginX of the guest screen. */
1187 int32_t yOrigin; /**< New OriginY of the guest screen. */
1188 uint32_t cx; /**< Horizontal pixel resolution. */
1189 uint32_t cy; /**< Vertical pixel resolution. */
1190 uint32_t cBitsPerPixel; /**< Bits per pixel. */
1191} VMMDevDisplayDef;
1192AssertCompileSize(VMMDevDisplayDef, 28);
1193
1194/** Multimonitor display change request structure. Used by VMMDevReq_GetDisplayChangeRequestMulti. */
1195typedef struct VMMDevDisplayChangeRequestMulti
1196{
1197 VMMDevRequestHeader header; /**< Header. */
1198 uint32_t eventAck; /**< Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
1199 * that the request is a response to that event.
1200 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1201 uint32_t cDisplays; /**< Number of monitors. In: how many the guest expects.
1202 * Out: how many the host provided. */
1203 VMMDevDisplayDef aDisplays[1]; /**< Layout of monitors. */
1204} VMMDevDisplayChangeRequestMulti;
1205AssertCompileSize(VMMDevDisplayChangeRequestMulti, 24+8+28);
1206
1207
1208/**
1209 * Video mode supported request structure.
1210 *
1211 * Used by VMMDevReq_VideoModeSupported.
1212 */
1213typedef struct
1214{
1215 /** Header. */
1216 VMMDevRequestHeader header;
1217 /** IN: Horizontal pixel resolution. */
1218 uint32_t width;
1219 /** IN: Vertical pixel resolution. */
1220 uint32_t height;
1221 /** IN: Bits per pixel. */
1222 uint32_t bpp;
1223 /** OUT: Support indicator. */
1224 bool fSupported;
1225} VMMDevVideoModeSupportedRequest;
1226AssertCompileSize(VMMDevVideoModeSupportedRequest, 24+16);
1227
1228/**
1229 * Video mode supported request structure for a specific display.
1230 *
1231 * Used by VMMDevReq_VideoModeSupported2.
1232 */
1233typedef struct
1234{
1235 /** Header. */
1236 VMMDevRequestHeader header;
1237 /** IN: The guest display number. */
1238 uint32_t display;
1239 /** IN: Horizontal pixel resolution. */
1240 uint32_t width;
1241 /** IN: Vertical pixel resolution. */
1242 uint32_t height;
1243 /** IN: Bits per pixel. */
1244 uint32_t bpp;
1245 /** OUT: Support indicator. */
1246 bool fSupported;
1247} VMMDevVideoModeSupportedRequest2;
1248AssertCompileSize(VMMDevVideoModeSupportedRequest2, 24+20);
1249
1250/**
1251 * Video modes height reduction request structure.
1252 *
1253 * Used by VMMDevReq_GetHeightReduction.
1254 */
1255typedef struct
1256{
1257 /** Header. */
1258 VMMDevRequestHeader header;
1259 /** OUT: Height reduction in pixels. */
1260 uint32_t heightReduction;
1261} VMMDevGetHeightReductionRequest;
1262AssertCompileSize(VMMDevGetHeightReductionRequest, 24+4);
1263
1264
1265/**
1266 * VRDP change request structure.
1267 *
1268 * Used by VMMDevReq_GetVRDPChangeRequest.
1269 */
1270typedef struct
1271{
1272 /** Header */
1273 VMMDevRequestHeader header;
1274 /** Whether VRDP is active or not. */
1275 uint8_t u8VRDPActive;
1276 /** The configured experience level for active VRDP. */
1277 uint32_t u32VRDPExperienceLevel;
1278} VMMDevVRDPChangeRequest;
1279AssertCompileSize(VMMDevVRDPChangeRequest, 24+8);
1280AssertCompileMemberOffset(VMMDevVRDPChangeRequest, u8VRDPActive, 24);
1281AssertCompileMemberOffset(VMMDevVRDPChangeRequest, u32VRDPExperienceLevel, 24+4);
1282
1283/** @name VRDP Experience level (VMMDevVRDPChangeRequest::u32VRDPExperienceLevel)
1284 * @{ */
1285#define VRDP_EXPERIENCE_LEVEL_ZERO 0 /**< Theming disabled. */
1286#define VRDP_EXPERIENCE_LEVEL_LOW 1 /**< Full window dragging and desktop wallpaper disabled. */
1287#define VRDP_EXPERIENCE_LEVEL_MEDIUM 2 /**< Font smoothing, gradients. */
1288#define VRDP_EXPERIENCE_LEVEL_HIGH 3 /**< Animation effects disabled. */
1289#define VRDP_EXPERIENCE_LEVEL_FULL 4 /**< Everything enabled. */
1290/** @} */
1291
1292
1293/**
1294 * VBVA enable request structure.
1295 *
1296 * Used by VMMDevReq_VideoAccelEnable.
1297 */
1298typedef struct
1299{
1300 /** Header. */
1301 VMMDevRequestHeader header;
1302 /** 0 - disable, !0 - enable. */
1303 uint32_t u32Enable;
1304 /** The size of VBVAMEMORY::au8RingBuffer expected by driver.
1305 * The host will refuse to enable VBVA if the size is not equal to
1306 * VBVA_RING_BUFFER_SIZE.
1307 */
1308 uint32_t cbRingBuffer;
1309 /** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
1310 uint32_t fu32Status;
1311} VMMDevVideoAccelEnable;
1312AssertCompileSize(VMMDevVideoAccelEnable, 24+12);
1313
1314/** @name VMMDevVideoAccelEnable::fu32Status.
1315 * @{ */
1316#define VBVA_F_STATUS_ACCEPTED (0x01)
1317#define VBVA_F_STATUS_ENABLED (0x02)
1318/** @} */
1319
1320
1321/**
1322 * VBVA flush request structure.
1323 *
1324 * Used by VMMDevReq_VideoAccelFlush.
1325 */
1326typedef struct
1327{
1328 /** Header. */
1329 VMMDevRequestHeader header;
1330} VMMDevVideoAccelFlush;
1331AssertCompileSize(VMMDevVideoAccelFlush, 24);
1332
1333
1334/**
1335 * VBVA set visible region request structure.
1336 *
1337 * Used by VMMDevReq_VideoSetVisibleRegion.
1338 */
1339typedef struct
1340{
1341 /** Header. */
1342 VMMDevRequestHeader header;
1343 /** Number of rectangles */
1344 uint32_t cRect;
1345 /** Rectangle array.
1346 * @todo array is spelled aRects[1]. */
1347 RTRECT Rect;
1348} VMMDevVideoSetVisibleRegion;
1349AssertCompileSize(RTRECT, 16);
1350AssertCompileSize(VMMDevVideoSetVisibleRegion, 24+4+16);
1351
1352/**
1353 * CPU event types.
1354 */
1355typedef enum
1356{
1357 VMMDevCpuStatusType_Invalid = 0,
1358 VMMDevCpuStatusType_Disable = 1,
1359 VMMDevCpuStatusType_Enable = 2,
1360 VMMDevCpuStatusType_SizeHack = 0x7fffffff
1361} VMMDevCpuStatusType;
1362
1363/**
1364 * CPU hotplug event status request.
1365 */
1366typedef struct
1367{
1368 /** Header. */
1369 VMMDevRequestHeader header;
1370 /** Status type */
1371 VMMDevCpuStatusType enmStatusType;
1372} VMMDevCpuHotPlugStatusRequest;
1373AssertCompileSize(VMMDevCpuHotPlugStatusRequest, 24+4);
1374
1375/**
1376 * Get the ID of the changed CPU and event type.
1377 */
1378typedef struct
1379{
1380 /** Header. */
1381 VMMDevRequestHeader header;
1382 /** Event type */
1383 VMMDevCpuEventType enmEventType;
1384 /** core id of the CPU changed */
1385 uint32_t idCpuCore;
1386 /** package id of the CPU changed */
1387 uint32_t idCpuPackage;
1388} VMMDevGetCpuHotPlugRequest;
1389AssertCompileSize(VMMDevGetCpuHotPlugRequest, 24+4+4+4);
1390
1391
1392AssertCompileSize(VMMDEVSHAREDREGIONDESC, 16); /* structure was promoted to VBox/types.h. */
1393
1394#define VMMDEVSHAREDREGIONDESC_MAX 32
1395
1396/**
1397 * Shared module registration
1398 */
1399typedef struct
1400{
1401 /** Header. */
1402 VMMDevRequestHeader header;
1403 /** Shared module size. */
1404 uint32_t cbModule;
1405 /** Number of included region descriptors */
1406 uint32_t cRegions;
1407 /** Base address of the shared module. */
1408 RTGCPTR64 GCBaseAddr;
1409 /** Guest OS type. */
1410 VBOXOSFAMILY enmGuestOS;
1411 /** Alignment. */
1412 uint32_t u32Align;
1413 /** Module name */
1414 char szName[128];
1415 /** Module version */
1416 char szVersion[16];
1417 /** Shared region descriptor(s). */
1418 VMMDEVSHAREDREGIONDESC aRegions[1];
1419} VMMDevSharedModuleRegistrationRequest;
1420AssertCompileSize(VMMDevSharedModuleRegistrationRequest, 24+4+4+8+4+4+128+16+16);
1421
1422
1423/**
1424 * Shared module unregistration
1425 */
1426typedef struct
1427{
1428 /** Header. */
1429 VMMDevRequestHeader header;
1430 /** Shared module size. */
1431 uint32_t cbModule;
1432 /** Align at 8 byte boundary. */
1433 uint32_t u32Alignment;
1434 /** Base address of the shared module. */
1435 RTGCPTR64 GCBaseAddr;
1436 /** Module name */
1437 char szName[128];
1438 /** Module version */
1439 char szVersion[16];
1440} VMMDevSharedModuleUnregistrationRequest;
1441AssertCompileSize(VMMDevSharedModuleUnregistrationRequest, 24+4+4+8+128+16);
1442
1443
1444/**
1445 * Shared module periodic check
1446 */
1447typedef struct
1448{
1449 /** Header. */
1450 VMMDevRequestHeader header;
1451} VMMDevSharedModuleCheckRequest;
1452AssertCompileSize(VMMDevSharedModuleCheckRequest, 24);
1453
1454/**
1455 * Paging sharing enabled query
1456 */
1457typedef struct
1458{
1459 /** Header. */
1460 VMMDevRequestHeader header;
1461 /** Enabled flag (out) */
1462 bool fEnabled;
1463 /** Alignment */
1464 bool fAlignment[3];
1465} VMMDevPageSharingStatusRequest;
1466AssertCompileSize(VMMDevPageSharingStatusRequest, 24+4);
1467
1468
1469/**
1470 * Page sharing status query (debug build only)
1471 */
1472typedef struct
1473{
1474 /** Header. */
1475 VMMDevRequestHeader header;
1476 /** Page address. */
1477 RTGCPTR GCPtrPage;
1478 /** Page flags. */
1479 uint64_t uPageFlags;
1480 /** Shared flag (out) */
1481 bool fShared;
1482 /** Alignment */
1483 bool fAlignment[3];
1484} VMMDevPageIsSharedRequest;
1485
1486/**
1487 * Session id request structure.
1488 *
1489 * Used by VMMDevReq_GetSessionId.
1490 */
1491typedef struct
1492{
1493 /** Header */
1494 VMMDevRequestHeader header;
1495 /** OUT: unique session id; the id will be different after each start, reset or restore of the VM */
1496 uint64_t idSession;
1497} VMMDevReqSessionId;
1498AssertCompileSize(VMMDevReqSessionId, 24+8);
1499
1500
1501/**
1502 * Write Core Dump request.
1503 *
1504 * Used by VMMDevReq_WriteCoreDump.
1505 */
1506typedef struct
1507{
1508 /** Header. */
1509 VMMDevRequestHeader header;
1510 /** Flags (reserved, MBZ). */
1511 uint32_t fFlags;
1512} VMMDevReqWriteCoreDump;
1513AssertCompileSize(VMMDevReqWriteCoreDump, 24+4);
1514
1515
1516/**
1517 * Heart beat check state structure.
1518 * Used by VMMDevReq_HeartbeatConfigure.
1519 */
1520typedef struct
1521{
1522 /** Header. */
1523 VMMDevRequestHeader header;
1524 /** OUT: Guest heartbeat interval in nanosec. */
1525 uint64_t cNsInterval;
1526 /** Heartbeat check flag. */
1527 bool fEnabled;
1528} VMMDevReqHeartbeat;
1529AssertCompileSize(VMMDevReqHeartbeat, 24+12);
1530
1531
1532/**
1533 * NT bug check report.
1534 * Used by VMMDevReq_NtBugCheck.
1535 * @remarks Can be issued with just the header if no more data is available.
1536 */
1537typedef struct
1538{
1539 /** Header. */
1540 VMMDevRequestHeader header;
1541 /** The bug check number (P0). */
1542 uint64_t uBugCheck;
1543 /** The four bug check parameters. */
1544 uint64_t auParameters[4];
1545} VMMDevReqNtBugCheck;
1546AssertCompileSize(VMMDevReqNtBugCheck, 24+40);
1547
1548
1549
1550#ifdef VBOX_WITH_HGCM
1551
1552/** @name HGCM flags.
1553 * @{
1554 */
1555# define VBOX_HGCM_REQ_DONE RT_BIT_32(VBOX_HGCM_REQ_DONE_BIT)
1556# define VBOX_HGCM_REQ_DONE_BIT 0
1557# define VBOX_HGCM_REQ_CANCELLED (0x2)
1558/** @} */
1559
1560/**
1561 * HGCM request header.
1562 */
1563typedef struct VMMDevHGCMRequestHeader
1564{
1565 /** Request header. */
1566 VMMDevRequestHeader header;
1567
1568 /** HGCM flags. */
1569 uint32_t fu32Flags;
1570
1571 /** Result code. */
1572 int32_t result;
1573} VMMDevHGCMRequestHeader;
1574AssertCompileSize(VMMDevHGCMRequestHeader, 24+8);
1575
1576/**
1577 * HGCM connect request structure.
1578 *
1579 * Used by VMMDevReq_HGCMConnect.
1580 */
1581typedef struct
1582{
1583 /** HGCM request header. */
1584 VMMDevHGCMRequestHeader header;
1585
1586 /** IN: Description of service to connect to. */
1587 HGCMServiceLocation loc;
1588
1589 /** OUT: Client identifier assigned by local instance of HGCM. */
1590 uint32_t u32ClientID;
1591} VMMDevHGCMConnect;
1592AssertCompileSize(VMMDevHGCMConnect, 32+132+4);
1593
1594
1595/**
1596 * HGCM disconnect request structure.
1597 *
1598 * Used by VMMDevReq_HGCMDisconnect.
1599 */
1600typedef struct
1601{
1602 /** HGCM request header. */
1603 VMMDevHGCMRequestHeader header;
1604
1605 /** IN: Client identifier. */
1606 uint32_t u32ClientID;
1607} VMMDevHGCMDisconnect;
1608AssertCompileSize(VMMDevHGCMDisconnect, 32+4);
1609
1610/**
1611 * HGCM call request structure.
1612 *
1613 * Used by VMMDevReq_HGCMCall32 and VMMDevReq_HGCMCall64.
1614 */
1615typedef struct
1616{
1617 /* request header */
1618 VMMDevHGCMRequestHeader header;
1619
1620 /** IN: Client identifier. */
1621 uint32_t u32ClientID;
1622 /** IN: Service function number. */
1623 uint32_t u32Function;
1624 /** IN: Number of parameters. */
1625 uint32_t cParms;
1626 /** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
1627} VMMDevHGCMCall;
1628AssertCompileSize(VMMDevHGCMCall, 32+12);
1629
1630/** @name Direction of data transfer (HGCMPageListInfo::flags). Bit flags.
1631 * @{ */
1632#define VBOX_HGCM_F_PARM_DIRECTION_NONE UINT32_C(0x00000000)
1633#define VBOX_HGCM_F_PARM_DIRECTION_TO_HOST UINT32_C(0x00000001)
1634#define VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST UINT32_C(0x00000002)
1635#define VBOX_HGCM_F_PARM_DIRECTION_BOTH UINT32_C(0x00000003)
1636#define VBOX_HGCM_F_PARM_DIRECTION_MASK UINT32_C(0x00000003)
1637/** Macro for validating that the specified flags are valid. */
1638#define VBOX_HGCM_F_PARM_ARE_VALID(fFlags) \
1639 ( ((fFlags) & VBOX_HGCM_F_PARM_DIRECTION_MASK) \
1640 && !((fFlags) & ~VBOX_HGCM_F_PARM_DIRECTION_MASK) )
1641/** @} */
1642
1643/**
1644 * VMMDevHGCMParmType_PageList points to this structure to actually describe the
1645 * buffer.
1646 */
1647typedef struct
1648{
1649 uint32_t flags; /**< VBOX_HGCM_F_PARM_*. */
1650 uint16_t offFirstPage; /**< Offset in the first page where data begins. */
1651 uint16_t cPages; /**< Number of pages. */
1652 RTGCPHYS64 aPages[1]; /**< Page addresses. */
1653} HGCMPageListInfo;
1654AssertCompileSize(HGCMPageListInfo, 4+2+2+8);
1655
1656
1657/** Get the pointer to the first parmater of a HGCM call request. */
1658# define VMMDEV_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1659/** Get the pointer to the first parmater of a 32-bit HGCM call request. */
1660# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1661
1662# ifdef VBOX_WITH_64_BITS_GUESTS
1663/* Explicit defines for the host code. */
1664# ifdef VBOX_HGCM_HOST_CODE
1665# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1666# define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1667# endif /* VBOX_HGCM_HOST_CODE */
1668# endif /* VBOX_WITH_64_BITS_GUESTS */
1669
1670# define VBOX_HGCM_MAX_PARMS 32
1671
1672/**
1673 * HGCM cancel request structure.
1674 *
1675 * The Cancel request is issued using the same physical memory address as was
1676 * used for the corresponding initial HGCMCall.
1677 *
1678 * Used by VMMDevReq_HGCMCancel.
1679 */
1680typedef struct
1681{
1682 /** Header. */
1683 VMMDevHGCMRequestHeader header;
1684} VMMDevHGCMCancel;
1685AssertCompileSize(VMMDevHGCMCancel, 32);
1686
1687/**
1688 * HGCM cancel request structure, version 2.
1689 *
1690 * Used by VMMDevReq_HGCMCancel2.
1691 *
1692 * VINF_SUCCESS when cancelled.
1693 * VERR_NOT_FOUND if the specified request cannot be found.
1694 * VERR_INVALID_PARAMETER if the address is invalid valid.
1695 */
1696typedef struct
1697{
1698 /** Header. */
1699 VMMDevRequestHeader header;
1700 /** The physical address of the request to cancel. */
1701 RTGCPHYS32 physReqToCancel;
1702} VMMDevHGCMCancel2;
1703AssertCompileSize(VMMDevHGCMCancel2, 24+4);
1704
1705#endif /* VBOX_WITH_HGCM */
1706
1707
1708/**
1709 * Inline helper to determine the request size for the given operation.
1710 * Returns 0 if the given operation is not handled and/or supported.
1711 *
1712 * @returns Size.
1713 * @param requestType The VMMDev request type.
1714 */
1715DECLINLINE(size_t) vmmdevGetRequestSize(VMMDevRequestType requestType)
1716{
1717 switch (requestType)
1718 {
1719 case VMMDevReq_GetMouseStatus:
1720 case VMMDevReq_SetMouseStatus:
1721 return sizeof(VMMDevReqMouseStatus);
1722 case VMMDevReq_SetPointerShape:
1723 return sizeof(VMMDevReqMousePointer);
1724 case VMMDevReq_GetHostVersion:
1725 return sizeof(VMMDevReqHostVersion);
1726 case VMMDevReq_Idle:
1727 return sizeof(VMMDevReqIdle);
1728 case VMMDevReq_GetHostTime:
1729 return sizeof(VMMDevReqHostTime);
1730 case VMMDevReq_GetHypervisorInfo:
1731 case VMMDevReq_SetHypervisorInfo:
1732 return sizeof(VMMDevReqHypervisorInfo);
1733 case VMMDevReq_RegisterPatchMemory:
1734 case VMMDevReq_DeregisterPatchMemory:
1735 return sizeof(VMMDevReqPatchMemory);
1736 case VMMDevReq_SetPowerStatus:
1737 return sizeof(VMMDevPowerStateRequest);
1738 case VMMDevReq_AcknowledgeEvents:
1739 return sizeof(VMMDevEvents);
1740 case VMMDevReq_ReportGuestInfo:
1741 return sizeof(VMMDevReportGuestInfo);
1742 case VMMDevReq_ReportGuestInfo2:
1743 return sizeof(VMMDevReportGuestInfo2);
1744 case VMMDevReq_ReportGuestStatus:
1745 return sizeof(VMMDevReportGuestStatus);
1746 case VMMDevReq_ReportGuestUserState:
1747 return sizeof(VMMDevReportGuestUserState);
1748 case VMMDevReq_GetDisplayChangeRequest:
1749 return sizeof(VMMDevDisplayChangeRequest);
1750 case VMMDevReq_GetDisplayChangeRequest2:
1751 return sizeof(VMMDevDisplayChangeRequest2);
1752 case VMMDevReq_GetDisplayChangeRequestEx:
1753 return sizeof(VMMDevDisplayChangeRequestEx);
1754 case VMMDevReq_GetDisplayChangeRequestMulti:
1755 return RT_UOFFSETOF(VMMDevDisplayChangeRequestMulti, aDisplays[0]);
1756 case VMMDevReq_VideoModeSupported:
1757 return sizeof(VMMDevVideoModeSupportedRequest);
1758 case VMMDevReq_GetHeightReduction:
1759 return sizeof(VMMDevGetHeightReductionRequest);
1760 case VMMDevReq_ReportGuestCapabilities:
1761 return sizeof(VMMDevReqGuestCapabilities);
1762 case VMMDevReq_SetGuestCapabilities:
1763 return sizeof(VMMDevReqGuestCapabilities2);
1764#ifdef VBOX_WITH_HGCM
1765 case VMMDevReq_HGCMConnect:
1766 return sizeof(VMMDevHGCMConnect);
1767 case VMMDevReq_HGCMDisconnect:
1768 return sizeof(VMMDevHGCMDisconnect);
1769 case VMMDevReq_HGCMCall32:
1770 return sizeof(VMMDevHGCMCall);
1771# ifdef VBOX_WITH_64_BITS_GUESTS
1772 case VMMDevReq_HGCMCall64:
1773 return sizeof(VMMDevHGCMCall);
1774# endif
1775 case VMMDevReq_HGCMCancel:
1776 return sizeof(VMMDevHGCMCancel);
1777#endif /* VBOX_WITH_HGCM */
1778 case VMMDevReq_VideoAccelEnable:
1779 return sizeof(VMMDevVideoAccelEnable);
1780 case VMMDevReq_VideoAccelFlush:
1781 return sizeof(VMMDevVideoAccelFlush);
1782 case VMMDevReq_VideoSetVisibleRegion:
1783 /* The original protocol didn't consider a guest with NO visible
1784 * windows */
1785 return sizeof(VMMDevVideoSetVisibleRegion) - sizeof(RTRECT);
1786 case VMMDevReq_GetSeamlessChangeRequest:
1787 return sizeof(VMMDevSeamlessChangeRequest);
1788 case VMMDevReq_QueryCredentials:
1789 return sizeof(VMMDevCredentials);
1790 case VMMDevReq_ReportGuestStats:
1791 return sizeof(VMMDevReportGuestStats);
1792 case VMMDevReq_GetMemBalloonChangeRequest:
1793 return sizeof(VMMDevGetMemBalloonChangeRequest);
1794 case VMMDevReq_GetStatisticsChangeRequest:
1795 return sizeof(VMMDevGetStatisticsChangeRequest);
1796 case VMMDevReq_ChangeMemBalloon:
1797 return sizeof(VMMDevChangeMemBalloon);
1798 case VMMDevReq_GetVRDPChangeRequest:
1799 return sizeof(VMMDevVRDPChangeRequest);
1800 case VMMDevReq_LogString:
1801 return sizeof(VMMDevReqLogString);
1802 case VMMDevReq_CtlGuestFilterMask:
1803 return sizeof(VMMDevCtlGuestFilterMask);
1804 case VMMDevReq_GetCpuHotPlugRequest:
1805 return sizeof(VMMDevGetCpuHotPlugRequest);
1806 case VMMDevReq_SetCpuHotPlugStatus:
1807 return sizeof(VMMDevCpuHotPlugStatusRequest);
1808 case VMMDevReq_RegisterSharedModule:
1809 return sizeof(VMMDevSharedModuleRegistrationRequest);
1810 case VMMDevReq_UnregisterSharedModule:
1811 return sizeof(VMMDevSharedModuleUnregistrationRequest);
1812 case VMMDevReq_CheckSharedModules:
1813 return sizeof(VMMDevSharedModuleCheckRequest);
1814 case VMMDevReq_GetPageSharingStatus:
1815 return sizeof(VMMDevPageSharingStatusRequest);
1816 case VMMDevReq_DebugIsPageShared:
1817 return sizeof(VMMDevPageIsSharedRequest);
1818 case VMMDevReq_GetSessionId:
1819 return sizeof(VMMDevReqSessionId);
1820 case VMMDevReq_HeartbeatConfigure:
1821 return sizeof(VMMDevReqHeartbeat);
1822 case VMMDevReq_GuestHeartbeat:
1823 return sizeof(VMMDevRequestHeader);
1824 default:
1825 break;
1826 }
1827
1828 return 0;
1829}
1830
1831
1832/**
1833 * Initializes a request structure.
1834 *
1835 * @returns VBox status code.
1836 * @param req The request structure to initialize.
1837 * @param type The request type.
1838 */
1839DECLINLINE(int) vmmdevInitRequest(VMMDevRequestHeader *req, VMMDevRequestType type)
1840{
1841 uint32_t requestSize;
1842 if (!req)
1843 return VERR_INVALID_PARAMETER;
1844 requestSize = (uint32_t)vmmdevGetRequestSize(type);
1845 if (!requestSize)
1846 return VERR_INVALID_PARAMETER;
1847 req->size = requestSize;
1848 req->version = VMMDEV_REQUEST_HEADER_VERSION;
1849 req->requestType = type;
1850 req->rc = VERR_GENERAL_FAILURE;
1851 req->reserved1 = 0;
1852 req->fRequestor = 0;
1853 return VINF_SUCCESS;
1854}
1855
1856/** @} */
1857
1858/** @name VBVA ring defines.
1859 *
1860 * The VBVA ring buffer is suitable for transferring large (< 2GB) amount of
1861 * data. For example big bitmaps which do not fit to the buffer.
1862 *
1863 * Guest starts writing to the buffer by initializing a record entry in the
1864 * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
1865 * written. As data is written to the ring buffer, the guest increases off32End
1866 * for the record.
1867 *
1868 * The host reads the aRecords on flushes and processes all completed records.
1869 * When host encounters situation when only a partial record presents and
1870 * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE -
1871 * VBVA_RING_BUFFER_THRESHOLD, the host fetched all record data and updates
1872 * off32Head. After that on each flush the host continues fetching the data
1873 * until the record is completed.
1874 *
1875 */
1876#define VMMDEV_VBVA_RING_BUFFER_SIZE (_4M - _1K)
1877#define VMMDEV_VBVA_RING_BUFFER_THRESHOLD (4 * _1K)
1878
1879#define VMMDEV_VBVA_MAX_RECORDS (64)
1880/** @} */
1881
1882/**
1883 * VBVA record.
1884 */
1885typedef struct VMMDEVVBVARECORD
1886{
1887 /** The length of the record. Changed by guest. */
1888 uint32_t cbRecord;
1889} VMMDEVVBVARECORD;
1890AssertCompileSize(VMMDEVVBVARECORD, 4);
1891
1892#if ARCH_BITS >= 32
1893
1894/**
1895 * VBVA memory layout.
1896 *
1897 * This is a subsection of the VMMDevMemory structure.
1898 */
1899typedef struct VBVAMEMORY
1900{
1901 /** VBVA_F_MODE_*. */
1902 uint32_t fu32ModeFlags;
1903
1904 /** The offset where the data start in the buffer. */
1905 uint32_t off32Data;
1906 /** The offset where next data must be placed in the buffer. */
1907 uint32_t off32Free;
1908
1909 /** The ring buffer for data. */
1910 uint8_t au8RingBuffer[VMMDEV_VBVA_RING_BUFFER_SIZE];
1911
1912 /** The queue of record descriptions. */
1913 VMMDEVVBVARECORD aRecords[VMMDEV_VBVA_MAX_RECORDS];
1914 uint32_t indexRecordFirst;
1915 uint32_t indexRecordFree;
1916
1917 /** RDP orders supported by the client. The guest reports only them
1918 * and falls back to DIRTY rects for not supported ones.
1919 *
1920 * (1 << VBVA_VRDP_*)
1921 */
1922 uint32_t fu32SupportedOrders;
1923
1924} VBVAMEMORY;
1925AssertCompileSize(VBVAMEMORY, 12 + (_4M-_1K) + 4*64 + 12);
1926
1927
1928/**
1929 * The layout of VMMDEV RAM region that contains information for guest.
1930 */
1931typedef struct VMMDevMemory
1932{
1933 /** The size of this structure. */
1934 uint32_t u32Size;
1935 /** The structure version. (VMMDEV_MEMORY_VERSION) */
1936 uint32_t u32Version;
1937
1938 union
1939 {
1940 struct
1941 {
1942 /** Flag telling that VMMDev set the IRQ and acknowlegment is required */
1943 bool fHaveEvents;
1944 } V1_04;
1945
1946 struct
1947 {
1948 /** Pending events flags, set by host. */
1949 uint32_t u32HostEvents;
1950 /** Mask of events the guest wants to see, set by guest. */
1951 uint32_t u32GuestEventMask;
1952 } V1_03;
1953 } V;
1954
1955 VBVAMEMORY vbvaMemory;
1956
1957} VMMDevMemory;
1958AssertCompileSize(VMMDevMemory, 8+8 + (12 + (_4M-_1K) + 4*64 + 12) );
1959AssertCompileMemberOffset(VMMDevMemory, vbvaMemory, 16);
1960
1961/** Version of VMMDevMemory structure (VMMDevMemory::u32Version). */
1962# define VMMDEV_MEMORY_VERSION (1)
1963
1964#endif /* ARCH_BITS >= 32 */
1965
1966/** @} */
1967
1968RT_C_DECLS_END
1969#pragma pack()
1970
1971#endif /* !VBOX_INCLUDED_VMMDev_h */
1972
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