VirtualBox

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

Last change on this file since 46197 was 46093, checked in by vboxsync, 12 years ago

include/VBox/VMMDev.h: remove L4 from a comment.

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