VirtualBox

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

Last change on this file since 98140 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

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