VirtualBox

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

Last change on this file since 68630 was 68630, checked in by vboxsync, 8 years ago

Adding VBoxGuestCoreTypes.h for avoiding having to include VMMDev.h from VBoxGuestLib.h. Dropped a few unnecessary VMMDev.h includes here and there.

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

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