VMMDev.h revision ed0d9ad011741656c6a8456b97b036e1aa815da2
/** @file
*/
/*
* Copyright (C) 2006-2007 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___VBox_VMMDev_h
#define ___VBox_VMMDev_h
/** @defgroup grp_vmmdev VMM Device
*
* Note! This interface cannot be changed, it can only be extended!
*
* @{
*/
/** Size of VMMDev RAM region accessible by guest.
* Must be big enough to contain VMMDevMemory structure (see further down).
* For now: 4 megabyte.
*/
/** Size of VMMDev heap region accessible by guest.
* (Must be a power of two (pci range).)
*/
/** Port for generic request interface (relative offset). */
#define VMMDEV_PORT_OFF_REQUEST 0
/** @name VMMDev events.
*
* Used mainly by VMMDevReq_AcknowledgeEvents/VMMDevEvents and version 1.3 of
* VMMDevMemory.
*
* @{
*/
/** Host mouse capabilities has been changed. */
#define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED RT_BIT(0)
/** HGCM event. */
/** A display change request has been issued. */
/** Credentials are available for judgement. */
/** The guest has been restored. */
/** Seamless mode state changed. */
/** Memory balloon size changed. */
/** Statistics interval changed. */
/** VRDP status changed. */
/** New mouse position data available. */
/** CPU hotplug event occurred. */
/** The mask of valid events, for sanity checking. */
/** @} */
/** @defgroup grp_vmmdev_req VMMDev Generic Request Interface
* @{
*/
/** @name Current version of the VMMDev interface.
*
* Additions are allowed to work only if
* additions_major == vmmdev_current && additions_minor <= vmmdev_current.
* Additions version is reported to host (VMMDev) by VMMDevReq_ReportGuestInfo.
*
* @remarks These defines also live in the 16-bit and assembly versions of this
* header.
*/
#define VMMDEV_VERSION 0x00010004
/** @} */
/** Maximum request packet size. */
#define VMMDEV_MAX_VMMDEVREQ_SIZE _1M
/**
* VMMDev request types.
* @note when updating this, adjust vmmdevGetRequestSize() as well
*/
typedef enum
{
VMMDevReq_Idle = 5,
VMMDevReq_GetHostTime = 10,
VMMDevReq_SetPowerStatus = 30,
#ifdef VBOX_WITH_HGCM
VMMDevReq_HGCMConnect = 60,
VMMDevReq_HGCMDisconnect = 61,
#ifdef VBOX_WITH_64_BITS_GUESTS
VMMDevReq_HGCMCall32 = 62,
VMMDevReq_HGCMCall64 = 63,
#else
VMMDevReq_HGCMCall = 62,
#endif /* VBOX_WITH_64_BITS_GUESTS */
VMMDevReq_HGCMCancel = 64,
VMMDevReq_HGCMCancel2 = 65,
#endif
VMMDevReq_QueryCredentials = 100,
VMMDevReq_ReportGuestStats = 110,
VMMDevReq_ChangeMemBalloon = 113,
VMMDevReq_LogString = 200,
VMMDevReq_CheckSharedModules = 214,
VMMDevReq_DebugIsPageShared = 216,
VMMDevReq_WriteCoreDump = 218,
VMMDevReq_SizeHack = 0x7fffffff
#ifdef VBOX_WITH_64_BITS_GUESTS
/*
* Constants and structures are redefined for the guest.
*
* Host code MUST always use either *32 or *64 variant explicitely.
* Host source code will use VBOX_HGCM_HOST_CODE define to catch undefined
* data types and constants.
*
* This redefinition means that the new additions builds will use
* the *64 or *32 variants depending on the current architecture bit count (ARCH_BITS).
*/
# ifndef VBOX_HGCM_HOST_CODE
# if ARCH_BITS == 64
# define VMMDevReq_HGCMCall VMMDevReq_HGCMCall64
# define VMMDevReq_HGCMCall VMMDevReq_HGCMCall32
# else
# error "Unsupported ARCH_BITS"
# endif
# endif /* !VBOX_HGCM_HOST_CODE */
#endif /* VBOX_WITH_64_BITS_GUESTS */
/** Version of VMMDevRequestHeader structure. */
#define VMMDEV_REQUEST_HEADER_VERSION (0x10001)
/**
* Generic VMMDev request header.
*/
typedef struct
{
/** IN: Size of the structure in bytes (including body). */
/** IN: Version of the structure. */
/** IN: Type of the request. */
/** OUT: Return code. */
/** Reserved field no.1. MBZ. */
/** Reserved field no.2. MBZ. */
/**
* Mouse status request structure.
*
* Used by VMMDevReq_GetMouseStatus and VMMDevReq_SetMouseStatus.
*/
typedef struct
{
/** header */
/** Mouse feature mask. See VMMDEV_MOUSE_*. */
/** Mouse x position. */
/** Mouse y position. */
/** @name Mouse capability bits (VMMDevReqMouseStatus::mouseFeatures).
* @{ */
/** The guest can (== wants to) handle absolute coordinates. */
#define VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE RT_BIT(0)
/** The host can (== wants to) send absolute coordinates.
* (Input not captured.) */
/** The guest can *NOT* switch to software cursor and therefore depends on the
* host cursor.
*
* When guest additions are installed and the host has promised to display the
* cursor itself, the guest installs a hardware mouse driver. Don't ask the
* guest to switch to a software cursor then. */
/** The host does NOT provide support for drawing the cursor itself.
* This is for instance the case for the L4 console. */
/** The guest can read VMMDev events to find out about pointer movement */
/** If the guest changes the status of the
* VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR bit, the host will honour this */
/** The host supplies an absolute pointing device. The Guest Additions may
* wish to use this to decide whether to install their own driver */
/** The mask of all VMMDEV_MOUSE_* flags */
/** The mask of guest capability changes for which notification events should
* be sent */
#define VMMDEV_MOUSE_NOTIFY_HOST_MASK \
/** The mask of all capabilities which the guest can legitimately change */
#define VMMDEV_MOUSE_GUEST_MASK \
/** The mask of host capability changes for which notification events should
* be sent */
#define VMMDEV_MOUSE_NOTIFY_GUEST_MASK \
/** The mask of all capabilities which the host can legitimately change */
#define VMMDEV_MOUSE_HOST_MASK \
/** @} */
/**
* Mouse pointer shape/visibility change request.
*
* Used by VMMDevReq_SetPointerShape. The size is variable.
*/
typedef struct VMMDevReqMousePointer
{
/** Header. */
/** VBOX_MOUSE_POINTER_* bit flags. */
/** x coordinate of hot spot. */
/** y coordinate of hot spot. */
/** Width of the pointer in pixels. */
/** Height of the pointer in scanlines. */
/** Pointer data.
*
****
* The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
*
* For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
* For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
*
* Guest driver must create the AND mask for pointers with alpha channel, so if host does not
* support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
* be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
*
* The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
* therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
* end of any scanline are undefined.
*
* The XOR mask follows the AND mask on the next 4 bytes aligned offset:
* uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
* Bytes in the gap between the AND and the XOR mask are undefined.
* XOR mask scanlines have no gap between them and size of XOR mask is:
* cXor = width * 4 * height.
****
*
* Preallocate 4 bytes for accessing actual data as p->pointerData.
*/
char pointerData[4];
/**
* Get the size that a VMMDevReqMousePointer request should have for a given
* size of cursor, including the trailing cursor image and mask data.
* @note an "empty" request still has the four preallocated bytes of data
*
* @returns the size
* @param width the cursor width
* @param height the cursor height
*/
{
sizeof(VMMDevReqMousePointer));
}
/** @name VMMDevReqMousePointer::fFlags
* @note The VBOX_MOUSE_POINTER_* flags are used in the guest video driver,
* values must be <= 0x8000 and must not be changed. (try make more sense
* of this, please).
* @{
*/
/** pointer is visible */
#define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
/** pointer has alpha channel */
#define VBOX_MOUSE_POINTER_ALPHA (0x0002)
/** pointerData contains new pointer shape */
#define VBOX_MOUSE_POINTER_SHAPE (0x0004)
/** @} */
/**
* String log request structure.
*
* Used by VMMDevReq_LogString.
* @deprecated Use the IPRT logger or VbglR3WriteLog instead.
*/
typedef struct
{
/** header */
/** variable length string data */
char szString[1];
/**
* VirtualBox host version request structure.
*
* Used by VMMDevReq_GetHostVersion.
*
* @remarks VBGL uses this to detect the precense of new features in the
* interface.
*/
typedef struct
{
/** Header. */
/** Major version. */
/** Minor version. */
/** Build number. */
/** SVN revision. */
/** Feature mask. */
/** @name VMMDevReqHostVersion::features
* @{ */
/** Physical page lists are supported by HGCM. */
#define VMMDEV_HVF_HGCM_PHYS_PAGE_LIST RT_BIT(0)
/** @} */
/**
* Guest capabilities structure.
*
* Used by VMMDevReq_ReportGuestCapabilities.
*/
typedef struct
{
/** Header. */
/** Capabilities (VMMDEV_GUEST_*). */
/**
* Guest capabilities structure, version 2.
*
* Used by VMMDevReq_SetGuestCapabilities.
*/
typedef struct
{
/** Header. */
/** Mask of capabilities to be added. */
/** Mask of capabilities to be removed. */
/** @name Guest capability bits.
* Used by VMMDevReq_ReportGuestCapabilities and VMMDevReq_SetGuestCapabilities.
* @{ */
/** The guest supports seamless display rendering. */
#define VMMDEV_GUEST_SUPPORTS_SEAMLESS RT_BIT_32(0)
/** The guest supports mapping guest to host windows. */
/** The guest graphical additions are active.
* Used for fast activation and deactivation of certain graphical operations
* (e.g. resizing & seamless). The legacy VMMDevReq_ReportGuestCapabilities
* request sets this automatically, but VMMDevReq_SetGuestCapabilities does
* not. */
/** @} */
/**
* Idle request structure.
*
* Used by VMMDevReq_Idle.
*/
typedef struct
{
/** Header. */
/**
* Host time request structure.
*
* Used by VMMDevReq_GetHostTime.
*/
typedef struct
{
/** Header */
/** OUT: Time in milliseconds since unix epoch. */
/**
* Hypervisor info structure.
*
* Used by VMMDevReq_GetHypervisorInfo and VMMDevReq_SetHypervisorInfo.
*/
typedef struct
{
/** Header. */
/** Guest virtual address of proposed hypervisor start.
* Not used by VMMDevReq_GetHypervisorInfo.
* @todo Make this 64-bit compatible? */
/** Hypervisor size in bytes. */
/** @name Default patch memory size .
* Used by VMMDevReq_RegisterPatchMemory and VMMDevReq_DeregisterPatchMemory.
* @{ */
#define VMMDEV_GUEST_DEFAULT_PATCHMEM_SIZE 8192
/** @} */
/**
* Patching memory structure. (locked executable & read-only page from the guest's perspective)
*
* Used by VMMDevReq_RegisterPatchMemory and VMMDevReq_DeregisterPatchMemory
*/
typedef struct
{
/** Header. */
/** Guest virtual address of the patching page(s). */
/** Patch page size in bytes. */
/**
* Guest power requests.
*
* See VMMDevReq_SetPowerStatus and VMMDevPowerStateRequest.
*/
typedef enum
{
VMMDevPowerState_SizeHack = 0x7fffffff
/**
* VM power status structure.
*
* Used by VMMDevReq_SetPowerStatus.
*/
typedef struct
{
/** Header. */
/** Power state request. */
/**
* Pending events structure.
*
* Used by VMMDevReq_AcknowledgeEvents.
*/
typedef struct
{
/** Header. */
/** OUT: Pending event mask. */
} VMMDevEvents;
/**
* Guest event filter mask control.
*
* Used by VMMDevReq_CtlGuestFilterMask.
*/
typedef struct
{
/** Header. */
/** Mask of events to be added to the filter. */
/** Mask of events to be removed from the filter. */
/**
* Guest information structure.
*
* Used by VMMDevReportGuestInfo and PDMIVMMDEVCONNECTOR::pfnUpdateGuestVersion.
*/
typedef struct VBoxGuestInfo
{
/** The VMMDev interface version expected by additions.
* *Deprecated*, do not use anymore! Will be removed. */
/** Guest OS type. */
/**
* Guest information report.
*
* Used by VMMDevReq_ReportGuestInfo.
*/
typedef struct
{
/** Header. */
/** Guest information. */
/**
* Guest information structure, version 2.
*
* Used by VMMDevReportGuestInfo2 and PDMIVMMDEVCONNECTOR::pfnUpdateGuestVersion2.
*/
typedef struct VBoxGuestInfo2
{
/** Major version. */
/** Minor version. */
/** Build number. */
/** SVN revision. */
/** Feature mask, currently unused. */
/** Some additional information, for example 'Beta 1' or something like that. */
char szName[128];
/**
* Guest information report, version 2.
*
* Used by VMMDevReq_ReportGuestInfo2.
*/
typedef struct
{
/** Header. */
/** Guest information. */
/**
* Guest status facility.
*/
typedef enum
{
VBoxGuestStatusFacility_All = 999,
VBoxGuestStatusFacility_SizeHack = 0x7fffffff
/**
* The current guest status of a facility.
*/
typedef enum
{
VBoxGuestStatusCurrent_SizeHack = 0x7fffffff
/**
* Guest status structure.
*
* Used by VMMDevReqGuestStatus.
*/
typedef struct VBoxGuestStatus
{
/** Facility the status is indicated for. */
/** Current guest status. */
/** Flags, not used at the moment. */
/**
* Guest Additions status structure.
*
* Used by VMMDevReq_ReportGuestStatus.
*/
typedef struct
{
/** Header. */
/** Guest information. */
/**
* Guest statistics structure.
*
* Used by VMMDevReportGuestStats and PDMIVMMDEVCONNECTOR::pfnReportStatistics.
*/
typedef struct VBoxGuestStatistics
{
/** Virtual CPU ID. */
/** Reported statistics. */
/** Idle CPU load (0-100) for last interval. */
/** Kernel CPU load (0-100) for last interval. */
/** User CPU load (0-100) for last interval. */
/** Nr of threads. */
/** Nr of processes. */
/** Nr of handles. */
/** Memory load (0-100). */
/** Page size of guest system. */
/** Total physical memory (in 4KB pages). */
/** Available physical memory (in 4KB pages). */
/** Ballooned physical memory (in 4KB pages). */
/** Total number of committed memory (which is not necessarily in-use) (in 4KB pages). */
/** Total amount of memory used by the kernel (in 4KB pages). */
/** Total amount of paged memory used by the kernel (in 4KB pages). */
/** Total amount of nonpaged memory used by the kernel (in 4KB pages). */
/** Total amount of memory used for the system cache (in 4KB pages). */
/** Pagefile size (in 4KB pages). */
/** @name Guest statistics values (VBoxGuestStatistics::u32StatCaps).
* @{ */
#define VBOX_GUEST_STAT_CPU_LOAD_IDLE RT_BIT(0)
/** @} */
/**
* Guest statistics command structure.
*
* Used by VMMDevReq_ReportGuestStats.
*/
typedef struct
{
/** Header. */
/** Guest information. */
/** Memory balloon change request structure. */
/**
* Poll for ballooning change request.
*
* Used by VMMDevReq_GetMemBalloonChangeRequest.
*/
typedef struct
{
/** Header. */
/** Balloon size in megabytes. */
/** Guest ram size in megabytes. */
/** Setting this to VMMDEV_EVENT_BALLOON_CHANGE_REQUEST indicates that the
* request is a response to that event.
* (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
/**
* Change the size of the balloon.
*
* Used by VMMDevReq_ChangeMemBalloon.
*/
typedef struct
{
/** Header. */
/** The number of pages in the array. */
/** true = inflate, false = deflate. */
/** Physical address (RTGCPHYS) of each page, variable size. */
/** @name The ballooning chunk size which VMMDev works at.
* @{ */
/** @} */
/**
* Guest statistics interval change request structure.
*
* Used by VMMDevReq_GetStatisticsChangeRequest.
*/
typedef struct
{
/** Header. */
/** The interval in seconds. */
/** Setting this to VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST indicates
* that the request is a response to that event.
* (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
/** The size of a string field in the credentials request (including '\\0').
* @see VMMDevCredentials */
#define VMMDEV_CREDENTIALS_SZ_SIZE 128
/**
* Credentials request structure.
*
* Used by VMMDevReq_QueryCredentials.
*/
#pragma pack(4)
typedef struct
{
/** Header. */
/** OUT: User name (UTF-8). */
/** OUT: Password (UTF-8). */
/** OUT: Domain name (UTF-8). */
#pragma pack()
/** @name Credentials request flag (VMMDevCredentials::u32Flags)
* @{ */
/** query from host whether credentials are present */
/** read credentials from host (can be combined with clear) */
/** clear credentials on host (can be combined with read) */
/** read credentials for judgement in the guest */
/** clear credentials for judegement on the host */
/** report credentials acceptance by guest */
/** report credentials denial by guest */
/** report that no judgement could be made by guest */
/** flag telling the guest that credentials are present */
/** flag telling guest that local logons should be prohibited */
/** @} */
/**
* Seamless mode change request structure.
*
* Used by VMMDevReq_GetSeamlessChangeRequest.
*/
typedef struct
{
/** Header. */
/** New seamless mode. */
/** Setting this to VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST indicates
* that the request is a response to that event.
* (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
/**
* Display change request structure.
*
* Used by VMMDevReq_GetDisplayChangeRequest.
*/
typedef struct
{
/** Header. */
/** Horizontal pixel resolution (0 = do not change). */
/** Vertical pixel resolution (0 = do not change). */
/** Bits per pixel (0 = do not change). */
/** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
* that the request is a response to that event.
* (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
/**
* Display change request structure, version 2.
*
* Used by VMMDevReq_GetDisplayChangeRequest2.
*/
typedef struct
{
/** Header. */
/** Horizontal pixel resolution (0 = do not change). */
/** Vertical pixel resolution (0 = do not change). */
/** Bits per pixel (0 = do not change). */
/** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
* that the request is a response to that event.
* (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
/** 0 for primary display, 1 for the first secondary, etc. */
/**
* Video mode supported request structure.
*
* Used by VMMDevReq_VideoModeSupported.
*/
typedef struct
{
/** Header. */
/** IN: Horizontal pixel resolution. */
/** IN: Vertical pixel resolution. */
/** IN: Bits per pixel. */
/** OUT: Support indicator. */
bool fSupported;
/**
* Video mode supported request structure for a specific display.
*
* Used by VMMDevReq_VideoModeSupported2.
*/
typedef struct
{
/** Header. */
/** IN: The guest display number. */
/** IN: Horizontal pixel resolution. */
/** IN: Vertical pixel resolution. */
/** IN: Bits per pixel. */
/** OUT: Support indicator. */
bool fSupported;
/**
* Video modes height reduction request structure.
*
* Used by VMMDevReq_GetHeightReduction.
*/
typedef struct
{
/** Header. */
/** OUT: Height reduction in pixels. */
/**
* VRDP change request structure.
*
* Used by VMMDevReq_GetVRDPChangeRequest.
*/
typedef struct
{
/** Header */
/** Whether VRDP is active or not. */
/** The configured experience level for active VRDP. */
/** @name VRDP Experience level (VMMDevVRDPChangeRequest::u32VRDPExperienceLevel)
* @{ */
#define VRDP_EXPERIENCE_LEVEL_ZERO 0 /**< Theming disabled. */
/** @} */
/**
* VBVA enable request structure.
*
* Used by VMMDevReq_VideoAccelEnable.
*/
typedef struct
{
/** Header. */
/** 0 - disable, !0 - enable. */
/** The size of VBVAMEMORY::au8RingBuffer expected by driver.
* The host will refuse to enable VBVA if the size is not equal to
* VBVA_RING_BUFFER_SIZE.
*/
/** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
/** @name VMMDevVideoAccelEnable::fu32Status.
* @{ */
#define VBVA_F_STATUS_ACCEPTED (0x01)
#define VBVA_F_STATUS_ENABLED (0x02)
/** @} */
/**
* VBVA flush request structure.
*
* Used by VMMDevReq_VideoAccelFlush.
*/
typedef struct
{
/** Header. */
/**
* VBVA set visible region request structure.
*
* Used by VMMDevReq_VideoSetVisibleRegion.
*/
typedef struct
{
/** Header. */
/** Number of rectangles */
/** Rectangle array.
* @todo array is spelled aRects[1]. */
/**
* CPU event types.
*/
typedef enum
{
VMMDevCpuStatusType_SizeHack = 0x7fffffff
/**
* CPU hotplug event status request.
*/
typedef struct
{
/** Header. */
/** Status type */
/**
* Get the ID of the changed CPU and event type.
*/
typedef struct
{
/** Header. */
/** Event type */
/** core id of the CPU changed */
/** package id of the CPU changed */
/**
* Shared region description
*/
typedef struct
{
#define VMMDEVSHAREDREGIONDESC_MAX 32
/**
* Shared module registration
*/
typedef struct
{
/** Header. */
/** Shared module size. */
/** Number of included region descriptors */
/** Base address of the shared module. */
/** Guest OS type. */
/** Alignment. */
/** Module name */
char szName[128];
/** Module version */
char szVersion[16];
/** Shared region descriptor(s). */
/**
* Shared module unregistration
*/
typedef struct
{
/** Header. */
/** Shared module size. */
/** Align at 8 byte boundary. */
/** Base address of the shared module. */
/** Module name */
char szName[128];
/** Module version */
char szVersion[16];
/**
* Shared module periodic check
*/
typedef struct
{
/** Header. */
/**
* Paging sharing enabled query
*/
typedef struct
{
/** Header. */
/** Enabled flag (out) */
bool fEnabled;
/** Alignment */
bool fAlignment[3];
/**
* Page sharing status query (debug build only)
*/
typedef struct
{
/** Header. */
/** Page address. */
/** Page flags. */
/** Shared flag (out) */
bool fShared;
/** Alignment */
bool fAlignment[3];
/**
* Session id request structure.
*
* Used by VMMDevReq_GetSessionId.
*/
typedef struct
{
/** Header */
/** OUT: unique session id; the id will be different after each start, reset or restore of the VM */
/**
* Write Core Dump request.
*
* Used by VMMDevReq_WriteCoreDump.
*/
typedef struct
{
/** Header. */
/** Flags (reserved, MBZ). */
#pragma pack()
#ifdef VBOX_WITH_HGCM
/** @name HGCM flags.
* @{
*/
# define VBOX_HGCM_REQ_DONE_BIT 0
# define VBOX_HGCM_REQ_CANCELLED (0x2)
/** @} */
# pragma pack(4)
/**
* HGCM request header.
*/
typedef struct VMMDevHGCMRequestHeader
{
/** Request header. */
/** HGCM flags. */
/** Result code. */
/**
* HGCM connect request structure.
*
* Used by VMMDevReq_HGCMConnect.
*/
typedef struct
{
/** HGCM request header. */
/** IN: Description of service to connect to. */
/** OUT: Client identifier assigned by local instance of HGCM. */
/**
* HGCM disconnect request structure.
*
* Used by VMMDevReq_HGCMDisconnect.
*/
typedef struct
{
/** HGCM request header. */
/** IN: Client identifier. */
/**
* HGCM parameter type.
*/
typedef enum
{
VMMDevHGCMParmType_SizeHack = 0x7fffffff
# ifdef VBOX_WITH_64_BITS_GUESTS
/**
* HGCM function parameter, 32-bit client.
*/
typedef struct
{
union
{
struct
{
union
{
} u;
} Pointer;
struct
{
} PageList;
} u;
# ifdef __cplusplus
{
u.value64 = 0; /* init unused bits to 0 */
}
{
if (type == VMMDevHGCMParmType_32bit)
{
return VINF_SUCCESS;
}
return VERR_INVALID_PARAMETER;
}
{
}
{
if (type == VMMDevHGCMParmType_64bit)
{
return VINF_SUCCESS;
}
return VERR_INVALID_PARAMETER;
}
{
}
# endif /* __cplusplus */
/**
* HGCM function parameter, 64-bit client.
*/
typedef struct
{
union
{
struct
{
union
{
} u;
} Pointer;
struct
{
} PageList;
} u;
# ifdef __cplusplus
{
u.value64 = 0; /* init unused bits to 0 */
}
{
if (type == VMMDevHGCMParmType_32bit)
{
return VINF_SUCCESS;
}
return VERR_INVALID_PARAMETER;
}
{
}
{
if (type == VMMDevHGCMParmType_64bit)
{
return VINF_SUCCESS;
}
return VERR_INVALID_PARAMETER;
}
{
}
# endif /** __cplusplus */
/* Redefine the structure type for the guest code. */
# ifndef VBOX_HGCM_HOST_CODE
# if ARCH_BITS == 64
# else
# error "Unsupported sizeof (void *)"
# endif
# endif /* !VBOX_HGCM_HOST_CODE */
# else /* !VBOX_WITH_64_BITS_GUESTS */
/**
* HGCM function parameter, 32-bit client.
*
* @todo If this is the same as HGCMFunctionParameter32, why the duplication?
*/
typedef struct
{
union
{
struct
{
union
{
} u;
} Pointer;
struct
{
} PageList;
} u;
# ifdef __cplusplus
{
u.value64 = 0; /* init unused bits to 0 */
}
{
if (type == VMMDevHGCMParmType_32bit)
{
return VINF_SUCCESS;
}
return VERR_INVALID_PARAMETER;
}
{
}
{
if (type == VMMDevHGCMParmType_64bit)
{
return VINF_SUCCESS;
}
return VERR_INVALID_PARAMETER;
}
{
}
# endif /* __cplusplus */
# endif /* !VBOX_WITH_64_BITS_GUESTS */
/**
* HGCM call request structure.
*
* Used by VMMDevReq_HGCMCall, VMMDevReq_HGCMCall32 and VMMDevReq_HGCMCall64.
*/
typedef struct
{
/* request header */
/** IN: Client identifier. */
/** IN: Service function number. */
/** IN: Number of parameters. */
/** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
/** @name Direction of data transfer (HGCMPageListInfo::flags). Bit flags.
* @{ */
/** Macro for validating that the specified flags are valid. */
#define VBOX_HGCM_F_PARM_ARE_VALID(fFlags) \
&& (fFlags) < VBOX_HGCM_F_PARM_DIRECTION_BOTH )
/** @} */
/**
* VMMDevHGCMParmType_PageList points to this structure to actually describe the
* buffer.
*/
typedef struct
{
# pragma pack()
/** Get the pointer to the first parmater of a HGCM call request. */
# define VMMDEV_HGCM_CALL_PARMS(a) ((HGCMFunctionParameter *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
/** Get the pointer to the first parmater of a 32-bit HGCM call request. */
# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
# ifdef VBOX_WITH_64_BITS_GUESTS
/* Explicit defines for the host code. */
# ifdef VBOX_HGCM_HOST_CODE
# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
# define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
# endif /* VBOX_HGCM_HOST_CODE */
# endif /* VBOX_WITH_64_BITS_GUESTS */
# define VBOX_HGCM_MAX_PARMS 32
/**
* HGCM cancel request structure.
*
* The Cancel request is issued using the same physical memory address as was
* used for the corresponding initial HGCMCall.
*
* Used by VMMDevReq_HGCMCancel.
*/
typedef struct
{
/** Header. */
/**
* HGCM cancel request structure, version 2.
*
* Used by VMMDevReq_HGCMCancel2.
*
* VINF_SUCCESS when cancelled.
* VERR_NOT_FOUND if the specified request cannot be found.
* VERR_INVALID_PARAMETER if the address is invalid valid.
*/
typedef struct
{
/** Header. */
/** The physical address of the request to cancel. */
#endif /* VBOX_WITH_HGCM */
/**
* Inline helper to determine the request size for the given operation.
*
* @returns Size.
* @param requestType The VMMDev request type.
*/
{
switch (requestType)
{
case VMMDevReq_GetMouseStatus:
case VMMDevReq_SetMouseStatus:
return sizeof(VMMDevReqMouseStatus);
return sizeof(VMMDevReqMousePointer);
case VMMDevReq_GetHostVersion:
return sizeof(VMMDevReqHostVersion);
case VMMDevReq_Idle:
return sizeof(VMMDevReqIdle);
case VMMDevReq_GetHostTime:
return sizeof(VMMDevReqHostTime);
return sizeof(VMMDevReqHypervisorInfo);
return sizeof(VMMDevReqPatchMemory);
case VMMDevReq_SetPowerStatus:
return sizeof(VMMDevPowerStateRequest);
return sizeof(VMMDevEvents);
return sizeof(VMMDevReportGuestInfo);
return sizeof(VMMDevReportGuestInfo2);
return sizeof(VMMDevReportGuestStatus);
return sizeof(VMMDevDisplayChangeRequest);
return sizeof(VMMDevDisplayChangeRequest2);
return sizeof(VMMDevVideoModeSupportedRequest);
return sizeof(VMMDevGetHeightReductionRequest);
return sizeof(VMMDevReqGuestCapabilities);
return sizeof(VMMDevReqGuestCapabilities2);
#ifdef VBOX_WITH_HGCM
case VMMDevReq_HGCMConnect:
return sizeof(VMMDevHGCMConnect);
case VMMDevReq_HGCMDisconnect:
return sizeof(VMMDevHGCMDisconnect);
#ifdef VBOX_WITH_64_BITS_GUESTS
case VMMDevReq_HGCMCall32:
return sizeof(VMMDevHGCMCall);
case VMMDevReq_HGCMCall64:
return sizeof(VMMDevHGCMCall);
#else
case VMMDevReq_HGCMCall:
return sizeof(VMMDevHGCMCall);
#endif /* VBOX_WITH_64_BITS_GUESTS */
case VMMDevReq_HGCMCancel:
return sizeof(VMMDevHGCMCancel);
#endif /* VBOX_WITH_HGCM */
return sizeof(VMMDevVideoAccelEnable);
return sizeof(VMMDevVideoAccelFlush);
return sizeof(VMMDevVideoSetVisibleRegion);
return sizeof(VMMDevSeamlessChangeRequest);
return sizeof(VMMDevCredentials);
return sizeof(VMMDevReportGuestStats);
return sizeof(VMMDevGetMemBalloonChangeRequest);
return sizeof(VMMDevGetStatisticsChangeRequest);
return sizeof(VMMDevChangeMemBalloon);
return sizeof(VMMDevVRDPChangeRequest);
case VMMDevReq_LogString:
return sizeof(VMMDevReqLogString);
return sizeof(VMMDevCtlGuestFilterMask);
return sizeof(VMMDevGetCpuHotPlugRequest);
return sizeof(VMMDevCpuHotPlugStatusRequest);
return sizeof(VMMDevSharedModuleRegistrationRequest);
return sizeof(VMMDevSharedModuleUnregistrationRequest);
return sizeof(VMMDevSharedModuleCheckRequest);
return sizeof(VMMDevPageSharingStatusRequest);
return sizeof(VMMDevPageIsSharedRequest);
case VMMDevReq_GetSessionId:
return sizeof(VMMDevReqSessionId);
default:
return 0;
}
}
/**
* Initializes a request structure.
*
* @returns VBox status code.
* @param req The request structure to initialize.
* @param type The request type.
*/
{
if (!req)
return VERR_INVALID_PARAMETER;
if (!requestSize)
return VERR_INVALID_PARAMETER;
return VINF_SUCCESS;
}
/** @} */
/**
* VBVA command header.
*
* @todo Where does this fit in?
*/
typedef struct VBVACMDHDR
{
/** Coordinates of affected rectangle. */
int16_t x;
int16_t y;
uint16_t w;
uint16_t h;
} VBVACMDHDR;
#pragma pack()
/** @name VBVA ring defines.
*
* The VBVA ring buffer is suitable for transferring large (< 2GB) amount of
* data. For example big bitmaps which do not fit to the buffer.
*
* Guest starts writing to the buffer by initializing a record entry in the
* aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
* written. As data is written to the ring buffer, the guest increases off32End
* for the record.
*
* The host reads the aRecords on flushes and processes all completed records.
* When host encounters situation when only a partial record presents and
* cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE -
* VBVA_RING_BUFFER_THRESHOLD, the host fetched all record data and updates
* off32Head. After that on each flush the host continues fetching the data
* until the record is completed.
*
*/
#define VBVA_MAX_RECORDS (64)
#define VBVA_F_MODE_ENABLED (0x00000001)
#define VBVA_F_MODE_VRDP (0x00000002)
#define VBVA_F_MODE_VRDP_RESET (0x00000004)
#define VBVA_F_MODE_VRDP_ORDER_MASK (0x00000008)
#define VBVA_F_RECORD_PARTIAL (0x80000000)
/** @} */
/**
* VBVA record.
*/
typedef struct VBVARECORD
{
/** The length of the record. Changed by guest. */
} VBVARECORD;
/**
* VBVA memory layout.
*
* This is a subsection of the VMMDevMemory structure.
*/
typedef struct VBVAMEMORY
{
/** VBVA_F_MODE_*. */
/** The offset where the data start in the buffer. */
/** The offset where next data must be placed in the buffer. */
/** The ring buffer for data. */
/** The queue of record descriptions. */
/** RDP orders supported by the client. The guest reports only them
* and falls back to DIRTY rects for not supported ones.
*
* (1 << VBVA_VRDP_*)
*/
} VBVAMEMORY;
#pragma pack()
/**
* The layout of VMMDEV RAM region that contains information for guest.
*/
typedef struct VMMDevMemory
{
/** The size of this structure. */
/** The structure version. (VMMDEV_MEMORY_VERSION) */
union
{
struct
{
/** Flag telling that VMMDev set the IRQ and acknowlegment is required */
bool fHaveEvents;
} V1_04;
struct
{
/** Pending events flags, set by host. */
/** Mask of events the guest wants to see, set by guest. */
} V1_03;
} V;
} VMMDevMemory;
#pragma pack()
/** Version of VMMDevMemory structure (VMMDevMemory::u32Version). */
#define VMMDEV_MEMORY_VERSION (1)
/** @} */
#endif