VirtualBox

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

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

VBoxGuest,VMMDev,DBGF,VM: Added bug check report to VBoxGuest/VMMDev and hooked it up to DBGF. Made DBGF remember the last reported bug check, adding an info handler for displaying it. Added VM reset counters w/ getters for use in bug check reporting.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use