VirtualBox

Changeset 21226 in vbox for trunk/include


Ignore:
Timestamp:
Jul 5, 2009 5:37:04 PM (15 years ago)
Author:
vboxsync
Message:

VMMDev.h: cleanup.

Location:
trunk/include/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxGuest.h

    r21224 r21226  
    7979# define VBOXGUEST_USER_DEVICE_NAME     VBOXGUEST_DEVICE_NAME
    8080#endif
     81
     82/** Fictive start address of the hypervisor physical memory for MmMapIoSpace. */
     83#define VBOXGUEST_HYPERVISOR_PHYSICAL_START     UINT32_C(0xf8000000)
    8184
    8285
  • trunk/include/VBox/VBoxGuest16.h

    r21224 r21226  
    8080#define VMMDevReq_CtlGuestFilterMask            42
    8181
    82 #define VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE      RT_BIT(0)
    83 #define VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE       RT_BIT(1)
    84 #define VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR RT_BIT(2)
    85 #define VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER   RT_BIT(3)
     82#define VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE      RT_BIT(0)
     83#define VMMDEV_MOUSE_HOST_CAN_ABSOLUTE       RT_BIT(1)
     84#define VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR RT_BIT(2)
     85#define VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER   RT_BIT(3)
    8686
    8787typedef struct
  • trunk/include/VBox/VMMDev.h

    r21225 r21226  
    4848 */
    4949
    50 /** @name Mouse capability bits
    51  * @{ */
    52 /** the guest requests absolute mouse coordinates (guest additions installed) */
    53 #define VMMDEV_MOUSEGUESTWANTSABS                           RT_BIT(0)
    54 /** the host wants to send absolute mouse coordinates (input not captured) */
    55 #define VMMDEV_MOUSEHOSTWANTSABS                            RT_BIT(1)
    56 /** the guest needs a hardware cursor on host. When guest additions are installed
    57  *  and the host has promised to display the cursor itself, the guest installs a
    58  *  hardware mouse driver. Don't ask the guest to switch to a software cursor then. */
    59 #define VMMDEV_MOUSEGUESTNEEDSHOSTCUR                       RT_BIT(2)
    60 /** the host is NOT able to draw the cursor itself (e.g. L4 console) */
    61 #define VMMDEV_MOUSEHOSTCANNOTHWPOINTER                     RT_BIT(3)
    62 /** The guest can read VMMDev events to find out about pointer movement */
    63 #define VMMDEV_MOUSEGUESTUSESVMMDEV                         RT_BIT(4)
    64 /** @} */
    65 
    66 /** @name Flags for pfnSetCredentials
    67  * @{ */
    68 /** the guest should perform a logon with the credentials */
    69 #define VMMDEV_SETCREDENTIALS_GUESTLOGON                    RT_BIT(0)
    70 /** the guest should prevent local logons */
    71 #define VMMDEV_SETCREDENTIALS_NOLOCALLOGON                  RT_BIT(1)
    72 /** the guest should verify the credentials */
    73 #define VMMDEV_SETCREDENTIALS_JUDGE                         RT_BIT(15)
    74 /** @} */
    75 
    76 /** @name Guest capability bits.
    77  * VMMDevReq_ReportGuestCapabilities, VMMDevReq_SetGuestCapabilities
    78  * @{ */
    79 /** the guest supports seamless display rendering */
    80 #define VMMDEV_GUEST_SUPPORTS_SEAMLESS                      RT_BIT(0)
    81 /** the guest supports mapping guest to host windows */
    82 #define VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING     RT_BIT(1)
    83 /** the guest graphical additions are active - used for fast activation
    84  *  and deactivation of certain graphical operations (e.g. resizing & seamless).
    85  *  The legacy VMMDevReq_ReportGuestCapabilities request sets this
    86  *  automatically, but VMMDevReq_SetGuestCapabilities does not. */
    87 #define VMMDEV_GUEST_SUPPORTS_GRAPHICS                      RT_BIT(2)
    88 /** @} */
    8950
    9051/** Size of VMMDev RAM region accessible by guest.
     
    9960#define VMMDEV_HEAP_SIZE                                    (4 * PAGE_SIZE)
    10061
    101 
    102 /** @name VBoxGuest port definitions
     62/** Port for generic request interface (relative offset). */
     63#define VMMDEV_PORT_OFF_REQUEST                             0
     64
     65
     66/** @name VMMDev events.
     67 *
     68 * Used mainly by VMMDevReq_AcknowledgeEvents/VMMDevEvents and version 1.3 of
     69 * VMMDevMemory.
     70 *
    10371 * @{
    10472 */
    105 
    106 /** guest can (== wants to) handle absolute coordinates */
    107 #define VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE      RT_BIT(0)
    108 /** host can (== wants to) send absolute coordinates */
    109 #define VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE       RT_BIT(1)
    110 /** guest can *NOT* switch to software cursor and therefore depends on the host cursor */
    111 #define VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR RT_BIT(2)
    112 /** host does NOT provide support for drawing the cursor itself (e.g. L4 console) */
    113 #define VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER   RT_BIT(3)
    114 /** The guest can read VMMDev events to find out about pointer movement */
    115 #define VBOXGUEST_MOUSE_GUEST_USES_VMMDEV       RT_BIT(4)
    116 
    117 /** fictive start address of the hypervisor physical memory for MmMapIoSpace */
    118 #define HYPERVISOR_PHYSICAL_START  0xf8000000
    119 
    120 /*
    121  * VMMDev Generic Request Interface
    122  */
    123 
    124 /** port for generic request interface */
    125 #define PORT_VMMDEV_REQUEST_OFFSET 0
    126 
    127 /** Current version of the VMMDev interface.
     73/** Host mouse capabilities has been changed. */
     74#define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED             RT_BIT(0)
     75/** HGCM event. */
     76#define VMMDEV_EVENT_HGCM                                   RT_BIT(1)
     77/** A display change request has been issued. */
     78#define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST                 RT_BIT(2)
     79/** Credentials are available for judgement. */
     80#define VMMDEV_EVENT_JUDGE_CREDENTIALS                      RT_BIT(3)
     81/** The guest has been restored. */
     82#define VMMDEV_EVENT_RESTORED                               RT_BIT(4)
     83/** Seamless mode state changed. */
     84#define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST           RT_BIT(5)
     85/** Memory balloon size changed. */
     86#define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST                 RT_BIT(6)
     87/** Statistics interval changed. */
     88#define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST     RT_BIT(7)
     89/** VRDP status changed. */
     90#define VMMDEV_EVENT_VRDP                                   RT_BIT(8)
     91/** New mouse position data available */
     92#define VMMDEV_EVENT_MOUSE_POSITION_CHANGED                 RT_BIT(9)
     93/** @} */
     94
     95
     96/** @defgroup grp_vmmdev_req    VMMDev Generic Request Interface
     97 * @{
     98 */
     99
     100/** @name Current version of the VMMDev interface.
    128101 *
    129102 * Additions are allowed to work only if
     
    133106 * @remark  These defines also live in the 16-bit and assembly versions of this header.
    134107 */
    135 #define VMMDEV_VERSION       0x00010004
    136 #define VMMDEV_VERSION_MAJOR (VMMDEV_VERSION >> 16)
    137 #define VMMDEV_VERSION_MINOR (VMMDEV_VERSION & 0xffff)
    138 
    139 /* Maximum request packet size */
     108#define VMMDEV_VERSION                      0x00010004
     109#define VMMDEV_VERSION_MAJOR                (VMMDEV_VERSION >> 16)
     110#define VMMDEV_VERSION_MINOR                (VMMDEV_VERSION & 0xffff)
     111/** @} */
     112
     113/** Maximum request packet size. */
    140114#define VMMDEV_MAX_VMMDEVREQ_SIZE           _1M
    141115
     
    217191#define VMMDEV_REQUEST_HEADER_VERSION (0x10001)
    218192
    219 #pragma pack(4)
    220 /** generic VMMDev request header */
    221 typedef struct
    222 {
    223     /** size of the structure in bytes (including body). Filled by caller */
     193#pragma pack(4) /* force structure dword packing here. */
     194
     195/**
     196 * Generic VMMDev request header.
     197 */
     198typedef struct
     199{
     200    /** IN: Size of the structure in bytes (including body). */
    224201    uint32_t size;
    225     /** version of the structure. Filled by caller */
     202    /** IN: Version of the structure.*/
    226203    uint32_t version;
    227     /** type of the request */
     204    /** IN: Type of the request. */
    228205    VMMDevRequestType requestType;
    229     /** return code. Filled by VMMDev */
     206    /** OUT: Return code. */
    230207    int32_t  rc;
    231     /** reserved fields */
     208    /** Reserved field no.1. MBZ. */
    232209    uint32_t reserved1;
     210    /** Reserved field no.2. MBZ. */
    233211    uint32_t reserved2;
    234212} VMMDevRequestHeader;
    235213AssertCompileSize(VMMDevRequestHeader, 24);
    236214
    237 /** mouse status request structure */
     215
     216/**
     217 * Mouse status request structure.
     218 *
     219 * Used by VMMDevReq_GetMouseStatus and VMMDevReq_SetMouseStatus.
     220 */
    238221typedef struct
    239222{
    240223    /** header */
    241224    VMMDevRequestHeader header;
    242     /** mouse feature mask */
     225    /** Mouse feature mask. See VMMDEV_MOUSE_*. */
    243226    uint32_t mouseFeatures;
    244     /** mouse x position */
     227    /** Mouse x position. */
    245228    uint32_t pointerXPos;
    246     /** mouse y position */
     229    /** Mouse y position. */
    247230    uint32_t pointerYPos;
    248231} VMMDevReqMouseStatus;
    249 
    250 /** Note VBOX_MOUSE_POINTER_* flags are used in guest video driver,
    251  *  values must be <= 0x8000 and must not be changed.
    252  */
    253 
    254 /** pointer is visible */
    255 #define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
    256 /** pointer has alpha channel */
    257 #define VBOX_MOUSE_POINTER_ALPHA   (0x0002)
    258 /** pointerData contains new pointer shape */
    259 #define VBOX_MOUSE_POINTER_SHAPE   (0x0004)
    260 
    261 /** mouse pointer shape/visibility change request */
    262 typedef struct
    263 {
    264     /** header */
    265     VMMDevRequestHeader header;
    266     /** VBOX_MOUSE_POINTER_* bit flags */
     232AssertCompileSize(VMMDevReqMouseStatus, 24+12);
     233
     234/** @name Mouse capability bits (VMMDevReqMouseStatus::mouseFeatures).
     235 * @{ */
     236/** The guest can (== wants to) handle absolute coordinates.  */
     237#define VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE                     RT_BIT(0)
     238/** The host can (== wants to) send absolute coordinates.
     239 * (Input not captured.) */
     240#define VMMDEV_MOUSE_HOST_CAN_ABSOLUTE                      RT_BIT(1)
     241/** The guest can *NOT* switch to software cursor and therefore depends on the
     242 * host cursor.
     243 *
     244 * When guest additions are installed and the host has promised to display the
     245 * cursor itself, the guest installs a hardware mouse driver. Don't ask the
     246 * guest to switch to a software cursor then. */
     247#define VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR                RT_BIT(2)
     248/** The host does NOT provide support for drawing the cursor itself.
     249 * This is for instance the case for the L4 console. */
     250#define VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER                  RT_BIT(3)
     251/** The guest can read VMMDev events to find out about pointer movement */
     252#define VMMDEV_MOUSE_GUEST_USES_VMMDEV                      RT_BIT(4)
     253/** @} */
     254
     255
     256/**
     257 * Mouse pointer shape/visibility change request.
     258 *
     259 * Used by VMMDevReq_SetPointerShape. The size is variable.
     260 */
     261typedef struct
     262{
     263    /** Header. */
     264    VMMDevRequestHeader header;
     265    /** VBOX_MOUSE_POINTER_* bit flags. */
    267266    uint32_t fFlags;
    268     /** x coordinate of hot spot */
     267    /** x coordinate of hot spot. */
    269268    uint32_t xHot;
    270     /** y coordinate of hot spot */
     269    /** y coordinate of hot spot. */
    271270    uint32_t yHot;
    272     /** width of the pointer in pixels */
     271    /** Width of the pointer in pixels. */
    273272    uint32_t width;
    274     /** height of the pointer in scanlines */
     273    /** Height of the pointer in scanlines. */
    275274    uint32_t height;
    276275    /** Pointer data.
     
    297296     ****
    298297     *
    299      * Preallocate 4 bytes for accessing actual data as p->pointerData
     298     * Preallocate 4 bytes for accessing actual data as p->pointerData.
    300299     */
    301300    char pointerData[4];
    302301} VMMDevReqMousePointer;
    303 
    304 /** string log request structure */
     302AssertCompileSize(VMMDevReqMousePointer, 24+24);
     303
     304/** @name VMMDevReqMousePointer::fFlags
     305 * @note The VBOX_MOUSE_POINTER_* flags are used in the guest video driver,
     306 *       values must be <= 0x8000 and must not be changed. (try make more sense
     307 *       of this, please).
     308 * @{
     309 */
     310/** pointer is visible */
     311#define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
     312/** pointer has alpha channel */
     313#define VBOX_MOUSE_POINTER_ALPHA   (0x0002)
     314/** pointerData contains new pointer shape */
     315#define VBOX_MOUSE_POINTER_SHAPE   (0x0004)
     316/** @} */
     317
     318
     319/**
     320 * String log request structure.
     321 *
     322 * Used by VMMDevReq_LogString.
     323 * @deprecated  Use the IPRT logger or VbglR3WriteLog instead.
     324 */
    305325typedef struct
    306326{
     
    310330    char szString[1];
    311331} VMMDevReqLogString;
    312 
    313 /** host version request structure */
    314 typedef struct
    315 {
    316     /** header */
    317     VMMDevRequestHeader header;
    318     /** major version */
     332AssertCompileSize(VMMDevReqLogString, 24+4);
     333
     334
     335/**
     336 * VirtualBox host version request structure.
     337 *
     338 * Used by VMMDevReq_GetHostVersion.
     339 */
     340typedef struct
     341{
     342    /** Header. */
     343    VMMDevRequestHeader header;
     344    /** Major version. */
    319345    uint32_t major;
    320     /** minor version */
     346    /** Minor version. */
    321347    uint32_t minor;
    322     /** build number */
     348    /** Build number. */
    323349    uint32_t build;
    324350} VMMDevReqHostVersion;
    325 
    326 /** guest capabilites structure */
    327 typedef struct
    328 {
    329     /** header */
    330     VMMDevRequestHeader header;
    331     /** capabilities (VMMDEV_GUEST_*) */
    332     uint32_t    caps;
     351AssertCompileSize(VMMDevReqHostVersion, 24+12);
     352
     353
     354/**
     355 * Guest capabilites structure.
     356 *
     357 * Used by VMMDevReq_ReportGuestCapabilities.
     358 */
     359typedef struct
     360{
     361    /** Header. */
     362    VMMDevRequestHeader header;
     363    /** Capabilities (VMMDEV_GUEST_*). */
     364    uint32_t caps;
    333365} VMMDevReqGuestCapabilities;
    334 
    335 /** guest capabilites structure */
    336 typedef struct
    337 {
    338     /** header */
    339     VMMDevRequestHeader header;
    340     /** mask of capabilities to be added */
    341     uint32_t    u32OrMask;
    342     /** mask of capabilities to be removed */
    343     uint32_t    u32NotMask;
     366AssertCompileSize(VMMDevReqGuestCapabilities, 24+4);
     367
     368/**
     369 * Guest capabilites structure, version 2.
     370 *
     371 * Used by VMMDevReq_SetGuestCapabilities.
     372 */
     373typedef struct
     374{
     375    /** Header. */
     376    VMMDevRequestHeader header;
     377    /** Mask of capabilities to be added. */
     378    uint32_t u32OrMask;
     379    /** Mask of capabilities to be removed. */
     380    uint32_t u32NotMask;
    344381} VMMDevReqGuestCapabilities2;
    345 
    346 /** idle request structure */
    347 typedef struct
    348 {
    349     /** header */
     382AssertCompileSize(VMMDevReqGuestCapabilities2, 24+8);
     383
     384/** @name Guest capability bits .
     385 * Used by VMMDevReq_ReportGuestCapabilities and VMMDevReq_SetGuestCapabilities.
     386 * @{ */
     387/** The guest supports seamless display rendering. */
     388#define VMMDEV_GUEST_SUPPORTS_SEAMLESS                      RT_BIT_32(0)
     389/** The guest supports mapping guest to host windows. */
     390#define VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING     RT_BIT_32(1)
     391/** The guest graphical additions are active.
     392 * Used for fast activation and deactivation of certain graphical operations
     393 * (e.g. resizing & seamless). The legacy VMMDevReq_ReportGuestCapabilities
     394 * request sets this automatically, but VMMDevReq_SetGuestCapabilities does
     395 * not. */
     396#define VMMDEV_GUEST_SUPPORTS_GRAPHICS                      RT_BIT_32(2)
     397/** @} */
     398
     399
     400/**
     401 * Idle request structure.
     402 *
     403 * Used by VMMDevReq_Idle.
     404 */
     405typedef struct
     406{
     407    /** Header. */
    350408    VMMDevRequestHeader header;
    351409} VMMDevReqIdle;
    352 
    353 /** host time request structure */
    354 typedef struct
    355 {
    356     /** header */
    357     VMMDevRequestHeader header;
    358     /** time in milliseconds since unix epoch. Filled by VMMDev. */
     410AssertCompileSize(VMMDevReqIdle, 24);
     411
     412
     413/**
     414 * Host time request structure.
     415 *
     416 * Used by VMMDevReq_GetHostTime.
     417 */
     418typedef struct
     419{
     420    /** Header */
     421    VMMDevRequestHeader header;
     422    /** OUT: Time in milliseconds since unix epoch. */
    359423    uint64_t time;
    360424} VMMDevReqHostTime;
    361 
    362 /** hypervisor info structure */
    363 typedef struct
    364 {
    365     /** header */
    366     VMMDevRequestHeader header;
    367     /** guest virtual address of proposed hypervisor start */
    368     /** TODO: Make this 64-bit compatible */
     425AssertCompileSize(VMMDevReqHostTime, 24+8);
     426
     427
     428/**
     429 * Hypervisor info structure.
     430 *
     431 * Used by VMMDevReq_GetHypervisorInfo and VMMDevReq_SetHypervisorInfo.
     432 */
     433typedef struct
     434{
     435    /** Header. */
     436    VMMDevRequestHeader header;
     437    /** Guest virtual address of proposed hypervisor start.
     438     * Not used by VMMDevReq_GetHypervisorInfo.
     439     * @todo Make this 64-bit compatible? */
    369440    RTGCPTR32 hypervisorStart;
    370     /** hypervisor size in bytes */
     441    /** Hypervisor size in bytes. */
    371442    uint32_t hypervisorSize;
    372443} VMMDevReqHypervisorInfo;
    373 
    374 /** system power requests */
     444AssertCompileSize(VMMDevReqHypervisorInfo, 24+8);
     445
     446
     447/**
     448 * Guest power requests.
     449 *
     450 * See VMMDevReq_SetPowerStatus and VMMDevPowerStateRequest.
     451 */
    375452typedef enum
    376453{
     
    381458    VMMDevPowerState_SizeHack = 0x7fffffff
    382459} VMMDevPowerState;
    383 
    384 /** system power status structure */
    385 typedef struct
    386 {
    387     /** header */
    388     VMMDevRequestHeader header;
    389     /** power state request */
     460AssertCompileSize(VMMDevPowerState, 4);
     461
     462/**
     463 * VM power status structure.
     464 *
     465 * Used by VMMDevReq_SetPowerStatus.
     466 */
     467typedef struct
     468{
     469    /** Header. */
     470    VMMDevRequestHeader header;
     471    /** Power state request. */
    390472    VMMDevPowerState powerState;
    391473} VMMDevPowerStateRequest;
    392 
    393 /** pending events structure */
    394 typedef struct
    395 {
    396     /** header */
    397     VMMDevRequestHeader header;
    398     /** pending event bitmap */
     474AssertCompileSize(VMMDevPowerStateRequest, 24+4);
     475
     476
     477/**
     478 * Pending events structure.
     479 *
     480 * Used by VMMDevReq_AcknowledgeEvents.
     481 */
     482typedef struct
     483{
     484    /** Header. */
     485    VMMDevRequestHeader header;
     486    /** OUT: Pending event mask. */
    399487    uint32_t events;
    400488} VMMDevEvents;
    401 
    402 /** guest filter mask control */
    403 typedef struct
    404 {
    405     /** header */
    406     VMMDevRequestHeader header;
    407     /** mask of events to be added to filter */
     489AssertCompileSize(VMMDevEvents, 24+4);
     490
     491
     492/**
     493 * Guest event filter mask control.
     494 *
     495 * Used by VMMDevReq_CtlGuestFilterMask.
     496 */
     497typedef struct
     498{
     499    /** Header. */
     500    VMMDevRequestHeader header;
     501    /** Mask of events to be added to the filter. */
    408502    uint32_t u32OrMask;
    409     /** mask of events to be removed from filter */
     503    /** Mask of events to be removed from the filter. */
    410504    uint32_t u32NotMask;
    411505} VMMDevCtlGuestFilterMask;
    412 
    413 /** guest information structure */
     506AssertCompileSize(VMMDevCtlGuestFilterMask, 24+8);
     507
     508
     509/**
     510 * Guest information structure.
     511 *
     512 * Used by VMMDevReportGuestInfo and PDMIVMMDEVCONNECTOR::pfnUpdateGuestVersion.
     513 */
    414514typedef struct VBoxGuestInfo
    415515{
    416516    /** The VMMDev interface version expected by additions. */
    417517    uint32_t additionsVersion;
    418     /** guest OS type */
     518    /** Guest OS type. */
    419519    VBOXOSTYPE osType;
    420     /** @todo */
    421520} VBoxGuestInfo;
    422 
    423 /** guest information structure */
    424 typedef struct
    425 {
    426     /** header */
     521AssertCompileSize(VBoxGuestInfo, 8);
     522
     523/**
     524 * Guest information report.
     525 *
     526 * Used by VMMDevReq_ReportGuestInfo.
     527 */
     528typedef struct
     529{
     530    /** Header. */
    427531    VMMDevRequestHeader header;
    428532    /** Guest information. */
    429533    VBoxGuestInfo guestInfo;
    430534} VMMDevReportGuestInfo;
    431 
    432 /** guest statistics values */
     535AssertCompileSize(VMMDevReportGuestInfo, 24+8);
     536
     537
     538/**
     539 * Guest statistics structure.
     540 *
     541 * Used by VMMDevReportGuestStats and PDMIVMMDEVCONNECTOR::pfnReportStatistics.
     542 */
     543typedef struct VBoxGuestStatistics
     544{
     545    /** Virtual CPU ID. */
     546    uint32_t        u32CpuId;
     547    /** Reported statistics. */
     548    uint32_t        u32StatCaps;
     549    /** Idle CPU load (0-100) for last interval. */
     550    uint32_t        u32CpuLoad_Idle;
     551    /** Kernel CPU load (0-100) for last interval. */
     552    uint32_t        u32CpuLoad_Kernel;
     553    /** User CPU load (0-100) for last interval. */
     554    uint32_t        u32CpuLoad_User;
     555    /** Nr of threads. */
     556    uint32_t        u32Threads;
     557    /** Nr of processes. */
     558    uint32_t        u32Processes;
     559    /** Nr of handles. */
     560    uint32_t        u32Handles;
     561    /** Memory load (0-100). */
     562    uint32_t        u32MemoryLoad;
     563    /** Page size of guest system. */
     564    uint32_t        u32PageSize;
     565    /** Total physical memory (in 4KB pages). */
     566    uint32_t        u32PhysMemTotal;
     567    /** Available physical memory (in 4KB pages). */
     568    uint32_t        u32PhysMemAvail;
     569    /** Ballooned physical memory (in 4KB pages). */
     570    uint32_t        u32PhysMemBalloon;
     571    /** Total number of committed memory (which is not necessarily in-use) (in 4KB pages). */
     572    uint32_t        u32MemCommitTotal;
     573    /** Total amount of memory used by the kernel (in 4KB pages). */
     574    uint32_t        u32MemKernelTotal;
     575    /** Total amount of paged memory used by the kernel (in 4KB pages). */
     576    uint32_t        u32MemKernelPaged;
     577    /** Total amount of nonpaged memory used by the kernel (in 4KB pages). */
     578    uint32_t        u32MemKernelNonPaged;
     579    /** Total amount of memory used for the system cache (in 4KB pages). */
     580    uint32_t        u32MemSystemCache;
     581    /** Pagefile size (in 4KB pages). */
     582    uint32_t        u32PageFileSize;
     583} VBoxGuestStatistics;
     584AssertCompileSize(VBoxGuestStatistics, 19*4);
     585
     586/** @name Guest statistics values (VBoxGuestStatistics::u32StatCaps).
     587 * @{ */
    433588#define VBOX_GUEST_STAT_CPU_LOAD_IDLE       RT_BIT(0)
    434589#define VBOX_GUEST_STAT_CPU_LOAD_KERNEL     RT_BIT(1)
     
    447602#define VBOX_GUEST_STAT_MEM_SYSTEM_CACHE    RT_BIT(14)
    448603#define VBOX_GUEST_STAT_PAGE_FILE_SIZE      RT_BIT(15)
    449 
    450 
    451 /** guest statistics structure */
    452 typedef struct VBoxGuestStatistics
    453 {
    454     /** Virtual CPU id */
    455     uint32_t        u32CpuId;
    456     /** Reported statistics */
    457     uint32_t        u32StatCaps;
    458     /** Idle CPU load (0-100) for last interval */
    459     uint32_t        u32CpuLoad_Idle;
    460     /** Kernel CPU load (0-100) for last interval */
    461     uint32_t        u32CpuLoad_Kernel;
    462     /** User CPU load (0-100) for last interval */
    463     uint32_t        u32CpuLoad_User;
    464     /** Nr of threads */
    465     uint32_t        u32Threads;
    466     /** Nr of processes */
    467     uint32_t        u32Processes;
    468     /** Nr of handles */
    469     uint32_t        u32Handles;
    470     /** Memory load (0-100) */
    471     uint32_t        u32MemoryLoad;
    472     /** Page size of guest system */
    473     uint32_t        u32PageSize;
    474     /** Total physical memory (in 4kb pages) */
    475     uint32_t        u32PhysMemTotal;
    476     /** Available physical memory (in 4kb pages) */
    477     uint32_t        u32PhysMemAvail;
    478     /** Ballooned physical memory (in 4kb pages) */
    479     uint32_t        u32PhysMemBalloon;
    480     /** Total number of committed memory (which is not necessarily in-use) (in 4kb pages) */
    481     uint32_t        u32MemCommitTotal;
    482     /** Total amount of memory used by the kernel (in 4kb pages) */
    483     uint32_t        u32MemKernelTotal;
    484     /** Total amount of paged memory used by the kernel (in 4kb pages) */
    485     uint32_t        u32MemKernelPaged;
    486     /** Total amount of nonpaged memory used by the kernel (in 4kb pages) */
    487     uint32_t        u32MemKernelNonPaged;
    488     /** Total amount of memory used for the system cache (in 4kb pages) */
    489     uint32_t        u32MemSystemCache;
    490     /** Pagefile size (in 4kb pages) */
    491     uint32_t        u32PageFileSize;
    492 } VBoxGuestStatistics;
    493 
    494 /** guest statistics command structure */
    495 typedef struct
    496 {
    497     /** header */
     604/** @} */
     605
     606/**
     607 * Guest statistics command structure.
     608 *
     609 * Used by VMMDevReq_ReportGuestStats.
     610 */
     611typedef struct
     612{
     613    /** Header. */
    498614    VMMDevRequestHeader header;
    499615    /** Guest information. */
    500616    VBoxGuestStatistics guestStats;
    501617} VMMDevReportGuestStats;
    502 
    503 /** memory balloon change request structure */
    504 #define VMMDEV_MAX_MEMORY_BALLOON(PhysMemTotal)     ((90*PhysMemTotal)/100)
    505 
    506 typedef struct
    507 {
    508     /** header */
    509     VMMDevRequestHeader header;
    510     uint32_t            u32BalloonSize;     /* balloon size in megabytes */
    511     uint32_t            u32PhysMemSize;     /* guest ram size in megabytes */
     618AssertCompileSize(VMMDevReportGuestStats, 24+19*4);
     619
     620
     621/** Memory balloon change request structure. */
     622#define VMMDEV_MAX_MEMORY_BALLOON(PhysMemTotal)     ( (9 * (PhysMemTotal)) / 10 )
     623
     624/**
     625 * Poll for ballooning change request.
     626 *
     627 * Used by VMMDevReq_GetMemBalloonChangeRequest.
     628 */
     629typedef struct
     630{
     631    /** Header. */
     632    VMMDevRequestHeader header;
     633    /** Balloon size in megabytes. */
     634    uint32_t            u32BalloonSize;
     635    /** Guest ram size in megabytes. */
     636    uint32_t            u32PhysMemSize;
     637    /** Setting this to VMMDEV_EVENT_BALLOON_CHANGE_REQUEST indicates that the
     638     * request is a response to that event.
     639     * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
    512640    uint32_t            eventAck;
    513641} VMMDevGetMemBalloonChangeRequest;
    514 
    515 /** inflate/deflate memory balloon structure */
    516 #define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES            (_1M/4096)
    517 #define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE             (VMMDEV_MEMORY_BALLOON_CHUNK_PAGES*4096)
    518 
    519 typedef struct
    520 {
    521     /** header */
    522     VMMDevRequestHeader header;
     642AssertCompileSize(VMMDevGetMemBalloonChangeRequest, 24+12);
     643
     644
     645/**
     646 * Change the size of the balloon.
     647 *
     648 * Used by VMMDevReq_ChangeMemBalloon.
     649 */
     650typedef struct
     651{
     652    /** Header. */
     653    VMMDevRequestHeader header;
     654    /** The number of pages in the array. */
    523655    uint32_t            cPages;
    524     uint32_t            fInflate;       /* true = inflate, false = defalte */
     656    /** true = inflate, false = deflate.  */
     657    uint32_t            fInflate;
    525658    /** Physical address (RTGCPHYS) of each page, variable size. */
    526659    RTGCPHYS            aPhysPage[1];
    527660} VMMDevChangeMemBalloon;
    528 
    529 /** guest statistics interval change request structure */
    530 typedef struct
    531 {
    532     /** header */
    533     VMMDevRequestHeader header;
    534     uint32_t            u32StatInterval; /* interval in seconds */
     661AssertCompileSize(VMMDevChangeMemBalloon, 24+16);
     662
     663/** @name The ballooning chunk size which VMMDev works at.
     664 * @{ */
     665#define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES            (_1M/4096)
     666#define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE             (VMMDEV_MEMORY_BALLOON_CHUNK_PAGES*4096)
     667/** @} */
     668
     669
     670/**
     671 * Guest statistics interval change request structure.
     672 *
     673 * Used by VMMDevReq_GetStatisticsChangeRequest.
     674 */
     675typedef struct
     676{
     677    /** Header. */
     678    VMMDevRequestHeader header;
     679    /** The interval in seconds. */
     680    uint32_t            u32StatInterval;
     681    /** Setting this to VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST indicates
     682     * that the request is a response to that event.
     683     * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
    535684    uint32_t            eventAck;
    536685} VMMDevGetStatisticsChangeRequest;
    537 
    538 /** display change request structure */
    539 typedef struct
    540 {
    541     /** header */
    542     VMMDevRequestHeader header;
    543     /** horizontal pixel resolution (0 = do not change) */
    544     uint32_t xres;
    545     /** vertical pixel resolution (0 = do not change) */
    546     uint32_t yres;
    547     /** bits per pixel (0 = do not change) */
    548     uint32_t bpp;
    549     /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
    550      *  Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
    551      */
    552     uint32_t eventAck;
    553 } VMMDevDisplayChangeRequest;
    554 
    555 typedef struct
    556 {
    557     /** header */
    558     VMMDevRequestHeader header;
    559     /** horizontal pixel resolution (0 = do not change) */
    560     uint32_t xres;
    561     /** vertical pixel resolution (0 = do not change) */
    562     uint32_t yres;
    563     /** bits per pixel (0 = do not change) */
    564     uint32_t bpp;
    565     /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
    566      *  Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
    567      */
    568     uint32_t eventAck;
    569     /** 0 for primary display, 1 for the first secondary, etc. */
    570     uint32_t display;
    571 } VMMDevDisplayChangeRequest2;
    572 
    573 /** video mode supported request structure */
    574 typedef struct
    575 {
    576     /** header */
    577     VMMDevRequestHeader header;
    578     /** horizontal pixel resolution (input) */
    579     uint32_t width;
    580     /** vertical pixel resolution (input) */
    581     uint32_t height;
    582     /** bits per pixel (input) */
    583     uint32_t bpp;
    584     /** supported flag (output) */
    585     bool fSupported;
    586 } VMMDevVideoModeSupportedRequest;
    587 
    588 /** video modes height reduction request structure */
    589 typedef struct
    590 {
    591     /** header */
    592     VMMDevRequestHeader header;
    593     /** height reduction in pixels (output) */
    594     uint32_t heightReduction;
    595 } VMMDevGetHeightReductionRequest;
    596 
    597 #define VRDP_EXPERIENCE_LEVEL_ZERO     0 /* Theming disabled. */
    598 #define VRDP_EXPERIENCE_LEVEL_LOW      1 /* Full window dragging and desktop wallpaper disabled. */
    599 #define VRDP_EXPERIENCE_LEVEL_MEDIUM   2 /* Font smoothing, gradients. */
    600 #define VRDP_EXPERIENCE_LEVEL_HIGH     3 /* Animation effects disabled. */
    601 #define VRDP_EXPERIENCE_LEVEL_FULL     4 /* Everything enabled. */
    602 
    603 typedef struct
    604 {
    605     /** header */
    606     VMMDevRequestHeader header;
    607     /** Whether VRDP is active or not */
    608     uint8_t u8VRDPActive;
    609     /** The configured experience level for active VRDP. */
    610     uint32_t u32VRDPExperienceLevel;
    611 } VMMDevVRDPChangeRequest;
    612 
    613 
    614 
     686AssertCompileSize(VMMDevGetStatisticsChangeRequest, 24+8);
     687
     688
     689/** The length of a string field in the credentials request.
     690 * @see VMMDevCredentials  */
     691#define VMMDEV_CREDENTIALS_STRLEN           128
     692
     693/**
     694 * Credentials request structure.
     695 *
     696 * Used by VMMDevReq_QueryCredentials.
     697 */
     698#pragma pack(4)
     699typedef struct
     700{
     701    /** Header. */
     702    VMMDevRequestHeader header;
     703    /** IN/OUT: Request flags. */
     704    uint32_t u32Flags;
     705    /** OUT: User name (UTF-8). */
     706    char szUserName[VMMDEV_CREDENTIALS_STRLEN];
     707    /** OUT: Password (UTF-8). */
     708    char szPassword[VMMDEV_CREDENTIALS_STRLEN];
     709    /** OUT: Domain name (UTF-8). */
     710    char szDomain[VMMDEV_CREDENTIALS_STRLEN];
     711} VMMDevCredentials;
     712AssertCompileSize(VMMDevCredentials, 24+4+3*128);
    615713#pragma pack()
    616714
    617 #ifdef VBOX_WITH_HGCM
    618 
    619 /** HGCM flags.
    620  *  @{
    621  */
    622 #define VBOX_HGCM_REQ_DONE      (0x1)
    623 #define VBOX_HGCM_REQ_CANCELLED (0x2)
    624 /** @} */
    625 
    626 #pragma pack(4)
    627 typedef struct _VMMDevHGCMRequestHeader
    628 {
    629     /** Request header. */
    630     VMMDevRequestHeader header;
    631 
    632     /** HGCM flags. */
    633     uint32_t fu32Flags;
    634 
    635     /** Result code. */
    636     int32_t result;
    637 } VMMDevHGCMRequestHeader;
    638 AssertCompileSize(VMMDevHGCMRequestHeader, 24+8);
    639 
    640 /** HGCM service location types. */
    641 typedef enum
    642 {
    643     VMMDevHGCMLoc_Invalid    = 0,
    644     VMMDevHGCMLoc_LocalHost  = 1,
    645     VMMDevHGCMLoc_LocalHost_Existing = 2,
    646     VMMDevHGCMLoc_SizeHack   = 0x7fffffff
    647 } HGCMServiceLocationType;
    648 
    649 typedef struct
    650 {
    651     char achName[128]; /**< This is really szName. */
    652 } HGCMServiceLocationHost;
    653 
    654 typedef struct HGCMSERVICELOCATION
    655 {
    656     /** Type of the location. */
    657     HGCMServiceLocationType type;
    658 
    659     union
    660     {
    661         HGCMServiceLocationHost host;
    662     } u;
    663 } HGCMServiceLocation;
    664 
    665 typedef struct
    666 {
    667     /* request header */
    668     VMMDevHGCMRequestHeader header;
    669 
    670     /** IN: Description of service to connect to. */
    671     HGCMServiceLocation loc;
    672 
    673     /** OUT: Client identifier assigned by local instance of HGCM. */
    674     uint32_t u32ClientID;
    675 } VMMDevHGCMConnect;
    676 
    677 typedef struct
    678 {
    679     /* request header */
    680     VMMDevHGCMRequestHeader header;
    681 
    682     /** IN: Client identifier. */
    683     uint32_t u32ClientID;
    684 } VMMDevHGCMDisconnect;
    685 
    686 typedef enum
    687 {
    688     VMMDevHGCMParmType_Invalid            = 0,
    689     VMMDevHGCMParmType_32bit              = 1,
    690     VMMDevHGCMParmType_64bit              = 2,
    691     VMMDevHGCMParmType_PhysAddr           = 3,
    692     VMMDevHGCMParmType_LinAddr            = 4, /**< In and Out */
    693     VMMDevHGCMParmType_LinAddr_In         = 5, /**< In  (read;  host<-guest) */
    694     VMMDevHGCMParmType_LinAddr_Out        = 6, /**< Out (write; host->guest) */
    695     VMMDevHGCMParmType_LinAddr_Locked     = 7, /**< Locked In and Out */
    696     VMMDevHGCMParmType_LinAddr_Locked_In  = 8, /**< Locked In  (read;  host<-guest) */
    697     VMMDevHGCMParmType_LinAddr_Locked_Out = 9, /**< Locked Out (write; host->guest) */
    698     VMMDevHGCMParmType_SizeHack           = 0x7fffffff
    699 } HGCMFunctionParameterType;
    700 
    701 #ifdef VBOX_WITH_64_BITS_GUESTS
    702 typedef struct _HGCMFUNCTIONPARAMETER32
    703 {
    704     HGCMFunctionParameterType type;
    705     union
    706     {
    707         uint32_t   value32;
    708         uint64_t   value64;
    709         struct
    710         {
    711             uint32_t size;
    712 
    713             union
    714             {
    715                 RTGCPHYS32 physAddr;
    716                 RTGCPTR32  linearAddr;
    717             } u;
    718         } Pointer;
    719     } u;
    720 #ifdef __cplusplus
    721     void SetUInt32(uint32_t u32)
    722     {
    723         type = VMMDevHGCMParmType_32bit;
    724         u.value64 = 0; /* init unused bits to 0 */
    725         u.value32 = u32;
    726     }
    727 
    728     int GetUInt32(uint32_t *pu32)
    729     {
    730         if (type == VMMDevHGCMParmType_32bit)
    731         {
    732             *pu32 = u.value32;
    733             return VINF_SUCCESS;
    734         }
    735         return VERR_INVALID_PARAMETER;
    736     }
    737 
    738     void SetUInt64(uint64_t u64)
    739     {
    740         type      = VMMDevHGCMParmType_64bit;
    741         u.value64 = u64;
    742     }
    743 
    744     int GetUInt64(uint64_t *pu64)
    745     {
    746         if (type == VMMDevHGCMParmType_64bit)
    747         {
    748             *pu64 = u.value64;
    749             return VINF_SUCCESS;
    750         }
    751         return VERR_INVALID_PARAMETER;
    752     }
    753 
    754     void SetPtr(void *pv, uint32_t cb)
    755     {
    756         type                    = VMMDevHGCMParmType_LinAddr;
    757         u.Pointer.size          = cb;
    758         u.Pointer.u.linearAddr  = (RTGCPTR32)(uintptr_t)pv;
    759     }
    760 #endif
    761 } HGCMFunctionParameter32;
    762 
    763 typedef struct _HGCMFUNCTIONPARAMETER64
    764 {
    765     HGCMFunctionParameterType type;
    766     union
    767     {
    768         uint32_t   value32;
    769         uint64_t   value64;
    770         struct
    771         {
    772             uint32_t size;
    773 
    774             union
    775             {
    776                 RTGCPHYS64 physAddr;
    777                 RTGCPTR64  linearAddr;
    778             } u;
    779         } Pointer;
    780     } u;
    781 #ifdef __cplusplus
    782     void SetUInt32(uint32_t u32)
    783     {
    784         type = VMMDevHGCMParmType_32bit;
    785         u.value64 = 0; /* init unused bits to 0 */
    786         u.value32 = u32;
    787     }
    788 
    789     int GetUInt32(uint32_t *pu32)
    790     {
    791         if (type == VMMDevHGCMParmType_32bit)
    792         {
    793             *pu32 = u.value32;
    794             return VINF_SUCCESS;
    795         }
    796         return VERR_INVALID_PARAMETER;
    797     }
    798 
    799     void SetUInt64(uint64_t u64)
    800     {
    801         type      = VMMDevHGCMParmType_64bit;
    802         u.value64 = u64;
    803     }
    804 
    805     int GetUInt64(uint64_t *pu64)
    806     {
    807         if (type == VMMDevHGCMParmType_64bit)
    808         {
    809             *pu64 = u.value64;
    810             return VINF_SUCCESS;
    811         }
    812         return VERR_INVALID_PARAMETER;
    813     }
    814 
    815     void SetPtr(void *pv, uint32_t cb)
    816     {
    817         type                    = VMMDevHGCMParmType_LinAddr;
    818         u.Pointer.size          = cb;
    819         u.Pointer.u.linearAddr  = (uintptr_t)pv;
    820     }
    821 #endif
    822 } HGCMFunctionParameter64;
    823 #else /* !VBOX_WITH_64_BITS_GUESTS */
    824 typedef struct _HGCMFUNCTIONPARAMETER
    825 {
    826     HGCMFunctionParameterType type;
    827     union
    828     {
    829         uint32_t   value32;
    830         uint64_t   value64;
    831         struct
    832         {
    833             uint32_t size;
    834 
    835             union
    836             {
    837                 RTGCPHYS32 physAddr;
    838                 RTGCPTR32  linearAddr;
    839             } u;
    840         } Pointer;
    841     } u;
    842 #ifdef __cplusplus
    843     void SetUInt32(uint32_t u32)
    844     {
    845         type = VMMDevHGCMParmType_32bit;
    846         u.value64 = 0; /* init unused bits to 0 */
    847         u.value32 = u32;
    848     }
    849 
    850     int GetUInt32(uint32_t *pu32)
    851     {
    852         if (type == VMMDevHGCMParmType_32bit)
    853         {
    854             *pu32 = u.value32;
    855             return VINF_SUCCESS;
    856         }
    857         return VERR_INVALID_PARAMETER;
    858     }
    859 
    860     void SetUInt64(uint64_t u64)
    861     {
    862         type      = VMMDevHGCMParmType_64bit;
    863         u.value64 = u64;
    864     }
    865 
    866     int GetUInt64(uint64_t *pu64)
    867     {
    868         if (type == VMMDevHGCMParmType_64bit)
    869         {
    870             *pu64 = u.value64;
    871             return VINF_SUCCESS;
    872         }
    873         return VERR_INVALID_PARAMETER;
    874     }
    875 
    876     void SetPtr(void *pv, uint32_t cb)
    877     {
    878         type                    = VMMDevHGCMParmType_LinAddr;
    879         u.Pointer.size          = cb;
    880         u.Pointer.u.linearAddr  = (uintptr_t)pv;
    881     }
    882 #endif
    883 } HGCMFunctionParameter;
    884 #endif /* !VBOX_WITH_64_BITS_GUESTS */
    885 
    886 
    887 #ifdef VBOX_WITH_64_BITS_GUESTS
    888 /* Redefine the structure type for the guest code. */
    889 # ifndef VBOX_HGCM_HOST_CODE
    890 #  if ARCH_BITS == 64
    891 #    define HGCMFunctionParameter HGCMFunctionParameter64
    892 #  elif ARCH_BITS == 32
    893 #    define HGCMFunctionParameter HGCMFunctionParameter32
    894 #  else
    895 #   error "Unsupported sizeof (void *)"
    896 #  endif
    897 # endif /* !VBOX_HGCM_HOST_CODE */
    898 #endif /* VBOX_WITH_64_BITS_GUESTS */
    899 
    900 typedef struct
    901 {
    902     /* request header */
    903     VMMDevHGCMRequestHeader header;
    904 
    905     /** IN: Client identifier. */
    906     uint32_t u32ClientID;
    907     /** IN: Service function number. */
    908     uint32_t u32Function;
    909     /** IN: Number of parameters. */
    910     uint32_t cParms;
    911     /** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
    912 } VMMDevHGCMCall;
    913 #pragma pack()
    914 
    915 #define VMMDEV_HGCM_CALL_PARMS(a)   ((HGCMFunctionParameter *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
    916 #define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
    917 
    918 #ifdef VBOX_WITH_64_BITS_GUESTS
    919 /* Explicit defines for the host code. */
    920 # ifdef VBOX_HGCM_HOST_CODE
    921 #  define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
    922 #  define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
    923 # endif /* VBOX_HGCM_HOST_CODE */
    924 #endif /* VBOX_WITH_64_BITS_GUESTS */
    925 
    926 #define VBOX_HGCM_MAX_PARMS 32
    927 
    928 /* The Cancel request is issued using the same physical memory address
    929  * as was used for the corresponding initial HGCMCall.
    930  */
    931 typedef struct
    932 {
    933     /* request header */
    934     VMMDevHGCMRequestHeader header;
    935 } VMMDevHGCMCancel;
    936 
    937 #endif /* VBOX_WITH_HGCM */
    938 
    939 
    940 #define VBVA_F_STATUS_ACCEPTED (0x01)
    941 #define VBVA_F_STATUS_ENABLED  (0x02)
    942 
    943 #pragma pack(4)
    944 
    945 typedef struct _VMMDevVideoAccelEnable
    946 {
    947     /* request header */
    948     VMMDevRequestHeader header;
    949 
    950     /** 0 - disable, !0 - enable. */
    951     uint32_t u32Enable;
    952 
    953     /** The size of VBVAMEMORY::au8RingBuffer expected by driver.
    954      *  The host will refuse to enable VBVA if the size is not equal to
    955      *  VBVA_RING_BUFFER_SIZE.
    956      */
    957     uint32_t cbRingBuffer;
    958 
    959     /** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
    960     uint32_t fu32Status;
    961 
    962 } VMMDevVideoAccelEnable;
    963 
    964 typedef struct _VMMDevVideoAccelFlush
    965 {
    966     /* request header */
    967     VMMDevRequestHeader header;
    968 
    969 } VMMDevVideoAccelFlush;
    970 
    971 
    972 typedef struct _VMMDevVideoSetVisibleRegion
    973 {
    974     /* request header */
    975     VMMDevRequestHeader header;
    976 
    977     /** Number of rectangles */
    978     uint32_t cRect;
    979 
    980     /** Rectangle array */
    981     RTRECT   Rect;
    982 } VMMDevVideoSetVisibleRegion;
    983 
    984 
    985 /** Seamless mode */
    986 typedef enum
    987 {
    988     VMMDev_Seamless_Disabled         = 0,     /* normal mode; entire guest desktop displayed */
    989     VMMDev_Seamless_Visible_Region   = 1,     /* visible region mode; only top-level guest windows displayed */
    990     VMMDev_Seamless_Host_Window      = 2      /* windowed mode; each top-level guest window is represented in a host window */
    991 } VMMDevSeamlessMode;
    992 
    993 typedef struct
    994 {
    995     /** header */
    996     VMMDevRequestHeader header;
    997 
    998     /** New seamless mode */
    999     VMMDevSeamlessMode  mode;
    1000     /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST.
    1001      *  Values: 0 - just querying, VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST - event acknowledged.
    1002      */
    1003     uint32_t eventAck;
    1004 } VMMDevSeamlessChangeRequest;
    1005 
    1006 #pragma pack()
    1007 
    1008 #pragma pack(1)
    1009 /** VBVA command header. */
    1010 typedef struct _VBVACMDHDR
    1011 {
    1012    /** Coordinates of affected rectangle. */
    1013    int16_t x;
    1014    int16_t y;
    1015    uint16_t w;
    1016    uint16_t h;
    1017 } VBVACMDHDR;
    1018 #pragma pack()
    1019 
    1020 /* The VBVA ring buffer is suitable for transferring large (< 2gb) amount of data.
    1021  * For example big bitmaps which do not fit to the buffer.
    1022  *
    1023  * Guest starts writing to the buffer by initializing a record entry in the
    1024  * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
    1025  * written. As data is written to the ring buffer, the guest increases off32End
    1026  * for the record.
    1027  *
    1028  * The host reads the aRecords on flushes and processes all completed records.
    1029  * When host encounters situation when only a partial record presents and
    1030  * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE - VBVA_RING_BUFFER_THRESHOLD,
    1031  * the host fetched all record data and updates off32Head. After that on each flush
    1032  * the host continues fetching the data until the record is completed.
    1033  *
    1034  */
    1035 
    1036 #define VBVA_RING_BUFFER_SIZE        (_4M - _1K)
    1037 #define VBVA_RING_BUFFER_THRESHOLD   (4 * _1K)
    1038 
    1039 #define VBVA_MAX_RECORDS (64)
    1040 
    1041 #define VBVA_F_MODE_ENABLED         (0x00000001)
    1042 #define VBVA_F_MODE_VRDP            (0x00000002)
    1043 #define VBVA_F_MODE_VRDP_RESET      (0x00000004)
    1044 #define VBVA_F_MODE_VRDP_ORDER_MASK (0x00000008)
    1045 
    1046 #define VBVA_F_RECORD_PARTIAL   (0x80000000)
    1047 
    1048 #pragma pack(1)
    1049 typedef struct _VBVARECORD
    1050 {
    1051     /** The length of the record. Changed by guest. */
    1052     uint32_t cbRecord;
    1053 } VBVARECORD;
    1054 
    1055 typedef struct _VBVAMEMORY
    1056 {
    1057     /** VBVA_F_MODE_* */
    1058     uint32_t fu32ModeFlags;
    1059 
    1060     /** The offset where the data start in the buffer. */
    1061     uint32_t off32Data;
    1062     /** The offset where next data must be placed in the buffer. */
    1063     uint32_t off32Free;
    1064 
    1065     /** The ring buffer for data. */
    1066     uint8_t  au8RingBuffer[VBVA_RING_BUFFER_SIZE];
    1067 
    1068     /** The queue of record descriptions. */
    1069     VBVARECORD aRecords[VBVA_MAX_RECORDS];
    1070     uint32_t indexRecordFirst;
    1071     uint32_t indexRecordFree;
    1072 
    1073     /* RDP orders supported by the client. The guest reports only them
    1074      * and falls back to DIRTY rects for not supported ones.
    1075      *
    1076      * (1 << VBVA_VRDP_*)
    1077      */
    1078     uint32_t fu32SupportedOrders;
    1079 
    1080 } VBVAMEMORY;
    1081 #pragma pack()
    1082 
    1083 /** @} */
    1084 
    1085 
    1086 /**
    1087  * VMMDev RAM
    1088  * @{
    1089  */
    1090 
    1091 #pragma pack(1)
    1092 /** Layout of VMMDEV RAM region that contains information for guest */
    1093 typedef struct
    1094 {
    1095     /** size */
    1096     uint32_t u32Size;
    1097     /** version */
    1098     uint32_t u32Version;
    1099 
    1100     union {
    1101         /** Flag telling that VMMDev set the IRQ and acknowlegment is required */
    1102         struct {
    1103             bool fHaveEvents;
    1104         } V1_04;
    1105 
    1106         struct {
    1107             /** Pending events flags, set by host. */
    1108             uint32_t u32HostEvents;
    1109             /** Mask of events the guest wants to see, set by guest. */
    1110             uint32_t u32GuestEventMask;
    1111         } V1_03;
    1112     } V;
    1113 
    1114     VBVAMEMORY vbvaMemory;
    1115 
    1116 } VMMDevMemory;
    1117 #pragma pack()
    1118 
    1119 /** Version of VMMDevMemory structure. */
    1120 #define VMMDEV_MEMORY_VERSION (1)
    1121 
    1122 /** @} */
    1123 
    1124 
    1125 /**
    1126  * VMMDev events.
    1127  * @{
    1128  */
    1129 
    1130 /** Host mouse capabilities has been changed. */
    1131 #define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED             RT_BIT(0)
    1132 /** HGCM event. */
    1133 #define VMMDEV_EVENT_HGCM                                   RT_BIT(1)
    1134 /** A display change request has been issued. */
    1135 #define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST                 RT_BIT(2)
    1136 /** Credentials are available for judgement. */
    1137 #define VMMDEV_EVENT_JUDGE_CREDENTIALS                      RT_BIT(3)
    1138 /** The guest has been restored. */
    1139 #define VMMDEV_EVENT_RESTORED                               RT_BIT(4)
    1140 /** Seamless mode state changed */
    1141 #define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST           RT_BIT(5)
    1142 /** Memory balloon size changed */
    1143 #define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST                 RT_BIT(6)
    1144 /** Statistics interval changed */
    1145 #define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST     RT_BIT(7)
    1146 /** VRDP status changed. */
    1147 #define VMMDEV_EVENT_VRDP                                   RT_BIT(8)
    1148 /** New mouse position data available */
    1149 #define VMMDEV_EVENT_MOUSE_POSITION_CHANGED                 RT_BIT(9)
    1150 
    1151 /** @} */
    1152 
    1153 
    1154 /*
    1155  * Credentials request flags and structure
    1156  */
    1157 
    1158 #define VMMDEV_CREDENTIALS_STRLEN           128
    1159 
     715/** @name Credentials request flag (VMMDevCredentials::u32Flags)
     716 * @{ */
    1160717/** query from host whether credentials are present */
    1161718#define VMMDEV_CREDENTIALS_QUERYPRESENCE     RT_BIT(1)
     
    1179736/** flag telling guest that local logons should be prohibited */
    1180737#define VMMDEV_CREDENTIALS_NOLOCALLOGON      RT_BIT(17)
    1181 
    1182 /** credentials request structure */
    1183 #pragma pack(4)
    1184 typedef struct _VMMDevCredentials
     738/** @} */
     739
     740
     741/**
     742 * Seamless mode.
     743 *
     744 * Used by VbglR3SeamlessWaitEvent
     745 *
     746 * @todo DARN! DARN! DARN! Who forgot to do the 32-bit hack here???
     747 *       FIXME! XXX!
     748 *
     749 *       We will now have to carefully check how our compilers have treated this
     750 *       flag. If any are compressing it into a byte type, we'll have to check
     751 *       how the request memory is initialized. If we are 104% sure it's ok to
     752 *       expand it, we'll expand it. If not, we must redefine the field to a
     753 *       uint8_t and a 3 byte padding.
     754 *  */
     755typedef enum
     756{
     757    VMMDev_Seamless_Disabled         = 0,     /**< normal mode; entire guest desktop displayed. */
     758    VMMDev_Seamless_Visible_Region   = 1,     /**< visible region mode; only top-level guest windows displayed. */
     759    VMMDev_Seamless_Host_Window      = 2      /**< windowed mode; each top-level guest window is represented in a host window. */
     760} VMMDevSeamlessMode;
     761
     762/**
     763 * Seamless mode change request structure.
     764 *
     765 * Used by VMMDevReq_GetSeamlessChangeRequest.
     766 */
     767typedef struct
     768{
     769    /** Header. */
     770    VMMDevRequestHeader header;
     771
     772    /** New seamless mode. */
     773    VMMDevSeamlessMode mode;
     774    /** Setting this to VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST indicates
     775     * that the request is a response to that event.
     776     * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
     777    uint32_t eventAck;
     778} VMMDevSeamlessChangeRequest;
     779AssertCompileSize(VMMDevSeamlessChangeRequest, 24+8);
     780AssertCompileMemberOffset(VMMDevSeamlessChangeRequest, eventAck, 24+4);
     781
     782
     783/**
     784 * Display change request structure.
     785 *
     786 * Used by VMMDevReq_GetDisplayChangeRequest.
     787 */
     788typedef struct
     789{
     790    /** Header. */
     791    VMMDevRequestHeader header;
     792    /** Horizontal pixel resolution (0 = do not change). */
     793    uint32_t xres;
     794    /** Vertical pixel resolution (0 = do not change). */
     795    uint32_t yres;
     796    /** Bits per pixel (0 = do not change). */
     797    uint32_t bpp;
     798    /** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
     799     * that the request is a response to that event.
     800     * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
     801    uint32_t eventAck;
     802} VMMDevDisplayChangeRequest;
     803AssertCompileSize(VMMDevDisplayChangeRequest, 24+16);
     804
     805
     806/**
     807 * Display change request structure, version 2.
     808 *
     809 * Used by VMMDevReq_GetDisplayChangeRequest2.
     810 */
     811typedef struct
     812{
     813    /** Header. */
     814    VMMDevRequestHeader header;
     815    /** Horizontal pixel resolution (0 = do not change). */
     816    uint32_t xres;
     817    /** Vertical pixel resolution (0 = do not change). */
     818    uint32_t yres;
     819    /** Bits per pixel (0 = do not change). */
     820    uint32_t bpp;
     821    /** Setting this to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST indicates
     822     * that the request is a response to that event.
     823     * (Don't confuse this with VMMDevReq_AcknowledgeEvents.) */
     824    uint32_t eventAck;
     825    /** 0 for primary display, 1 for the first secondary, etc. */
     826    uint32_t display;
     827} VMMDevDisplayChangeRequest2;
     828AssertCompileSize(VMMDevDisplayChangeRequest2, 24+20);
     829
     830
     831/**
     832 * Video mode supported request structure.
     833 *
     834 * Used by VMMDevReq_VideoModeSupported.
     835 */
     836typedef struct
     837{
     838    /** Header. */
     839    VMMDevRequestHeader header;
     840    /** IN: Horizontal pixel resolution. */
     841    uint32_t width;
     842    /** IN: Vertical pixel resolution. */
     843    uint32_t height;
     844    /** IN: Bits per pixel. */
     845    uint32_t bpp;
     846    /** OUT: Support indicator. */
     847    bool fSupported;
     848} VMMDevVideoModeSupportedRequest;
     849AssertCompileSize(VMMDevVideoModeSupportedRequest, 24+16);
     850
     851
     852/**
     853 * Video modes height reduction request structure.
     854 *
     855 * Used by VMMDevReq_GetHeightReduction.
     856 */
     857typedef struct
     858{
     859    /** Header. */
     860    VMMDevRequestHeader header;
     861    /** OUT: Height reduction in pixels. */
     862    uint32_t heightReduction;
     863} VMMDevGetHeightReductionRequest;
     864AssertCompileSize(VMMDevGetHeightReductionRequest, 24+4);
     865
     866
     867/**
     868 * VRDP change request structure.
     869 *
     870 * Used by VMMDevReq_GetVRDPChangeRequest.
     871 */
     872typedef struct
     873{
     874    /** Header */
     875    VMMDevRequestHeader header;
     876    /** Whether VRDP is active or not. */
     877    uint8_t u8VRDPActive;
     878    /** The configured experience level for active VRDP. */
     879    uint32_t u32VRDPExperienceLevel;
     880} VMMDevVRDPChangeRequest;
     881AssertCompileSize(VMMDevVRDPChangeRequest, 24+8);
     882AssertCompileMemberOffset(VMMDevVRDPChangeRequest, u8VRDPActive, 24);
     883AssertCompileMemberOffset(VMMDevVRDPChangeRequest, u32VRDPExperienceLevel, 24+4);
     884
     885/** @name VRDP Experience level (VMMDevVRDPChangeRequest::u32VRDPExperienceLevel)
     886 * @{ */
     887#define VRDP_EXPERIENCE_LEVEL_ZERO     0 /**< Theming disabled. */
     888#define VRDP_EXPERIENCE_LEVEL_LOW      1 /**< Full window dragging and desktop wallpaper disabled. */
     889#define VRDP_EXPERIENCE_LEVEL_MEDIUM   2 /**< Font smoothing, gradients. */
     890#define VRDP_EXPERIENCE_LEVEL_HIGH     3 /**< Animation effects disabled. */
     891#define VRDP_EXPERIENCE_LEVEL_FULL     4 /**< Everything enabled. */
     892/** @} */
     893
     894
     895/**
     896 * VBVA enable request structure.
     897 *
     898 * Used by VMMDevReq_VideoAccelEnable.
     899 */
     900typedef struct
     901{
     902    /** Header. */
     903    VMMDevRequestHeader header;
     904    /** 0 - disable, !0 - enable. */
     905    uint32_t u32Enable;
     906    /** The size of VBVAMEMORY::au8RingBuffer expected by driver.
     907     *  The host will refuse to enable VBVA if the size is not equal to
     908     *  VBVA_RING_BUFFER_SIZE.
     909     */
     910    uint32_t cbRingBuffer;
     911    /** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
     912    uint32_t fu32Status;
     913} VMMDevVideoAccelEnable;
     914AssertCompileSize(VMMDevVideoAccelEnable, 24+12);
     915
     916/** @name VMMDevVideoAccelEnable::fu32Status.
     917 * @{ */
     918#define VBVA_F_STATUS_ACCEPTED (0x01)
     919#define VBVA_F_STATUS_ENABLED  (0x02)
     920/** @} */
     921
     922
     923/**
     924 * VBVA flush request structure.
     925 *
     926 * Used by VMMDevReq_VideoAccelFlush.
     927 */
     928typedef struct
     929{
     930    /** Header. */
     931    VMMDevRequestHeader header;
     932} VMMDevVideoAccelFlush;
     933AssertCompileSize(VMMDevVideoAccelFlush, 24);
     934
     935
     936/**
     937 * VBVA set visible region request structure.
     938 *
     939 * Used by VMMDevReq_VideoSetVisibleRegion.
     940 */
     941typedef struct
     942{
     943    /** Header. */
     944    VMMDevRequestHeader header;
     945    /** Number of rectangles */
     946    uint32_t cRect;
     947    /** Rectangle array.
     948     * @todo array is spelled aRects[1].  */
     949    RTRECT Rect;
     950} VMMDevVideoSetVisibleRegion;
     951AssertCompileSize(RTRECT, 16);
     952AssertCompileSize(VMMDevVideoSetVisibleRegion, 24+4+16);
     953
     954#pragma pack()
     955
     956/**
     957 * VBVA command header.
     958 */
     959#pragma pack(1) /* unnecessary */
     960typedef struct _VBVACMDHDR
     961{
     962   /** Coordinates of affected rectangle. */
     963   int16_t x;
     964   int16_t y;
     965   uint16_t w;
     966   uint16_t h;
     967} VBVACMDHDR;
     968#pragma pack()
     969
     970/** @name VBVA ring defines.
     971 *
     972 * The VBVA ring buffer is suitable for transferring large (< 2GB) amount of
     973 * data. For example big bitmaps which do not fit to the buffer.
     974 *
     975 * Guest starts writing to the buffer by initializing a record entry in the
     976 * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
     977 * written. As data is written to the ring buffer, the guest increases off32End
     978 * for the record.
     979 *
     980 * The host reads the aRecords on flushes and processes all completed records.
     981 * When host encounters situation when only a partial record presents and
     982 * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE -
     983 * VBVA_RING_BUFFER_THRESHOLD, the host fetched all record data and updates
     984 * off32Head. After that on each flush the host continues fetching the data
     985 * until the record is completed.
     986 *
     987 */
     988#define VBVA_RING_BUFFER_SIZE        (_4M - _1K)
     989#define VBVA_RING_BUFFER_THRESHOLD   (4 * _1K)
     990
     991#define VBVA_MAX_RECORDS (64)
     992
     993#define VBVA_F_MODE_ENABLED         (0x00000001)
     994#define VBVA_F_MODE_VRDP            (0x00000002)
     995#define VBVA_F_MODE_VRDP_RESET      (0x00000004)
     996#define VBVA_F_MODE_VRDP_ORDER_MASK (0x00000008)
     997
     998#define VBVA_F_RECORD_PARTIAL       (0x80000000)
     999/** @} */
     1000
     1001typedef struct
     1002{
     1003    /** The length of the record. Changed by guest. */
     1004    uint32_t cbRecord;
     1005} VBVARECORD;
     1006AssertCompileSize(VBVARECORD, 4);
     1007
     1008/**
     1009 * VBVA memory layout.
     1010 */
     1011#pragma pack(1) /* paranoia */
     1012typedef struct VBVAMEMORY
     1013{
     1014    /** VBVA_F_MODE_*. */
     1015    uint32_t fu32ModeFlags;
     1016
     1017    /** The offset where the data start in the buffer. */
     1018    uint32_t off32Data;
     1019    /** The offset where next data must be placed in the buffer. */
     1020    uint32_t off32Free;
     1021
     1022    /** The ring buffer for data. */
     1023    uint8_t  au8RingBuffer[VBVA_RING_BUFFER_SIZE];
     1024
     1025    /** The queue of record descriptions. */
     1026    VBVARECORD aRecords[VBVA_MAX_RECORDS];
     1027    uint32_t indexRecordFirst;
     1028    uint32_t indexRecordFree;
     1029
     1030    /** RDP orders supported by the client. The guest reports only them
     1031     * and falls back to DIRTY rects for not supported ones.
     1032     *
     1033     * (1 << VBVA_VRDP_*)
     1034     */
     1035    uint32_t fu32SupportedOrders;
     1036
     1037} VBVAMEMORY;
     1038#pragma pack()
     1039AssertCompileSize(VBVAMEMORY, 12 + (_4M-_1K) + 4*64 + 12);
     1040
     1041
     1042
     1043#ifdef VBOX_WITH_HGCM
     1044
     1045/** @name HGCM flags.
     1046 * @{
     1047 */
     1048# define VBOX_HGCM_REQ_DONE      (0x1)
     1049# define VBOX_HGCM_REQ_CANCELLED (0x2)
     1050/** @} */
     1051
     1052# pragma pack(4)
     1053
     1054/**
     1055 * HGCM request header.
     1056 */
     1057typedef struct VMMDevHGCMRequestHeader
     1058{
     1059    /** Request header. */
     1060    VMMDevRequestHeader header;
     1061
     1062    /** HGCM flags. */
     1063    uint32_t fu32Flags;
     1064
     1065    /** Result code. */
     1066    int32_t result;
     1067} VMMDevHGCMRequestHeader;
     1068AssertCompileSize(VMMDevHGCMRequestHeader, 24+8);
     1069
     1070/**
     1071 * HGCM service location types.
     1072 */
     1073typedef enum
     1074{
     1075    VMMDevHGCMLoc_Invalid    = 0,
     1076    VMMDevHGCMLoc_LocalHost  = 1,
     1077    VMMDevHGCMLoc_LocalHost_Existing = 2,
     1078    VMMDevHGCMLoc_SizeHack   = 0x7fffffff
     1079} HGCMServiceLocationType;
     1080AssertCompileSize(HGCMServiceLocationType, 4);
     1081
     1082/**
     1083 * HGCM host service location.
     1084 */
     1085typedef struct
     1086{
     1087    char achName[128]; /**< This is really szName. */
     1088} HGCMServiceLocationHost;
     1089AssertCompileSize(HGCMServiceLocationHost, 128);
     1090
     1091/**
     1092 * HGCM service location.
     1093 */
     1094typedef struct HGCMSERVICELOCATION
     1095{
     1096    /** Type of the location. */
     1097    HGCMServiceLocationType type;
     1098
     1099    union
     1100    {
     1101        HGCMServiceLocationHost host;
     1102    } u;
     1103} HGCMServiceLocation;
     1104AssertCompileSize(HGCMServiceLocation, 128+4);
     1105
     1106/**
     1107 * HGCM connect request structure.
     1108 *
     1109 * Used by VMMDevReq_HGCMConnect.
     1110 */
     1111typedef struct
     1112{
     1113    /** HGCM request header. */
     1114    VMMDevHGCMRequestHeader header;
     1115
     1116    /** IN: Description of service to connect to. */
     1117    HGCMServiceLocation loc;
     1118
     1119    /** OUT: Client identifier assigned by local instance of HGCM. */
     1120    uint32_t u32ClientID;
     1121} VMMDevHGCMConnect;
     1122AssertCompileSize(VMMDevHGCMConnect, 32+132+4);
     1123
     1124
     1125/**
     1126 * HGCM disconnect request structure.
     1127 *
     1128 * Used by VMMDevReq_HGCMDisconnect.
     1129 */
     1130typedef struct
     1131{
     1132    /** HGCM request header. */
     1133    VMMDevHGCMRequestHeader header;
     1134
     1135    /** IN: Client identifier. */
     1136    uint32_t u32ClientID;
     1137} VMMDevHGCMDisconnect;
     1138AssertCompileSize(VMMDevHGCMDisconnect, 32+4);
     1139
     1140/**
     1141 * HGCM parameter type.
     1142 */
     1143typedef enum
     1144{
     1145    VMMDevHGCMParmType_Invalid            = 0,
     1146    VMMDevHGCMParmType_32bit              = 1,
     1147    VMMDevHGCMParmType_64bit              = 2,
     1148    VMMDevHGCMParmType_PhysAddr           = 3,
     1149    VMMDevHGCMParmType_LinAddr            = 4, /**< In and Out */
     1150    VMMDevHGCMParmType_LinAddr_In         = 5, /**< In  (read;  host<-guest) */
     1151    VMMDevHGCMParmType_LinAddr_Out        = 6, /**< Out (write; host->guest) */
     1152    VMMDevHGCMParmType_LinAddr_Locked     = 7, /**< Locked In and Out */
     1153    VMMDevHGCMParmType_LinAddr_Locked_In  = 8, /**< Locked In  (read;  host<-guest) */
     1154    VMMDevHGCMParmType_LinAddr_Locked_Out = 9, /**< Locked Out (write; host->guest) */
     1155    VMMDevHGCMParmType_SizeHack           = 0x7fffffff
     1156} HGCMFunctionParameterType;
     1157AssertCompileSize(HGCMFunctionParameterType, 4);
     1158
     1159# ifdef VBOX_WITH_64_BITS_GUESTS
     1160/**
     1161 * HGCM function parameter, 32-bit client.
     1162 */
     1163typedef struct
     1164{
     1165    HGCMFunctionParameterType type;
     1166    union
     1167    {
     1168        uint32_t   value32;
     1169        uint64_t   value64;
     1170        struct
     1171        {
     1172            uint32_t size;
     1173
     1174            union
     1175            {
     1176                RTGCPHYS32 physAddr;
     1177                RTGCPTR32  linearAddr;
     1178            } u;
     1179        } Pointer;
     1180    } u;
     1181#  ifdef __cplusplus
     1182    void SetUInt32(uint32_t u32)
     1183    {
     1184        type = VMMDevHGCMParmType_32bit;
     1185        u.value64 = 0; /* init unused bits to 0 */
     1186        u.value32 = u32;
     1187    }
     1188
     1189    int GetUInt32(uint32_t *pu32)
     1190    {
     1191        if (type == VMMDevHGCMParmType_32bit)
     1192        {
     1193            *pu32 = u.value32;
     1194            return VINF_SUCCESS;
     1195        }
     1196        return VERR_INVALID_PARAMETER;
     1197    }
     1198
     1199    void SetUInt64(uint64_t u64)
     1200    {
     1201        type      = VMMDevHGCMParmType_64bit;
     1202        u.value64 = u64;
     1203    }
     1204
     1205    int GetUInt64(uint64_t *pu64)
     1206    {
     1207        if (type == VMMDevHGCMParmType_64bit)
     1208        {
     1209            *pu64 = u.value64;
     1210            return VINF_SUCCESS;
     1211        }
     1212        return VERR_INVALID_PARAMETER;
     1213    }
     1214
     1215    void SetPtr(void *pv, uint32_t cb)
     1216    {
     1217        type                    = VMMDevHGCMParmType_LinAddr;
     1218        u.Pointer.size          = cb;
     1219        u.Pointer.u.linearAddr  = (RTGCPTR32)(uintptr_t)pv;
     1220    }
     1221#  endif /* __cplusplus */
     1222} HGCMFunctionParameter32;
     1223AssertCompileSize(HGCMFunctionParameter32, 4+8);
     1224
     1225/**
     1226 * HGCM function parameter, 64-bit client.
     1227 */
     1228typedef struct
     1229{
     1230    HGCMFunctionParameterType type;
     1231    union
     1232    {
     1233        uint32_t   value32;
     1234        uint64_t   value64;
     1235        struct
     1236        {
     1237            uint32_t size;
     1238
     1239            union
     1240            {
     1241                RTGCPHYS64 physAddr;
     1242                RTGCPTR64  linearAddr;
     1243            } u;
     1244        } Pointer;
     1245    } u;
     1246#  ifdef __cplusplus
     1247    void SetUInt32(uint32_t u32)
     1248    {
     1249        type = VMMDevHGCMParmType_32bit;
     1250        u.value64 = 0; /* init unused bits to 0 */
     1251        u.value32 = u32;
     1252    }
     1253
     1254    int GetUInt32(uint32_t *pu32)
     1255    {
     1256        if (type == VMMDevHGCMParmType_32bit)
     1257        {
     1258            *pu32 = u.value32;
     1259            return VINF_SUCCESS;
     1260        }
     1261        return VERR_INVALID_PARAMETER;
     1262    }
     1263
     1264    void SetUInt64(uint64_t u64)
     1265    {
     1266        type      = VMMDevHGCMParmType_64bit;
     1267        u.value64 = u64;
     1268    }
     1269
     1270    int GetUInt64(uint64_t *pu64)
     1271    {
     1272        if (type == VMMDevHGCMParmType_64bit)
     1273        {
     1274            *pu64 = u.value64;
     1275            return VINF_SUCCESS;
     1276        }
     1277        return VERR_INVALID_PARAMETER;
     1278    }
     1279
     1280    void SetPtr(void *pv, uint32_t cb)
     1281    {
     1282        type                    = VMMDevHGCMParmType_LinAddr;
     1283        u.Pointer.size          = cb;
     1284        u.Pointer.u.linearAddr  = (uintptr_t)pv;
     1285    }
     1286#  endif /** __cplusplus */
     1287} HGCMFunctionParameter64;
     1288AssertCompileSize(HGCMFunctionParameter64, 4+12);
     1289
     1290/* Redefine the structure type for the guest code. */
     1291#  ifndef VBOX_HGCM_HOST_CODE
     1292#   if ARCH_BITS == 64
     1293#     define HGCMFunctionParameter  HGCMFunctionParameter64
     1294#   elif ARCH_BITS == 32
     1295#     define HGCMFunctionParameter  HGCMFunctionParameter32
     1296#   else
     1297#    error "Unsupported sizeof (void *)"
     1298#   endif
     1299#  endif /* !VBOX_HGCM_HOST_CODE */
     1300
     1301# else /* !VBOX_WITH_64_BITS_GUESTS */
     1302
     1303/**
     1304 * HGCM function parameter, 32-bit client.
     1305 *
     1306 * @todo If this is the same as HGCMFunctionParameter32, why the duplication?
     1307 */
     1308typedef struct
     1309{
     1310    HGCMFunctionParameterType type;
     1311    union
     1312    {
     1313        uint32_t   value32;
     1314        uint64_t   value64;
     1315        struct
     1316        {
     1317            uint32_t size;
     1318
     1319            union
     1320            {
     1321                RTGCPHYS32 physAddr;
     1322                RTGCPTR32  linearAddr;
     1323            } u;
     1324        } Pointer;
     1325    } u;
     1326#  ifdef __cplusplus
     1327    void SetUInt32(uint32_t u32)
     1328    {
     1329        type = VMMDevHGCMParmType_32bit;
     1330        u.value64 = 0; /* init unused bits to 0 */
     1331        u.value32 = u32;
     1332    }
     1333
     1334    int GetUInt32(uint32_t *pu32)
     1335    {
     1336        if (type == VMMDevHGCMParmType_32bit)
     1337        {
     1338            *pu32 = u.value32;
     1339            return VINF_SUCCESS;
     1340        }
     1341        return VERR_INVALID_PARAMETER;
     1342    }
     1343
     1344    void SetUInt64(uint64_t u64)
     1345    {
     1346        type      = VMMDevHGCMParmType_64bit;
     1347        u.value64 = u64;
     1348    }
     1349
     1350    int GetUInt64(uint64_t *pu64)
     1351    {
     1352        if (type == VMMDevHGCMParmType_64bit)
     1353        {
     1354            *pu64 = u.value64;
     1355            return VINF_SUCCESS;
     1356        }
     1357        return VERR_INVALID_PARAMETER;
     1358    }
     1359
     1360    void SetPtr(void *pv, uint32_t cb)
     1361    {
     1362        type                    = VMMDevHGCMParmType_LinAddr;
     1363        u.Pointer.size          = cb;
     1364        u.Pointer.u.linearAddr  = (uintptr_t)pv;
     1365    }
     1366#  endif /* __cplusplus */
     1367} HGCMFunctionParameter;
     1368AssertCompileSize(HGCMFunctionParameter, 4+8);
     1369# endif /* !VBOX_WITH_64_BITS_GUESTS */
     1370
     1371/**
     1372 * HGCM call request structure.
     1373 *
     1374 * Used by VMMDevReq_HGCMCall, VMMDevReq_HGCMCall32 and VMMDevReq_HGCMCall64.
     1375 */
     1376typedef struct
    11851377{
    11861378    /* request header */
    1187     VMMDevRequestHeader header;
    1188     /* request flags (in/out) */
    1189     uint32_t u32Flags;
    1190     /* user name (UTF-8) (out) */
    1191     char szUserName[VMMDEV_CREDENTIALS_STRLEN];
    1192     /* password (UTF-8) (out) */
    1193     char szPassword[VMMDEV_CREDENTIALS_STRLEN];
    1194     /* domain name (UTF-8) (out) */
    1195     char szDomain[VMMDEV_CREDENTIALS_STRLEN];
    1196 } VMMDevCredentials;
    1197 #pragma pack()
     1379    VMMDevHGCMRequestHeader header;
     1380
     1381    /** IN: Client identifier. */
     1382    uint32_t u32ClientID;
     1383    /** IN: Service function number. */
     1384    uint32_t u32Function;
     1385    /** IN: Number of parameters. */
     1386    uint32_t cParms;
     1387    /** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
     1388} VMMDevHGCMCall;
     1389AssertCompileSize(VMMDevHGCMCall, 32+12);
     1390
     1391# pragma pack()
     1392
     1393/** Get the pointer to the first parmater of a HGCM call request.  */
     1394# define VMMDEV_HGCM_CALL_PARMS(a)   ((HGCMFunctionParameter *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
     1395/** Get the pointer to the first parmater of a 32-bit HGCM call request.  */
     1396# define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
     1397
     1398# ifdef VBOX_WITH_64_BITS_GUESTS
     1399/* Explicit defines for the host code. */
     1400#  ifdef VBOX_HGCM_HOST_CODE
     1401#   define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
     1402#   define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)(a) + sizeof (VMMDevHGCMCall)))
     1403#  endif /* VBOX_HGCM_HOST_CODE */
     1404# endif /* VBOX_WITH_64_BITS_GUESTS */
     1405
     1406# define VBOX_HGCM_MAX_PARMS 32
     1407
     1408/**
     1409 * HGCM cancel request structure.
     1410 *
     1411 * The Cancel request is issued using the same physical memory address as was
     1412 * used for the corresponding initial HGCMCall.
     1413 *
     1414 * Used by VMMDevReq_HGCMCancel.
     1415 */
     1416typedef struct
     1417{
     1418    /** Header. */
     1419    VMMDevHGCMRequestHeader header;
     1420} VMMDevHGCMCancel;
     1421AssertCompileSize(VMMDevHGCMCancel, 32);
     1422
     1423#endif /* VBOX_WITH_HGCM */
    11981424
    11991425
     
    12791505        case VMMDevReq_LogString:
    12801506            return sizeof(VMMDevReqLogString);
     1507        case VMMDevReq_CtlGuestFilterMask:
     1508            return sizeof(VMMDevCtlGuestFilterMask);
    12811509        default:
    12821510            return 0;
     
    13101538
    13111539/** @} */
     1540
     1541
     1542/**
     1543 * The layout of VMMDEV RAM region that contains information for guest.
     1544 */
     1545#pragma pack(1) /* paranoia */
     1546typedef struct
     1547{
     1548    /** size */
     1549    uint32_t u32Size;
     1550    /** version */
     1551    uint32_t u32Version;
     1552
     1553    union {
     1554        /** Flag telling that VMMDev set the IRQ and acknowlegment is required */
     1555        struct {
     1556            bool fHaveEvents;
     1557        } V1_04;
     1558
     1559        struct {
     1560            /** Pending events flags, set by host. */
     1561            uint32_t u32HostEvents;
     1562            /** Mask of events the guest wants to see, set by guest. */
     1563            uint32_t u32GuestEventMask;
     1564        } V1_03;
     1565    } V;
     1566
     1567    VBVAMEMORY vbvaMemory;
     1568
     1569} VMMDevMemory;
     1570AssertCompileSize(VMMDevMemory, 8+8 + (12 + (_4M-_1K) + 4*64 + 12) );
     1571#pragma pack()
     1572
     1573/** Version of VMMDevMemory structure (VMMDevMemory::u32Version). */
     1574#define VMMDEV_MEMORY_VERSION   (1)
     1575
     1576
     1577/** @} */
    13121578RT_C_DECLS_END
    13131579
  • trunk/include/VBox/pdmifs.h

    r21217 r21226  
    17061706     * query them and may do whatever it wants with them.
    17071707     *
    1708      * @returns VBox status code
    1709      * @param   pszUsername            User name, may be empty (UTF-8)
    1710      * @param   pszPassword            Password, may be empty (UTF-8)
    1711      * @param   pszDomain              Domain name, may be empty (UTF-8)
    1712      * @param   fFlags                 Bitflags
     1708     * @returns VBox status code.
     1709     * @param   pszUsername            User name, may be empty (UTF-8).
     1710     * @param   pszPassword            Password, may be empty (UTF-8).
     1711     * @param   pszDomain              Domain name, may be empty (UTF-8).
     1712     * @param   fFlags                 VMMDEV_SETCREDENTIALS_*.
    17131713     */
    17141714    DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
     
    17681768} PDMIVMMDEVPORT;
    17691769
     1770/** @name Flags for PDMIVMMDEVPORT::pfnSetCredentials.
     1771 * @{ */
     1772/** The guest should perform a logon with the credentials. */
     1773#define VMMDEV_SETCREDENTIALS_GUESTLOGON                    RT_BIT(0)
     1774/** The guest should prevent local logons. */
     1775#define VMMDEV_SETCREDENTIALS_NOLOCALLOGON                  RT_BIT(1)
     1776/** The guest should verify the credentials. */
     1777#define VMMDEV_SETCREDENTIALS_JUDGE                         RT_BIT(15)
     1778/** @} */
     1779
     1780
    17701781/** Forward declaration of the video accelerator command memory. */
    1771 struct _VBVAMEMORY;
     1782struct VBVAMEMORY;
    17721783/** Forward declaration of the guest information structure. */
    17731784struct VBoxGuestInfo;
     
    17751786struct VBoxGuestStatistics;
    17761787/** Pointer to video accelerator command memory. */
    1777 typedef struct _VBVAMEMORY *PVBVAMEMORY;
     1788typedef struct VBVAMEMORY *PVBVAMEMORY;
    17781789
    17791790/** Pointer to a VMMDev connector interface. */
Note: See TracChangeset for help on using the changeset viewer.

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