VirtualBox

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

Last change on this file since 75851 was 75784, checked in by vboxsync, 6 years ago

VMMDev.h: Added VMMDEV_REQUESTOR_NO_USER_DEVICE. bugref:9105

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 64.6 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/** VMMDev supports fast IRQ acknowledgements. */
547#define VMMDEV_HVF_FAST_IRQ_ACK RT_BIT_32(31)
548/** @} */
549
550
551/**
552 * Guest capabilities structure.
553 *
554 * Used by VMMDevReq_ReportGuestCapabilities.
555 */
556typedef struct
557{
558 /** Header. */
559 VMMDevRequestHeader header;
560 /** Capabilities (VMMDEV_GUEST_*). */
561 uint32_t caps;
562} VMMDevReqGuestCapabilities;
563AssertCompileSize(VMMDevReqGuestCapabilities, 24+4);
564
565
566/**
567 * Guest capabilities structure, version 2.
568 *
569 * Used by VMMDevReq_SetGuestCapabilities.
570 */
571typedef struct
572{
573 /** Header. */
574 VMMDevRequestHeader header;
575 /** Mask of capabilities to be added. */
576 uint32_t u32OrMask;
577 /** Mask of capabilities to be removed. */
578 uint32_t u32NotMask;
579} VMMDevReqGuestCapabilities2;
580AssertCompileSize(VMMDevReqGuestCapabilities2, 24+8);
581
582
583/**
584 * Idle request structure.
585 *
586 * Used by VMMDevReq_Idle.
587 */
588typedef struct
589{
590 /** Header. */
591 VMMDevRequestHeader header;
592} VMMDevReqIdle;
593AssertCompileSize(VMMDevReqIdle, 24);
594
595
596/**
597 * Host time request structure.
598 *
599 * Used by VMMDevReq_GetHostTime.
600 */
601typedef struct
602{
603 /** Header */
604 VMMDevRequestHeader header;
605 /** OUT: Time in milliseconds since unix epoch. */
606 uint64_t time;
607} VMMDevReqHostTime;
608AssertCompileSize(VMMDevReqHostTime, 24+8);
609
610
611/**
612 * Hypervisor info structure.
613 *
614 * Used by VMMDevReq_GetHypervisorInfo and VMMDevReq_SetHypervisorInfo.
615 */
616typedef struct
617{
618 /** Header. */
619 VMMDevRequestHeader header;
620 /** Guest virtual address of proposed hypervisor start.
621 * Not used by VMMDevReq_GetHypervisorInfo.
622 * @todo Make this 64-bit compatible? */
623 RTGCPTR32 hypervisorStart;
624 /** Hypervisor size in bytes. */
625 uint32_t hypervisorSize;
626} VMMDevReqHypervisorInfo;
627AssertCompileSize(VMMDevReqHypervisorInfo, 24+8);
628
629/** @name Default patch memory size .
630 * Used by VMMDevReq_RegisterPatchMemory and VMMDevReq_DeregisterPatchMemory.
631 * @{ */
632#define VMMDEV_GUEST_DEFAULT_PATCHMEM_SIZE 8192
633/** @} */
634
635/**
636 * Patching memory structure. (locked executable & read-only page from the guest's perspective)
637 *
638 * Used by VMMDevReq_RegisterPatchMemory and VMMDevReq_DeregisterPatchMemory
639 */
640typedef struct
641{
642 /** Header. */
643 VMMDevRequestHeader header;
644 /** Guest virtual address of the patching page(s). */
645 RTGCPTR64 pPatchMem;
646 /** Patch page size in bytes. */
647 uint32_t cbPatchMem;
648} VMMDevReqPatchMemory;
649AssertCompileSize(VMMDevReqPatchMemory, 24+12);
650
651
652/**
653 * Guest power requests.
654 *
655 * See VMMDevReq_SetPowerStatus and VMMDevPowerStateRequest.
656 */
657typedef enum
658{
659 VMMDevPowerState_Invalid = 0,
660 VMMDevPowerState_Pause = 1,
661 VMMDevPowerState_PowerOff = 2,
662 VMMDevPowerState_SaveState = 3,
663 VMMDevPowerState_SizeHack = 0x7fffffff
664} VMMDevPowerState;
665AssertCompileSize(VMMDevPowerState, 4);
666
667/**
668 * VM power status structure.
669 *
670 * Used by VMMDevReq_SetPowerStatus.
671 */
672typedef struct
673{
674 /** Header. */
675 VMMDevRequestHeader header;
676 /** Power state request. */
677 VMMDevPowerState powerState;
678} VMMDevPowerStateRequest;
679AssertCompileSize(VMMDevPowerStateRequest, 24+4);
680
681
682/**
683 * Pending events structure.
684 *
685 * Used by VMMDevReq_AcknowledgeEvents.
686 */
687typedef struct
688{
689 /** Header. */
690 VMMDevRequestHeader header;
691 /** OUT: Pending event mask. */
692 uint32_t events;
693} VMMDevEvents;
694AssertCompileSize(VMMDevEvents, 24+4);
695
696
697/**
698 * Guest event filter mask control.
699 *
700 * Used by VMMDevReq_CtlGuestFilterMask.
701 */
702typedef struct
703{
704 /** Header. */
705 VMMDevRequestHeader header;
706 /** Mask of events to be added to the filter. */
707 uint32_t u32OrMask;
708 /** Mask of events to be removed from the filter. */
709 uint32_t u32NotMask;
710} VMMDevCtlGuestFilterMask;
711AssertCompileSize(VMMDevCtlGuestFilterMask, 24+8);
712
713
714/**
715 * Guest information structure.
716 *
717 * Used by VMMDevReportGuestInfo and PDMIVMMDEVCONNECTOR::pfnUpdateGuestVersion.
718 */
719typedef struct VBoxGuestInfo
720{
721 /** The VMMDev interface version expected by additions.
722 * *Deprecated*, do not use anymore! Will be removed. */
723 uint32_t interfaceVersion;
724 /** Guest OS type. */
725 VBOXOSTYPE osType;
726} VBoxGuestInfo;
727AssertCompileSize(VBoxGuestInfo, 8);
728
729/**
730 * Guest information report.
731 *
732 * Used by VMMDevReq_ReportGuestInfo.
733 */
734typedef struct
735{
736 /** Header. */
737 VMMDevRequestHeader header;
738 /** Guest information. */
739 VBoxGuestInfo guestInfo;
740} VMMDevReportGuestInfo;
741AssertCompileSize(VMMDevReportGuestInfo, 24+8);
742
743
744/**
745 * Guest information structure, version 2.
746 *
747 * Used by VMMDevReportGuestInfo2 and PDMIVMMDEVCONNECTOR::pfnUpdateGuestVersion2.
748 */
749typedef struct VBoxGuestInfo2
750{
751 /** Major version. */
752 uint16_t additionsMajor;
753 /** Minor version. */
754 uint16_t additionsMinor;
755 /** Build number. */
756 uint32_t additionsBuild;
757 /** SVN revision. */
758 uint32_t additionsRevision;
759 /** Feature mask, VBOXGSTINFO2_F_XXX. */
760 uint32_t additionsFeatures;
761 /** The intentional meaning of this field was:
762 * Some additional information, for example 'Beta 1' or something like that.
763 *
764 * The way it was implemented was implemented: VBOX_VERSION_STRING.
765 *
766 * This means the first three members are duplicated in this field (if the guest
767 * build config is sane). So, the user must check this and chop it off before
768 * usage. There is, because of the Main code's blind trust in the field's
769 * content, no way back. */
770 char szName[128];
771} VBoxGuestInfo2;
772AssertCompileSize(VBoxGuestInfo2, 144);
773
774/** @name VBOXGSTINFO2_F_XXX - Features
775 * @{ */
776/** Request header carries requestor information. */
777#define VBOXGSTINFO2_F_REQUESTOR_INFO RT_BIT_32(0)
778/** @} */
779
780
781/**
782 * Guest information report, version 2.
783 *
784 * Used by VMMDevReq_ReportGuestInfo2.
785 */
786typedef struct
787{
788 /** Header. */
789 VMMDevRequestHeader header;
790 /** Guest information. */
791 VBoxGuestInfo2 guestInfo;
792} VMMDevReportGuestInfo2;
793AssertCompileSize(VMMDevReportGuestInfo2, 24+144);
794
795
796/**
797 * The facility class.
798 *
799 * This needs to be kept in sync with AdditionsFacilityClass of the Main API!
800 */
801typedef enum
802{
803 VBoxGuestFacilityClass_None = 0,
804 VBoxGuestFacilityClass_Driver = 10,
805 VBoxGuestFacilityClass_Service = 30,
806 VBoxGuestFacilityClass_Program = 50,
807 VBoxGuestFacilityClass_Feature = 100,
808 VBoxGuestFacilityClass_ThirdParty = 999,
809 VBoxGuestFacilityClass_All = 0x7ffffffe,
810 VBoxGuestFacilityClass_SizeHack = 0x7fffffff
811} VBoxGuestFacilityClass;
812AssertCompileSize(VBoxGuestFacilityClass, 4);
813
814/**
815 * Guest status structure.
816 *
817 * Used by VMMDevReqGuestStatus.
818 */
819typedef struct VBoxGuestStatus
820{
821 /** Facility the status is indicated for. */
822 VBoxGuestFacilityType facility;
823 /** Current guest status. */
824 VBoxGuestFacilityStatus status;
825 /** Flags, not used at the moment. */
826 uint32_t flags;
827} VBoxGuestStatus;
828AssertCompileSize(VBoxGuestStatus, 12);
829
830/**
831 * Guest Additions status structure.
832 *
833 * Used by VMMDevReq_ReportGuestStatus.
834 */
835typedef struct
836{
837 /** Header. */
838 VMMDevRequestHeader header;
839 /** Guest information. */
840 VBoxGuestStatus guestStatus;
841} VMMDevReportGuestStatus;
842AssertCompileSize(VMMDevReportGuestStatus, 24+12);
843
844
845/**
846 * Guest user status updates.
847 */
848typedef struct VBoxGuestUserStatus
849{
850 /** The guest user state to send. */
851 VBoxGuestUserState state;
852 /** Size (in bytes) of szUser. */
853 uint32_t cbUser;
854 /** Size (in bytes) of szDomain. */
855 uint32_t cbDomain;
856 /** Size (in bytes) of aDetails. */
857 uint32_t cbDetails;
858 /** Note: Here begins the dynamically
859 * allocated region. */
860 /** Guest user to report state for. */
861 char szUser[1];
862 /** Domain the guest user is bound to. */
863 char szDomain[1];
864 /** Optional details of the state. */
865 uint8_t aDetails[1];
866} VBoxGuestUserStatus;
867AssertCompileSize(VBoxGuestUserStatus, 20);
868
869
870/**
871 * Guest user status structure.
872 *
873 * Used by VMMDevReq_ReportGuestUserStatus.
874 */
875typedef struct
876{
877 /** Header. */
878 VMMDevRequestHeader header;
879 /** Guest user status. */
880 VBoxGuestUserStatus status;
881} VMMDevReportGuestUserState;
882AssertCompileSize(VMMDevReportGuestUserState, 24+20);
883
884
885/**
886 * Guest statistics structure.
887 *
888 * Used by VMMDevReportGuestStats and PDMIVMMDEVCONNECTOR::pfnReportStatistics.
889 */
890typedef struct VBoxGuestStatistics
891{
892 /** Virtual CPU ID. */
893 uint32_t u32CpuId;
894 /** Reported statistics. */
895 uint32_t u32StatCaps;
896 /** Idle CPU load (0-100) for last interval. */
897 uint32_t u32CpuLoad_Idle;
898 /** Kernel CPU load (0-100) for last interval. */
899 uint32_t u32CpuLoad_Kernel;
900 /** User CPU load (0-100) for last interval. */
901 uint32_t u32CpuLoad_User;
902 /** Nr of threads. */
903 uint32_t u32Threads;
904 /** Nr of processes. */
905 uint32_t u32Processes;
906 /** Nr of handles. */
907 uint32_t u32Handles;
908 /** Memory load (0-100). */
909 uint32_t u32MemoryLoad;
910 /** Page size of guest system. */
911 uint32_t u32PageSize;
912 /** Total physical memory (in 4KB pages). */
913 uint32_t u32PhysMemTotal;
914 /** Available physical memory (in 4KB pages). */
915 uint32_t u32PhysMemAvail;
916 /** Ballooned physical memory (in 4KB pages). */
917 uint32_t u32PhysMemBalloon;
918 /** Total number of committed memory (which is not necessarily in-use) (in 4KB pages). */
919 uint32_t u32MemCommitTotal;
920 /** Total amount of memory used by the kernel (in 4KB pages). */
921 uint32_t u32MemKernelTotal;
922 /** Total amount of paged memory used by the kernel (in 4KB pages). */
923 uint32_t u32MemKernelPaged;
924 /** Total amount of nonpaged memory used by the kernel (in 4KB pages). */
925 uint32_t u32MemKernelNonPaged;
926 /** Total amount of memory used for the system cache (in 4KB pages). */
927 uint32_t u32MemSystemCache;
928 /** Pagefile size (in 4KB pages). */
929 uint32_t u32PageFileSize;
930} VBoxGuestStatistics;
931AssertCompileSize(VBoxGuestStatistics, 19*4);
932
933/** @name Guest statistics values (VBoxGuestStatistics::u32StatCaps).
934 * @{ */
935#define VBOX_GUEST_STAT_CPU_LOAD_IDLE RT_BIT(0)
936#define VBOX_GUEST_STAT_CPU_LOAD_KERNEL RT_BIT(1)
937#define VBOX_GUEST_STAT_CPU_LOAD_USER RT_BIT(2)
938#define VBOX_GUEST_STAT_THREADS RT_BIT(3)
939#define VBOX_GUEST_STAT_PROCESSES RT_BIT(4)
940#define VBOX_GUEST_STAT_HANDLES RT_BIT(5)
941#define VBOX_GUEST_STAT_MEMORY_LOAD RT_BIT(6)
942#define VBOX_GUEST_STAT_PHYS_MEM_TOTAL RT_BIT(7)
943#define VBOX_GUEST_STAT_PHYS_MEM_AVAIL RT_BIT(8)
944#define VBOX_GUEST_STAT_PHYS_MEM_BALLOON RT_BIT(9)
945#define VBOX_GUEST_STAT_MEM_COMMIT_TOTAL RT_BIT(10)
946#define VBOX_GUEST_STAT_MEM_KERNEL_TOTAL RT_BIT(11)
947#define VBOX_GUEST_STAT_MEM_KERNEL_PAGED RT_BIT(12)
948#define VBOX_GUEST_STAT_MEM_KERNEL_NONPAGED RT_BIT(13)
949#define VBOX_GUEST_STAT_MEM_SYSTEM_CACHE RT_BIT(14)
950#define VBOX_GUEST_STAT_PAGE_FILE_SIZE RT_BIT(15)
951/** @} */
952
953/**
954 * Guest statistics command structure.
955 *
956 * Used by VMMDevReq_ReportGuestStats.
957 */
958typedef struct
959{
960 /** Header. */
961 VMMDevRequestHeader header;
962 /** Guest information. */
963 VBoxGuestStatistics guestStats;
964} VMMDevReportGuestStats;
965AssertCompileSize(VMMDevReportGuestStats, 24+19*4);
966
967
968/** Memory balloon change request structure. */
969#define VMMDEV_MAX_MEMORY_BALLOON(PhysMemTotal) ( (9 * (PhysMemTotal)) / 10 )
970
971/**
972 * Poll for ballooning change request.
973 *
974 * Used by VMMDevReq_GetMemBalloonChangeRequest.
975 */
976typedef struct
977{
978 /** Header. */
979 VMMDevRequestHeader header;
980 /** Balloon size in megabytes. */
981 uint32_t cBalloonChunks;
982 /** Guest ram size in megabytes. */
983 uint32_t cPhysMemChunks;
984 /** Setting this to VMMDEV_EVENT_BALLOON_CHANGE_REQUEST indicates that the
985 * request is a response to that event.
986 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
987 uint32_t eventAck;
988} VMMDevGetMemBalloonChangeRequest;
989AssertCompileSize(VMMDevGetMemBalloonChangeRequest, 24+12);
990
991
992/**
993 * Change the size of the balloon.
994 *
995 * Used by VMMDevReq_ChangeMemBalloon.
996 */
997typedef struct
998{
999 /** Header. */
1000 VMMDevRequestHeader header;
1001 /** The number of pages in the array. */
1002 uint32_t cPages;
1003 /** true = inflate, false = deflate. */
1004 uint32_t fInflate;
1005 /** Physical address (RTGCPHYS) of each page, variable size. */
1006 RTGCPHYS aPhysPage[1];
1007} VMMDevChangeMemBalloon;
1008AssertCompileSize(VMMDevChangeMemBalloon, 24+16);
1009
1010
1011/**
1012 * Guest statistics interval change request structure.
1013 *
1014 * Used by VMMDevReq_GetStatisticsChangeRequest.
1015 */
1016typedef struct
1017{
1018 /** Header. */
1019 VMMDevRequestHeader header;
1020 /** The interval in seconds. */
1021 uint32_t u32StatInterval;
1022 /** Setting this to VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST indicates
1023 * that the request is a response to that event.
1024 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1025 uint32_t eventAck;
1026} VMMDevGetStatisticsChangeRequest;
1027AssertCompileSize(VMMDevGetStatisticsChangeRequest, 24+8);
1028
1029
1030/** The size of a string field in the credentials request (including '\\0').
1031 * @see VMMDevCredentials */
1032#define VMMDEV_CREDENTIALS_SZ_SIZE 128
1033
1034/**
1035 * Credentials request structure.
1036 *
1037 * Used by VMMDevReq_QueryCredentials.
1038 */
1039typedef struct
1040{
1041 /** Header. */
1042 VMMDevRequestHeader header;
1043 /** IN/OUT: Request flags. */
1044 uint32_t u32Flags;
1045 /** OUT: User name (UTF-8). */
1046 char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
1047 /** OUT: Password (UTF-8). */
1048 char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
1049 /** OUT: Domain name (UTF-8). */
1050 char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
1051} VMMDevCredentials;
1052AssertCompileSize(VMMDevCredentials, 24+4+3*128);
1053
1054/** @name Credentials request flag (VMMDevCredentials::u32Flags)
1055 * @{ */
1056/** query from host whether credentials are present */
1057#define VMMDEV_CREDENTIALS_QUERYPRESENCE RT_BIT(1)
1058/** read credentials from host (can be combined with clear) */
1059#define VMMDEV_CREDENTIALS_READ RT_BIT(2)
1060/** clear credentials on host (can be combined with read) */
1061#define VMMDEV_CREDENTIALS_CLEAR RT_BIT(3)
1062/** read credentials for judgement in the guest */
1063#define VMMDEV_CREDENTIALS_READJUDGE RT_BIT(8)
1064/** clear credentials for judegement on the host */
1065#define VMMDEV_CREDENTIALS_CLEARJUDGE RT_BIT(9)
1066/** report credentials acceptance by guest */
1067#define VMMDEV_CREDENTIALS_JUDGE_OK RT_BIT(10)
1068/** report credentials denial by guest */
1069#define VMMDEV_CREDENTIALS_JUDGE_DENY RT_BIT(11)
1070/** report that no judgement could be made by guest */
1071#define VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT RT_BIT(12)
1072
1073/** flag telling the guest that credentials are present */
1074#define VMMDEV_CREDENTIALS_PRESENT RT_BIT(16)
1075/** flag telling guest that local logons should be prohibited */
1076#define VMMDEV_CREDENTIALS_NOLOCALLOGON RT_BIT(17)
1077/** @} */
1078
1079
1080/**
1081 * Seamless mode change request structure.
1082 *
1083 * Used by VMMDevReq_GetSeamlessChangeRequest.
1084 */
1085typedef struct
1086{
1087 /** Header. */
1088 VMMDevRequestHeader header;
1089
1090 /** New seamless mode. */
1091 VMMDevSeamlessMode mode;
1092 /** Setting this to VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST indicates
1093 * that the request is a response to that event.
1094 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1095 uint32_t eventAck;
1096} VMMDevSeamlessChangeRequest;
1097AssertCompileSize(VMMDevSeamlessChangeRequest, 24+8);
1098AssertCompileMemberOffset(VMMDevSeamlessChangeRequest, eventAck, 24+4);
1099
1100
1101/**
1102 * Display change request structure.
1103 *
1104 * Used by VMMDevReq_GetDisplayChangeRequest.
1105 */
1106typedef struct
1107{
1108 /** Header. */
1109 VMMDevRequestHeader header;
1110 /** Horizontal pixel resolution (0 = do not change). */
1111 uint32_t xres;
1112 /** Vertical pixel resolution (0 = do not change). */
1113 uint32_t yres;
1114 /** Bits per pixel (0 = do not change). */
1115 uint32_t bpp;
1116 /** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
1117 * that the request is a response to that event.
1118 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1119 uint32_t eventAck;
1120} VMMDevDisplayChangeRequest;
1121AssertCompileSize(VMMDevDisplayChangeRequest, 24+16);
1122
1123
1124/**
1125 * Display change request structure, version 2.
1126 *
1127 * Used by VMMDevReq_GetDisplayChangeRequest2.
1128 */
1129typedef struct
1130{
1131 /** Header. */
1132 VMMDevRequestHeader header;
1133 /** Horizontal pixel resolution (0 = do not change). */
1134 uint32_t xres;
1135 /** Vertical pixel resolution (0 = do not change). */
1136 uint32_t yres;
1137 /** Bits per pixel (0 = do not change). */
1138 uint32_t bpp;
1139 /** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
1140 * that the request is a response to that event.
1141 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1142 uint32_t eventAck;
1143 /** 0 for primary display, 1 for the first secondary, etc. */
1144 uint32_t display;
1145} VMMDevDisplayChangeRequest2;
1146AssertCompileSize(VMMDevDisplayChangeRequest2, 24+20);
1147
1148
1149/**
1150 * Display change request structure, version Extended.
1151 *
1152 * Used by VMMDevReq_GetDisplayChangeRequestEx.
1153 */
1154typedef struct
1155{
1156 /** Header. */
1157 VMMDevRequestHeader header;
1158 /** Horizontal pixel resolution (0 = do not change). */
1159 uint32_t xres;
1160 /** Vertical pixel resolution (0 = do not change). */
1161 uint32_t yres;
1162 /** Bits per pixel (0 = do not change). */
1163 uint32_t bpp;
1164 /** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
1165 * that the request is a response to that event.
1166 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1167 uint32_t eventAck;
1168 /** 0 for primary display, 1 for the first secondary, etc. */
1169 uint32_t display;
1170 /** New OriginX of secondary virtual screen */
1171 uint32_t cxOrigin;
1172 /** New OriginY of secondary virtual screen */
1173 uint32_t cyOrigin;
1174 /** Change in origin of the secondary virtaul scree is
1175 * required */
1176 bool fChangeOrigin;
1177 /** secondary virtual screen enabled or disabled */
1178 bool fEnabled;
1179} VMMDevDisplayChangeRequestEx;
1180AssertCompileSize(VMMDevDisplayChangeRequestEx, 24+32);
1181
1182
1183/** Flags for VMMDevDisplayDef::fDisplayFlags */
1184#define VMMDEV_DISPLAY_PRIMARY UINT32_C(0x00000001) /**< Primary display. */
1185#define VMMDEV_DISPLAY_DISABLED UINT32_C(0x00000002) /**< Display is disabled. */
1186#define VMMDEV_DISPLAY_ORIGIN UINT32_C(0x00000004) /**< Change position of the diplay. */
1187#define VMMDEV_DISPLAY_CX UINT32_C(0x00000008) /**< Change the horizontal resolution of the display. */
1188#define VMMDEV_DISPLAY_CY UINT32_C(0x00000010) /**< Change the vertical resolution of the display. */
1189#define VMMDEV_DISPLAY_BPP UINT32_C(0x00000020) /**< Change the color depth of the display. */
1190
1191/** Definition of one monitor. Used by VMMDevReq_GetDisplayChangeRequestMulti. */
1192typedef struct VMMDevDisplayDef
1193{
1194 uint32_t fDisplayFlags; /**< VMMDEV_DISPLAY_* flags. */
1195 uint32_t idDisplay; /**< The display number. */
1196 int32_t xOrigin; /**< New OriginX of the guest screen. */
1197 int32_t yOrigin; /**< New OriginY of the guest screen. */
1198 uint32_t cx; /**< Horizontal pixel resolution. */
1199 uint32_t cy; /**< Vertical pixel resolution. */
1200 uint32_t cBitsPerPixel; /**< Bits per pixel. */
1201} VMMDevDisplayDef;
1202AssertCompileSize(VMMDevDisplayDef, 28);
1203
1204/** Multimonitor display change request structure. Used by VMMDevReq_GetDisplayChangeRequestMulti. */
1205typedef struct VMMDevDisplayChangeRequestMulti
1206{
1207 VMMDevRequestHeader header; /**< Header. */
1208 uint32_t eventAck; /**< Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
1209 * that the request is a response to that event.
1210 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1211 uint32_t cDisplays; /**< Number of monitors. In: how many the guest expects.
1212 * Out: how many the host provided. */
1213 VMMDevDisplayDef aDisplays[1]; /**< Layout of monitors. */
1214} VMMDevDisplayChangeRequestMulti;
1215AssertCompileSize(VMMDevDisplayChangeRequestMulti, 24+8+28);
1216
1217
1218/**
1219 * Video mode supported request structure.
1220 *
1221 * Used by VMMDevReq_VideoModeSupported.
1222 */
1223typedef struct
1224{
1225 /** Header. */
1226 VMMDevRequestHeader header;
1227 /** IN: Horizontal pixel resolution. */
1228 uint32_t width;
1229 /** IN: Vertical pixel resolution. */
1230 uint32_t height;
1231 /** IN: Bits per pixel. */
1232 uint32_t bpp;
1233 /** OUT: Support indicator. */
1234 bool fSupported;
1235} VMMDevVideoModeSupportedRequest;
1236AssertCompileSize(VMMDevVideoModeSupportedRequest, 24+16);
1237
1238/**
1239 * Video mode supported request structure for a specific display.
1240 *
1241 * Used by VMMDevReq_VideoModeSupported2.
1242 */
1243typedef struct
1244{
1245 /** Header. */
1246 VMMDevRequestHeader header;
1247 /** IN: The guest display number. */
1248 uint32_t display;
1249 /** IN: Horizontal pixel resolution. */
1250 uint32_t width;
1251 /** IN: Vertical pixel resolution. */
1252 uint32_t height;
1253 /** IN: Bits per pixel. */
1254 uint32_t bpp;
1255 /** OUT: Support indicator. */
1256 bool fSupported;
1257} VMMDevVideoModeSupportedRequest2;
1258AssertCompileSize(VMMDevVideoModeSupportedRequest2, 24+20);
1259
1260/**
1261 * Video modes height reduction request structure.
1262 *
1263 * Used by VMMDevReq_GetHeightReduction.
1264 */
1265typedef struct
1266{
1267 /** Header. */
1268 VMMDevRequestHeader header;
1269 /** OUT: Height reduction in pixels. */
1270 uint32_t heightReduction;
1271} VMMDevGetHeightReductionRequest;
1272AssertCompileSize(VMMDevGetHeightReductionRequest, 24+4);
1273
1274
1275/**
1276 * VRDP change request structure.
1277 *
1278 * Used by VMMDevReq_GetVRDPChangeRequest.
1279 */
1280typedef struct
1281{
1282 /** Header */
1283 VMMDevRequestHeader header;
1284 /** Whether VRDP is active or not. */
1285 uint8_t u8VRDPActive;
1286 /** The configured experience level for active VRDP. */
1287 uint32_t u32VRDPExperienceLevel;
1288} VMMDevVRDPChangeRequest;
1289AssertCompileSize(VMMDevVRDPChangeRequest, 24+8);
1290AssertCompileMemberOffset(VMMDevVRDPChangeRequest, u8VRDPActive, 24);
1291AssertCompileMemberOffset(VMMDevVRDPChangeRequest, u32VRDPExperienceLevel, 24+4);
1292
1293/** @name VRDP Experience level (VMMDevVRDPChangeRequest::u32VRDPExperienceLevel)
1294 * @{ */
1295#define VRDP_EXPERIENCE_LEVEL_ZERO 0 /**< Theming disabled. */
1296#define VRDP_EXPERIENCE_LEVEL_LOW 1 /**< Full window dragging and desktop wallpaper disabled. */
1297#define VRDP_EXPERIENCE_LEVEL_MEDIUM 2 /**< Font smoothing, gradients. */
1298#define VRDP_EXPERIENCE_LEVEL_HIGH 3 /**< Animation effects disabled. */
1299#define VRDP_EXPERIENCE_LEVEL_FULL 4 /**< Everything enabled. */
1300/** @} */
1301
1302
1303/**
1304 * VBVA enable request structure.
1305 *
1306 * Used by VMMDevReq_VideoAccelEnable.
1307 */
1308typedef struct
1309{
1310 /** Header. */
1311 VMMDevRequestHeader header;
1312 /** 0 - disable, !0 - enable. */
1313 uint32_t u32Enable;
1314 /** The size of VBVAMEMORY::au8RingBuffer expected by driver.
1315 * The host will refuse to enable VBVA if the size is not equal to
1316 * VBVA_RING_BUFFER_SIZE.
1317 */
1318 uint32_t cbRingBuffer;
1319 /** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
1320 uint32_t fu32Status;
1321} VMMDevVideoAccelEnable;
1322AssertCompileSize(VMMDevVideoAccelEnable, 24+12);
1323
1324/** @name VMMDevVideoAccelEnable::fu32Status.
1325 * @{ */
1326#define VBVA_F_STATUS_ACCEPTED (0x01)
1327#define VBVA_F_STATUS_ENABLED (0x02)
1328/** @} */
1329
1330
1331/**
1332 * VBVA flush request structure.
1333 *
1334 * Used by VMMDevReq_VideoAccelFlush.
1335 */
1336typedef struct
1337{
1338 /** Header. */
1339 VMMDevRequestHeader header;
1340} VMMDevVideoAccelFlush;
1341AssertCompileSize(VMMDevVideoAccelFlush, 24);
1342
1343
1344/**
1345 * VBVA set visible region request structure.
1346 *
1347 * Used by VMMDevReq_VideoSetVisibleRegion.
1348 */
1349typedef struct
1350{
1351 /** Header. */
1352 VMMDevRequestHeader header;
1353 /** Number of rectangles */
1354 uint32_t cRect;
1355 /** Rectangle array.
1356 * @todo array is spelled aRects[1]. */
1357 RTRECT Rect;
1358} VMMDevVideoSetVisibleRegion;
1359AssertCompileSize(RTRECT, 16);
1360AssertCompileSize(VMMDevVideoSetVisibleRegion, 24+4+16);
1361
1362/**
1363 * CPU event types.
1364 */
1365typedef enum
1366{
1367 VMMDevCpuStatusType_Invalid = 0,
1368 VMMDevCpuStatusType_Disable = 1,
1369 VMMDevCpuStatusType_Enable = 2,
1370 VMMDevCpuStatusType_SizeHack = 0x7fffffff
1371} VMMDevCpuStatusType;
1372
1373/**
1374 * CPU hotplug event status request.
1375 */
1376typedef struct
1377{
1378 /** Header. */
1379 VMMDevRequestHeader header;
1380 /** Status type */
1381 VMMDevCpuStatusType enmStatusType;
1382} VMMDevCpuHotPlugStatusRequest;
1383AssertCompileSize(VMMDevCpuHotPlugStatusRequest, 24+4);
1384
1385/**
1386 * Get the ID of the changed CPU and event type.
1387 */
1388typedef struct
1389{
1390 /** Header. */
1391 VMMDevRequestHeader header;
1392 /** Event type */
1393 VMMDevCpuEventType enmEventType;
1394 /** core id of the CPU changed */
1395 uint32_t idCpuCore;
1396 /** package id of the CPU changed */
1397 uint32_t idCpuPackage;
1398} VMMDevGetCpuHotPlugRequest;
1399AssertCompileSize(VMMDevGetCpuHotPlugRequest, 24+4+4+4);
1400
1401
1402/**
1403 * Shared region description
1404 */
1405typedef struct VMMDEVSHAREDREGIONDESC
1406{
1407 RTGCPTR64 GCRegionAddr;
1408 uint32_t cbRegion;
1409 uint32_t u32Alignment;
1410} VMMDEVSHAREDREGIONDESC;
1411AssertCompileSize(VMMDEVSHAREDREGIONDESC, 16);
1412
1413#define VMMDEVSHAREDREGIONDESC_MAX 32
1414
1415/**
1416 * Shared module registration
1417 */
1418typedef struct
1419{
1420 /** Header. */
1421 VMMDevRequestHeader header;
1422 /** Shared module size. */
1423 uint32_t cbModule;
1424 /** Number of included region descriptors */
1425 uint32_t cRegions;
1426 /** Base address of the shared module. */
1427 RTGCPTR64 GCBaseAddr;
1428 /** Guest OS type. */
1429 VBOXOSFAMILY enmGuestOS;
1430 /** Alignment. */
1431 uint32_t u32Align;
1432 /** Module name */
1433 char szName[128];
1434 /** Module version */
1435 char szVersion[16];
1436 /** Shared region descriptor(s). */
1437 VMMDEVSHAREDREGIONDESC aRegions[1];
1438} VMMDevSharedModuleRegistrationRequest;
1439AssertCompileSize(VMMDevSharedModuleRegistrationRequest, 24+4+4+8+4+4+128+16+16);
1440
1441
1442/**
1443 * Shared module unregistration
1444 */
1445typedef struct
1446{
1447 /** Header. */
1448 VMMDevRequestHeader header;
1449 /** Shared module size. */
1450 uint32_t cbModule;
1451 /** Align at 8 byte boundary. */
1452 uint32_t u32Alignment;
1453 /** Base address of the shared module. */
1454 RTGCPTR64 GCBaseAddr;
1455 /** Module name */
1456 char szName[128];
1457 /** Module version */
1458 char szVersion[16];
1459} VMMDevSharedModuleUnregistrationRequest;
1460AssertCompileSize(VMMDevSharedModuleUnregistrationRequest, 24+4+4+8+128+16);
1461
1462
1463/**
1464 * Shared module periodic check
1465 */
1466typedef struct
1467{
1468 /** Header. */
1469 VMMDevRequestHeader header;
1470} VMMDevSharedModuleCheckRequest;
1471AssertCompileSize(VMMDevSharedModuleCheckRequest, 24);
1472
1473/**
1474 * Paging sharing enabled query
1475 */
1476typedef struct
1477{
1478 /** Header. */
1479 VMMDevRequestHeader header;
1480 /** Enabled flag (out) */
1481 bool fEnabled;
1482 /** Alignment */
1483 bool fAlignment[3];
1484} VMMDevPageSharingStatusRequest;
1485AssertCompileSize(VMMDevPageSharingStatusRequest, 24+4);
1486
1487
1488/**
1489 * Page sharing status query (debug build only)
1490 */
1491typedef struct
1492{
1493 /** Header. */
1494 VMMDevRequestHeader header;
1495 /** Page address. */
1496 RTGCPTR GCPtrPage;
1497 /** Page flags. */
1498 uint64_t uPageFlags;
1499 /** Shared flag (out) */
1500 bool fShared;
1501 /** Alignment */
1502 bool fAlignment[3];
1503} VMMDevPageIsSharedRequest;
1504
1505/**
1506 * Session id request structure.
1507 *
1508 * Used by VMMDevReq_GetSessionId.
1509 */
1510typedef struct
1511{
1512 /** Header */
1513 VMMDevRequestHeader header;
1514 /** OUT: unique session id; the id will be different after each start, reset or restore of the VM */
1515 uint64_t idSession;
1516} VMMDevReqSessionId;
1517AssertCompileSize(VMMDevReqSessionId, 24+8);
1518
1519
1520/**
1521 * Write Core Dump request.
1522 *
1523 * Used by VMMDevReq_WriteCoreDump.
1524 */
1525typedef struct
1526{
1527 /** Header. */
1528 VMMDevRequestHeader header;
1529 /** Flags (reserved, MBZ). */
1530 uint32_t fFlags;
1531} VMMDevReqWriteCoreDump;
1532AssertCompileSize(VMMDevReqWriteCoreDump, 24+4);
1533
1534
1535/**
1536 * Heart beat check state structure.
1537 * Used by VMMDevReq_HeartbeatConfigure.
1538 */
1539typedef struct
1540{
1541 /** Header. */
1542 VMMDevRequestHeader header;
1543 /** OUT: Guest heartbeat interval in nanosec. */
1544 uint64_t cNsInterval;
1545 /** Heartbeat check flag. */
1546 bool fEnabled;
1547} VMMDevReqHeartbeat;
1548AssertCompileSize(VMMDevReqHeartbeat, 24+12);
1549
1550
1551/**
1552 * NT bug check report.
1553 * Used by VMMDevReq_NtBugCheck.
1554 * @remarks Can be issued with just the header if no more data is available.
1555 */
1556typedef struct
1557{
1558 /** Header. */
1559 VMMDevRequestHeader header;
1560 /** The bug check number (P0). */
1561 uint64_t uBugCheck;
1562 /** The four bug check parameters. */
1563 uint64_t auParameters[4];
1564} VMMDevReqNtBugCheck;
1565AssertCompileSize(VMMDevReqNtBugCheck, 24+40);
1566
1567
1568
1569#ifdef VBOX_WITH_HGCM
1570
1571/** @name HGCM flags.
1572 * @{
1573 */
1574# define VBOX_HGCM_REQ_DONE RT_BIT_32(VBOX_HGCM_REQ_DONE_BIT)
1575# define VBOX_HGCM_REQ_DONE_BIT 0
1576# define VBOX_HGCM_REQ_CANCELLED (0x2)
1577/** @} */
1578
1579/**
1580 * HGCM request header.
1581 */
1582typedef struct VMMDevHGCMRequestHeader
1583{
1584 /** Request header. */
1585 VMMDevRequestHeader header;
1586
1587 /** HGCM flags. */
1588 uint32_t fu32Flags;
1589
1590 /** Result code. */
1591 int32_t result;
1592} VMMDevHGCMRequestHeader;
1593AssertCompileSize(VMMDevHGCMRequestHeader, 24+8);
1594
1595/**
1596 * HGCM connect request structure.
1597 *
1598 * Used by VMMDevReq_HGCMConnect.
1599 */
1600typedef struct
1601{
1602 /** HGCM request header. */
1603 VMMDevHGCMRequestHeader header;
1604
1605 /** IN: Description of service to connect to. */
1606 HGCMServiceLocation loc;
1607
1608 /** OUT: Client identifier assigned by local instance of HGCM. */
1609 uint32_t u32ClientID;
1610} VMMDevHGCMConnect;
1611AssertCompileSize(VMMDevHGCMConnect, 32+132+4);
1612
1613
1614/**
1615 * HGCM disconnect request structure.
1616 *
1617 * Used by VMMDevReq_HGCMDisconnect.
1618 */
1619typedef struct
1620{
1621 /** HGCM request header. */
1622 VMMDevHGCMRequestHeader header;
1623
1624 /** IN: Client identifier. */
1625 uint32_t u32ClientID;
1626} VMMDevHGCMDisconnect;
1627AssertCompileSize(VMMDevHGCMDisconnect, 32+4);
1628
1629/**
1630 * HGCM call request structure.
1631 *
1632 * Used by VMMDevReq_HGCMCall, VMMDevReq_HGCMCall32 and VMMDevReq_HGCMCall64.
1633 */
1634typedef struct
1635{
1636 /* request header */
1637 VMMDevHGCMRequestHeader header;
1638
1639 /** IN: Client identifier. */
1640 uint32_t u32ClientID;
1641 /** IN: Service function number. */
1642 uint32_t u32Function;
1643 /** IN: Number of parameters. */
1644 uint32_t cParms;
1645 /** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
1646} VMMDevHGCMCall;
1647AssertCompileSize(VMMDevHGCMCall, 32+12);
1648
1649/** @name Direction of data transfer (HGCMPageListInfo::flags). Bit flags.
1650 * @{ */
1651#define VBOX_HGCM_F_PARM_DIRECTION_NONE UINT32_C(0x00000000)
1652#define VBOX_HGCM_F_PARM_DIRECTION_TO_HOST UINT32_C(0x00000001)
1653#define VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST UINT32_C(0x00000002)
1654#define VBOX_HGCM_F_PARM_DIRECTION_BOTH UINT32_C(0x00000003)
1655/** Macro for validating that the specified flags are valid. */
1656#define VBOX_HGCM_F_PARM_ARE_VALID(fFlags) \
1657 ( (fFlags) > VBOX_HGCM_F_PARM_DIRECTION_NONE \
1658 && (fFlags) < VBOX_HGCM_F_PARM_DIRECTION_BOTH )
1659/** @} */
1660
1661/**
1662 * VMMDevHGCMParmType_PageList points to this structure to actually describe the
1663 * buffer.
1664 */
1665typedef struct
1666{
1667 uint32_t flags; /**< VBOX_HGCM_F_PARM_*. */
1668 uint16_t offFirstPage; /**< Offset in the first page where data begins. */
1669 uint16_t cPages; /**< Number of pages. */
1670 RTGCPHYS64 aPages[1]; /**< Page addresses. */
1671} HGCMPageListInfo;
1672AssertCompileSize(HGCMPageListInfo, 4+2+2+8);
1673
1674
1675/** Get the pointer to the first parmater of a HGCM call request. */
1676# define VMMDEV_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1677/** Get the pointer to the first parmater of a 32-bit HGCM call request. */
1678# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1679
1680# ifdef VBOX_WITH_64_BITS_GUESTS
1681/* Explicit defines for the host code. */
1682# ifdef VBOX_HGCM_HOST_CODE
1683# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1684# define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1685# endif /* VBOX_HGCM_HOST_CODE */
1686# endif /* VBOX_WITH_64_BITS_GUESTS */
1687
1688# define VBOX_HGCM_MAX_PARMS 32
1689
1690/**
1691 * HGCM cancel request structure.
1692 *
1693 * The Cancel request is issued using the same physical memory address as was
1694 * used for the corresponding initial HGCMCall.
1695 *
1696 * Used by VMMDevReq_HGCMCancel.
1697 */
1698typedef struct
1699{
1700 /** Header. */
1701 VMMDevHGCMRequestHeader header;
1702} VMMDevHGCMCancel;
1703AssertCompileSize(VMMDevHGCMCancel, 32);
1704
1705/**
1706 * HGCM cancel request structure, version 2.
1707 *
1708 * Used by VMMDevReq_HGCMCancel2.
1709 *
1710 * VINF_SUCCESS when cancelled.
1711 * VERR_NOT_FOUND if the specified request cannot be found.
1712 * VERR_INVALID_PARAMETER if the address is invalid valid.
1713 */
1714typedef struct
1715{
1716 /** Header. */
1717 VMMDevRequestHeader header;
1718 /** The physical address of the request to cancel. */
1719 RTGCPHYS32 physReqToCancel;
1720} VMMDevHGCMCancel2;
1721AssertCompileSize(VMMDevHGCMCancel2, 24+4);
1722
1723#endif /* VBOX_WITH_HGCM */
1724
1725
1726/**
1727 * Inline helper to determine the request size for the given operation.
1728 * Returns 0 if the given operation is not handled and/or supported.
1729 *
1730 * @returns Size.
1731 * @param requestType The VMMDev request type.
1732 */
1733DECLINLINE(size_t) vmmdevGetRequestSize(VMMDevRequestType requestType)
1734{
1735 switch (requestType)
1736 {
1737 case VMMDevReq_GetMouseStatus:
1738 case VMMDevReq_SetMouseStatus:
1739 return sizeof(VMMDevReqMouseStatus);
1740 case VMMDevReq_SetPointerShape:
1741 return sizeof(VMMDevReqMousePointer);
1742 case VMMDevReq_GetHostVersion:
1743 return sizeof(VMMDevReqHostVersion);
1744 case VMMDevReq_Idle:
1745 return sizeof(VMMDevReqIdle);
1746 case VMMDevReq_GetHostTime:
1747 return sizeof(VMMDevReqHostTime);
1748 case VMMDevReq_GetHypervisorInfo:
1749 case VMMDevReq_SetHypervisorInfo:
1750 return sizeof(VMMDevReqHypervisorInfo);
1751 case VMMDevReq_RegisterPatchMemory:
1752 case VMMDevReq_DeregisterPatchMemory:
1753 return sizeof(VMMDevReqPatchMemory);
1754 case VMMDevReq_SetPowerStatus:
1755 return sizeof(VMMDevPowerStateRequest);
1756 case VMMDevReq_AcknowledgeEvents:
1757 return sizeof(VMMDevEvents);
1758 case VMMDevReq_ReportGuestInfo:
1759 return sizeof(VMMDevReportGuestInfo);
1760 case VMMDevReq_ReportGuestInfo2:
1761 return sizeof(VMMDevReportGuestInfo2);
1762 case VMMDevReq_ReportGuestStatus:
1763 return sizeof(VMMDevReportGuestStatus);
1764 case VMMDevReq_ReportGuestUserState:
1765 return sizeof(VMMDevReportGuestUserState);
1766 case VMMDevReq_GetDisplayChangeRequest:
1767 return sizeof(VMMDevDisplayChangeRequest);
1768 case VMMDevReq_GetDisplayChangeRequest2:
1769 return sizeof(VMMDevDisplayChangeRequest2);
1770 case VMMDevReq_GetDisplayChangeRequestEx:
1771 return sizeof(VMMDevDisplayChangeRequestEx);
1772 case VMMDevReq_GetDisplayChangeRequestMulti:
1773 return RT_UOFFSETOF(VMMDevDisplayChangeRequestMulti, aDisplays[0]);
1774 case VMMDevReq_VideoModeSupported:
1775 return sizeof(VMMDevVideoModeSupportedRequest);
1776 case VMMDevReq_GetHeightReduction:
1777 return sizeof(VMMDevGetHeightReductionRequest);
1778 case VMMDevReq_ReportGuestCapabilities:
1779 return sizeof(VMMDevReqGuestCapabilities);
1780 case VMMDevReq_SetGuestCapabilities:
1781 return sizeof(VMMDevReqGuestCapabilities2);
1782#ifdef VBOX_WITH_HGCM
1783 case VMMDevReq_HGCMConnect:
1784 return sizeof(VMMDevHGCMConnect);
1785 case VMMDevReq_HGCMDisconnect:
1786 return sizeof(VMMDevHGCMDisconnect);
1787#ifdef VBOX_WITH_64_BITS_GUESTS
1788 case VMMDevReq_HGCMCall32:
1789 return sizeof(VMMDevHGCMCall);
1790 case VMMDevReq_HGCMCall64:
1791 return sizeof(VMMDevHGCMCall);
1792#else
1793 case VMMDevReq_HGCMCall:
1794 return sizeof(VMMDevHGCMCall);
1795#endif /* VBOX_WITH_64_BITS_GUESTS */
1796 case VMMDevReq_HGCMCancel:
1797 return sizeof(VMMDevHGCMCancel);
1798#endif /* VBOX_WITH_HGCM */
1799 case VMMDevReq_VideoAccelEnable:
1800 return sizeof(VMMDevVideoAccelEnable);
1801 case VMMDevReq_VideoAccelFlush:
1802 return sizeof(VMMDevVideoAccelFlush);
1803 case VMMDevReq_VideoSetVisibleRegion:
1804 /* The original protocol didn't consider a guest with NO visible
1805 * windows */
1806 return sizeof(VMMDevVideoSetVisibleRegion) - sizeof(RTRECT);
1807 case VMMDevReq_GetSeamlessChangeRequest:
1808 return sizeof(VMMDevSeamlessChangeRequest);
1809 case VMMDevReq_QueryCredentials:
1810 return sizeof(VMMDevCredentials);
1811 case VMMDevReq_ReportGuestStats:
1812 return sizeof(VMMDevReportGuestStats);
1813 case VMMDevReq_GetMemBalloonChangeRequest:
1814 return sizeof(VMMDevGetMemBalloonChangeRequest);
1815 case VMMDevReq_GetStatisticsChangeRequest:
1816 return sizeof(VMMDevGetStatisticsChangeRequest);
1817 case VMMDevReq_ChangeMemBalloon:
1818 return sizeof(VMMDevChangeMemBalloon);
1819 case VMMDevReq_GetVRDPChangeRequest:
1820 return sizeof(VMMDevVRDPChangeRequest);
1821 case VMMDevReq_LogString:
1822 return sizeof(VMMDevReqLogString);
1823 case VMMDevReq_CtlGuestFilterMask:
1824 return sizeof(VMMDevCtlGuestFilterMask);
1825 case VMMDevReq_GetCpuHotPlugRequest:
1826 return sizeof(VMMDevGetCpuHotPlugRequest);
1827 case VMMDevReq_SetCpuHotPlugStatus:
1828 return sizeof(VMMDevCpuHotPlugStatusRequest);
1829 case VMMDevReq_RegisterSharedModule:
1830 return sizeof(VMMDevSharedModuleRegistrationRequest);
1831 case VMMDevReq_UnregisterSharedModule:
1832 return sizeof(VMMDevSharedModuleUnregistrationRequest);
1833 case VMMDevReq_CheckSharedModules:
1834 return sizeof(VMMDevSharedModuleCheckRequest);
1835 case VMMDevReq_GetPageSharingStatus:
1836 return sizeof(VMMDevPageSharingStatusRequest);
1837 case VMMDevReq_DebugIsPageShared:
1838 return sizeof(VMMDevPageIsSharedRequest);
1839 case VMMDevReq_GetSessionId:
1840 return sizeof(VMMDevReqSessionId);
1841 case VMMDevReq_HeartbeatConfigure:
1842 return sizeof(VMMDevReqHeartbeat);
1843 case VMMDevReq_GuestHeartbeat:
1844 return sizeof(VMMDevRequestHeader);
1845 default:
1846 break;
1847 }
1848
1849 return 0;
1850}
1851
1852
1853/**
1854 * Initializes a request structure.
1855 *
1856 * @returns VBox status code.
1857 * @param req The request structure to initialize.
1858 * @param type The request type.
1859 */
1860DECLINLINE(int) vmmdevInitRequest(VMMDevRequestHeader *req, VMMDevRequestType type)
1861{
1862 uint32_t requestSize;
1863 if (!req)
1864 return VERR_INVALID_PARAMETER;
1865 requestSize = (uint32_t)vmmdevGetRequestSize(type);
1866 if (!requestSize)
1867 return VERR_INVALID_PARAMETER;
1868 req->size = requestSize;
1869 req->version = VMMDEV_REQUEST_HEADER_VERSION;
1870 req->requestType = type;
1871 req->rc = VERR_GENERAL_FAILURE;
1872 req->reserved1 = 0;
1873 req->fRequestor = 0;
1874 return VINF_SUCCESS;
1875}
1876
1877/** @} */
1878
1879/** @name VBVA ring defines.
1880 *
1881 * The VBVA ring buffer is suitable for transferring large (< 2GB) amount of
1882 * data. For example big bitmaps which do not fit to the buffer.
1883 *
1884 * Guest starts writing to the buffer by initializing a record entry in the
1885 * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
1886 * written. As data is written to the ring buffer, the guest increases off32End
1887 * for the record.
1888 *
1889 * The host reads the aRecords on flushes and processes all completed records.
1890 * When host encounters situation when only a partial record presents and
1891 * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE -
1892 * VBVA_RING_BUFFER_THRESHOLD, the host fetched all record data and updates
1893 * off32Head. After that on each flush the host continues fetching the data
1894 * until the record is completed.
1895 *
1896 */
1897#define VMMDEV_VBVA_RING_BUFFER_SIZE (_4M - _1K)
1898#define VMMDEV_VBVA_RING_BUFFER_THRESHOLD (4 * _1K)
1899
1900#define VMMDEV_VBVA_MAX_RECORDS (64)
1901/** @} */
1902
1903/**
1904 * VBVA record.
1905 */
1906typedef struct VMMDEVVBVARECORD
1907{
1908 /** The length of the record. Changed by guest. */
1909 uint32_t cbRecord;
1910} VMMDEVVBVARECORD;
1911AssertCompileSize(VMMDEVVBVARECORD, 4);
1912
1913#if ARCH_BITS >= 32
1914
1915/**
1916 * VBVA memory layout.
1917 *
1918 * This is a subsection of the VMMDevMemory structure.
1919 */
1920typedef struct VBVAMEMORY
1921{
1922 /** VBVA_F_MODE_*. */
1923 uint32_t fu32ModeFlags;
1924
1925 /** The offset where the data start in the buffer. */
1926 uint32_t off32Data;
1927 /** The offset where next data must be placed in the buffer. */
1928 uint32_t off32Free;
1929
1930 /** The ring buffer for data. */
1931 uint8_t au8RingBuffer[VMMDEV_VBVA_RING_BUFFER_SIZE];
1932
1933 /** The queue of record descriptions. */
1934 VMMDEVVBVARECORD aRecords[VMMDEV_VBVA_MAX_RECORDS];
1935 uint32_t indexRecordFirst;
1936 uint32_t indexRecordFree;
1937
1938 /** RDP orders supported by the client. The guest reports only them
1939 * and falls back to DIRTY rects for not supported ones.
1940 *
1941 * (1 << VBVA_VRDP_*)
1942 */
1943 uint32_t fu32SupportedOrders;
1944
1945} VBVAMEMORY;
1946AssertCompileSize(VBVAMEMORY, 12 + (_4M-_1K) + 4*64 + 12);
1947
1948
1949/**
1950 * The layout of VMMDEV RAM region that contains information for guest.
1951 */
1952typedef struct VMMDevMemory
1953{
1954 /** The size of this structure. */
1955 uint32_t u32Size;
1956 /** The structure version. (VMMDEV_MEMORY_VERSION) */
1957 uint32_t u32Version;
1958
1959 union
1960 {
1961 struct
1962 {
1963 /** Flag telling that VMMDev set the IRQ and acknowlegment is required */
1964 bool fHaveEvents;
1965 } V1_04;
1966
1967 struct
1968 {
1969 /** Pending events flags, set by host. */
1970 uint32_t u32HostEvents;
1971 /** Mask of events the guest wants to see, set by guest. */
1972 uint32_t u32GuestEventMask;
1973 } V1_03;
1974 } V;
1975
1976 VBVAMEMORY vbvaMemory;
1977
1978} VMMDevMemory;
1979AssertCompileSize(VMMDevMemory, 8+8 + (12 + (_4M-_1K) + 4*64 + 12) );
1980AssertCompileMemberOffset(VMMDevMemory, vbvaMemory, 16);
1981
1982/** Version of VMMDevMemory structure (VMMDevMemory::u32Version). */
1983# define VMMDEV_MEMORY_VERSION (1)
1984
1985#endif /* ARCH_BITS >= 32 */
1986
1987/** @} */
1988
1989RT_C_DECLS_END
1990#pragma pack()
1991
1992#endif
1993
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