VirtualBox

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

Last change on this file since 93115 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

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

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