VirtualBox

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

Last change on this file since 70979 was 70873, checked in by vboxsync, 7 years ago

VMMDev,VBoxGuest: Classify who is calling the host (part 1). bugref:9105

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