VirtualBox

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

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

Main/VMMDev: optionally report multi-monitor mouse co-ordinates relative to the whole virtual framebuffer and not to the first screen

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