VirtualBox

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

Last change on this file since 35967 was 35967, checked in by vboxsync, 14 years ago

Main/VBoxManage: Update on guest facilities, added IAdditionsFacility; now it's possible to iterate over known facilities (see VBoxManage showvminfo --details). Also, facilities now are grouped into several classes (AdditionsFacilityClass).

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