VirtualBox

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

Last change on this file since 76410 was 76393, checked in by vboxsync, 6 years ago

VBox/vmm/gmm.h,pgm.h: Avoid dragging in VMMDev.h just for VMMDEVSHAREDREGIONDESC, so moved VMMDEVSHAREDREGIONDESC to types.h. bugref:9344

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