VirtualBox

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

Last change on this file since 61066 was 58163, checked in by vboxsync, 9 years ago

VMMDev.h: r=bird: Please, don't spread enum values like this ever again.

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