VirtualBox

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

Last change on this file since 76507 was 76507, checked in by vboxsync, 5 years ago

/include: scm --fix-header-guards. bugref:9344

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

© 2023 Oracle
ContactPrivacy policyTerms of Use