VirtualBox

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

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

VMMDev,HGCM: Give access to VMMDevRequestHeader::fRequestor. [adjustments] bugref:9105

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette