VirtualBox

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

Last change on this file since 50055 was 49846, checked in by vboxsync, 11 years ago

HGCM: check size.

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