VirtualBox

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

Last change on this file since 49725 was 49411, checked in by vboxsync, 12 years ago

VMMDev: s/VMMDEV_MAX_VMMDEV_PARMS/VMMDEV_MAX_HGCM_PARMS/g, return outside logging contraint if, return VERR_INVALID_PARAMETER because that's closer than VERR_NOT_SUPPORTED (as in 'not supported operation').

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

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