VirtualBox

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

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

Main/Frontends: Also use facilities for guest features (seamless, graphics), added facility-state-to-name to VBoxManage, some renaming.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 59.4 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 = 1001,
682 VBoxGuestFacilityType_All = 0xfffffffe,
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 * Guest status structure.
709 *
710 * Used by VMMDevReqGuestStatus.
711 */
712typedef struct VBoxGuestStatus
713{
714 /** Facility the status is indicated for. */
715 VBoxGuestFacilityType facility;
716 /** Current guest status. */
717 VBoxGuestFacilityStatus status;
718 /** Flags, not used at the moment. */
719 uint32_t flags;
720} VBoxGuestStatus;
721AssertCompileSize(VBoxGuestStatus, 12);
722
723/**
724 * Guest Additions status structure.
725 *
726 * Used by VMMDevReq_ReportGuestStatus.
727 */
728typedef struct
729{
730 /** Header. */
731 VMMDevRequestHeader header;
732 /** Guest information. */
733 VBoxGuestStatus guestStatus;
734} VMMDevReportGuestStatus;
735AssertCompileSize(VMMDevReportGuestStatus, 24+12);
736
737
738/**
739 * Guest statistics structure.
740 *
741 * Used by VMMDevReportGuestStats and PDMIVMMDEVCONNECTOR::pfnReportStatistics.
742 */
743typedef struct VBoxGuestStatistics
744{
745 /** Virtual CPU ID. */
746 uint32_t u32CpuId;
747 /** Reported statistics. */
748 uint32_t u32StatCaps;
749 /** Idle CPU load (0-100) for last interval. */
750 uint32_t u32CpuLoad_Idle;
751 /** Kernel CPU load (0-100) for last interval. */
752 uint32_t u32CpuLoad_Kernel;
753 /** User CPU load (0-100) for last interval. */
754 uint32_t u32CpuLoad_User;
755 /** Nr of threads. */
756 uint32_t u32Threads;
757 /** Nr of processes. */
758 uint32_t u32Processes;
759 /** Nr of handles. */
760 uint32_t u32Handles;
761 /** Memory load (0-100). */
762 uint32_t u32MemoryLoad;
763 /** Page size of guest system. */
764 uint32_t u32PageSize;
765 /** Total physical memory (in 4KB pages). */
766 uint32_t u32PhysMemTotal;
767 /** Available physical memory (in 4KB pages). */
768 uint32_t u32PhysMemAvail;
769 /** Ballooned physical memory (in 4KB pages). */
770 uint32_t u32PhysMemBalloon;
771 /** Total number of committed memory (which is not necessarily in-use) (in 4KB pages). */
772 uint32_t u32MemCommitTotal;
773 /** Total amount of memory used by the kernel (in 4KB pages). */
774 uint32_t u32MemKernelTotal;
775 /** Total amount of paged memory used by the kernel (in 4KB pages). */
776 uint32_t u32MemKernelPaged;
777 /** Total amount of nonpaged memory used by the kernel (in 4KB pages). */
778 uint32_t u32MemKernelNonPaged;
779 /** Total amount of memory used for the system cache (in 4KB pages). */
780 uint32_t u32MemSystemCache;
781 /** Pagefile size (in 4KB pages). */
782 uint32_t u32PageFileSize;
783} VBoxGuestStatistics;
784AssertCompileSize(VBoxGuestStatistics, 19*4);
785
786/** @name Guest statistics values (VBoxGuestStatistics::u32StatCaps).
787 * @{ */
788#define VBOX_GUEST_STAT_CPU_LOAD_IDLE RT_BIT(0)
789#define VBOX_GUEST_STAT_CPU_LOAD_KERNEL RT_BIT(1)
790#define VBOX_GUEST_STAT_CPU_LOAD_USER RT_BIT(2)
791#define VBOX_GUEST_STAT_THREADS RT_BIT(3)
792#define VBOX_GUEST_STAT_PROCESSES RT_BIT(4)
793#define VBOX_GUEST_STAT_HANDLES RT_BIT(5)
794#define VBOX_GUEST_STAT_MEMORY_LOAD RT_BIT(6)
795#define VBOX_GUEST_STAT_PHYS_MEM_TOTAL RT_BIT(7)
796#define VBOX_GUEST_STAT_PHYS_MEM_AVAIL RT_BIT(8)
797#define VBOX_GUEST_STAT_PHYS_MEM_BALLOON RT_BIT(9)
798#define VBOX_GUEST_STAT_MEM_COMMIT_TOTAL RT_BIT(10)
799#define VBOX_GUEST_STAT_MEM_KERNEL_TOTAL RT_BIT(11)
800#define VBOX_GUEST_STAT_MEM_KERNEL_PAGED RT_BIT(12)
801#define VBOX_GUEST_STAT_MEM_KERNEL_NONPAGED RT_BIT(13)
802#define VBOX_GUEST_STAT_MEM_SYSTEM_CACHE RT_BIT(14)
803#define VBOX_GUEST_STAT_PAGE_FILE_SIZE RT_BIT(15)
804/** @} */
805
806/**
807 * Guest statistics command structure.
808 *
809 * Used by VMMDevReq_ReportGuestStats.
810 */
811typedef struct
812{
813 /** Header. */
814 VMMDevRequestHeader header;
815 /** Guest information. */
816 VBoxGuestStatistics guestStats;
817} VMMDevReportGuestStats;
818AssertCompileSize(VMMDevReportGuestStats, 24+19*4);
819
820
821/** Memory balloon change request structure. */
822#define VMMDEV_MAX_MEMORY_BALLOON(PhysMemTotal) ( (9 * (PhysMemTotal)) / 10 )
823
824/**
825 * Poll for ballooning change request.
826 *
827 * Used by VMMDevReq_GetMemBalloonChangeRequest.
828 */
829typedef struct
830{
831 /** Header. */
832 VMMDevRequestHeader header;
833 /** Balloon size in megabytes. */
834 uint32_t cBalloonChunks;
835 /** Guest ram size in megabytes. */
836 uint32_t cPhysMemChunks;
837 /** Setting this to VMMDEV_EVENT_BALLOON_CHANGE_REQUEST indicates that the
838 * request is a response to that event.
839 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
840 uint32_t eventAck;
841} VMMDevGetMemBalloonChangeRequest;
842AssertCompileSize(VMMDevGetMemBalloonChangeRequest, 24+12);
843
844
845/**
846 * Change the size of the balloon.
847 *
848 * Used by VMMDevReq_ChangeMemBalloon.
849 */
850typedef struct
851{
852 /** Header. */
853 VMMDevRequestHeader header;
854 /** The number of pages in the array. */
855 uint32_t cPages;
856 /** true = inflate, false = deflate. */
857 uint32_t fInflate;
858 /** Physical address (RTGCPHYS) of each page, variable size. */
859 RTGCPHYS aPhysPage[1];
860} VMMDevChangeMemBalloon;
861AssertCompileSize(VMMDevChangeMemBalloon, 24+16);
862
863/** @name The ballooning chunk size which VMMDev works at.
864 * @{ */
865#define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES (_1M/4096)
866#define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE (VMMDEV_MEMORY_BALLOON_CHUNK_PAGES*4096)
867/** @} */
868
869
870/**
871 * Guest statistics interval change request structure.
872 *
873 * Used by VMMDevReq_GetStatisticsChangeRequest.
874 */
875typedef struct
876{
877 /** Header. */
878 VMMDevRequestHeader header;
879 /** The interval in seconds. */
880 uint32_t u32StatInterval;
881 /** Setting this to VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST indicates
882 * that the request is a response to that event.
883 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
884 uint32_t eventAck;
885} VMMDevGetStatisticsChangeRequest;
886AssertCompileSize(VMMDevGetStatisticsChangeRequest, 24+8);
887
888
889/** The size of a string field in the credentials request (including '\\0').
890 * @see VMMDevCredentials */
891#define VMMDEV_CREDENTIALS_SZ_SIZE 128
892
893/**
894 * Credentials request structure.
895 *
896 * Used by VMMDevReq_QueryCredentials.
897 */
898#pragma pack(4)
899typedef struct
900{
901 /** Header. */
902 VMMDevRequestHeader header;
903 /** IN/OUT: Request flags. */
904 uint32_t u32Flags;
905 /** OUT: User name (UTF-8). */
906 char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
907 /** OUT: Password (UTF-8). */
908 char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
909 /** OUT: Domain name (UTF-8). */
910 char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
911} VMMDevCredentials;
912AssertCompileSize(VMMDevCredentials, 24+4+3*128);
913#pragma pack()
914
915/** @name Credentials request flag (VMMDevCredentials::u32Flags)
916 * @{ */
917/** query from host whether credentials are present */
918#define VMMDEV_CREDENTIALS_QUERYPRESENCE RT_BIT(1)
919/** read credentials from host (can be combined with clear) */
920#define VMMDEV_CREDENTIALS_READ RT_BIT(2)
921/** clear credentials on host (can be combined with read) */
922#define VMMDEV_CREDENTIALS_CLEAR RT_BIT(3)
923/** read credentials for judgement in the guest */
924#define VMMDEV_CREDENTIALS_READJUDGE RT_BIT(8)
925/** clear credentials for judegement on the host */
926#define VMMDEV_CREDENTIALS_CLEARJUDGE RT_BIT(9)
927/** report credentials acceptance by guest */
928#define VMMDEV_CREDENTIALS_JUDGE_OK RT_BIT(10)
929/** report credentials denial by guest */
930#define VMMDEV_CREDENTIALS_JUDGE_DENY RT_BIT(11)
931/** report that no judgement could be made by guest */
932#define VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT RT_BIT(12)
933
934/** flag telling the guest that credentials are present */
935#define VMMDEV_CREDENTIALS_PRESENT RT_BIT(16)
936/** flag telling guest that local logons should be prohibited */
937#define VMMDEV_CREDENTIALS_NOLOCALLOGON RT_BIT(17)
938/** @} */
939
940
941/**
942 * Seamless mode change request structure.
943 *
944 * Used by VMMDevReq_GetSeamlessChangeRequest.
945 */
946typedef struct
947{
948 /** Header. */
949 VMMDevRequestHeader header;
950
951 /** New seamless mode. */
952 VMMDevSeamlessMode mode;
953 /** Setting this to VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST indicates
954 * that the request is a response to that event.
955 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
956 uint32_t eventAck;
957} VMMDevSeamlessChangeRequest;
958AssertCompileSize(VMMDevSeamlessChangeRequest, 24+8);
959AssertCompileMemberOffset(VMMDevSeamlessChangeRequest, eventAck, 24+4);
960
961
962/**
963 * Display change request structure.
964 *
965 * Used by VMMDevReq_GetDisplayChangeRequest.
966 */
967typedef struct
968{
969 /** Header. */
970 VMMDevRequestHeader header;
971 /** Horizontal pixel resolution (0 = do not change). */
972 uint32_t xres;
973 /** Vertical pixel resolution (0 = do not change). */
974 uint32_t yres;
975 /** Bits per pixel (0 = do not change). */
976 uint32_t bpp;
977 /** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
978 * that the request is a response to that event.
979 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
980 uint32_t eventAck;
981} VMMDevDisplayChangeRequest;
982AssertCompileSize(VMMDevDisplayChangeRequest, 24+16);
983
984
985/**
986 * Display change request structure, version 2.
987 *
988 * Used by VMMDevReq_GetDisplayChangeRequest2.
989 */
990typedef struct
991{
992 /** Header. */
993 VMMDevRequestHeader header;
994 /** Horizontal pixel resolution (0 = do not change). */
995 uint32_t xres;
996 /** Vertical pixel resolution (0 = do not change). */
997 uint32_t yres;
998 /** Bits per pixel (0 = do not change). */
999 uint32_t bpp;
1000 /** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
1001 * that the request is a response to that event.
1002 * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
1003 uint32_t eventAck;
1004 /** 0 for primary display, 1 for the first secondary, etc. */
1005 uint32_t display;
1006} VMMDevDisplayChangeRequest2;
1007AssertCompileSize(VMMDevDisplayChangeRequest2, 24+20);
1008
1009
1010/**
1011 * Video mode supported request structure.
1012 *
1013 * Used by VMMDevReq_VideoModeSupported.
1014 */
1015typedef struct
1016{
1017 /** Header. */
1018 VMMDevRequestHeader header;
1019 /** IN: Horizontal pixel resolution. */
1020 uint32_t width;
1021 /** IN: Vertical pixel resolution. */
1022 uint32_t height;
1023 /** IN: Bits per pixel. */
1024 uint32_t bpp;
1025 /** OUT: Support indicator. */
1026 bool fSupported;
1027} VMMDevVideoModeSupportedRequest;
1028AssertCompileSize(VMMDevVideoModeSupportedRequest, 24+16);
1029
1030/**
1031 * Video mode supported request structure for a specific display.
1032 *
1033 * Used by VMMDevReq_VideoModeSupported2.
1034 */
1035typedef struct
1036{
1037 /** Header. */
1038 VMMDevRequestHeader header;
1039 /** IN: The guest display number. */
1040 uint32_t display;
1041 /** IN: Horizontal pixel resolution. */
1042 uint32_t width;
1043 /** IN: Vertical pixel resolution. */
1044 uint32_t height;
1045 /** IN: Bits per pixel. */
1046 uint32_t bpp;
1047 /** OUT: Support indicator. */
1048 bool fSupported;
1049} VMMDevVideoModeSupportedRequest2;
1050AssertCompileSize(VMMDevVideoModeSupportedRequest2, 24+20);
1051
1052/**
1053 * Video modes height reduction request structure.
1054 *
1055 * Used by VMMDevReq_GetHeightReduction.
1056 */
1057typedef struct
1058{
1059 /** Header. */
1060 VMMDevRequestHeader header;
1061 /** OUT: Height reduction in pixels. */
1062 uint32_t heightReduction;
1063} VMMDevGetHeightReductionRequest;
1064AssertCompileSize(VMMDevGetHeightReductionRequest, 24+4);
1065
1066
1067/**
1068 * VRDP change request structure.
1069 *
1070 * Used by VMMDevReq_GetVRDPChangeRequest.
1071 */
1072typedef struct
1073{
1074 /** Header */
1075 VMMDevRequestHeader header;
1076 /** Whether VRDP is active or not. */
1077 uint8_t u8VRDPActive;
1078 /** The configured experience level for active VRDP. */
1079 uint32_t u32VRDPExperienceLevel;
1080} VMMDevVRDPChangeRequest;
1081AssertCompileSize(VMMDevVRDPChangeRequest, 24+8);
1082AssertCompileMemberOffset(VMMDevVRDPChangeRequest, u8VRDPActive, 24);
1083AssertCompileMemberOffset(VMMDevVRDPChangeRequest, u32VRDPExperienceLevel, 24+4);
1084
1085/** @name VRDP Experience level (VMMDevVRDPChangeRequest::u32VRDPExperienceLevel)
1086 * @{ */
1087#define VRDP_EXPERIENCE_LEVEL_ZERO 0 /**< Theming disabled. */
1088#define VRDP_EXPERIENCE_LEVEL_LOW 1 /**< Full window dragging and desktop wallpaper disabled. */
1089#define VRDP_EXPERIENCE_LEVEL_MEDIUM 2 /**< Font smoothing, gradients. */
1090#define VRDP_EXPERIENCE_LEVEL_HIGH 3 /**< Animation effects disabled. */
1091#define VRDP_EXPERIENCE_LEVEL_FULL 4 /**< Everything enabled. */
1092/** @} */
1093
1094
1095/**
1096 * VBVA enable request structure.
1097 *
1098 * Used by VMMDevReq_VideoAccelEnable.
1099 */
1100typedef struct
1101{
1102 /** Header. */
1103 VMMDevRequestHeader header;
1104 /** 0 - disable, !0 - enable. */
1105 uint32_t u32Enable;
1106 /** The size of VBVAMEMORY::au8RingBuffer expected by driver.
1107 * The host will refuse to enable VBVA if the size is not equal to
1108 * VBVA_RING_BUFFER_SIZE.
1109 */
1110 uint32_t cbRingBuffer;
1111 /** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
1112 uint32_t fu32Status;
1113} VMMDevVideoAccelEnable;
1114AssertCompileSize(VMMDevVideoAccelEnable, 24+12);
1115
1116/** @name VMMDevVideoAccelEnable::fu32Status.
1117 * @{ */
1118#define VBVA_F_STATUS_ACCEPTED (0x01)
1119#define VBVA_F_STATUS_ENABLED (0x02)
1120/** @} */
1121
1122
1123/**
1124 * VBVA flush request structure.
1125 *
1126 * Used by VMMDevReq_VideoAccelFlush.
1127 */
1128typedef struct
1129{
1130 /** Header. */
1131 VMMDevRequestHeader header;
1132} VMMDevVideoAccelFlush;
1133AssertCompileSize(VMMDevVideoAccelFlush, 24);
1134
1135
1136/**
1137 * VBVA set visible region request structure.
1138 *
1139 * Used by VMMDevReq_VideoSetVisibleRegion.
1140 */
1141typedef struct
1142{
1143 /** Header. */
1144 VMMDevRequestHeader header;
1145 /** Number of rectangles */
1146 uint32_t cRect;
1147 /** Rectangle array.
1148 * @todo array is spelled aRects[1]. */
1149 RTRECT Rect;
1150} VMMDevVideoSetVisibleRegion;
1151AssertCompileSize(RTRECT, 16);
1152AssertCompileSize(VMMDevVideoSetVisibleRegion, 24+4+16);
1153
1154/**
1155 * CPU event types.
1156 */
1157typedef enum
1158{
1159 VMMDevCpuStatusType_Invalid = 0,
1160 VMMDevCpuStatusType_Disable = 1,
1161 VMMDevCpuStatusType_Enable = 2,
1162 VMMDevCpuStatusType_SizeHack = 0x7fffffff
1163} VMMDevCpuStatusType;
1164
1165/**
1166 * CPU hotplug event status request.
1167 */
1168typedef struct
1169{
1170 /** Header. */
1171 VMMDevRequestHeader header;
1172 /** Status type */
1173 VMMDevCpuStatusType enmStatusType;
1174} VMMDevCpuHotPlugStatusRequest;
1175AssertCompileSize(VMMDevCpuHotPlugStatusRequest, 24+4);
1176
1177/**
1178 * Get the ID of the changed CPU and event type.
1179 */
1180typedef struct
1181{
1182 /** Header. */
1183 VMMDevRequestHeader header;
1184 /** Event type */
1185 VMMDevCpuEventType enmEventType;
1186 /** core id of the CPU changed */
1187 uint32_t idCpuCore;
1188 /** package id of the CPU changed */
1189 uint32_t idCpuPackage;
1190} VMMDevGetCpuHotPlugRequest;
1191AssertCompileSize(VMMDevGetCpuHotPlugRequest, 24+4+4+4);
1192
1193
1194/**
1195 * Shared region description
1196 */
1197typedef struct
1198{
1199 RTGCPTR64 GCRegionAddr;
1200 uint32_t cbRegion;
1201 uint32_t u32Alignment;
1202} VMMDEVSHAREDREGIONDESC;
1203AssertCompileSize(VMMDEVSHAREDREGIONDESC, 16);
1204
1205#define VMMDEVSHAREDREGIONDESC_MAX 32
1206
1207/**
1208 * Shared module registration
1209 */
1210typedef struct
1211{
1212 /** Header. */
1213 VMMDevRequestHeader header;
1214 /** Shared module size. */
1215 uint32_t cbModule;
1216 /** Number of included region descriptors */
1217 uint32_t cRegions;
1218 /** Base address of the shared module. */
1219 RTGCPTR64 GCBaseAddr;
1220 /** Guest OS type. */
1221 VBOXOSFAMILY enmGuestOS;
1222 /** Alignment. */
1223 uint32_t u32Align;
1224 /** Module name */
1225 char szName[128];
1226 /** Module version */
1227 char szVersion[16];
1228 /** Shared region descriptor(s). */
1229 VMMDEVSHAREDREGIONDESC aRegions[1];
1230} VMMDevSharedModuleRegistrationRequest;
1231AssertCompileSize(VMMDevSharedModuleRegistrationRequest, 24+4+4+8+4+4+128+16+16);
1232
1233
1234/**
1235 * Shared module unregistration
1236 */
1237typedef struct
1238{
1239 /** Header. */
1240 VMMDevRequestHeader header;
1241 /** Shared module size. */
1242 uint32_t cbModule;
1243 /** Align at 8 byte boundary. */
1244 uint32_t u32Alignment;
1245 /** Base address of the shared module. */
1246 RTGCPTR64 GCBaseAddr;
1247 /** Module name */
1248 char szName[128];
1249 /** Module version */
1250 char szVersion[16];
1251} VMMDevSharedModuleUnregistrationRequest;
1252AssertCompileSize(VMMDevSharedModuleUnregistrationRequest, 24+4+4+8+128+16);
1253
1254
1255/**
1256 * Shared module periodic check
1257 */
1258typedef struct
1259{
1260 /** Header. */
1261 VMMDevRequestHeader header;
1262} VMMDevSharedModuleCheckRequest;
1263AssertCompileSize(VMMDevSharedModuleCheckRequest, 24);
1264
1265/**
1266 * Paging sharing enabled query
1267 */
1268typedef struct
1269{
1270 /** Header. */
1271 VMMDevRequestHeader header;
1272 /** Enabled flag (out) */
1273 bool fEnabled;
1274 /** Alignment */
1275 bool fAlignment[3];
1276} VMMDevPageSharingStatusRequest;
1277AssertCompileSize(VMMDevPageSharingStatusRequest, 24+4);
1278
1279
1280/**
1281 * Page sharing status query (debug build only)
1282 */
1283typedef struct
1284{
1285 /** Header. */
1286 VMMDevRequestHeader header;
1287 /** Page address. */
1288 RTGCPTR GCPtrPage;
1289 /** Page flags. */
1290 uint64_t uPageFlags;
1291 /** Shared flag (out) */
1292 bool fShared;
1293 /** Alignment */
1294 bool fAlignment[3];
1295} VMMDevPageIsSharedRequest;
1296
1297/**
1298 * Session id request structure.
1299 *
1300 * Used by VMMDevReq_GetSessionId.
1301 */
1302typedef struct
1303{
1304 /** Header */
1305 VMMDevRequestHeader header;
1306 /** OUT: unique session id; the id will be different after each start, reset or restore of the VM */
1307 uint64_t idSession;
1308} VMMDevReqSessionId;
1309AssertCompileSize(VMMDevReqSessionId, 24+8);
1310
1311
1312/**
1313 * Write Core Dump request.
1314 *
1315 * Used by VMMDevReq_WriteCoreDump.
1316 */
1317typedef struct
1318{
1319 /** Header. */
1320 VMMDevRequestHeader header;
1321 /** Flags (reserved, MBZ). */
1322 uint32_t fFlags;
1323} VMMDevReqWriteCoreDump;
1324AssertCompileSize(VMMDevReqWriteCoreDump, 24+4);
1325
1326
1327#pragma pack()
1328
1329
1330#ifdef VBOX_WITH_HGCM
1331
1332/** @name HGCM flags.
1333 * @{
1334 */
1335# define VBOX_HGCM_REQ_DONE RT_BIT_32(VBOX_HGCM_REQ_DONE_BIT)
1336# define VBOX_HGCM_REQ_DONE_BIT 0
1337# define VBOX_HGCM_REQ_CANCELLED (0x2)
1338/** @} */
1339
1340# pragma pack(4)
1341
1342/**
1343 * HGCM request header.
1344 */
1345typedef struct VMMDevHGCMRequestHeader
1346{
1347 /** Request header. */
1348 VMMDevRequestHeader header;
1349
1350 /** HGCM flags. */
1351 uint32_t fu32Flags;
1352
1353 /** Result code. */
1354 int32_t result;
1355} VMMDevHGCMRequestHeader;
1356AssertCompileSize(VMMDevHGCMRequestHeader, 24+8);
1357
1358/**
1359 * HGCM connect request structure.
1360 *
1361 * Used by VMMDevReq_HGCMConnect.
1362 */
1363typedef struct
1364{
1365 /** HGCM request header. */
1366 VMMDevHGCMRequestHeader header;
1367
1368 /** IN: Description of service to connect to. */
1369 HGCMServiceLocation loc;
1370
1371 /** OUT: Client identifier assigned by local instance of HGCM. */
1372 uint32_t u32ClientID;
1373} VMMDevHGCMConnect;
1374AssertCompileSize(VMMDevHGCMConnect, 32+132+4);
1375
1376
1377/**
1378 * HGCM disconnect request structure.
1379 *
1380 * Used by VMMDevReq_HGCMDisconnect.
1381 */
1382typedef struct
1383{
1384 /** HGCM request header. */
1385 VMMDevHGCMRequestHeader header;
1386
1387 /** IN: Client identifier. */
1388 uint32_t u32ClientID;
1389} VMMDevHGCMDisconnect;
1390AssertCompileSize(VMMDevHGCMDisconnect, 32+4);
1391
1392/**
1393 * HGCM parameter type.
1394 */
1395typedef enum
1396{
1397 VMMDevHGCMParmType_Invalid = 0,
1398 VMMDevHGCMParmType_32bit = 1,
1399 VMMDevHGCMParmType_64bit = 2,
1400 VMMDevHGCMParmType_PhysAddr = 3, /**< @deprecated Doesn't work, use PageList. */
1401 VMMDevHGCMParmType_LinAddr = 4, /**< In and Out */
1402 VMMDevHGCMParmType_LinAddr_In = 5, /**< In (read; host<-guest) */
1403 VMMDevHGCMParmType_LinAddr_Out = 6, /**< Out (write; host->guest) */
1404 VMMDevHGCMParmType_LinAddr_Locked = 7, /**< Locked In and Out */
1405 VMMDevHGCMParmType_LinAddr_Locked_In = 8, /**< Locked In (read; host<-guest) */
1406 VMMDevHGCMParmType_LinAddr_Locked_Out = 9, /**< Locked Out (write; host->guest) */
1407 VMMDevHGCMParmType_PageList = 10, /**< Physical addresses of locked pages for a buffer. */
1408 VMMDevHGCMParmType_SizeHack = 0x7fffffff
1409} HGCMFunctionParameterType;
1410AssertCompileSize(HGCMFunctionParameterType, 4);
1411
1412# ifdef VBOX_WITH_64_BITS_GUESTS
1413/**
1414 * HGCM function parameter, 32-bit client.
1415 */
1416typedef struct
1417{
1418 HGCMFunctionParameterType type;
1419 union
1420 {
1421 uint32_t value32;
1422 uint64_t value64;
1423 struct
1424 {
1425 uint32_t size;
1426
1427 union
1428 {
1429 RTGCPHYS32 physAddr;
1430 RTGCPTR32 linearAddr;
1431 } u;
1432 } Pointer;
1433 struct
1434 {
1435 uint32_t size; /**< Size of the buffer described by the page list. */
1436 uint32_t offset; /**< Relative to the request header, valid if size != 0. */
1437 } PageList;
1438 } u;
1439# ifdef __cplusplus
1440 void SetUInt32(uint32_t u32)
1441 {
1442 type = VMMDevHGCMParmType_32bit;
1443 u.value64 = 0; /* init unused bits to 0 */
1444 u.value32 = u32;
1445 }
1446
1447 int GetUInt32(uint32_t *pu32)
1448 {
1449 if (type == VMMDevHGCMParmType_32bit)
1450 {
1451 *pu32 = u.value32;
1452 return VINF_SUCCESS;
1453 }
1454 return VERR_INVALID_PARAMETER;
1455 }
1456
1457 void SetUInt64(uint64_t u64)
1458 {
1459 type = VMMDevHGCMParmType_64bit;
1460 u.value64 = u64;
1461 }
1462
1463 int GetUInt64(uint64_t *pu64)
1464 {
1465 if (type == VMMDevHGCMParmType_64bit)
1466 {
1467 *pu64 = u.value64;
1468 return VINF_SUCCESS;
1469 }
1470 return VERR_INVALID_PARAMETER;
1471 }
1472
1473 void SetPtr(void *pv, uint32_t cb)
1474 {
1475 type = VMMDevHGCMParmType_LinAddr;
1476 u.Pointer.size = cb;
1477 u.Pointer.u.linearAddr = (RTGCPTR32)(uintptr_t)pv;
1478 }
1479# endif /* __cplusplus */
1480} HGCMFunctionParameter32;
1481AssertCompileSize(HGCMFunctionParameter32, 4+8);
1482
1483/**
1484 * HGCM function parameter, 64-bit client.
1485 */
1486typedef struct
1487{
1488 HGCMFunctionParameterType type;
1489 union
1490 {
1491 uint32_t value32;
1492 uint64_t value64;
1493 struct
1494 {
1495 uint32_t size;
1496
1497 union
1498 {
1499 RTGCPHYS64 physAddr;
1500 RTGCPTR64 linearAddr;
1501 } u;
1502 } Pointer;
1503 struct
1504 {
1505 uint32_t size; /**< Size of the buffer described by the page list. */
1506 uint32_t offset; /**< Relative to the request header, valid if size != 0. */
1507 } PageList;
1508 } u;
1509# ifdef __cplusplus
1510 void SetUInt32(uint32_t u32)
1511 {
1512 type = VMMDevHGCMParmType_32bit;
1513 u.value64 = 0; /* init unused bits to 0 */
1514 u.value32 = u32;
1515 }
1516
1517 int GetUInt32(uint32_t *pu32)
1518 {
1519 if (type == VMMDevHGCMParmType_32bit)
1520 {
1521 *pu32 = u.value32;
1522 return VINF_SUCCESS;
1523 }
1524 return VERR_INVALID_PARAMETER;
1525 }
1526
1527 void SetUInt64(uint64_t u64)
1528 {
1529 type = VMMDevHGCMParmType_64bit;
1530 u.value64 = u64;
1531 }
1532
1533 int GetUInt64(uint64_t *pu64)
1534 {
1535 if (type == VMMDevHGCMParmType_64bit)
1536 {
1537 *pu64 = u.value64;
1538 return VINF_SUCCESS;
1539 }
1540 return VERR_INVALID_PARAMETER;
1541 }
1542
1543 void SetPtr(void *pv, uint32_t cb)
1544 {
1545 type = VMMDevHGCMParmType_LinAddr;
1546 u.Pointer.size = cb;
1547 u.Pointer.u.linearAddr = (uintptr_t)pv;
1548 }
1549# endif /** __cplusplus */
1550} HGCMFunctionParameter64;
1551AssertCompileSize(HGCMFunctionParameter64, 4+12);
1552
1553/* Redefine the structure type for the guest code. */
1554# ifndef VBOX_HGCM_HOST_CODE
1555# if ARCH_BITS == 64
1556# define HGCMFunctionParameter HGCMFunctionParameter64
1557# elif ARCH_BITS == 32
1558# define HGCMFunctionParameter HGCMFunctionParameter32
1559# else
1560# error "Unsupported sizeof (void *)"
1561# endif
1562# endif /* !VBOX_HGCM_HOST_CODE */
1563
1564# else /* !VBOX_WITH_64_BITS_GUESTS */
1565
1566/**
1567 * HGCM function parameter, 32-bit client.
1568 *
1569 * @todo If this is the same as HGCMFunctionParameter32, why the duplication?
1570 */
1571typedef struct
1572{
1573 HGCMFunctionParameterType type;
1574 union
1575 {
1576 uint32_t value32;
1577 uint64_t value64;
1578 struct
1579 {
1580 uint32_t size;
1581
1582 union
1583 {
1584 RTGCPHYS32 physAddr;
1585 RTGCPTR32 linearAddr;
1586 } u;
1587 } Pointer;
1588 struct
1589 {
1590 uint32_t size; /**< Size of the buffer described by the page list. */
1591 uint32_t offset; /**< Relative to the request header, valid if size != 0. */
1592 } PageList;
1593 } u;
1594# ifdef __cplusplus
1595 void SetUInt32(uint32_t u32)
1596 {
1597 type = VMMDevHGCMParmType_32bit;
1598 u.value64 = 0; /* init unused bits to 0 */
1599 u.value32 = u32;
1600 }
1601
1602 int GetUInt32(uint32_t *pu32)
1603 {
1604 if (type == VMMDevHGCMParmType_32bit)
1605 {
1606 *pu32 = u.value32;
1607 return VINF_SUCCESS;
1608 }
1609 return VERR_INVALID_PARAMETER;
1610 }
1611
1612 void SetUInt64(uint64_t u64)
1613 {
1614 type = VMMDevHGCMParmType_64bit;
1615 u.value64 = u64;
1616 }
1617
1618 int GetUInt64(uint64_t *pu64)
1619 {
1620 if (type == VMMDevHGCMParmType_64bit)
1621 {
1622 *pu64 = u.value64;
1623 return VINF_SUCCESS;
1624 }
1625 return VERR_INVALID_PARAMETER;
1626 }
1627
1628 void SetPtr(void *pv, uint32_t cb)
1629 {
1630 type = VMMDevHGCMParmType_LinAddr;
1631 u.Pointer.size = cb;
1632 u.Pointer.u.linearAddr = (uintptr_t)pv;
1633 }
1634# endif /* __cplusplus */
1635} HGCMFunctionParameter;
1636AssertCompileSize(HGCMFunctionParameter, 4+8);
1637# endif /* !VBOX_WITH_64_BITS_GUESTS */
1638
1639/**
1640 * HGCM call request structure.
1641 *
1642 * Used by VMMDevReq_HGCMCall, VMMDevReq_HGCMCall32 and VMMDevReq_HGCMCall64.
1643 */
1644typedef struct
1645{
1646 /* request header */
1647 VMMDevHGCMRequestHeader header;
1648
1649 /** IN: Client identifier. */
1650 uint32_t u32ClientID;
1651 /** IN: Service function number. */
1652 uint32_t u32Function;
1653 /** IN: Number of parameters. */
1654 uint32_t cParms;
1655 /** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
1656} VMMDevHGCMCall;
1657AssertCompileSize(VMMDevHGCMCall, 32+12);
1658
1659/** @name Direction of data transfer (HGCMPageListInfo::flags). Bit flags.
1660 * @{ */
1661#define VBOX_HGCM_F_PARM_DIRECTION_NONE UINT32_C(0x00000000)
1662#define VBOX_HGCM_F_PARM_DIRECTION_TO_HOST UINT32_C(0x00000001)
1663#define VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST UINT32_C(0x00000002)
1664#define VBOX_HGCM_F_PARM_DIRECTION_BOTH UINT32_C(0x00000003)
1665/** Macro for validating that the specified flags are valid. */
1666#define VBOX_HGCM_F_PARM_ARE_VALID(fFlags) \
1667 ( (fFlags) > VBOX_HGCM_F_PARM_DIRECTION_NONE \
1668 && (fFlags) < VBOX_HGCM_F_PARM_DIRECTION_BOTH )
1669/** @} */
1670
1671/**
1672 * VMMDevHGCMParmType_PageList points to this structure to actually describe the
1673 * buffer.
1674 */
1675typedef struct
1676{
1677 uint32_t flags; /**< VBOX_HGCM_F_PARM_*. */
1678 uint16_t offFirstPage; /**< Offset in the first page where data begins. */
1679 uint16_t cPages; /**< Number of pages. */
1680 RTGCPHYS64 aPages[1]; /**< Page addresses. */
1681} HGCMPageListInfo;
1682AssertCompileSize(HGCMPageListInfo, 4+2+2+8);
1683
1684# pragma pack()
1685
1686/** Get the pointer to the first parmater of a HGCM call request. */
1687# define VMMDEV_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1688/** Get the pointer to the first parmater of a 32-bit HGCM call request. */
1689# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1690
1691# ifdef VBOX_WITH_64_BITS_GUESTS
1692/* Explicit defines for the host code. */
1693# ifdef VBOX_HGCM_HOST_CODE
1694# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1695# define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
1696# endif /* VBOX_HGCM_HOST_CODE */
1697# endif /* VBOX_WITH_64_BITS_GUESTS */
1698
1699# define VBOX_HGCM_MAX_PARMS 32
1700
1701/**
1702 * HGCM cancel request structure.
1703 *
1704 * The Cancel request is issued using the same physical memory address as was
1705 * used for the corresponding initial HGCMCall.
1706 *
1707 * Used by VMMDevReq_HGCMCancel.
1708 */
1709typedef struct
1710{
1711 /** Header. */
1712 VMMDevHGCMRequestHeader header;
1713} VMMDevHGCMCancel;
1714AssertCompileSize(VMMDevHGCMCancel, 32);
1715
1716/**
1717 * HGCM cancel request structure, version 2.
1718 *
1719 * Used by VMMDevReq_HGCMCancel2.
1720 *
1721 * VINF_SUCCESS when cancelled.
1722 * VERR_NOT_FOUND if the specified request cannot be found.
1723 * VERR_INVALID_PARAMETER if the address is invalid valid.
1724 */
1725typedef struct
1726{
1727 /** Header. */
1728 VMMDevRequestHeader header;
1729 /** The physical address of the request to cancel. */
1730 RTGCPHYS32 physReqToCancel;
1731} VMMDevHGCMCancel2;
1732AssertCompileSize(VMMDevHGCMCancel2, 24+4);
1733
1734#endif /* VBOX_WITH_HGCM */
1735
1736
1737/**
1738 * Inline helper to determine the request size for the given operation.
1739 *
1740 * @returns Size.
1741 * @param requestType The VMMDev request type.
1742 */
1743DECLINLINE(size_t) vmmdevGetRequestSize(VMMDevRequestType requestType)
1744{
1745 switch (requestType)
1746 {
1747 case VMMDevReq_GetMouseStatus:
1748 case VMMDevReq_SetMouseStatus:
1749 return sizeof(VMMDevReqMouseStatus);
1750 case VMMDevReq_SetPointerShape:
1751 return sizeof(VMMDevReqMousePointer);
1752 case VMMDevReq_GetHostVersion:
1753 return sizeof(VMMDevReqHostVersion);
1754 case VMMDevReq_Idle:
1755 return sizeof(VMMDevReqIdle);
1756 case VMMDevReq_GetHostTime:
1757 return sizeof(VMMDevReqHostTime);
1758 case VMMDevReq_GetHypervisorInfo:
1759 case VMMDevReq_SetHypervisorInfo:
1760 return sizeof(VMMDevReqHypervisorInfo);
1761 case VMMDevReq_RegisterPatchMemory:
1762 case VMMDevReq_DeregisterPatchMemory:
1763 return sizeof(VMMDevReqPatchMemory);
1764 case VMMDevReq_SetPowerStatus:
1765 return sizeof(VMMDevPowerStateRequest);
1766 case VMMDevReq_AcknowledgeEvents:
1767 return sizeof(VMMDevEvents);
1768 case VMMDevReq_ReportGuestInfo:
1769 return sizeof(VMMDevReportGuestInfo);
1770 case VMMDevReq_ReportGuestInfo2:
1771 return sizeof(VMMDevReportGuestInfo2);
1772 case VMMDevReq_ReportGuestStatus:
1773 return sizeof(VMMDevReportGuestStatus);
1774 case VMMDevReq_GetDisplayChangeRequest:
1775 return sizeof(VMMDevDisplayChangeRequest);
1776 case VMMDevReq_GetDisplayChangeRequest2:
1777 return sizeof(VMMDevDisplayChangeRequest2);
1778 case VMMDevReq_VideoModeSupported:
1779 return sizeof(VMMDevVideoModeSupportedRequest);
1780 case VMMDevReq_GetHeightReduction:
1781 return sizeof(VMMDevGetHeightReductionRequest);
1782 case VMMDevReq_ReportGuestCapabilities:
1783 return sizeof(VMMDevReqGuestCapabilities);
1784 case VMMDevReq_SetGuestCapabilities:
1785 return sizeof(VMMDevReqGuestCapabilities2);
1786#ifdef VBOX_WITH_HGCM
1787 case VMMDevReq_HGCMConnect:
1788 return sizeof(VMMDevHGCMConnect);
1789 case VMMDevReq_HGCMDisconnect:
1790 return sizeof(VMMDevHGCMDisconnect);
1791#ifdef VBOX_WITH_64_BITS_GUESTS
1792 case VMMDevReq_HGCMCall32:
1793 return sizeof(VMMDevHGCMCall);
1794 case VMMDevReq_HGCMCall64:
1795 return sizeof(VMMDevHGCMCall);
1796#else
1797 case VMMDevReq_HGCMCall:
1798 return sizeof(VMMDevHGCMCall);
1799#endif /* VBOX_WITH_64_BITS_GUESTS */
1800 case VMMDevReq_HGCMCancel:
1801 return sizeof(VMMDevHGCMCancel);
1802#endif /* VBOX_WITH_HGCM */
1803 case VMMDevReq_VideoAccelEnable:
1804 return sizeof(VMMDevVideoAccelEnable);
1805 case VMMDevReq_VideoAccelFlush:
1806 return sizeof(VMMDevVideoAccelFlush);
1807 case VMMDevReq_VideoSetVisibleRegion:
1808 return sizeof(VMMDevVideoSetVisibleRegion);
1809 case VMMDevReq_GetSeamlessChangeRequest:
1810 return sizeof(VMMDevSeamlessChangeRequest);
1811 case VMMDevReq_QueryCredentials:
1812 return sizeof(VMMDevCredentials);
1813 case VMMDevReq_ReportGuestStats:
1814 return sizeof(VMMDevReportGuestStats);
1815 case VMMDevReq_GetMemBalloonChangeRequest:
1816 return sizeof(VMMDevGetMemBalloonChangeRequest);
1817 case VMMDevReq_GetStatisticsChangeRequest:
1818 return sizeof(VMMDevGetStatisticsChangeRequest);
1819 case VMMDevReq_ChangeMemBalloon:
1820 return sizeof(VMMDevChangeMemBalloon);
1821 case VMMDevReq_GetVRDPChangeRequest:
1822 return sizeof(VMMDevVRDPChangeRequest);
1823 case VMMDevReq_LogString:
1824 return sizeof(VMMDevReqLogString);
1825 case VMMDevReq_CtlGuestFilterMask:
1826 return sizeof(VMMDevCtlGuestFilterMask);
1827 case VMMDevReq_GetCpuHotPlugRequest:
1828 return sizeof(VMMDevGetCpuHotPlugRequest);
1829 case VMMDevReq_SetCpuHotPlugStatus:
1830 return sizeof(VMMDevCpuHotPlugStatusRequest);
1831 case VMMDevReq_RegisterSharedModule:
1832 return sizeof(VMMDevSharedModuleRegistrationRequest);
1833 case VMMDevReq_UnregisterSharedModule:
1834 return sizeof(VMMDevSharedModuleUnregistrationRequest);
1835 case VMMDevReq_CheckSharedModules:
1836 return sizeof(VMMDevSharedModuleCheckRequest);
1837 case VMMDevReq_GetPageSharingStatus:
1838 return sizeof(VMMDevPageSharingStatusRequest);
1839 case VMMDevReq_DebugIsPageShared:
1840 return sizeof(VMMDevPageIsSharedRequest);
1841 case VMMDevReq_GetSessionId:
1842 return sizeof(VMMDevReqSessionId);
1843 default:
1844 return 0;
1845 }
1846}
1847
1848
1849/**
1850 * Initializes a request structure.
1851 *
1852 * @returns VBox status code.
1853 * @param req The request structure to initialize.
1854 * @param type The request type.
1855 */
1856DECLINLINE(int) vmmdevInitRequest(VMMDevRequestHeader *req, VMMDevRequestType type)
1857{
1858 uint32_t requestSize;
1859 if (!req)
1860 return VERR_INVALID_PARAMETER;
1861 requestSize = (uint32_t)vmmdevGetRequestSize(type);
1862 if (!requestSize)
1863 return VERR_INVALID_PARAMETER;
1864 req->size = requestSize;
1865 req->version = VMMDEV_REQUEST_HEADER_VERSION;
1866 req->requestType = type;
1867 req->rc = VERR_GENERAL_FAILURE;
1868 req->reserved1 = 0;
1869 req->reserved2 = 0;
1870 return VINF_SUCCESS;
1871}
1872
1873/** @} */
1874
1875
1876/**
1877 * VBVA command header.
1878 *
1879 * @todo Where does this fit in?
1880 */
1881#pragma pack(1) /* unnecessary */
1882typedef struct VBVACMDHDR
1883{
1884 /** Coordinates of affected rectangle. */
1885 int16_t x;
1886 int16_t y;
1887 uint16_t w;
1888 uint16_t h;
1889} VBVACMDHDR;
1890#pragma pack()
1891
1892/** @name VBVA ring defines.
1893 *
1894 * The VBVA ring buffer is suitable for transferring large (< 2GB) amount of
1895 * data. For example big bitmaps which do not fit to the buffer.
1896 *
1897 * Guest starts writing to the buffer by initializing a record entry in the
1898 * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
1899 * written. As data is written to the ring buffer, the guest increases off32End
1900 * for the record.
1901 *
1902 * The host reads the aRecords on flushes and processes all completed records.
1903 * When host encounters situation when only a partial record presents and
1904 * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE -
1905 * VBVA_RING_BUFFER_THRESHOLD, the host fetched all record data and updates
1906 * off32Head. After that on each flush the host continues fetching the data
1907 * until the record is completed.
1908 *
1909 */
1910#define VBVA_RING_BUFFER_SIZE (_4M - _1K)
1911#define VBVA_RING_BUFFER_THRESHOLD (4 * _1K)
1912
1913#define VBVA_MAX_RECORDS (64)
1914
1915#define VBVA_F_MODE_ENABLED (0x00000001)
1916#define VBVA_F_MODE_VRDP (0x00000002)
1917#define VBVA_F_MODE_VRDP_RESET (0x00000004)
1918#define VBVA_F_MODE_VRDP_ORDER_MASK (0x00000008)
1919
1920#define VBVA_F_RECORD_PARTIAL (0x80000000)
1921/** @} */
1922
1923/**
1924 * VBVA record.
1925 */
1926typedef struct VBVARECORD
1927{
1928 /** The length of the record. Changed by guest. */
1929 uint32_t cbRecord;
1930} VBVARECORD;
1931AssertCompileSize(VBVARECORD, 4);
1932
1933
1934/**
1935 * VBVA memory layout.
1936 *
1937 * This is a subsection of the VMMDevMemory structure.
1938 */
1939#pragma pack(1) /* paranoia */
1940typedef struct VBVAMEMORY
1941{
1942 /** VBVA_F_MODE_*. */
1943 uint32_t fu32ModeFlags;
1944
1945 /** The offset where the data start in the buffer. */
1946 uint32_t off32Data;
1947 /** The offset where next data must be placed in the buffer. */
1948 uint32_t off32Free;
1949
1950 /** The ring buffer for data. */
1951 uint8_t au8RingBuffer[VBVA_RING_BUFFER_SIZE];
1952
1953 /** The queue of record descriptions. */
1954 VBVARECORD aRecords[VBVA_MAX_RECORDS];
1955 uint32_t indexRecordFirst;
1956 uint32_t indexRecordFree;
1957
1958 /** RDP orders supported by the client. The guest reports only them
1959 * and falls back to DIRTY rects for not supported ones.
1960 *
1961 * (1 << VBVA_VRDP_*)
1962 */
1963 uint32_t fu32SupportedOrders;
1964
1965} VBVAMEMORY;
1966#pragma pack()
1967AssertCompileSize(VBVAMEMORY, 12 + (_4M-_1K) + 4*64 + 12);
1968
1969
1970/**
1971 * The layout of VMMDEV RAM region that contains information for guest.
1972 */
1973#pragma pack(1) /* paranoia */
1974typedef struct VMMDevMemory
1975{
1976 /** The size of this structure. */
1977 uint32_t u32Size;
1978 /** The structure version. (VMMDEV_MEMORY_VERSION) */
1979 uint32_t u32Version;
1980
1981 union
1982 {
1983 struct
1984 {
1985 /** Flag telling that VMMDev set the IRQ and acknowlegment is required */
1986 bool fHaveEvents;
1987 } V1_04;
1988
1989 struct
1990 {
1991 /** Pending events flags, set by host. */
1992 uint32_t u32HostEvents;
1993 /** Mask of events the guest wants to see, set by guest. */
1994 uint32_t u32GuestEventMask;
1995 } V1_03;
1996 } V;
1997
1998 VBVAMEMORY vbvaMemory;
1999
2000} VMMDevMemory;
2001AssertCompileSize(VMMDevMemory, 8+8 + (12 + (_4M-_1K) + 4*64 + 12) );
2002#pragma pack()
2003
2004/** Version of VMMDevMemory structure (VMMDevMemory::u32Version). */
2005#define VMMDEV_MEMORY_VERSION (1)
2006
2007/** @} */
2008RT_C_DECLS_END
2009
2010#endif
2011
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