VirtualBox

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

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

VMMDev.h: Corrected the VMMDEV_REQUESTOR_CON_MASK value and docs (harmless). Copy&past bug. Thanks to Hans de Goede for noticing and pointing this out. bugref:9105

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