VirtualBox

Changeset 21223 in vbox for trunk/include


Ignore:
Timestamp:
Jul 5, 2009 2:33:51 PM (16 years ago)
Author:
vboxsync
Message:

Moving VMMDEV bits from VBoxGuest.h to VMMDev.h

Location:
trunk/include/VBox
Files:
3 edited

Legend:

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

    r21217 r21223  
    11/** @file
    22 * VBoxGuest - VirtualBox Guest Additions Driver Interface. (ADD,DEV)
     3 *
     4 * @remarks This is in the process of being split up and usage cleaned up.
    35 */
    46
     
    3133#define ___VBox_VBoxGuest_h
    3234
    33 #include <iprt/cdefs.h>
    34 #include <iprt/types.h>
    35 #ifdef IN_RING3
    36 # include <iprt/stdarg.h>
    37 #endif
     35
     36#include <VBox/cdefs.h>
     37#include <VBox/types.h>
    3838#include <iprt/assert.h>
    39 #include <VBox/err.h>
    40 #include <VBox/ostypes.h>
    41 
    42 /*******************************************************************************
    43 *   Defined Constants And Macros                                               *
    44 *******************************************************************************/
    45 
    46 /** @todo The following is a temporary fix for the problem of accessing
    47     hypervisor pointers from within guest additions */
    48 
    49 /** Hypervisor linear pointer size type */
    50 typedef RTGCPTR32 VMMDEVHYPPTR32;
    51 typedef RTGCPTR64 VMMDEVHYPPTR64;
    52 /** Hypervisor physical pointer size type */
    53 typedef RTGCPHYS32 VMMDEVHYPPHYS32;
    54 typedef RTGCPHYS64 VMMDEVHYPPHYS64;
    55 
    56 #if defined(VBOX_WITH_64_BITS_GUESTS) && ARCH_BITS == 64
    57 # define VMMDEVHYPPTR  VMMDEVHYPPTR64
    58 # define VMMDEVHYPPHYS VMMDEVHYPPHYS64
    59 # else
    60 # define VMMDEVHYPPTR  VMMDEVHYPPTR32
    61 # define VMMDEVHYPPHYS VMMDEVHYPPHYS32
    62 #endif
     39#include <VBox/VMMDev.h> /* Temporarily. */
     40
    6341
    6442#if defined(RT_OS_LINUX) && !defined(VBOX_WITH_COMMON_VBOXGUEST_ON_LINUX)
     
    10078#endif
    10179
    102 /** VirtualBox vendor ID */
    103 #define VBOX_PCI_VENDORID (0x80ee)
    104 
    105 /** VMMDev PCI card identifiers */
    106 #define VMMDEV_VENDORID VBOX_PCI_VENDORID
    107 #define VMMDEV_DEVICEID (0xcafe)
    108 
    109 /** VirtualBox graphics card identifiers */
    110 #define VBOX_VENDORID VBOX_PCI_VENDORID
    111 #define VBOX_VESA_VENDORID VBOX_PCI_VENDORID
    112 #define VBOX_DEVICEID (0xbeef)
    113 #define VBOX_VESA_DEVICEID (0xbeef)
    114 
    115 /**
    116  * VBoxGuest port definitions
    117  * @{
    118  */
    119 
    120 /** guest can (== wants to) handle absolute coordinates */
    121 #define VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE      RT_BIT(0)
    122 /** host can (== wants to) send absolute coordinates */
    123 #define VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE       RT_BIT(1)
    124 /** guest can *NOT* switch to software cursor and therefore depends on the host cursor */
    125 #define VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR RT_BIT(2)
    126 /** host does NOT provide support for drawing the cursor itself (e.g. L4 console) */
    127 #define VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER   RT_BIT(3)
    128 /** The guest can read VMMDev events to find out about pointer movement */
    129 #define VBOXGUEST_MOUSE_GUEST_USES_VMMDEV       RT_BIT(4)
    130 
    131 /** fictive start address of the hypervisor physical memory for MmMapIoSpace */
    132 #define HYPERVISOR_PHYSICAL_START  0xf8000000
    133 
    134 /*
    135  * VMMDev Generic Request Interface
    136  */
    137 
    138 /** port for generic request interface */
    139 #define PORT_VMMDEV_REQUEST_OFFSET 0
    140 
    141 /** Current version of the VMMDev interface.
    142  *
    143  * Additions are allowed to work only if
    144  * additions_major == vmmdev_current && additions_minor <= vmmdev_current.
    145  * Additions version is reported to host (VMMDev) by VMMDevReq_ReportGuestInfo.
    146  *
    147  * @remark  These defines also live in the 16-bit and assembly versions of this header.
    148  */
    149 #define VMMDEV_VERSION       0x00010004
    150 #define VMMDEV_VERSION_MAJOR (VMMDEV_VERSION >> 16)
    151 #define VMMDEV_VERSION_MINOR (VMMDEV_VERSION & 0xffff)
    152 
    153 /* Maximum request packet size */
    154 #define VMMDEV_MAX_VMMDEVREQ_SIZE           _1M
    155 
    156 /**
    157  * VMMDev request types.
    158  * @note when updating this, adjust vmmdevGetRequestSize() as well
    159  */
    160 typedef enum
    161 {
    162     VMMDevReq_InvalidRequest             =  0,
    163     VMMDevReq_GetMouseStatus             =  1,
    164     VMMDevReq_SetMouseStatus             =  2,
    165     VMMDevReq_SetPointerShape            =  3,
    166     /** @todo implement on host side */
    167     VMMDevReq_GetHostVersion             =  4,
    168     VMMDevReq_Idle                       =  5,
    169     VMMDevReq_GetHostTime                = 10,
    170     VMMDevReq_GetHypervisorInfo          = 20,
    171     VMMDevReq_SetHypervisorInfo          = 21,
    172     VMMDevReq_SetPowerStatus             = 30,
    173     VMMDevReq_AcknowledgeEvents          = 41,
    174     VMMDevReq_CtlGuestFilterMask         = 42,
    175     VMMDevReq_ReportGuestInfo            = 50,
    176     VMMDevReq_GetDisplayChangeRequest    = 51,
    177     VMMDevReq_VideoModeSupported         = 52,
    178     VMMDevReq_GetHeightReduction         = 53,
    179     VMMDevReq_GetDisplayChangeRequest2   = 54,
    180     VMMDevReq_ReportGuestCapabilities    = 55,
    181     VMMDevReq_SetGuestCapabilities       = 56,
    182 #ifdef VBOX_WITH_HGCM
    183     VMMDevReq_HGCMConnect                = 60,
    184     VMMDevReq_HGCMDisconnect             = 61,
    185 #ifdef VBOX_WITH_64_BITS_GUESTS
    186     VMMDevReq_HGCMCall32                 = 62,
    187     VMMDevReq_HGCMCall64                 = 63,
    188 #else
    189     VMMDevReq_HGCMCall                   = 62,
    190 #endif /* VBOX_WITH_64_BITS_GUESTS */
    191     VMMDevReq_HGCMCancel                 = 64,
    192 #endif
    193     VMMDevReq_VideoAccelEnable           = 70,
    194     VMMDevReq_VideoAccelFlush            = 71,
    195     VMMDevReq_VideoSetVisibleRegion      = 72,
    196     VMMDevReq_GetSeamlessChangeRequest   = 73,
    197     VMMDevReq_QueryCredentials           = 100,
    198     VMMDevReq_ReportCredentialsJudgement = 101,
    199     VMMDevReq_ReportGuestStats           = 110,
    200     VMMDevReq_GetMemBalloonChangeRequest = 111,
    201     VMMDevReq_GetStatisticsChangeRequest = 112,
    202     VMMDevReq_ChangeMemBalloon           = 113,
    203     VMMDevReq_GetVRDPChangeRequest       = 150,
    204     VMMDevReq_LogString                  = 200,
    205     VMMDevReq_SizeHack                   = 0x7fffffff
    206 } VMMDevRequestType;
    207 
    208 #ifdef VBOX_WITH_64_BITS_GUESTS
    209 /*
    210  * Constants and structures are redefined for the guest.
    211  *
    212  * Host code MUST always use either *32 or *64 variant explicitely.
    213  * Host source code will use VBOX_HGCM_HOST_CODE define to catch undefined
    214  * data types and constants.
    215  *
    216  * This redefinition means that the new additions builds will use
    217  * the *64 or *32 variants depending on the current architecture bit count (ARCH_BITS).
    218  */
    219 # ifndef VBOX_HGCM_HOST_CODE
    220 #  if ARCH_BITS == 64
    221 #   define VMMDevReq_HGCMCall VMMDevReq_HGCMCall64
    222 #  elif ARCH_BITS == 32
    223 #   define VMMDevReq_HGCMCall VMMDevReq_HGCMCall32
    224 #  else
    225 #   error "Unsupported ARCH_BITS"
    226 #  endif
    227 # endif /* !VBOX_HGCM_HOST_CODE */
    228 #endif /* VBOX_WITH_64_BITS_GUESTS */
    229 
    230 /** Version of VMMDevRequestHeader structure. */
    231 #define VMMDEV_REQUEST_HEADER_VERSION (0x10001)
    232 
    233 #pragma pack(4)
    234 /** generic VMMDev request header */
    235 typedef struct
    236 {
    237     /** size of the structure in bytes (including body). Filled by caller */
    238     uint32_t size;
    239     /** version of the structure. Filled by caller */
    240     uint32_t version;
    241     /** type of the request */
    242     VMMDevRequestType requestType;
    243     /** return code. Filled by VMMDev */
    244     int32_t  rc;
    245     /** reserved fields */
    246     uint32_t reserved1;
    247     uint32_t reserved2;
    248 } VMMDevRequestHeader;
    249 AssertCompileSize(VMMDevRequestHeader, 24);
    250 
    251 /** mouse status request structure */
    252 typedef struct
    253 {
    254     /** header */
    255     VMMDevRequestHeader header;
    256     /** mouse feature mask */
    257     uint32_t mouseFeatures;
    258     /** mouse x position */
    259     uint32_t pointerXPos;
    260     /** mouse y position */
    261     uint32_t pointerYPos;
    262 } VMMDevReqMouseStatus;
    263 
    264 /** Note VBOX_MOUSE_POINTER_* flags are used in guest video driver,
    265  *  values must be <= 0x8000 and must not be changed.
    266  */
    267 
    268 /** pointer is visible */
    269 #define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
    270 /** pointer has alpha channel */
    271 #define VBOX_MOUSE_POINTER_ALPHA   (0x0002)
    272 /** pointerData contains new pointer shape */
    273 #define VBOX_MOUSE_POINTER_SHAPE   (0x0004)
    274 
    275 /** mouse pointer shape/visibility change request */
    276 typedef struct
    277 {
    278     /** header */
    279     VMMDevRequestHeader header;
    280     /** VBOX_MOUSE_POINTER_* bit flags */
    281     uint32_t fFlags;
    282     /** x coordinate of hot spot */
    283     uint32_t xHot;
    284     /** y coordinate of hot spot */
    285     uint32_t yHot;
    286     /** width of the pointer in pixels */
    287     uint32_t width;
    288     /** height of the pointer in scanlines */
    289     uint32_t height;
    290     /** Pointer data.
    291      *
    292      ****
    293      * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
    294      *
    295      * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
    296      * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
    297      *
    298      * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
    299      * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
    300      * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
    301      *
    302      * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
    303      * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
    304      * end of any scanline are undefined.
    305      *
    306      * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
    307      * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
    308      * Bytes in the gap between the AND and the XOR mask are undefined.
    309      * XOR mask scanlines have no gap between them and size of XOR mask is:
    310      * cXor = width * 4 * height.
    311      ****
    312      *
    313      * Preallocate 4 bytes for accessing actual data as p->pointerData
    314      */
    315     char pointerData[4];
    316 } VMMDevReqMousePointer;
    317 
    318 /** string log request structure */
    319 typedef struct
    320 {
    321     /** header */
    322     VMMDevRequestHeader header;
    323     /** variable length string data */
    324     char szString[1];
    325 } VMMDevReqLogString;
    326 
    327 /** host version request structure */
    328 typedef struct
    329 {
    330     /** header */
    331     VMMDevRequestHeader header;
    332     /** major version */
    333     uint32_t major;
    334     /** minor version */
    335     uint32_t minor;
    336     /** build number */
    337     uint32_t build;
    338 } VMMDevReqHostVersion;
    339 
    340 /** guest capabilites structure */
    341 typedef struct
    342 {
    343     /** header */
    344     VMMDevRequestHeader header;
    345     /** capabilities (VMMDEV_GUEST_*) */
    346     uint32_t    caps;
    347 } VMMDevReqGuestCapabilities;
    348 
    349 /** guest capabilites structure */
    350 typedef struct
    351 {
    352     /** header */
    353     VMMDevRequestHeader header;
    354     /** mask of capabilities to be added */
    355     uint32_t    u32OrMask;
    356     /** mask of capabilities to be removed */
    357     uint32_t    u32NotMask;
    358 } VMMDevReqGuestCapabilities2;
    359 
    360 /** idle request structure */
    361 typedef struct
    362 {
    363     /** header */
    364     VMMDevRequestHeader header;
    365 } VMMDevReqIdle;
    366 
    367 /** host time request structure */
    368 typedef struct
    369 {
    370     /** header */
    371     VMMDevRequestHeader header;
    372     /** time in milliseconds since unix epoch. Filled by VMMDev. */
    373     uint64_t time;
    374 } VMMDevReqHostTime;
    375 
    376 /** hypervisor info structure */
    377 typedef struct
    378 {
    379     /** header */
    380     VMMDevRequestHeader header;
    381     /** guest virtual address of proposed hypervisor start */
    382     /** TODO: Make this 64-bit compatible */
    383     VMMDEVHYPPTR32 hypervisorStart;
    384     /** hypervisor size in bytes */
    385     uint32_t hypervisorSize;
    386 } VMMDevReqHypervisorInfo;
    387 
    388 /** system power requests */
    389 typedef enum
    390 {
    391     VMMDevPowerState_Invalid   = 0,
    392     VMMDevPowerState_Pause     = 1,
    393     VMMDevPowerState_PowerOff  = 2,
    394     VMMDevPowerState_SaveState = 3,
    395     VMMDevPowerState_SizeHack = 0x7fffffff
    396 } VMMDevPowerState;
    397 
    398 /** system power status structure */
    399 typedef struct
    400 {
    401     /** header */
    402     VMMDevRequestHeader header;
    403     /** power state request */
    404     VMMDevPowerState powerState;
    405 } VMMDevPowerStateRequest;
    406 
    407 /** pending events structure */
    408 typedef struct
    409 {
    410     /** header */
    411     VMMDevRequestHeader header;
    412     /** pending event bitmap */
    413     uint32_t events;
    414 } VMMDevEvents;
    415 
    416 /** guest filter mask control */
    417 typedef struct
    418 {
    419     /** header */
    420     VMMDevRequestHeader header;
    421     /** mask of events to be added to filter */
    422     uint32_t u32OrMask;
    423     /** mask of events to be removed from filter */
    424     uint32_t u32NotMask;
    425 } VMMDevCtlGuestFilterMask;
    426 
    427 /** guest information structure */
    428 typedef struct VBoxGuestInfo
    429 {
    430     /** The VMMDev interface version expected by additions. */
    431     uint32_t additionsVersion;
    432     /** guest OS type */
    433     VBOXOSTYPE osType;
    434     /** @todo */
    435 } VBoxGuestInfo;
    436 
    437 /** guest information structure */
    438 typedef struct
    439 {
    440     /** header */
    441     VMMDevRequestHeader header;
    442     /** Guest information. */
    443     VBoxGuestInfo guestInfo;
    444 } VMMDevReportGuestInfo;
    445 
    446 /** guest statistics values */
    447 #define VBOX_GUEST_STAT_CPU_LOAD_IDLE       RT_BIT(0)
    448 #define VBOX_GUEST_STAT_CPU_LOAD_KERNEL     RT_BIT(1)
    449 #define VBOX_GUEST_STAT_CPU_LOAD_USER       RT_BIT(2)
    450 #define VBOX_GUEST_STAT_THREADS             RT_BIT(3)
    451 #define VBOX_GUEST_STAT_PROCESSES           RT_BIT(4)
    452 #define VBOX_GUEST_STAT_HANDLES             RT_BIT(5)
    453 #define VBOX_GUEST_STAT_MEMORY_LOAD         RT_BIT(6)
    454 #define VBOX_GUEST_STAT_PHYS_MEM_TOTAL      RT_BIT(7)
    455 #define VBOX_GUEST_STAT_PHYS_MEM_AVAIL      RT_BIT(8)
    456 #define VBOX_GUEST_STAT_PHYS_MEM_BALLOON    RT_BIT(9)
    457 #define VBOX_GUEST_STAT_MEM_COMMIT_TOTAL    RT_BIT(10)
    458 #define VBOX_GUEST_STAT_MEM_KERNEL_TOTAL    RT_BIT(11)
    459 #define VBOX_GUEST_STAT_MEM_KERNEL_PAGED    RT_BIT(12)
    460 #define VBOX_GUEST_STAT_MEM_KERNEL_NONPAGED RT_BIT(13)
    461 #define VBOX_GUEST_STAT_MEM_SYSTEM_CACHE    RT_BIT(14)
    462 #define VBOX_GUEST_STAT_PAGE_FILE_SIZE      RT_BIT(15)
    463 
    464 
    465 /** guest statistics structure */
    466 typedef struct VBoxGuestStatistics
    467 {
    468     /** Virtual CPU id */
    469     uint32_t        u32CpuId;
    470     /** Reported statistics */
    471     uint32_t        u32StatCaps;
    472     /** Idle CPU load (0-100) for last interval */
    473     uint32_t        u32CpuLoad_Idle;
    474     /** Kernel CPU load (0-100) for last interval */
    475     uint32_t        u32CpuLoad_Kernel;
    476     /** User CPU load (0-100) for last interval */
    477     uint32_t        u32CpuLoad_User;
    478     /** Nr of threads */
    479     uint32_t        u32Threads;
    480     /** Nr of processes */
    481     uint32_t        u32Processes;
    482     /** Nr of handles */
    483     uint32_t        u32Handles;
    484     /** Memory load (0-100) */
    485     uint32_t        u32MemoryLoad;
    486     /** Page size of guest system */
    487     uint32_t        u32PageSize;
    488     /** Total physical memory (in 4kb pages) */
    489     uint32_t        u32PhysMemTotal;
    490     /** Available physical memory (in 4kb pages) */
    491     uint32_t        u32PhysMemAvail;
    492     /** Ballooned physical memory (in 4kb pages) */
    493     uint32_t        u32PhysMemBalloon;
    494     /** Total number of committed memory (which is not necessarily in-use) (in 4kb pages) */
    495     uint32_t        u32MemCommitTotal;
    496     /** Total amount of memory used by the kernel (in 4kb pages) */
    497     uint32_t        u32MemKernelTotal;
    498     /** Total amount of paged memory used by the kernel (in 4kb pages) */
    499     uint32_t        u32MemKernelPaged;
    500     /** Total amount of nonpaged memory used by the kernel (in 4kb pages) */
    501     uint32_t        u32MemKernelNonPaged;
    502     /** Total amount of memory used for the system cache (in 4kb pages) */
    503     uint32_t        u32MemSystemCache;
    504     /** Pagefile size (in 4kb pages) */
    505     uint32_t        u32PageFileSize;
    506 } VBoxGuestStatistics;
    507 
    508 /** guest statistics command structure */
    509 typedef struct
    510 {
    511     /** header */
    512     VMMDevRequestHeader header;
    513     /** Guest information. */
    514     VBoxGuestStatistics guestStats;
    515 } VMMDevReportGuestStats;
    516 
    517 /** memory balloon change request structure */
    518 #define VMMDEV_MAX_MEMORY_BALLOON(PhysMemTotal)     ((90*PhysMemTotal)/100)
    519 
    520 typedef struct
    521 {
    522     /** header */
    523     VMMDevRequestHeader header;
    524     uint32_t            u32BalloonSize;     /* balloon size in megabytes */
    525     uint32_t            u32PhysMemSize;     /* guest ram size in megabytes */
    526     uint32_t            eventAck;
    527 } VMMDevGetMemBalloonChangeRequest;
    528 
    529 /** inflate/deflate memory balloon structure */
    530 #define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES            (_1M/4096)
    531 #define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE             (VMMDEV_MEMORY_BALLOON_CHUNK_PAGES*4096)
    532 
    533 typedef struct
    534 {
    535     /** header */
    536     VMMDevRequestHeader header;
    537     uint32_t            cPages;
    538     uint32_t            fInflate;       /* true = inflate, false = defalte */
    539     /** Physical address (RTGCPHYS) of each page, variable size. */
    540     RTGCPHYS            aPhysPage[1];
    541 } VMMDevChangeMemBalloon;
    542 
    543 /** guest statistics interval change request structure */
    544 typedef struct
    545 {
    546     /** header */
    547     VMMDevRequestHeader header;
    548     uint32_t            u32StatInterval; /* interval in seconds */
    549     uint32_t            eventAck;
    550 } VMMDevGetStatisticsChangeRequest;
    551 
    552 /** display change request structure */
    553 typedef struct
    554 {
    555     /** header */
    556     VMMDevRequestHeader header;
    557     /** horizontal pixel resolution (0 = do not change) */
    558     uint32_t xres;
    559     /** vertical pixel resolution (0 = do not change) */
    560     uint32_t yres;
    561     /** bits per pixel (0 = do not change) */
    562     uint32_t bpp;
    563     /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
    564      *  Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
    565      */
    566     uint32_t eventAck;
    567 } VMMDevDisplayChangeRequest;
    568 
    569 typedef struct
    570 {
    571     /** header */
    572     VMMDevRequestHeader header;
    573     /** horizontal pixel resolution (0 = do not change) */
    574     uint32_t xres;
    575     /** vertical pixel resolution (0 = do not change) */
    576     uint32_t yres;
    577     /** bits per pixel (0 = do not change) */
    578     uint32_t bpp;
    579     /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
    580      *  Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
    581      */
    582     uint32_t eventAck;
    583     /** 0 for primary display, 1 for the first secondary, etc. */
    584     uint32_t display;
    585 } VMMDevDisplayChangeRequest2;
    586 
    587 /** video mode supported request structure */
    588 typedef struct
    589 {
    590     /** header */
    591     VMMDevRequestHeader header;
    592     /** horizontal pixel resolution (input) */
    593     uint32_t width;
    594     /** vertical pixel resolution (input) */
    595     uint32_t height;
    596     /** bits per pixel (input) */
    597     uint32_t bpp;
    598     /** supported flag (output) */
    599     bool fSupported;
    600 } VMMDevVideoModeSupportedRequest;
    601 
    602 /** video modes height reduction request structure */
    603 typedef struct
    604 {
    605     /** header */
    606     VMMDevRequestHeader header;
    607     /** height reduction in pixels (output) */
    608     uint32_t heightReduction;
    609 } VMMDevGetHeightReductionRequest;
    610 
    611 #define VRDP_EXPERIENCE_LEVEL_ZERO     0 /* Theming disabled. */
    612 #define VRDP_EXPERIENCE_LEVEL_LOW      1 /* Full window dragging and desktop wallpaper disabled. */
    613 #define VRDP_EXPERIENCE_LEVEL_MEDIUM   2 /* Font smoothing, gradients. */
    614 #define VRDP_EXPERIENCE_LEVEL_HIGH     3 /* Animation effects disabled. */
    615 #define VRDP_EXPERIENCE_LEVEL_FULL     4 /* Everything enabled. */
    616 
    617 typedef struct
    618 {
    619     /** header */
    620     VMMDevRequestHeader header;
    621     /** Whether VRDP is active or not */
    622     uint8_t u8VRDPActive;
    623     /** The configured experience level for active VRDP. */
    624     uint32_t u32VRDPExperienceLevel;
    625 } VMMDevVRDPChangeRequest;
    626 
    627 
    628 
    629 #pragma pack()
    630 
    631 #ifdef VBOX_WITH_HGCM
    632 
    633 /** HGCM flags.
    634  *  @{
    635  */
    636 #define VBOX_HGCM_REQ_DONE      (0x1)
    637 #define VBOX_HGCM_REQ_CANCELLED (0x2)
    638 /** @} */
    639 
    640 #pragma pack(4)
    641 typedef struct _VMMDevHGCMRequestHeader
    642 {
    643     /** Request header. */
    644     VMMDevRequestHeader header;
    645 
    646     /** HGCM flags. */
    647     uint32_t fu32Flags;
    648 
    649     /** Result code. */
    650     int32_t result;
    651 } VMMDevHGCMRequestHeader;
    652 AssertCompileSize(VMMDevHGCMRequestHeader, 24+8);
    653 
    654 /** HGCM service location types. */
    655 typedef enum
    656 {
    657     VMMDevHGCMLoc_Invalid    = 0,
    658     VMMDevHGCMLoc_LocalHost  = 1,
    659     VMMDevHGCMLoc_LocalHost_Existing = 2,
    660     VMMDevHGCMLoc_SizeHack   = 0x7fffffff
    661 } HGCMServiceLocationType;
    662 
    663 typedef struct
    664 {
    665     char achName[128]; /**< This is really szName. */
    666 } HGCMServiceLocationHost;
    667 
    668 typedef struct HGCMSERVICELOCATION
    669 {
    670     /** Type of the location. */
    671     HGCMServiceLocationType type;
    672 
    673     union
    674     {
    675         HGCMServiceLocationHost host;
    676     } u;
    677 } HGCMServiceLocation;
    678 
    679 typedef struct
    680 {
    681     /* request header */
    682     VMMDevHGCMRequestHeader header;
    683 
    684     /** IN: Description of service to connect to. */
    685     HGCMServiceLocation loc;
    686 
    687     /** OUT: Client identifier assigned by local instance of HGCM. */
    688     uint32_t u32ClientID;
    689 } VMMDevHGCMConnect;
    690 
    691 typedef struct
    692 {
    693     /* request header */
    694     VMMDevHGCMRequestHeader header;
    695 
    696     /** IN: Client identifier. */
    697     uint32_t u32ClientID;
    698 } VMMDevHGCMDisconnect;
    699 
    700 typedef enum
    701 {
    702     VMMDevHGCMParmType_Invalid            = 0,
    703     VMMDevHGCMParmType_32bit              = 1,
    704     VMMDevHGCMParmType_64bit              = 2,
    705     VMMDevHGCMParmType_PhysAddr           = 3,
    706     VMMDevHGCMParmType_LinAddr            = 4, /**< In and Out */
    707     VMMDevHGCMParmType_LinAddr_In         = 5, /**< In  (read;  host<-guest) */
    708     VMMDevHGCMParmType_LinAddr_Out        = 6, /**< Out (write; host->guest) */
    709     VMMDevHGCMParmType_LinAddr_Locked     = 7, /**< Locked In and Out */
    710     VMMDevHGCMParmType_LinAddr_Locked_In  = 8, /**< Locked In  (read;  host<-guest) */
    711     VMMDevHGCMParmType_LinAddr_Locked_Out = 9, /**< Locked Out (write; host->guest) */
    712     VMMDevHGCMParmType_SizeHack           = 0x7fffffff
    713 } HGCMFunctionParameterType;
    714 
    715 #ifdef VBOX_WITH_64_BITS_GUESTS
    716 typedef struct _HGCMFUNCTIONPARAMETER32
    717 {
    718     HGCMFunctionParameterType type;
    719     union
    720     {
    721         uint32_t   value32;
    722         uint64_t   value64;
    723         struct
    724         {
    725             uint32_t size;
    726 
    727             union
    728             {
    729                 VMMDEVHYPPHYS32 physAddr;
    730                 VMMDEVHYPPTR32  linearAddr;
    731             } u;
    732         } Pointer;
    733     } u;
    734 #ifdef __cplusplus
    735     void SetUInt32(uint32_t u32)
    736     {
    737         type = VMMDevHGCMParmType_32bit;
    738         u.value64 = 0; /* init unused bits to 0 */
    739         u.value32 = u32;
    740     }
    741 
    742     int GetUInt32(uint32_t *pu32)
    743     {
    744         if (type == VMMDevHGCMParmType_32bit)
    745         {
    746             *pu32 = u.value32;
    747             return VINF_SUCCESS;
    748         }
    749         return VERR_INVALID_PARAMETER;
    750     }
    751 
    752     void SetUInt64(uint64_t u64)
    753     {
    754         type      = VMMDevHGCMParmType_64bit;
    755         u.value64 = u64;
    756     }
    757 
    758     int GetUInt64(uint64_t *pu64)
    759     {
    760         if (type == VMMDevHGCMParmType_64bit)
    761         {
    762             *pu64 = u.value64;
    763             return VINF_SUCCESS;
    764         }
    765         return VERR_INVALID_PARAMETER;
    766     }
    767 
    768     void SetPtr(void *pv, uint32_t cb)
    769     {
    770         type                    = VMMDevHGCMParmType_LinAddr;
    771         u.Pointer.size          = cb;
    772         u.Pointer.u.linearAddr  = (VMMDEVHYPPTR32)(uintptr_t)pv;
    773     }
    774 #endif
    775 } HGCMFunctionParameter32;
    776 
    777 typedef struct _HGCMFUNCTIONPARAMETER64
    778 {
    779     HGCMFunctionParameterType type;
    780     union
    781     {
    782         uint32_t   value32;
    783         uint64_t   value64;
    784         struct
    785         {
    786             uint32_t size;
    787 
    788             union
    789             {
    790                 VMMDEVHYPPHYS64 physAddr;
    791                 VMMDEVHYPPTR64  linearAddr;
    792             } u;
    793         } Pointer;
    794     } u;
    795 #ifdef __cplusplus
    796     void SetUInt32(uint32_t u32)
    797     {
    798         type = VMMDevHGCMParmType_32bit;
    799         u.value64 = 0; /* init unused bits to 0 */
    800         u.value32 = u32;
    801     }
    802 
    803     int GetUInt32(uint32_t *pu32)
    804     {
    805         if (type == VMMDevHGCMParmType_32bit)
    806         {
    807             *pu32 = u.value32;
    808             return VINF_SUCCESS;
    809         }
    810         return VERR_INVALID_PARAMETER;
    811     }
    812 
    813     void SetUInt64(uint64_t u64)
    814     {
    815         type      = VMMDevHGCMParmType_64bit;
    816         u.value64 = u64;
    817     }
    818 
    819     int GetUInt64(uint64_t *pu64)
    820     {
    821         if (type == VMMDevHGCMParmType_64bit)
    822         {
    823             *pu64 = u.value64;
    824             return VINF_SUCCESS;
    825         }
    826         return VERR_INVALID_PARAMETER;
    827     }
    828 
    829     void SetPtr(void *pv, uint32_t cb)
    830     {
    831         type                    = VMMDevHGCMParmType_LinAddr;
    832         u.Pointer.size          = cb;
    833         u.Pointer.u.linearAddr  = (uintptr_t)pv;
    834     }
    835 #endif
    836 } HGCMFunctionParameter64;
    837 #else /* !VBOX_WITH_64_BITS_GUESTS */
    838 typedef struct _HGCMFUNCTIONPARAMETER
    839 {
    840     HGCMFunctionParameterType type;
    841     union
    842     {
    843         uint32_t   value32;
    844         uint64_t   value64;
    845         struct
    846         {
    847             uint32_t size;
    848 
    849             union
    850             {
    851                 VMMDEVHYPPHYS32 physAddr;
    852                 VMMDEVHYPPTR32  linearAddr;
    853             } u;
    854         } Pointer;
    855     } u;
    856 #ifdef __cplusplus
    857     void SetUInt32(uint32_t u32)
    858     {
    859         type = VMMDevHGCMParmType_32bit;
    860         u.value64 = 0; /* init unused bits to 0 */
    861         u.value32 = u32;
    862     }
    863 
    864     int GetUInt32(uint32_t *pu32)
    865     {
    866         if (type == VMMDevHGCMParmType_32bit)
    867         {
    868             *pu32 = u.value32;
    869             return VINF_SUCCESS;
    870         }
    871         return VERR_INVALID_PARAMETER;
    872     }
    873 
    874     void SetUInt64(uint64_t u64)
    875     {
    876         type      = VMMDevHGCMParmType_64bit;
    877         u.value64 = u64;
    878     }
    879 
    880     int GetUInt64(uint64_t *pu64)
    881     {
    882         if (type == VMMDevHGCMParmType_64bit)
    883         {
    884             *pu64 = u.value64;
    885             return VINF_SUCCESS;
    886         }
    887         return VERR_INVALID_PARAMETER;
    888     }
    889 
    890     void SetPtr(void *pv, uint32_t cb)
    891     {
    892         type                    = VMMDevHGCMParmType_LinAddr;
    893         u.Pointer.size          = cb;
    894         u.Pointer.u.linearAddr  = (uintptr_t)pv;
    895     }
    896 #endif
    897 } HGCMFunctionParameter;
    898 #endif /* !VBOX_WITH_64_BITS_GUESTS */
    899 
    900 
    901 #ifdef VBOX_WITH_64_BITS_GUESTS
    902 /* Redefine the structure type for the guest code. */
    903 # ifndef VBOX_HGCM_HOST_CODE
    904 #  if ARCH_BITS == 64
    905 #    define HGCMFunctionParameter HGCMFunctionParameter64
    906 #  elif ARCH_BITS == 32
    907 #    define HGCMFunctionParameter HGCMFunctionParameter32
    908 #  else
    909 #   error "Unsupported sizeof (void *)"
    910 #  endif
    911 # endif /* !VBOX_HGCM_HOST_CODE */
    912 #endif /* VBOX_WITH_64_BITS_GUESTS */
    913 
    914 typedef struct
    915 {
    916     /* request header */
    917     VMMDevHGCMRequestHeader header;
    918 
    919     /** IN: Client identifier. */
    920     uint32_t u32ClientID;
    921     /** IN: Service function number. */
    922     uint32_t u32Function;
    923     /** IN: Number of parameters. */
    924     uint32_t cParms;
    925     /** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
    926 } VMMDevHGCMCall;
    927 #pragma pack()
    928 
    929 #define VMMDEV_HGCM_CALL_PARMS(a)   ((HGCMFunctionParameter *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
    930 #define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
    931 
    932 #ifdef VBOX_WITH_64_BITS_GUESTS
    933 /* Explicit defines for the host code. */
    934 # ifdef VBOX_HGCM_HOST_CODE
    935 #  define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
    936 #  define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
    937 # endif /* VBOX_HGCM_HOST_CODE */
    938 #endif /* VBOX_WITH_64_BITS_GUESTS */
    939 
    940 #define VBOX_HGCM_MAX_PARMS 32
    941 
    942 /* The Cancel request is issued using the same physical memory address
    943  * as was used for the corresponding initial HGCMCall.
    944  */
    945 typedef struct
    946 {
    947     /* request header */
    948     VMMDevHGCMRequestHeader header;
    949 } VMMDevHGCMCancel;
    950 
    951 #endif /* VBOX_WITH_HGCM */
    952 
    953 
    954 #define VBVA_F_STATUS_ACCEPTED (0x01)
    955 #define VBVA_F_STATUS_ENABLED  (0x02)
    956 
    957 #pragma pack(4)
    958 
    959 typedef struct _VMMDevVideoAccelEnable
    960 {
    961     /* request header */
    962     VMMDevRequestHeader header;
    963 
    964     /** 0 - disable, !0 - enable. */
    965     uint32_t u32Enable;
    966 
    967     /** The size of VBVAMEMORY::au8RingBuffer expected by driver.
    968      *  The host will refuse to enable VBVA if the size is not equal to
    969      *  VBVA_RING_BUFFER_SIZE.
    970      */
    971     uint32_t cbRingBuffer;
    972 
    973     /** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
    974     uint32_t fu32Status;
    975 
    976 } VMMDevVideoAccelEnable;
    977 
    978 typedef struct _VMMDevVideoAccelFlush
    979 {
    980     /* request header */
    981     VMMDevRequestHeader header;
    982 
    983 } VMMDevVideoAccelFlush;
    984 
    985 
    986 typedef struct _VMMDevVideoSetVisibleRegion
    987 {
    988     /* request header */
    989     VMMDevRequestHeader header;
    990 
    991     /** Number of rectangles */
    992     uint32_t cRect;
    993 
    994     /** Rectangle array */
    995     RTRECT   Rect;
    996 } VMMDevVideoSetVisibleRegion;
    997 
    998 
    999 /** Seamless mode */
    1000 typedef enum
    1001 {
    1002     VMMDev_Seamless_Disabled         = 0,     /* normal mode; entire guest desktop displayed */
    1003     VMMDev_Seamless_Visible_Region   = 1,     /* visible region mode; only top-level guest windows displayed */
    1004     VMMDev_Seamless_Host_Window      = 2      /* windowed mode; each top-level guest window is represented in a host window */
    1005 } VMMDevSeamlessMode;
    1006 
    1007 typedef struct
    1008 {
    1009     /** header */
    1010     VMMDevRequestHeader header;
    1011 
    1012     /** New seamless mode */
    1013     VMMDevSeamlessMode  mode;
    1014     /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST.
    1015      *  Values: 0 - just querying, VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST - event acknowledged.
    1016      */
    1017     uint32_t eventAck;
    1018 } VMMDevSeamlessChangeRequest;
    1019 
    1020 #pragma pack()
    1021 
    1022 #pragma pack(1)
    1023 /** VBVA command header. */
    1024 typedef struct _VBVACMDHDR
    1025 {
    1026    /** Coordinates of affected rectangle. */
    1027    int16_t x;
    1028    int16_t y;
    1029    uint16_t w;
    1030    uint16_t h;
    1031 } VBVACMDHDR;
    1032 #pragma pack()
    1033 
    1034 /* The VBVA ring buffer is suitable for transferring large (< 2gb) amount of data.
    1035  * For example big bitmaps which do not fit to the buffer.
    1036  *
    1037  * Guest starts writing to the buffer by initializing a record entry in the
    1038  * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
    1039  * written. As data is written to the ring buffer, the guest increases off32End
    1040  * for the record.
    1041  *
    1042  * The host reads the aRecords on flushes and processes all completed records.
    1043  * When host encounters situation when only a partial record presents and
    1044  * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE - VBVA_RING_BUFFER_THRESHOLD,
    1045  * the host fetched all record data and updates off32Head. After that on each flush
    1046  * the host continues fetching the data until the record is completed.
    1047  *
    1048  */
    1049 
    1050 #define VBVA_RING_BUFFER_SIZE        (_4M - _1K)
    1051 #define VBVA_RING_BUFFER_THRESHOLD   (4 * _1K)
    1052 
    1053 #define VBVA_MAX_RECORDS (64)
    1054 
    1055 #define VBVA_F_MODE_ENABLED         (0x00000001)
    1056 #define VBVA_F_MODE_VRDP            (0x00000002)
    1057 #define VBVA_F_MODE_VRDP_RESET      (0x00000004)
    1058 #define VBVA_F_MODE_VRDP_ORDER_MASK (0x00000008)
    1059 
    1060 #define VBVA_F_RECORD_PARTIAL   (0x80000000)
    1061 
    1062 #pragma pack(1)
    1063 typedef struct _VBVARECORD
    1064 {
    1065     /** The length of the record. Changed by guest. */
    1066     uint32_t cbRecord;
    1067 } VBVARECORD;
    1068 
    1069 typedef struct _VBVAMEMORY
    1070 {
    1071     /** VBVA_F_MODE_* */
    1072     uint32_t fu32ModeFlags;
    1073 
    1074     /** The offset where the data start in the buffer. */
    1075     uint32_t off32Data;
    1076     /** The offset where next data must be placed in the buffer. */
    1077     uint32_t off32Free;
    1078 
    1079     /** The ring buffer for data. */
    1080     uint8_t  au8RingBuffer[VBVA_RING_BUFFER_SIZE];
    1081 
    1082     /** The queue of record descriptions. */
    1083     VBVARECORD aRecords[VBVA_MAX_RECORDS];
    1084     uint32_t indexRecordFirst;
    1085     uint32_t indexRecordFree;
    1086 
    1087     /* RDP orders supported by the client. The guest reports only them
    1088      * and falls back to DIRTY rects for not supported ones.
    1089      *
    1090      * (1 << VBVA_VRDP_*)
    1091      */
    1092     uint32_t fu32SupportedOrders;
    1093 
    1094 } VBVAMEMORY;
    1095 #pragma pack()
    1096 
    1097 /** @} */
    1098 
    1099 
    1100 /**
    1101  * VMMDev RAM
    1102  * @{
    1103  */
    1104 
    1105 #pragma pack(1)
    1106 /** Layout of VMMDEV RAM region that contains information for guest */
    1107 typedef struct
    1108 {
    1109     /** size */
    1110     uint32_t u32Size;
    1111     /** version */
    1112     uint32_t u32Version;
    1113 
    1114     union {
    1115         /** Flag telling that VMMDev set the IRQ and acknowlegment is required */
    1116         struct {
    1117             bool fHaveEvents;
    1118         } V1_04;
    1119 
    1120         struct {
    1121             /** Pending events flags, set by host. */
    1122             uint32_t u32HostEvents;
    1123             /** Mask of events the guest wants to see, set by guest. */
    1124             uint32_t u32GuestEventMask;
    1125         } V1_03;
    1126     } V;
    1127 
    1128     VBVAMEMORY vbvaMemory;
    1129 
    1130 } VMMDevMemory;
    1131 #pragma pack()
    1132 
    1133 /** Version of VMMDevMemory structure. */
    1134 #define VMMDEV_MEMORY_VERSION (1)
    1135 
    1136 /** @} */
    1137 
    1138 
    1139 /**
    1140  * VMMDev events.
    1141  * @{
    1142  */
    1143 
    1144 /** Host mouse capabilities has been changed. */
    1145 #define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED             RT_BIT(0)
    1146 /** HGCM event. */
    1147 #define VMMDEV_EVENT_HGCM                                   RT_BIT(1)
    1148 /** A display change request has been issued. */
    1149 #define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST                 RT_BIT(2)
    1150 /** Credentials are available for judgement. */
    1151 #define VMMDEV_EVENT_JUDGE_CREDENTIALS                      RT_BIT(3)
    1152 /** The guest has been restored. */
    1153 #define VMMDEV_EVENT_RESTORED                               RT_BIT(4)
    1154 /** Seamless mode state changed */
    1155 #define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST           RT_BIT(5)
    1156 /** Memory balloon size changed */
    1157 #define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST                 RT_BIT(6)
    1158 /** Statistics interval changed */
    1159 #define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST     RT_BIT(7)
    1160 /** VRDP status changed. */
    1161 #define VMMDEV_EVENT_VRDP                                   RT_BIT(8)
    1162 /** New mouse position data available */
    1163 #define VMMDEV_EVENT_MOUSE_POSITION_CHANGED                 RT_BIT(9)
    1164 
    1165 /** @} */
    1166 
    116780
    116881#if !defined(IN_RC) && !defined(IN_RING0_AGNOSTIC) && !defined(IPRT_NO_CRT)
     
    1241154    uint32_t    u32Padding;
    1242155#endif
     156/** @todo r=bird: add a rc field. */
    1243157} VBGLBIGREQ;
    1244158/** Pointer to a request wrapper for solaris guests. */
     
    1301215#endif /* RT_ARCH_AMD64 */
    1302216
     217
     218
    1303219/** IOCTL to VBoxGuest to query the VMMDev IO port region start.
    1304220 * @remarks Ring-0 only. */
    1305 #define VBOXGUEST_IOCTL_GETVMMDEVPORT   VBOXGUEST_IOCTL_CODE(1, sizeof(VBoxGuestPortInfo))
     221#define VBOXGUEST_IOCTL_GETVMMDEVPORT               VBOXGUEST_IOCTL_CODE(1, sizeof(VBoxGuestPortInfo))
    1306222
    1307223#pragma pack(4)
     
    1313229
    1314230/** IOCTL to VBoxGuest to wait for a VMMDev host notification */
    1315 #define VBOXGUEST_IOCTL_WAITEVENT       VBOXGUEST_IOCTL_CODE_(2, sizeof(VBoxGuestWaitEventInfo))
     231#define VBOXGUEST_IOCTL_WAITEVENT                   VBOXGUEST_IOCTL_CODE_(2, sizeof(VBoxGuestWaitEventInfo))
    1316232
    1317233/** IOCTL to VBoxGuest to interrupt (cancel) any pending WAITEVENTs and return.
     
    1430346#endif /* VBOX_WITH_HGCM */
    1431347
    1432 /*
    1433  * Credentials request flags and structure
    1434  */
    1435 
    1436 #define VMMDEV_CREDENTIALS_STRLEN           128
    1437 
    1438 /** query from host whether credentials are present */
    1439 #define VMMDEV_CREDENTIALS_QUERYPRESENCE     RT_BIT(1)
    1440 /** read credentials from host (can be combined with clear) */
    1441 #define VMMDEV_CREDENTIALS_READ              RT_BIT(2)
    1442 /** clear credentials on host (can be combined with read) */
    1443 #define VMMDEV_CREDENTIALS_CLEAR             RT_BIT(3)
    1444 /** read credentials for judgement in the guest */
    1445 #define VMMDEV_CREDENTIALS_READJUDGE         RT_BIT(8)
    1446 /** clear credentials for judegement on the host */
    1447 #define VMMDEV_CREDENTIALS_CLEARJUDGE        RT_BIT(9)
    1448 /** report credentials acceptance by guest */
    1449 #define VMMDEV_CREDENTIALS_JUDGE_OK          RT_BIT(10)
    1450 /** report credentials denial by guest */
    1451 #define VMMDEV_CREDENTIALS_JUDGE_DENY        RT_BIT(11)
    1452 /** report that no judgement could be made by guest */
    1453 #define VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT RT_BIT(12)
    1454 
    1455 /** flag telling the guest that credentials are present */
    1456 #define VMMDEV_CREDENTIALS_PRESENT           RT_BIT(16)
    1457 /** flag telling guest that local logons should be prohibited */
    1458 #define VMMDEV_CREDENTIALS_NOLOCALLOGON      RT_BIT(17)
    1459 
    1460 /** credentials request structure */
    1461 #pragma pack(4)
    1462 typedef struct _VMMDevCredentials
    1463 {
    1464     /* request header */
    1465     VMMDevRequestHeader header;
    1466     /* request flags (in/out) */
    1467     uint32_t u32Flags;
    1468     /* user name (UTF-8) (out) */
    1469     char szUserName[VMMDEV_CREDENTIALS_STRLEN];
    1470     /* password (UTF-8) (out) */
    1471     char szPassword[VMMDEV_CREDENTIALS_STRLEN];
    1472     /* domain name (UTF-8) (out) */
    1473     char szDomain[VMMDEV_CREDENTIALS_STRLEN];
    1474 } VMMDevCredentials;
    1475 #pragma pack()
    1476 
    1477 /** inline helper to determine the request size for the given operation */
    1478 DECLINLINE(size_t) vmmdevGetRequestSize(VMMDevRequestType requestType)
    1479 {
    1480     switch (requestType)
    1481     {
    1482         case VMMDevReq_GetMouseStatus:
    1483         case VMMDevReq_SetMouseStatus:
    1484             return sizeof(VMMDevReqMouseStatus);
    1485         case VMMDevReq_SetPointerShape:
    1486             return sizeof(VMMDevReqMousePointer);
    1487         case VMMDevReq_GetHostVersion:
    1488             return sizeof(VMMDevReqHostVersion);
    1489         case VMMDevReq_Idle:
    1490             return sizeof(VMMDevReqIdle);
    1491         case VMMDevReq_GetHostTime:
    1492             return sizeof(VMMDevReqHostTime);
    1493         case VMMDevReq_GetHypervisorInfo:
    1494         case VMMDevReq_SetHypervisorInfo:
    1495             return sizeof(VMMDevReqHypervisorInfo);
    1496         case VMMDevReq_SetPowerStatus:
    1497             return sizeof(VMMDevPowerStateRequest);
    1498         case VMMDevReq_AcknowledgeEvents:
    1499             return sizeof(VMMDevEvents);
    1500         case VMMDevReq_ReportGuestInfo:
    1501             return sizeof(VMMDevReportGuestInfo);
    1502         case VMMDevReq_GetDisplayChangeRequest:
    1503             return sizeof(VMMDevDisplayChangeRequest);
    1504         case VMMDevReq_GetDisplayChangeRequest2:
    1505             return sizeof(VMMDevDisplayChangeRequest2);
    1506         case VMMDevReq_VideoModeSupported:
    1507             return sizeof(VMMDevVideoModeSupportedRequest);
    1508         case VMMDevReq_GetHeightReduction:
    1509             return sizeof(VMMDevGetHeightReductionRequest);
    1510         case VMMDevReq_ReportGuestCapabilities:
    1511             return sizeof(VMMDevReqGuestCapabilities);
    1512         case VMMDevReq_SetGuestCapabilities:
    1513             return sizeof(VMMDevReqGuestCapabilities2);
    1514 #ifdef VBOX_WITH_HGCM
    1515         case VMMDevReq_HGCMConnect:
    1516             return sizeof(VMMDevHGCMConnect);
    1517         case VMMDevReq_HGCMDisconnect:
    1518             return sizeof(VMMDevHGCMDisconnect);
    1519 #ifdef VBOX_WITH_64_BITS_GUESTS
    1520         case VMMDevReq_HGCMCall32:
    1521             return sizeof(VMMDevHGCMCall);
    1522         case VMMDevReq_HGCMCall64:
    1523             return sizeof(VMMDevHGCMCall);
    1524 #else
    1525         case VMMDevReq_HGCMCall:
    1526             return sizeof(VMMDevHGCMCall);
    1527 #endif /* VBOX_WITH_64_BITS_GUESTS */
    1528         case VMMDevReq_HGCMCancel:
    1529             return sizeof(VMMDevHGCMCancel);
    1530 #endif /* VBOX_WITH_HGCM */
    1531         case VMMDevReq_VideoAccelEnable:
    1532             return sizeof(VMMDevVideoAccelEnable);
    1533         case VMMDevReq_VideoAccelFlush:
    1534             return sizeof(VMMDevVideoAccelFlush);
    1535         case VMMDevReq_VideoSetVisibleRegion:
    1536             return sizeof(VMMDevVideoSetVisibleRegion);
    1537         case VMMDevReq_GetSeamlessChangeRequest:
    1538             return sizeof(VMMDevSeamlessChangeRequest);
    1539         case VMMDevReq_QueryCredentials:
    1540             return sizeof(VMMDevCredentials);
    1541         case VMMDevReq_ReportGuestStats:
    1542             return sizeof(VMMDevReportGuestStats);
    1543         case VMMDevReq_GetMemBalloonChangeRequest:
    1544             return sizeof(VMMDevGetMemBalloonChangeRequest);
    1545         case VMMDevReq_GetStatisticsChangeRequest:
    1546             return sizeof(VMMDevGetStatisticsChangeRequest);
    1547         case VMMDevReq_ChangeMemBalloon:
    1548             return sizeof(VMMDevChangeMemBalloon);
    1549         case VMMDevReq_GetVRDPChangeRequest:
    1550             return sizeof(VMMDevVRDPChangeRequest);
    1551         case VMMDevReq_LogString:
    1552             return sizeof(VMMDevReqLogString);
    1553         default:
    1554             return 0;
    1555     }
    1556 }
    1557 
    1558 /**
    1559  * Initializes a request structure.
    1560  *
    1561  */
    1562 DECLINLINE(int) vmmdevInitRequest(VMMDevRequestHeader *req, VMMDevRequestType type)
    1563 {
    1564     uint32_t requestSize;
    1565     if (!req)
    1566         return VERR_INVALID_PARAMETER;
    1567     requestSize = (uint32_t)vmmdevGetRequestSize(type);
    1568     if (!requestSize)
    1569         return VERR_INVALID_PARAMETER;
    1570     req->size        = requestSize;
    1571     req->version     = VMMDEV_REQUEST_HEADER_VERSION;
    1572     req->requestType = type;
    1573     req->rc          = VERR_GENERAL_FAILURE;
    1574     req->reserved1   = 0;
    1575     req->reserved2   = 0;
    1576     return VINF_SUCCESS;
    1577 }
    1578 
    1579348
    1580349#ifdef RT_OS_OS2
  • trunk/include/VBox/VMMDev.h

    r21219 r21223  
    3232
    3333#include <VBox/cdefs.h>
     34#include <VBox/param.h>                 /* for the PCI IDs. */
     35#include <VBox/types.h>
     36#include <VBox/err.h>
     37#include <VBox/ostypes.h>
     38#include <iprt/assert.h>
     39
    3440
    3541RT_C_DECLS_BEGIN
     
    4248 */
    4349
    44 /** Mouse capability bits
     50/** @todo The following is a temporary fix for the problem of accessing
     51    hypervisor pointers from within guest additions */
     52
     53/** Hypervisor linear pointer size type.
     54 * @todo r=bird: only hypervisorStart is a "hypervisor" address, all other use
     55 *       is guest addresses...
     56 *   */
     57typedef RTGCPTR32   VMMDEVHYPPTR32;
     58/** Hypervisor linear pointer sized type.
     59 * @todo r=bird: This is never used for any "hypervisor" addresses, only guest
     60 *       addresses. */
     61typedef RTGCPTR64   VMMDEVHYPPTR64;
     62/** Hypervisor physical pointer sized type.
     63 * @todo r=bird: Same confusion as with VMMDEVHYPPTR64. */
     64typedef RTGCPHYS32  VMMDEVHYPPHYS32;
     65/** Hypervisor physical pointer sized type.
     66 * @todo r=bird: Same confusion as with VMMDEVHYPPTR64. */
     67typedef RTGCPHYS64  VMMDEVHYPPHYS64;
     68
     69/** @def VMMDEVHYPPTR Hypervisor linear pointer sized type size type.
     70 * @todo r=bird: Same confusion as with VMMDEVHYPPTR64. */
     71/** @def VMMDEVHYPPHYS Hypervisor physical pointer sized type.
     72 * @todo r=bird: Same confusion as with VMMDEVHYPPTR64. */
     73#if defined(VBOX_WITH_64_BITS_GUESTS) && ARCH_BITS == 64
     74# define VMMDEVHYPPTR   VMMDEVHYPPTR64
     75# define VMMDEVHYPPHYS  VMMDEVHYPPHYS64
     76# else
     77# define VMMDEVHYPPTR   VMMDEVHYPPTR32
     78# define VMMDEVHYPPHYS  VMMDEVHYPPHYS32
     79#endif
     80
     81
     82/** @name Mouse capability bits
    4583 * @{ */
    4684/** the guest requests absolute mouse coordinates (guest additions installed) */
     
    5896/** @} */
    5997
    60 /** Flags for pfnSetCredentials
     98/** @name Flags for pfnSetCredentials
    6199 * @{ */
    62100/** the guest should perform a logon with the credentials */
     
    68106/** @} */
    69107
    70 /** Guest capability bits
     108/** @name Guest capability bits.
     109 * VMMDevReq_ReportGuestCapabilities, VMMDevReq_SetGuestCapabilities
    71110 * @{ */
    72111/** the guest supports seamless display rendering */
     
    92131#define VMMDEV_HEAP_SIZE                                    (4 * PAGE_SIZE)
    93132
     133
     134/** @name VBoxGuest port definitions
     135 * @{
     136 */
     137
     138/** guest can (== wants to) handle absolute coordinates */
     139#define VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE      RT_BIT(0)
     140/** host can (== wants to) send absolute coordinates */
     141#define VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE       RT_BIT(1)
     142/** guest can *NOT* switch to software cursor and therefore depends on the host cursor */
     143#define VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR RT_BIT(2)
     144/** host does NOT provide support for drawing the cursor itself (e.g. L4 console) */
     145#define VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER   RT_BIT(3)
     146/** The guest can read VMMDev events to find out about pointer movement */
     147#define VBOXGUEST_MOUSE_GUEST_USES_VMMDEV       RT_BIT(4)
     148
     149/** fictive start address of the hypervisor physical memory for MmMapIoSpace */
     150#define HYPERVISOR_PHYSICAL_START  0xf8000000
     151
     152/*
     153 * VMMDev Generic Request Interface
     154 */
     155
     156/** port for generic request interface */
     157#define PORT_VMMDEV_REQUEST_OFFSET 0
     158
     159/** Current version of the VMMDev interface.
     160 *
     161 * Additions are allowed to work only if
     162 * additions_major == vmmdev_current && additions_minor <= vmmdev_current.
     163 * Additions version is reported to host (VMMDev) by VMMDevReq_ReportGuestInfo.
     164 *
     165 * @remark  These defines also live in the 16-bit and assembly versions of this header.
     166 */
     167#define VMMDEV_VERSION       0x00010004
     168#define VMMDEV_VERSION_MAJOR (VMMDEV_VERSION >> 16)
     169#define VMMDEV_VERSION_MINOR (VMMDEV_VERSION & 0xffff)
     170
     171/* Maximum request packet size */
     172#define VMMDEV_MAX_VMMDEVREQ_SIZE           _1M
     173
     174/**
     175 * VMMDev request types.
     176 * @note when updating this, adjust vmmdevGetRequestSize() as well
     177 */
     178typedef enum
     179{
     180    VMMDevReq_InvalidRequest             =  0,
     181    VMMDevReq_GetMouseStatus             =  1,
     182    VMMDevReq_SetMouseStatus             =  2,
     183    VMMDevReq_SetPointerShape            =  3,
     184    /** @todo implement on host side */
     185    VMMDevReq_GetHostVersion             =  4,
     186    VMMDevReq_Idle                       =  5,
     187    VMMDevReq_GetHostTime                = 10,
     188    VMMDevReq_GetHypervisorInfo          = 20,
     189    VMMDevReq_SetHypervisorInfo          = 21,
     190    VMMDevReq_SetPowerStatus             = 30,
     191    VMMDevReq_AcknowledgeEvents          = 41,
     192    VMMDevReq_CtlGuestFilterMask         = 42,
     193    VMMDevReq_ReportGuestInfo            = 50,
     194    VMMDevReq_GetDisplayChangeRequest    = 51,
     195    VMMDevReq_VideoModeSupported         = 52,
     196    VMMDevReq_GetHeightReduction         = 53,
     197    VMMDevReq_GetDisplayChangeRequest2   = 54,
     198    VMMDevReq_ReportGuestCapabilities    = 55,
     199    VMMDevReq_SetGuestCapabilities       = 56,
     200#ifdef VBOX_WITH_HGCM
     201    VMMDevReq_HGCMConnect                = 60,
     202    VMMDevReq_HGCMDisconnect             = 61,
     203#ifdef VBOX_WITH_64_BITS_GUESTS
     204    VMMDevReq_HGCMCall32                 = 62,
     205    VMMDevReq_HGCMCall64                 = 63,
     206#else
     207    VMMDevReq_HGCMCall                   = 62,
     208#endif /* VBOX_WITH_64_BITS_GUESTS */
     209    VMMDevReq_HGCMCancel                 = 64,
     210#endif
     211    VMMDevReq_VideoAccelEnable           = 70,
     212    VMMDevReq_VideoAccelFlush            = 71,
     213    VMMDevReq_VideoSetVisibleRegion      = 72,
     214    VMMDevReq_GetSeamlessChangeRequest   = 73,
     215    VMMDevReq_QueryCredentials           = 100,
     216    VMMDevReq_ReportCredentialsJudgement = 101,
     217    VMMDevReq_ReportGuestStats           = 110,
     218    VMMDevReq_GetMemBalloonChangeRequest = 111,
     219    VMMDevReq_GetStatisticsChangeRequest = 112,
     220    VMMDevReq_ChangeMemBalloon           = 113,
     221    VMMDevReq_GetVRDPChangeRequest       = 150,
     222    VMMDevReq_LogString                  = 200,
     223    VMMDevReq_SizeHack                   = 0x7fffffff
     224} VMMDevRequestType;
     225
     226#ifdef VBOX_WITH_64_BITS_GUESTS
     227/*
     228 * Constants and structures are redefined for the guest.
     229 *
     230 * Host code MUST always use either *32 or *64 variant explicitely.
     231 * Host source code will use VBOX_HGCM_HOST_CODE define to catch undefined
     232 * data types and constants.
     233 *
     234 * This redefinition means that the new additions builds will use
     235 * the *64 or *32 variants depending on the current architecture bit count (ARCH_BITS).
     236 */
     237# ifndef VBOX_HGCM_HOST_CODE
     238#  if ARCH_BITS == 64
     239#   define VMMDevReq_HGCMCall VMMDevReq_HGCMCall64
     240#  elif ARCH_BITS == 32
     241#   define VMMDevReq_HGCMCall VMMDevReq_HGCMCall32
     242#  else
     243#   error "Unsupported ARCH_BITS"
     244#  endif
     245# endif /* !VBOX_HGCM_HOST_CODE */
     246#endif /* VBOX_WITH_64_BITS_GUESTS */
     247
     248/** Version of VMMDevRequestHeader structure. */
     249#define VMMDEV_REQUEST_HEADER_VERSION (0x10001)
     250
     251#pragma pack(4)
     252/** generic VMMDev request header */
     253typedef struct
     254{
     255    /** size of the structure in bytes (including body). Filled by caller */
     256    uint32_t size;
     257    /** version of the structure. Filled by caller */
     258    uint32_t version;
     259    /** type of the request */
     260    VMMDevRequestType requestType;
     261    /** return code. Filled by VMMDev */
     262    int32_t  rc;
     263    /** reserved fields */
     264    uint32_t reserved1;
     265    uint32_t reserved2;
     266} VMMDevRequestHeader;
     267AssertCompileSize(VMMDevRequestHeader, 24);
     268
     269/** mouse status request structure */
     270typedef struct
     271{
     272    /** header */
     273    VMMDevRequestHeader header;
     274    /** mouse feature mask */
     275    uint32_t mouseFeatures;
     276    /** mouse x position */
     277    uint32_t pointerXPos;
     278    /** mouse y position */
     279    uint32_t pointerYPos;
     280} VMMDevReqMouseStatus;
     281
     282/** Note VBOX_MOUSE_POINTER_* flags are used in guest video driver,
     283 *  values must be <= 0x8000 and must not be changed.
     284 */
     285
     286/** pointer is visible */
     287#define VBOX_MOUSE_POINTER_VISIBLE (0x0001)
     288/** pointer has alpha channel */
     289#define VBOX_MOUSE_POINTER_ALPHA   (0x0002)
     290/** pointerData contains new pointer shape */
     291#define VBOX_MOUSE_POINTER_SHAPE   (0x0004)
     292
     293/** mouse pointer shape/visibility change request */
     294typedef struct
     295{
     296    /** header */
     297    VMMDevRequestHeader header;
     298    /** VBOX_MOUSE_POINTER_* bit flags */
     299    uint32_t fFlags;
     300    /** x coordinate of hot spot */
     301    uint32_t xHot;
     302    /** y coordinate of hot spot */
     303    uint32_t yHot;
     304    /** width of the pointer in pixels */
     305    uint32_t width;
     306    /** height of the pointer in scanlines */
     307    uint32_t height;
     308    /** Pointer data.
     309     *
     310     ****
     311     * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color) mask.
     312     *
     313     * For pointers without alpha channel the XOR mask pixels are 32 bit values: (lsb)BGR0(msb).
     314     * For pointers with alpha channel the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
     315     *
     316     * Guest driver must create the AND mask for pointers with alpha channel, so if host does not
     317     * support alpha, the pointer could be displayed as a normal color pointer. The AND mask can
     318     * be constructed from alpha values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
     319     *
     320     * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND mask,
     321     * therefore, is cbAnd = (width + 7) / 8 * height. The padding bits at the
     322     * end of any scanline are undefined.
     323     *
     324     * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
     325     * uint8_t *pXor = pAnd + (cbAnd + 3) & ~3
     326     * Bytes in the gap between the AND and the XOR mask are undefined.
     327     * XOR mask scanlines have no gap between them and size of XOR mask is:
     328     * cXor = width * 4 * height.
     329     ****
     330     *
     331     * Preallocate 4 bytes for accessing actual data as p->pointerData
     332     */
     333    char pointerData[4];
     334} VMMDevReqMousePointer;
     335
     336/** string log request structure */
     337typedef struct
     338{
     339    /** header */
     340    VMMDevRequestHeader header;
     341    /** variable length string data */
     342    char szString[1];
     343} VMMDevReqLogString;
     344
     345/** host version request structure */
     346typedef struct
     347{
     348    /** header */
     349    VMMDevRequestHeader header;
     350    /** major version */
     351    uint32_t major;
     352    /** minor version */
     353    uint32_t minor;
     354    /** build number */
     355    uint32_t build;
     356} VMMDevReqHostVersion;
     357
     358/** guest capabilites structure */
     359typedef struct
     360{
     361    /** header */
     362    VMMDevRequestHeader header;
     363    /** capabilities (VMMDEV_GUEST_*) */
     364    uint32_t    caps;
     365} VMMDevReqGuestCapabilities;
     366
     367/** guest capabilites structure */
     368typedef struct
     369{
     370    /** header */
     371    VMMDevRequestHeader header;
     372    /** mask of capabilities to be added */
     373    uint32_t    u32OrMask;
     374    /** mask of capabilities to be removed */
     375    uint32_t    u32NotMask;
     376} VMMDevReqGuestCapabilities2;
     377
     378/** idle request structure */
     379typedef struct
     380{
     381    /** header */
     382    VMMDevRequestHeader header;
     383} VMMDevReqIdle;
     384
     385/** host time request structure */
     386typedef struct
     387{
     388    /** header */
     389    VMMDevRequestHeader header;
     390    /** time in milliseconds since unix epoch. Filled by VMMDev. */
     391    uint64_t time;
     392} VMMDevReqHostTime;
     393
     394/** hypervisor info structure */
     395typedef struct
     396{
     397    /** header */
     398    VMMDevRequestHeader header;
     399    /** guest virtual address of proposed hypervisor start */
     400    /** TODO: Make this 64-bit compatible */
     401    VMMDEVHYPPTR32 hypervisorStart;
     402    /** hypervisor size in bytes */
     403    uint32_t hypervisorSize;
     404} VMMDevReqHypervisorInfo;
     405
     406/** system power requests */
     407typedef enum
     408{
     409    VMMDevPowerState_Invalid   = 0,
     410    VMMDevPowerState_Pause     = 1,
     411    VMMDevPowerState_PowerOff  = 2,
     412    VMMDevPowerState_SaveState = 3,
     413    VMMDevPowerState_SizeHack = 0x7fffffff
     414} VMMDevPowerState;
     415
     416/** system power status structure */
     417typedef struct
     418{
     419    /** header */
     420    VMMDevRequestHeader header;
     421    /** power state request */
     422    VMMDevPowerState powerState;
     423} VMMDevPowerStateRequest;
     424
     425/** pending events structure */
     426typedef struct
     427{
     428    /** header */
     429    VMMDevRequestHeader header;
     430    /** pending event bitmap */
     431    uint32_t events;
     432} VMMDevEvents;
     433
     434/** guest filter mask control */
     435typedef struct
     436{
     437    /** header */
     438    VMMDevRequestHeader header;
     439    /** mask of events to be added to filter */
     440    uint32_t u32OrMask;
     441    /** mask of events to be removed from filter */
     442    uint32_t u32NotMask;
     443} VMMDevCtlGuestFilterMask;
     444
     445/** guest information structure */
     446typedef struct VBoxGuestInfo
     447{
     448    /** The VMMDev interface version expected by additions. */
     449    uint32_t additionsVersion;
     450    /** guest OS type */
     451    VBOXOSTYPE osType;
     452    /** @todo */
     453} VBoxGuestInfo;
     454
     455/** guest information structure */
     456typedef struct
     457{
     458    /** header */
     459    VMMDevRequestHeader header;
     460    /** Guest information. */
     461    VBoxGuestInfo guestInfo;
     462} VMMDevReportGuestInfo;
     463
     464/** guest statistics values */
     465#define VBOX_GUEST_STAT_CPU_LOAD_IDLE       RT_BIT(0)
     466#define VBOX_GUEST_STAT_CPU_LOAD_KERNEL     RT_BIT(1)
     467#define VBOX_GUEST_STAT_CPU_LOAD_USER       RT_BIT(2)
     468#define VBOX_GUEST_STAT_THREADS             RT_BIT(3)
     469#define VBOX_GUEST_STAT_PROCESSES           RT_BIT(4)
     470#define VBOX_GUEST_STAT_HANDLES             RT_BIT(5)
     471#define VBOX_GUEST_STAT_MEMORY_LOAD         RT_BIT(6)
     472#define VBOX_GUEST_STAT_PHYS_MEM_TOTAL      RT_BIT(7)
     473#define VBOX_GUEST_STAT_PHYS_MEM_AVAIL      RT_BIT(8)
     474#define VBOX_GUEST_STAT_PHYS_MEM_BALLOON    RT_BIT(9)
     475#define VBOX_GUEST_STAT_MEM_COMMIT_TOTAL    RT_BIT(10)
     476#define VBOX_GUEST_STAT_MEM_KERNEL_TOTAL    RT_BIT(11)
     477#define VBOX_GUEST_STAT_MEM_KERNEL_PAGED    RT_BIT(12)
     478#define VBOX_GUEST_STAT_MEM_KERNEL_NONPAGED RT_BIT(13)
     479#define VBOX_GUEST_STAT_MEM_SYSTEM_CACHE    RT_BIT(14)
     480#define VBOX_GUEST_STAT_PAGE_FILE_SIZE      RT_BIT(15)
     481
     482
     483/** guest statistics structure */
     484typedef struct VBoxGuestStatistics
     485{
     486    /** Virtual CPU id */
     487    uint32_t        u32CpuId;
     488    /** Reported statistics */
     489    uint32_t        u32StatCaps;
     490    /** Idle CPU load (0-100) for last interval */
     491    uint32_t        u32CpuLoad_Idle;
     492    /** Kernel CPU load (0-100) for last interval */
     493    uint32_t        u32CpuLoad_Kernel;
     494    /** User CPU load (0-100) for last interval */
     495    uint32_t        u32CpuLoad_User;
     496    /** Nr of threads */
     497    uint32_t        u32Threads;
     498    /** Nr of processes */
     499    uint32_t        u32Processes;
     500    /** Nr of handles */
     501    uint32_t        u32Handles;
     502    /** Memory load (0-100) */
     503    uint32_t        u32MemoryLoad;
     504    /** Page size of guest system */
     505    uint32_t        u32PageSize;
     506    /** Total physical memory (in 4kb pages) */
     507    uint32_t        u32PhysMemTotal;
     508    /** Available physical memory (in 4kb pages) */
     509    uint32_t        u32PhysMemAvail;
     510    /** Ballooned physical memory (in 4kb pages) */
     511    uint32_t        u32PhysMemBalloon;
     512    /** Total number of committed memory (which is not necessarily in-use) (in 4kb pages) */
     513    uint32_t        u32MemCommitTotal;
     514    /** Total amount of memory used by the kernel (in 4kb pages) */
     515    uint32_t        u32MemKernelTotal;
     516    /** Total amount of paged memory used by the kernel (in 4kb pages) */
     517    uint32_t        u32MemKernelPaged;
     518    /** Total amount of nonpaged memory used by the kernel (in 4kb pages) */
     519    uint32_t        u32MemKernelNonPaged;
     520    /** Total amount of memory used for the system cache (in 4kb pages) */
     521    uint32_t        u32MemSystemCache;
     522    /** Pagefile size (in 4kb pages) */
     523    uint32_t        u32PageFileSize;
     524} VBoxGuestStatistics;
     525
     526/** guest statistics command structure */
     527typedef struct
     528{
     529    /** header */
     530    VMMDevRequestHeader header;
     531    /** Guest information. */
     532    VBoxGuestStatistics guestStats;
     533} VMMDevReportGuestStats;
     534
     535/** memory balloon change request structure */
     536#define VMMDEV_MAX_MEMORY_BALLOON(PhysMemTotal)     ((90*PhysMemTotal)/100)
     537
     538typedef struct
     539{
     540    /** header */
     541    VMMDevRequestHeader header;
     542    uint32_t            u32BalloonSize;     /* balloon size in megabytes */
     543    uint32_t            u32PhysMemSize;     /* guest ram size in megabytes */
     544    uint32_t            eventAck;
     545} VMMDevGetMemBalloonChangeRequest;
     546
     547/** inflate/deflate memory balloon structure */
     548#define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES            (_1M/4096)
     549#define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE             (VMMDEV_MEMORY_BALLOON_CHUNK_PAGES*4096)
     550
     551typedef struct
     552{
     553    /** header */
     554    VMMDevRequestHeader header;
     555    uint32_t            cPages;
     556    uint32_t            fInflate;       /* true = inflate, false = defalte */
     557    /** Physical address (RTGCPHYS) of each page, variable size. */
     558    RTGCPHYS            aPhysPage[1];
     559} VMMDevChangeMemBalloon;
     560
     561/** guest statistics interval change request structure */
     562typedef struct
     563{
     564    /** header */
     565    VMMDevRequestHeader header;
     566    uint32_t            u32StatInterval; /* interval in seconds */
     567    uint32_t            eventAck;
     568} VMMDevGetStatisticsChangeRequest;
     569
     570/** display change request structure */
     571typedef struct
     572{
     573    /** header */
     574    VMMDevRequestHeader header;
     575    /** horizontal pixel resolution (0 = do not change) */
     576    uint32_t xres;
     577    /** vertical pixel resolution (0 = do not change) */
     578    uint32_t yres;
     579    /** bits per pixel (0 = do not change) */
     580    uint32_t bpp;
     581    /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
     582     *  Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
     583     */
     584    uint32_t eventAck;
     585} VMMDevDisplayChangeRequest;
     586
     587typedef struct
     588{
     589    /** header */
     590    VMMDevRequestHeader header;
     591    /** horizontal pixel resolution (0 = do not change) */
     592    uint32_t xres;
     593    /** vertical pixel resolution (0 = do not change) */
     594    uint32_t yres;
     595    /** bits per pixel (0 = do not change) */
     596    uint32_t bpp;
     597    /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST.
     598     *  Values: 0 - just querying, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST - event acknowledged.
     599     */
     600    uint32_t eventAck;
     601    /** 0 for primary display, 1 for the first secondary, etc. */
     602    uint32_t display;
     603} VMMDevDisplayChangeRequest2;
     604
     605/** video mode supported request structure */
     606typedef struct
     607{
     608    /** header */
     609    VMMDevRequestHeader header;
     610    /** horizontal pixel resolution (input) */
     611    uint32_t width;
     612    /** vertical pixel resolution (input) */
     613    uint32_t height;
     614    /** bits per pixel (input) */
     615    uint32_t bpp;
     616    /** supported flag (output) */
     617    bool fSupported;
     618} VMMDevVideoModeSupportedRequest;
     619
     620/** video modes height reduction request structure */
     621typedef struct
     622{
     623    /** header */
     624    VMMDevRequestHeader header;
     625    /** height reduction in pixels (output) */
     626    uint32_t heightReduction;
     627} VMMDevGetHeightReductionRequest;
     628
     629#define VRDP_EXPERIENCE_LEVEL_ZERO     0 /* Theming disabled. */
     630#define VRDP_EXPERIENCE_LEVEL_LOW      1 /* Full window dragging and desktop wallpaper disabled. */
     631#define VRDP_EXPERIENCE_LEVEL_MEDIUM   2 /* Font smoothing, gradients. */
     632#define VRDP_EXPERIENCE_LEVEL_HIGH     3 /* Animation effects disabled. */
     633#define VRDP_EXPERIENCE_LEVEL_FULL     4 /* Everything enabled. */
     634
     635typedef struct
     636{
     637    /** header */
     638    VMMDevRequestHeader header;
     639    /** Whether VRDP is active or not */
     640    uint8_t u8VRDPActive;
     641    /** The configured experience level for active VRDP. */
     642    uint32_t u32VRDPExperienceLevel;
     643} VMMDevVRDPChangeRequest;
     644
     645
     646
     647#pragma pack()
     648
     649#ifdef VBOX_WITH_HGCM
     650
     651/** HGCM flags.
     652 *  @{
     653 */
     654#define VBOX_HGCM_REQ_DONE      (0x1)
     655#define VBOX_HGCM_REQ_CANCELLED (0x2)
     656/** @} */
     657
     658#pragma pack(4)
     659typedef struct _VMMDevHGCMRequestHeader
     660{
     661    /** Request header. */
     662    VMMDevRequestHeader header;
     663
     664    /** HGCM flags. */
     665    uint32_t fu32Flags;
     666
     667    /** Result code. */
     668    int32_t result;
     669} VMMDevHGCMRequestHeader;
     670AssertCompileSize(VMMDevHGCMRequestHeader, 24+8);
     671
     672/** HGCM service location types. */
     673typedef enum
     674{
     675    VMMDevHGCMLoc_Invalid    = 0,
     676    VMMDevHGCMLoc_LocalHost  = 1,
     677    VMMDevHGCMLoc_LocalHost_Existing = 2,
     678    VMMDevHGCMLoc_SizeHack   = 0x7fffffff
     679} HGCMServiceLocationType;
     680
     681typedef struct
     682{
     683    char achName[128]; /**< This is really szName. */
     684} HGCMServiceLocationHost;
     685
     686typedef struct HGCMSERVICELOCATION
     687{
     688    /** Type of the location. */
     689    HGCMServiceLocationType type;
     690
     691    union
     692    {
     693        HGCMServiceLocationHost host;
     694    } u;
     695} HGCMServiceLocation;
     696
     697typedef struct
     698{
     699    /* request header */
     700    VMMDevHGCMRequestHeader header;
     701
     702    /** IN: Description of service to connect to. */
     703    HGCMServiceLocation loc;
     704
     705    /** OUT: Client identifier assigned by local instance of HGCM. */
     706    uint32_t u32ClientID;
     707} VMMDevHGCMConnect;
     708
     709typedef struct
     710{
     711    /* request header */
     712    VMMDevHGCMRequestHeader header;
     713
     714    /** IN: Client identifier. */
     715    uint32_t u32ClientID;
     716} VMMDevHGCMDisconnect;
     717
     718typedef enum
     719{
     720    VMMDevHGCMParmType_Invalid            = 0,
     721    VMMDevHGCMParmType_32bit              = 1,
     722    VMMDevHGCMParmType_64bit              = 2,
     723    VMMDevHGCMParmType_PhysAddr           = 3,
     724    VMMDevHGCMParmType_LinAddr            = 4, /**< In and Out */
     725    VMMDevHGCMParmType_LinAddr_In         = 5, /**< In  (read;  host<-guest) */
     726    VMMDevHGCMParmType_LinAddr_Out        = 6, /**< Out (write; host->guest) */
     727    VMMDevHGCMParmType_LinAddr_Locked     = 7, /**< Locked In and Out */
     728    VMMDevHGCMParmType_LinAddr_Locked_In  = 8, /**< Locked In  (read;  host<-guest) */
     729    VMMDevHGCMParmType_LinAddr_Locked_Out = 9, /**< Locked Out (write; host->guest) */
     730    VMMDevHGCMParmType_SizeHack           = 0x7fffffff
     731} HGCMFunctionParameterType;
     732
     733#ifdef VBOX_WITH_64_BITS_GUESTS
     734typedef struct _HGCMFUNCTIONPARAMETER32
     735{
     736    HGCMFunctionParameterType type;
     737    union
     738    {
     739        uint32_t   value32;
     740        uint64_t   value64;
     741        struct
     742        {
     743            uint32_t size;
     744
     745            union
     746            {
     747                VMMDEVHYPPHYS32 physAddr;
     748                VMMDEVHYPPTR32  linearAddr;
     749            } u;
     750        } Pointer;
     751    } u;
     752#ifdef __cplusplus
     753    void SetUInt32(uint32_t u32)
     754    {
     755        type = VMMDevHGCMParmType_32bit;
     756        u.value64 = 0; /* init unused bits to 0 */
     757        u.value32 = u32;
     758    }
     759
     760    int GetUInt32(uint32_t *pu32)
     761    {
     762        if (type == VMMDevHGCMParmType_32bit)
     763        {
     764            *pu32 = u.value32;
     765            return VINF_SUCCESS;
     766        }
     767        return VERR_INVALID_PARAMETER;
     768    }
     769
     770    void SetUInt64(uint64_t u64)
     771    {
     772        type      = VMMDevHGCMParmType_64bit;
     773        u.value64 = u64;
     774    }
     775
     776    int GetUInt64(uint64_t *pu64)
     777    {
     778        if (type == VMMDevHGCMParmType_64bit)
     779        {
     780            *pu64 = u.value64;
     781            return VINF_SUCCESS;
     782        }
     783        return VERR_INVALID_PARAMETER;
     784    }
     785
     786    void SetPtr(void *pv, uint32_t cb)
     787    {
     788        type                    = VMMDevHGCMParmType_LinAddr;
     789        u.Pointer.size          = cb;
     790        u.Pointer.u.linearAddr  = (VMMDEVHYPPTR32)(uintptr_t)pv;
     791    }
     792#endif
     793} HGCMFunctionParameter32;
     794
     795typedef struct _HGCMFUNCTIONPARAMETER64
     796{
     797    HGCMFunctionParameterType type;
     798    union
     799    {
     800        uint32_t   value32;
     801        uint64_t   value64;
     802        struct
     803        {
     804            uint32_t size;
     805
     806            union
     807            {
     808                VMMDEVHYPPHYS64 physAddr;
     809                VMMDEVHYPPTR64  linearAddr;
     810            } u;
     811        } Pointer;
     812    } u;
     813#ifdef __cplusplus
     814    void SetUInt32(uint32_t u32)
     815    {
     816        type = VMMDevHGCMParmType_32bit;
     817        u.value64 = 0; /* init unused bits to 0 */
     818        u.value32 = u32;
     819    }
     820
     821    int GetUInt32(uint32_t *pu32)
     822    {
     823        if (type == VMMDevHGCMParmType_32bit)
     824        {
     825            *pu32 = u.value32;
     826            return VINF_SUCCESS;
     827        }
     828        return VERR_INVALID_PARAMETER;
     829    }
     830
     831    void SetUInt64(uint64_t u64)
     832    {
     833        type      = VMMDevHGCMParmType_64bit;
     834        u.value64 = u64;
     835    }
     836
     837    int GetUInt64(uint64_t *pu64)
     838    {
     839        if (type == VMMDevHGCMParmType_64bit)
     840        {
     841            *pu64 = u.value64;
     842            return VINF_SUCCESS;
     843        }
     844        return VERR_INVALID_PARAMETER;
     845    }
     846
     847    void SetPtr(void *pv, uint32_t cb)
     848    {
     849        type                    = VMMDevHGCMParmType_LinAddr;
     850        u.Pointer.size          = cb;
     851        u.Pointer.u.linearAddr  = (uintptr_t)pv;
     852    }
     853#endif
     854} HGCMFunctionParameter64;
     855#else /* !VBOX_WITH_64_BITS_GUESTS */
     856typedef struct _HGCMFUNCTIONPARAMETER
     857{
     858    HGCMFunctionParameterType type;
     859    union
     860    {
     861        uint32_t   value32;
     862        uint64_t   value64;
     863        struct
     864        {
     865            uint32_t size;
     866
     867            union
     868            {
     869                VMMDEVHYPPHYS32 physAddr;
     870                VMMDEVHYPPTR32  linearAddr;
     871            } u;
     872        } Pointer;
     873    } u;
     874#ifdef __cplusplus
     875    void SetUInt32(uint32_t u32)
     876    {
     877        type = VMMDevHGCMParmType_32bit;
     878        u.value64 = 0; /* init unused bits to 0 */
     879        u.value32 = u32;
     880    }
     881
     882    int GetUInt32(uint32_t *pu32)
     883    {
     884        if (type == VMMDevHGCMParmType_32bit)
     885        {
     886            *pu32 = u.value32;
     887            return VINF_SUCCESS;
     888        }
     889        return VERR_INVALID_PARAMETER;
     890    }
     891
     892    void SetUInt64(uint64_t u64)
     893    {
     894        type      = VMMDevHGCMParmType_64bit;
     895        u.value64 = u64;
     896    }
     897
     898    int GetUInt64(uint64_t *pu64)
     899    {
     900        if (type == VMMDevHGCMParmType_64bit)
     901        {
     902            *pu64 = u.value64;
     903            return VINF_SUCCESS;
     904        }
     905        return VERR_INVALID_PARAMETER;
     906    }
     907
     908    void SetPtr(void *pv, uint32_t cb)
     909    {
     910        type                    = VMMDevHGCMParmType_LinAddr;
     911        u.Pointer.size          = cb;
     912        u.Pointer.u.linearAddr  = (uintptr_t)pv;
     913    }
     914#endif
     915} HGCMFunctionParameter;
     916#endif /* !VBOX_WITH_64_BITS_GUESTS */
     917
     918
     919#ifdef VBOX_WITH_64_BITS_GUESTS
     920/* Redefine the structure type for the guest code. */
     921# ifndef VBOX_HGCM_HOST_CODE
     922#  if ARCH_BITS == 64
     923#    define HGCMFunctionParameter HGCMFunctionParameter64
     924#  elif ARCH_BITS == 32
     925#    define HGCMFunctionParameter HGCMFunctionParameter32
     926#  else
     927#   error "Unsupported sizeof (void *)"
     928#  endif
     929# endif /* !VBOX_HGCM_HOST_CODE */
     930#endif /* VBOX_WITH_64_BITS_GUESTS */
     931
     932typedef struct
     933{
     934    /* request header */
     935    VMMDevHGCMRequestHeader header;
     936
     937    /** IN: Client identifier. */
     938    uint32_t u32ClientID;
     939    /** IN: Service function number. */
     940    uint32_t u32Function;
     941    /** IN: Number of parameters. */
     942    uint32_t cParms;
     943    /** Parameters follow in form: HGCMFunctionParameter aParms[X]; */
     944} VMMDevHGCMCall;
     945#pragma pack()
     946
     947#define VMMDEV_HGCM_CALL_PARMS(a)   ((HGCMFunctionParameter *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
     948#define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
     949
     950#ifdef VBOX_WITH_64_BITS_GUESTS
     951/* Explicit defines for the host code. */
     952# ifdef VBOX_HGCM_HOST_CODE
     953#  define VMMDEV_HGCM_CALL_PARMS32(a) ((HGCMFunctionParameter32 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
     954#  define VMMDEV_HGCM_CALL_PARMS64(a) ((HGCMFunctionParameter64 *)((uint8_t *)a + sizeof (VMMDevHGCMCall)))
     955# endif /* VBOX_HGCM_HOST_CODE */
     956#endif /* VBOX_WITH_64_BITS_GUESTS */
     957
     958#define VBOX_HGCM_MAX_PARMS 32
     959
     960/* The Cancel request is issued using the same physical memory address
     961 * as was used for the corresponding initial HGCMCall.
     962 */
     963typedef struct
     964{
     965    /* request header */
     966    VMMDevHGCMRequestHeader header;
     967} VMMDevHGCMCancel;
     968
     969#endif /* VBOX_WITH_HGCM */
     970
     971
     972#define VBVA_F_STATUS_ACCEPTED (0x01)
     973#define VBVA_F_STATUS_ENABLED  (0x02)
     974
     975#pragma pack(4)
     976
     977typedef struct _VMMDevVideoAccelEnable
     978{
     979    /* request header */
     980    VMMDevRequestHeader header;
     981
     982    /** 0 - disable, !0 - enable. */
     983    uint32_t u32Enable;
     984
     985    /** The size of VBVAMEMORY::au8RingBuffer expected by driver.
     986     *  The host will refuse to enable VBVA if the size is not equal to
     987     *  VBVA_RING_BUFFER_SIZE.
     988     */
     989    uint32_t cbRingBuffer;
     990
     991    /** Guest initializes the status to 0. Host sets appropriate VBVA_F_STATUS_ flags. */
     992    uint32_t fu32Status;
     993
     994} VMMDevVideoAccelEnable;
     995
     996typedef struct _VMMDevVideoAccelFlush
     997{
     998    /* request header */
     999    VMMDevRequestHeader header;
     1000
     1001} VMMDevVideoAccelFlush;
     1002
     1003
     1004typedef struct _VMMDevVideoSetVisibleRegion
     1005{
     1006    /* request header */
     1007    VMMDevRequestHeader header;
     1008
     1009    /** Number of rectangles */
     1010    uint32_t cRect;
     1011
     1012    /** Rectangle array */
     1013    RTRECT   Rect;
     1014} VMMDevVideoSetVisibleRegion;
     1015
     1016
     1017/** Seamless mode */
     1018typedef enum
     1019{
     1020    VMMDev_Seamless_Disabled         = 0,     /* normal mode; entire guest desktop displayed */
     1021    VMMDev_Seamless_Visible_Region   = 1,     /* visible region mode; only top-level guest windows displayed */
     1022    VMMDev_Seamless_Host_Window      = 2      /* windowed mode; each top-level guest window is represented in a host window */
     1023} VMMDevSeamlessMode;
     1024
     1025typedef struct
     1026{
     1027    /** header */
     1028    VMMDevRequestHeader header;
     1029
     1030    /** New seamless mode */
     1031    VMMDevSeamlessMode  mode;
     1032    /** Flag that the request is an acknowlegement for the VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST.
     1033     *  Values: 0 - just querying, VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST - event acknowledged.
     1034     */
     1035    uint32_t eventAck;
     1036} VMMDevSeamlessChangeRequest;
     1037
     1038#pragma pack()
     1039
     1040#pragma pack(1)
     1041/** VBVA command header. */
     1042typedef struct _VBVACMDHDR
     1043{
     1044   /** Coordinates of affected rectangle. */
     1045   int16_t x;
     1046   int16_t y;
     1047   uint16_t w;
     1048   uint16_t h;
     1049} VBVACMDHDR;
     1050#pragma pack()
     1051
     1052/* The VBVA ring buffer is suitable for transferring large (< 2gb) amount of data.
     1053 * For example big bitmaps which do not fit to the buffer.
     1054 *
     1055 * Guest starts writing to the buffer by initializing a record entry in the
     1056 * aRecords queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
     1057 * written. As data is written to the ring buffer, the guest increases off32End
     1058 * for the record.
     1059 *
     1060 * The host reads the aRecords on flushes and processes all completed records.
     1061 * When host encounters situation when only a partial record presents and
     1062 * cbRecord & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE - VBVA_RING_BUFFER_THRESHOLD,
     1063 * the host fetched all record data and updates off32Head. After that on each flush
     1064 * the host continues fetching the data until the record is completed.
     1065 *
     1066 */
     1067
     1068#define VBVA_RING_BUFFER_SIZE        (_4M - _1K)
     1069#define VBVA_RING_BUFFER_THRESHOLD   (4 * _1K)
     1070
     1071#define VBVA_MAX_RECORDS (64)
     1072
     1073#define VBVA_F_MODE_ENABLED         (0x00000001)
     1074#define VBVA_F_MODE_VRDP            (0x00000002)
     1075#define VBVA_F_MODE_VRDP_RESET      (0x00000004)
     1076#define VBVA_F_MODE_VRDP_ORDER_MASK (0x00000008)
     1077
     1078#define VBVA_F_RECORD_PARTIAL   (0x80000000)
     1079
     1080#pragma pack(1)
     1081typedef struct _VBVARECORD
     1082{
     1083    /** The length of the record. Changed by guest. */
     1084    uint32_t cbRecord;
     1085} VBVARECORD;
     1086
     1087typedef struct _VBVAMEMORY
     1088{
     1089    /** VBVA_F_MODE_* */
     1090    uint32_t fu32ModeFlags;
     1091
     1092    /** The offset where the data start in the buffer. */
     1093    uint32_t off32Data;
     1094    /** The offset where next data must be placed in the buffer. */
     1095    uint32_t off32Free;
     1096
     1097    /** The ring buffer for data. */
     1098    uint8_t  au8RingBuffer[VBVA_RING_BUFFER_SIZE];
     1099
     1100    /** The queue of record descriptions. */
     1101    VBVARECORD aRecords[VBVA_MAX_RECORDS];
     1102    uint32_t indexRecordFirst;
     1103    uint32_t indexRecordFree;
     1104
     1105    /* RDP orders supported by the client. The guest reports only them
     1106     * and falls back to DIRTY rects for not supported ones.
     1107     *
     1108     * (1 << VBVA_VRDP_*)
     1109     */
     1110    uint32_t fu32SupportedOrders;
     1111
     1112} VBVAMEMORY;
     1113#pragma pack()
     1114
     1115/** @} */
     1116
     1117
     1118/**
     1119 * VMMDev RAM
     1120 * @{
     1121 */
     1122
     1123#pragma pack(1)
     1124/** Layout of VMMDEV RAM region that contains information for guest */
     1125typedef struct
     1126{
     1127    /** size */
     1128    uint32_t u32Size;
     1129    /** version */
     1130    uint32_t u32Version;
     1131
     1132    union {
     1133        /** Flag telling that VMMDev set the IRQ and acknowlegment is required */
     1134        struct {
     1135            bool fHaveEvents;
     1136        } V1_04;
     1137
     1138        struct {
     1139            /** Pending events flags, set by host. */
     1140            uint32_t u32HostEvents;
     1141            /** Mask of events the guest wants to see, set by guest. */
     1142            uint32_t u32GuestEventMask;
     1143        } V1_03;
     1144    } V;
     1145
     1146    VBVAMEMORY vbvaMemory;
     1147
     1148} VMMDevMemory;
     1149#pragma pack()
     1150
     1151/** Version of VMMDevMemory structure. */
     1152#define VMMDEV_MEMORY_VERSION (1)
     1153
     1154/** @} */
     1155
     1156
     1157/**
     1158 * VMMDev events.
     1159 * @{
     1160 */
     1161
     1162/** Host mouse capabilities has been changed. */
     1163#define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED             RT_BIT(0)
     1164/** HGCM event. */
     1165#define VMMDEV_EVENT_HGCM                                   RT_BIT(1)
     1166/** A display change request has been issued. */
     1167#define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST                 RT_BIT(2)
     1168/** Credentials are available for judgement. */
     1169#define VMMDEV_EVENT_JUDGE_CREDENTIALS                      RT_BIT(3)
     1170/** The guest has been restored. */
     1171#define VMMDEV_EVENT_RESTORED                               RT_BIT(4)
     1172/** Seamless mode state changed */
     1173#define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST           RT_BIT(5)
     1174/** Memory balloon size changed */
     1175#define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST                 RT_BIT(6)
     1176/** Statistics interval changed */
     1177#define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST     RT_BIT(7)
     1178/** VRDP status changed. */
     1179#define VMMDEV_EVENT_VRDP                                   RT_BIT(8)
     1180/** New mouse position data available */
     1181#define VMMDEV_EVENT_MOUSE_POSITION_CHANGED                 RT_BIT(9)
     1182
     1183/** @} */
     1184
     1185
     1186/*
     1187 * Credentials request flags and structure
     1188 */
     1189
     1190#define VMMDEV_CREDENTIALS_STRLEN           128
     1191
     1192/** query from host whether credentials are present */
     1193#define VMMDEV_CREDENTIALS_QUERYPRESENCE     RT_BIT(1)
     1194/** read credentials from host (can be combined with clear) */
     1195#define VMMDEV_CREDENTIALS_READ              RT_BIT(2)
     1196/** clear credentials on host (can be combined with read) */
     1197#define VMMDEV_CREDENTIALS_CLEAR             RT_BIT(3)
     1198/** read credentials for judgement in the guest */
     1199#define VMMDEV_CREDENTIALS_READJUDGE         RT_BIT(8)
     1200/** clear credentials for judegement on the host */
     1201#define VMMDEV_CREDENTIALS_CLEARJUDGE        RT_BIT(9)
     1202/** report credentials acceptance by guest */
     1203#define VMMDEV_CREDENTIALS_JUDGE_OK          RT_BIT(10)
     1204/** report credentials denial by guest */
     1205#define VMMDEV_CREDENTIALS_JUDGE_DENY        RT_BIT(11)
     1206/** report that no judgement could be made by guest */
     1207#define VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT RT_BIT(12)
     1208
     1209/** flag telling the guest that credentials are present */
     1210#define VMMDEV_CREDENTIALS_PRESENT           RT_BIT(16)
     1211/** flag telling guest that local logons should be prohibited */
     1212#define VMMDEV_CREDENTIALS_NOLOCALLOGON      RT_BIT(17)
     1213
     1214/** credentials request structure */
     1215#pragma pack(4)
     1216typedef struct _VMMDevCredentials
     1217{
     1218    /* request header */
     1219    VMMDevRequestHeader header;
     1220    /* request flags (in/out) */
     1221    uint32_t u32Flags;
     1222    /* user name (UTF-8) (out) */
     1223    char szUserName[VMMDEV_CREDENTIALS_STRLEN];
     1224    /* password (UTF-8) (out) */
     1225    char szPassword[VMMDEV_CREDENTIALS_STRLEN];
     1226    /* domain name (UTF-8) (out) */
     1227    char szDomain[VMMDEV_CREDENTIALS_STRLEN];
     1228} VMMDevCredentials;
     1229#pragma pack()
     1230
     1231
     1232/**
     1233 * Inline helper to determine the request size for the given operation.
     1234 *
     1235 * @returns Size.
     1236 * @param   requestType     The VMMDev request type.
     1237 */
     1238DECLINLINE(size_t) vmmdevGetRequestSize(VMMDevRequestType requestType)
     1239{
     1240    switch (requestType)
     1241    {
     1242        case VMMDevReq_GetMouseStatus:
     1243        case VMMDevReq_SetMouseStatus:
     1244            return sizeof(VMMDevReqMouseStatus);
     1245        case VMMDevReq_SetPointerShape:
     1246            return sizeof(VMMDevReqMousePointer);
     1247        case VMMDevReq_GetHostVersion:
     1248            return sizeof(VMMDevReqHostVersion);
     1249        case VMMDevReq_Idle:
     1250            return sizeof(VMMDevReqIdle);
     1251        case VMMDevReq_GetHostTime:
     1252            return sizeof(VMMDevReqHostTime);
     1253        case VMMDevReq_GetHypervisorInfo:
     1254        case VMMDevReq_SetHypervisorInfo:
     1255            return sizeof(VMMDevReqHypervisorInfo);
     1256        case VMMDevReq_SetPowerStatus:
     1257            return sizeof(VMMDevPowerStateRequest);
     1258        case VMMDevReq_AcknowledgeEvents:
     1259            return sizeof(VMMDevEvents);
     1260        case VMMDevReq_ReportGuestInfo:
     1261            return sizeof(VMMDevReportGuestInfo);
     1262        case VMMDevReq_GetDisplayChangeRequest:
     1263            return sizeof(VMMDevDisplayChangeRequest);
     1264        case VMMDevReq_GetDisplayChangeRequest2:
     1265            return sizeof(VMMDevDisplayChangeRequest2);
     1266        case VMMDevReq_VideoModeSupported:
     1267            return sizeof(VMMDevVideoModeSupportedRequest);
     1268        case VMMDevReq_GetHeightReduction:
     1269            return sizeof(VMMDevGetHeightReductionRequest);
     1270        case VMMDevReq_ReportGuestCapabilities:
     1271            return sizeof(VMMDevReqGuestCapabilities);
     1272        case VMMDevReq_SetGuestCapabilities:
     1273            return sizeof(VMMDevReqGuestCapabilities2);
     1274#ifdef VBOX_WITH_HGCM
     1275        case VMMDevReq_HGCMConnect:
     1276            return sizeof(VMMDevHGCMConnect);
     1277        case VMMDevReq_HGCMDisconnect:
     1278            return sizeof(VMMDevHGCMDisconnect);
     1279#ifdef VBOX_WITH_64_BITS_GUESTS
     1280        case VMMDevReq_HGCMCall32:
     1281            return sizeof(VMMDevHGCMCall);
     1282        case VMMDevReq_HGCMCall64:
     1283            return sizeof(VMMDevHGCMCall);
     1284#else
     1285        case VMMDevReq_HGCMCall:
     1286            return sizeof(VMMDevHGCMCall);
     1287#endif /* VBOX_WITH_64_BITS_GUESTS */
     1288        case VMMDevReq_HGCMCancel:
     1289            return sizeof(VMMDevHGCMCancel);
     1290#endif /* VBOX_WITH_HGCM */
     1291        case VMMDevReq_VideoAccelEnable:
     1292            return sizeof(VMMDevVideoAccelEnable);
     1293        case VMMDevReq_VideoAccelFlush:
     1294            return sizeof(VMMDevVideoAccelFlush);
     1295        case VMMDevReq_VideoSetVisibleRegion:
     1296            return sizeof(VMMDevVideoSetVisibleRegion);
     1297        case VMMDevReq_GetSeamlessChangeRequest:
     1298            return sizeof(VMMDevSeamlessChangeRequest);
     1299        case VMMDevReq_QueryCredentials:
     1300            return sizeof(VMMDevCredentials);
     1301        case VMMDevReq_ReportGuestStats:
     1302            return sizeof(VMMDevReportGuestStats);
     1303        case VMMDevReq_GetMemBalloonChangeRequest:
     1304            return sizeof(VMMDevGetMemBalloonChangeRequest);
     1305        case VMMDevReq_GetStatisticsChangeRequest:
     1306            return sizeof(VMMDevGetStatisticsChangeRequest);
     1307        case VMMDevReq_ChangeMemBalloon:
     1308            return sizeof(VMMDevChangeMemBalloon);
     1309        case VMMDevReq_GetVRDPChangeRequest:
     1310            return sizeof(VMMDevVRDPChangeRequest);
     1311        case VMMDevReq_LogString:
     1312            return sizeof(VMMDevReqLogString);
     1313        default:
     1314            return 0;
     1315    }
     1316}
     1317
     1318
     1319/**
     1320 * Initializes a request structure.
     1321 *
     1322 * @returns VBox status code.
     1323 * @param   req             The request structure to initialize.
     1324 * @param   type            The request type.
     1325 */
     1326DECLINLINE(int) vmmdevInitRequest(VMMDevRequestHeader *req, VMMDevRequestType type)
     1327{
     1328    uint32_t requestSize;
     1329    if (!req)
     1330        return VERR_INVALID_PARAMETER;
     1331    requestSize = (uint32_t)vmmdevGetRequestSize(type);
     1332    if (!requestSize)
     1333        return VERR_INVALID_PARAMETER;
     1334    req->size        = requestSize;
     1335    req->version     = VMMDEV_REQUEST_HEADER_VERSION;
     1336    req->requestType = type;
     1337    req->rc          = VERR_GENERAL_FAILURE;
     1338    req->reserved1   = 0;
     1339    req->reserved2   = 0;
     1340    return VINF_SUCCESS;
     1341}
     1342
    941343/** @} */
    951344RT_C_DECLS_END
  • trunk/include/VBox/param.h

    r21217 r21223  
    135135
    136136
     137/** @defgroup   grp_vbox_pci        PCI Identifiers
     138 * @{ */
     139/** VirtualBox PCI vendor ID. */
     140#define VBOX_PCI_VENDORID           (0x80ee)
     141
     142/** @name VirtualBox graphics card identifiers
     143 * @{ */
     144#define VBOX_VENDORID               VBOX_PCI_VENDORID   /**< @todo wonderful choice of name! Please squeeze a _VGA_ or something in there, please. */
     145#define VBOX_DEVICEID               (0xbeef)            /**< @todo ditto. */
     146#define VBOX_VESA_VENDORID          VBOX_PCI_VENDORID
     147#define VBOX_VESA_DEVICEID          (0xbeef)
     148/** @} */
     149
     150/** @name VMMDev PCI card identifiers
     151 * @{ */
     152#define VMMDEV_VENDORID             VBOX_PCI_VENDORID
     153#define VMMDEV_DEVICEID             (0xcafe)
     154/** @} */
     155
     156/** @} */
     157
    137158/** @} */
    138159
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