VirtualBox

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

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

VMMDev: Simplify VMMDevReq_HGCMCall,VMMDevReq_HGCMCall32, and VMMDevReq_HGCMCall64 definitions. bugref:9172

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