VirtualBox

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

Last change on this file since 72594 was 72352, checked in by vboxsync, 7 years ago

Main, VMMDev: implemented IDisplay::SetScreenLayout, VMMDev multimonitor resize request and VBoxManage controlvm setscreenlayout. bugref:8393

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

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