VirtualBox

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

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

VMMDev: added VMMDevReqWriteCoreDump. VMM/DBGFCoreWrite: remove unused parameter.

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