VirtualBox

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

Last change on this file since 46783 was 46691, checked in by vboxsync, 11 years ago

VMMDev.h: Drop unnecessary pragmas, keeping the pack(4) on the whole header for what it's worth.

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