VirtualBox

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

Last change on this file was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

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

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