VirtualBox

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

Last change on this file since 72905 was 72627, checked in by vboxsync, 6 years ago

Additions: relicence components needed for Linux shared folders to MIT.
bugref:9109: Shared folders: update to match in-kernel code more closely
This change makes the code on which the Linux kernel shared folder patch is
based MIT-licenced, so that the version in the Linux kernel can be too. This
would make it easier to move code back and forth.

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