VirtualBox

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

最後變更 在這個檔案從64185是 64185,由 vboxsync 提交於 8 年 前

bugref:8614: Additions/common/VBoxVideo: make the code more self-contained: break the VBoxVideo.h dependency on VMMDev.h by moving VBVA and mouse cursor flags to VBoxVideo.h. Now there is a dependency the other way, but I do not think that is such a problem.

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette