Changeset 68659 in vbox for trunk/include
- Timestamp:
- Sep 5, 2017 6:35:16 PM (7 years ago)
- Location:
- trunk/include/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VMMDev.h
r68630 r68659 61 61 /** Port for generic request interface (relative offset). */ 62 62 #define VMMDEV_PORT_OFF_REQUEST 0 63 64 65 /** @name VMMDev events.66 *67 * Used mainly by VMMDevReq_AcknowledgeEvents/VMMDevEvents and version 1.3 of68 * VMMDevMemory.69 *70 * @{71 */72 /** Host mouse capabilities has been changed. */73 #define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED RT_BIT(0)74 /** HGCM event. */75 #define VMMDEV_EVENT_HGCM RT_BIT(1)76 /** A display change request has been issued. */77 #define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST RT_BIT(2)78 /** Credentials are available for judgement. */79 #define VMMDEV_EVENT_JUDGE_CREDENTIALS RT_BIT(3)80 /** The guest has been restored. */81 #define VMMDEV_EVENT_RESTORED RT_BIT(4)82 /** Seamless mode state changed. */83 #define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST RT_BIT(5)84 /** Memory balloon size changed. */85 #define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST RT_BIT(6)86 /** Statistics interval changed. */87 #define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST RT_BIT(7)88 /** VRDP status changed. */89 #define VMMDEV_EVENT_VRDP RT_BIT(8)90 /** New mouse position data available. */91 #define VMMDEV_EVENT_MOUSE_POSITION_CHANGED RT_BIT(9)92 /** CPU hotplug event occurred. */93 #define VMMDEV_EVENT_CPU_HOTPLUG RT_BIT(10)94 /** The mask of valid events, for sanity checking. */95 #define VMMDEV_EVENT_VALID_EVENT_MASK UINT32_C(0x000007ff)96 /** @} */97 63 98 64 … … 929 895 AssertCompileSize(VMMDevChangeMemBalloon, 24+16); 930 896 931 /** @name The ballooning chunk size which VMMDev works at.932 * @{ */933 #define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES (_1M/4096)934 #define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE (VMMDEV_MEMORY_BALLOON_CHUNK_PAGES*4096)935 /** @} */936 937 897 938 898 /** … … 1498 1458 } VMMDevHGCMDisconnect; 1499 1459 AssertCompileSize(VMMDevHGCMDisconnect, 32+4); 1500 1501 /**1502 * HGCM parameter type.1503 */1504 typedef enum1505 {1506 VMMDevHGCMParmType_Invalid = 0,1507 VMMDevHGCMParmType_32bit = 1,1508 VMMDevHGCMParmType_64bit = 2,1509 VMMDevHGCMParmType_PhysAddr = 3, /**< @deprecated Doesn't work, use PageList. */1510 VMMDevHGCMParmType_LinAddr = 4, /**< In and Out */1511 VMMDevHGCMParmType_LinAddr_In = 5, /**< In (read; host<-guest) */1512 VMMDevHGCMParmType_LinAddr_Out = 6, /**< Out (write; host->guest) */1513 VMMDevHGCMParmType_LinAddr_Locked = 7, /**< Locked In and Out */1514 VMMDevHGCMParmType_LinAddr_Locked_In = 8, /**< Locked In (read; host<-guest) */1515 VMMDevHGCMParmType_LinAddr_Locked_Out = 9, /**< Locked Out (write; host->guest) */1516 VMMDevHGCMParmType_PageList = 10, /**< Physical addresses of locked pages for a buffer. */1517 VMMDevHGCMParmType_SizeHack = 0x7fffffff1518 } HGCMFunctionParameterType;1519 AssertCompileSize(HGCMFunctionParameterType, 4);1520 1521 # ifdef VBOX_WITH_64_BITS_GUESTS1522 /**1523 * HGCM function parameter, 32-bit client.1524 */1525 typedef struct1526 {1527 HGCMFunctionParameterType type;1528 union1529 {1530 uint32_t value32;1531 uint64_t value64;1532 struct1533 {1534 uint32_t size;1535 1536 union1537 {1538 RTGCPHYS32 physAddr;1539 RTGCPTR32 linearAddr;1540 } u;1541 } Pointer;1542 struct1543 {1544 uint32_t size; /**< Size of the buffer described by the page list. */1545 uint32_t offset; /**< Relative to the request header, valid if size != 0. */1546 } PageList;1547 } u;1548 # ifdef __cplusplus1549 void SetUInt32(uint32_t u32)1550 {1551 type = VMMDevHGCMParmType_32bit;1552 u.value64 = 0; /* init unused bits to 0 */1553 u.value32 = u32;1554 }1555 1556 int GetUInt32(uint32_t RT_FAR *pu32)1557 {1558 if (type == VMMDevHGCMParmType_32bit)1559 {1560 *pu32 = u.value32;1561 return VINF_SUCCESS;1562 }1563 return VERR_INVALID_PARAMETER;1564 }1565 1566 void SetUInt64(uint64_t u64)1567 {1568 type = VMMDevHGCMParmType_64bit;1569 u.value64 = u64;1570 }1571 1572 int GetUInt64(uint64_t RT_FAR *pu64)1573 {1574 if (type == VMMDevHGCMParmType_64bit)1575 {1576 *pu64 = u.value64;1577 return VINF_SUCCESS;1578 }1579 return VERR_INVALID_PARAMETER;1580 }1581 1582 void SetPtr(void RT_FAR *pv, uint32_t cb)1583 {1584 type = VMMDevHGCMParmType_LinAddr;1585 u.Pointer.size = cb;1586 u.Pointer.u.linearAddr = (RTGCPTR32)(uintptr_t)pv;1587 }1588 # endif /* __cplusplus */1589 } HGCMFunctionParameter32;1590 AssertCompileSize(HGCMFunctionParameter32, 4+8);1591 1592 /**1593 * HGCM function parameter, 64-bit client.1594 */1595 typedef struct1596 {1597 HGCMFunctionParameterType type;1598 union1599 {1600 uint32_t value32;1601 uint64_t value64;1602 struct1603 {1604 uint32_t size;1605 1606 union1607 {1608 RTGCPHYS64 physAddr;1609 RTGCPTR64 linearAddr;1610 } u;1611 } Pointer;1612 struct1613 {1614 uint32_t size; /**< Size of the buffer described by the page list. */1615 uint32_t offset; /**< Relative to the request header, valid if size != 0. */1616 } PageList;1617 } u;1618 # ifdef __cplusplus1619 void SetUInt32(uint32_t u32)1620 {1621 type = VMMDevHGCMParmType_32bit;1622 u.value64 = 0; /* init unused bits to 0 */1623 u.value32 = u32;1624 }1625 1626 int GetUInt32(uint32_t RT_FAR *pu32)1627 {1628 if (type == VMMDevHGCMParmType_32bit)1629 {1630 *pu32 = u.value32;1631 return VINF_SUCCESS;1632 }1633 return VERR_INVALID_PARAMETER;1634 }1635 1636 void SetUInt64(uint64_t u64)1637 {1638 type = VMMDevHGCMParmType_64bit;1639 u.value64 = u64;1640 }1641 1642 int GetUInt64(uint64_t RT_FAR *pu64)1643 {1644 if (type == VMMDevHGCMParmType_64bit)1645 {1646 *pu64 = u.value64;1647 return VINF_SUCCESS;1648 }1649 return VERR_INVALID_PARAMETER;1650 }1651 1652 void SetPtr(void RT_FAR *pv, uint32_t cb)1653 {1654 type = VMMDevHGCMParmType_LinAddr;1655 u.Pointer.size = cb;1656 u.Pointer.u.linearAddr = (uintptr_t)pv;1657 }1658 # endif /** __cplusplus */1659 } HGCMFunctionParameter64;1660 AssertCompileSize(HGCMFunctionParameter64, 4+12);1661 1662 /* Redefine the structure type for the guest code. */1663 # ifndef VBOX_HGCM_HOST_CODE1664 # if ARCH_BITS == 641665 # define HGCMFunctionParameter HGCMFunctionParameter641666 # elif ARCH_BITS == 321667 # define HGCMFunctionParameter HGCMFunctionParameter321668 # else1669 # error "Unsupported sizeof (void *)"1670 # endif1671 # endif /* !VBOX_HGCM_HOST_CODE */1672 1673 # else /* !VBOX_WITH_64_BITS_GUESTS */1674 1675 /**1676 * HGCM function parameter, 32-bit client.1677 *1678 * @todo If this is the same as HGCMFunctionParameter32, why the duplication?1679 */1680 typedef struct1681 {1682 HGCMFunctionParameterType type;1683 union1684 {1685 uint32_t value32;1686 uint64_t value64;1687 struct1688 {1689 uint32_t size;1690 1691 union1692 {1693 RTGCPHYS32 physAddr;1694 RTGCPTR32 linearAddr;1695 } u;1696 } Pointer;1697 struct1698 {1699 uint32_t size; /**< Size of the buffer described by the page list. */1700 uint32_t offset; /**< Relative to the request header, valid if size != 0. */1701 } PageList;1702 } u;1703 # ifdef __cplusplus1704 void SetUInt32(uint32_t u32)1705 {1706 type = VMMDevHGCMParmType_32bit;1707 u.value64 = 0; /* init unused bits to 0 */1708 u.value32 = u32;1709 }1710 1711 int GetUInt32(uint32_t *pu32)1712 {1713 if (type == VMMDevHGCMParmType_32bit)1714 {1715 *pu32 = u.value32;1716 return VINF_SUCCESS;1717 }1718 return VERR_INVALID_PARAMETER;1719 }1720 1721 void SetUInt64(uint64_t u64)1722 {1723 type = VMMDevHGCMParmType_64bit;1724 u.value64 = u64;1725 }1726 1727 int GetUInt64(uint64_t *pu64)1728 {1729 if (type == VMMDevHGCMParmType_64bit)1730 {1731 *pu64 = u.value64;1732 return VINF_SUCCESS;1733 }1734 return VERR_INVALID_PARAMETER;1735 }1736 1737 void SetPtr(void *pv, uint32_t cb)1738 {1739 type = VMMDevHGCMParmType_LinAddr;1740 u.Pointer.size = cb;1741 u.Pointer.u.linearAddr = (uintptr_t)pv;1742 }1743 # endif /* __cplusplus */1744 } HGCMFunctionParameter;1745 AssertCompileSize(HGCMFunctionParameter, 4+8);1746 # endif /* !VBOX_WITH_64_BITS_GUESTS */1747 1460 1748 1461 /** -
trunk/include/VBox/VMMDevCoreTypes.h
r68630 r68659 31 31 32 32 #include <iprt/assert.h> 33 #ifdef __cplusplus 34 # include <iprt/err.h> 35 #endif 33 36 34 37 … … 36 39 * @{ 37 40 */ 41 42 /** @name VMMDev events. 43 * 44 * Used mainly by VMMDevReq_AcknowledgeEvents/VMMDevEvents and version 1.3 of 45 * VMMDevMemory. 46 * 47 * @{ 48 */ 49 /** Host mouse capabilities has been changed. */ 50 #define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED RT_BIT(0) 51 /** HGCM event. */ 52 #define VMMDEV_EVENT_HGCM RT_BIT(1) 53 /** A display change request has been issued. */ 54 #define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST RT_BIT(2) 55 /** Credentials are available for judgement. */ 56 #define VMMDEV_EVENT_JUDGE_CREDENTIALS RT_BIT(3) 57 /** The guest has been restored. */ 58 #define VMMDEV_EVENT_RESTORED RT_BIT(4) 59 /** Seamless mode state changed. */ 60 #define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST RT_BIT(5) 61 /** Memory balloon size changed. */ 62 #define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST RT_BIT(6) 63 /** Statistics interval changed. */ 64 #define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST RT_BIT(7) 65 /** VRDP status changed. */ 66 #define VMMDEV_EVENT_VRDP RT_BIT(8) 67 /** New mouse position data available. */ 68 #define VMMDEV_EVENT_MOUSE_POSITION_CHANGED RT_BIT(9) 69 /** CPU hotplug event occurred. */ 70 #define VMMDEV_EVENT_CPU_HOTPLUG RT_BIT(10) 71 /** The mask of valid events, for sanity checking. */ 72 #define VMMDEV_EVENT_VALID_EVENT_MASK UINT32_C(0x000007ff) 73 /** @} */ 74 75 76 /** @name The ballooning chunk size which VMMDev works at. 77 * @{ */ 78 #define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES (_1M/4096) 79 #define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE (VMMDEV_MEMORY_BALLOON_CHUNK_PAGES*4096) 80 /** @} */ 38 81 39 82 … … 60 103 VMMDev_Seamless_Host_Window = 2 /**< windowed mode; each top-level guest window is represented in a host window. */ 61 104 } VMMDevSeamlessMode; 105 62 106 63 107 /** … … 77 121 } VMMDevCpuEventType; 78 122 123 124 125 79 126 /** 80 127 * HGCM service location types. … … 115 162 } HGCMServiceLocation; 116 163 AssertCompileSize(HGCMServiceLocation, 128+4); 164 165 166 /** 167 * HGCM parameter type. 168 */ 169 typedef enum 170 { 171 VMMDevHGCMParmType_Invalid = 0, 172 VMMDevHGCMParmType_32bit = 1, 173 VMMDevHGCMParmType_64bit = 2, 174 VMMDevHGCMParmType_PhysAddr = 3, /**< @deprecated Doesn't work, use PageList. */ 175 VMMDevHGCMParmType_LinAddr = 4, /**< In and Out */ 176 VMMDevHGCMParmType_LinAddr_In = 5, /**< In (read; host<-guest) */ 177 VMMDevHGCMParmType_LinAddr_Out = 6, /**< Out (write; host->guest) */ 178 VMMDevHGCMParmType_LinAddr_Locked = 7, /**< Locked In and Out */ 179 VMMDevHGCMParmType_LinAddr_Locked_In = 8, /**< Locked In (read; host<-guest) */ 180 VMMDevHGCMParmType_LinAddr_Locked_Out = 9, /**< Locked Out (write; host->guest) */ 181 VMMDevHGCMParmType_PageList = 10, /**< Physical addresses of locked pages for a buffer. */ 182 VMMDevHGCMParmType_SizeHack = 0x7fffffff 183 } HGCMFunctionParameterType; 184 AssertCompileSize(HGCMFunctionParameterType, 4); 185 186 187 # ifdef VBOX_WITH_64_BITS_GUESTS 188 /** 189 * HGCM function parameter, 32-bit client. 190 */ 191 # pragma pack(4) /* We force structure dword packing here for hysterical raisins. Saves us 4 bytes, at the cost of 192 misaligning the value64 member of every other parameter structure. */ 193 typedef struct 194 { 195 HGCMFunctionParameterType type; 196 union 197 { 198 uint32_t value32; 199 uint64_t value64; 200 struct 201 { 202 uint32_t size; 203 204 union 205 { 206 RTGCPHYS32 physAddr; 207 RTGCPTR32 linearAddr; 208 } u; 209 } Pointer; 210 struct 211 { 212 uint32_t size; /**< Size of the buffer described by the page list. */ 213 uint32_t offset; /**< Relative to the request header, valid if size != 0. */ 214 } PageList; 215 } u; 216 # ifdef __cplusplus 217 void SetUInt32(uint32_t u32) 218 { 219 type = VMMDevHGCMParmType_32bit; 220 u.value64 = 0; /* init unused bits to 0 */ 221 u.value32 = u32; 222 } 223 224 int GetUInt32(uint32_t RT_FAR *pu32) 225 { 226 if (type == VMMDevHGCMParmType_32bit) 227 { 228 *pu32 = u.value32; 229 return VINF_SUCCESS; 230 } 231 return VERR_INVALID_PARAMETER; 232 } 233 234 void SetUInt64(uint64_t u64) 235 { 236 type = VMMDevHGCMParmType_64bit; 237 u.value64 = u64; 238 } 239 240 int GetUInt64(uint64_t RT_FAR *pu64) 241 { 242 if (type == VMMDevHGCMParmType_64bit) 243 { 244 *pu64 = u.value64; 245 return VINF_SUCCESS; 246 } 247 return VERR_INVALID_PARAMETER; 248 } 249 250 void SetPtr(void RT_FAR *pv, uint32_t cb) 251 { 252 type = VMMDevHGCMParmType_LinAddr; 253 u.Pointer.size = cb; 254 u.Pointer.u.linearAddr = (RTGCPTR32)(uintptr_t)pv; 255 } 256 # endif /* __cplusplus */ 257 } HGCMFunctionParameter32; 258 # pragma pack() 259 AssertCompileSize(HGCMFunctionParameter32, 4+8); 260 261 /** 262 * HGCM function parameter, 64-bit client. 263 */ 264 # pragma pack(4)/* We force structure dword packing here for hysterical raisins. Saves us 4 bytes, at the cost of 265 misaligning the value64, physAddr and linearAddr members of every other parameter structure. */ 266 typedef struct 267 { 268 HGCMFunctionParameterType type; 269 union 270 { 271 uint32_t value32; 272 uint64_t value64; 273 struct 274 { 275 uint32_t size; 276 277 union 278 { 279 RTGCPHYS64 physAddr; 280 RTGCPTR64 linearAddr; 281 } u; 282 } Pointer; 283 struct 284 { 285 uint32_t size; /**< Size of the buffer described by the page list. */ 286 uint32_t offset; /**< Relative to the request header, valid if size != 0. */ 287 } PageList; 288 } u; 289 # ifdef __cplusplus 290 void SetUInt32(uint32_t u32) 291 { 292 type = VMMDevHGCMParmType_32bit; 293 u.value64 = 0; /* init unused bits to 0 */ 294 u.value32 = u32; 295 } 296 297 int GetUInt32(uint32_t RT_FAR *pu32) 298 { 299 if (type == VMMDevHGCMParmType_32bit) 300 { 301 *pu32 = u.value32; 302 return VINF_SUCCESS; 303 } 304 return VERR_INVALID_PARAMETER; 305 } 306 307 void SetUInt64(uint64_t u64) 308 { 309 type = VMMDevHGCMParmType_64bit; 310 u.value64 = u64; 311 } 312 313 int GetUInt64(uint64_t RT_FAR *pu64) 314 { 315 if (type == VMMDevHGCMParmType_64bit) 316 { 317 *pu64 = u.value64; 318 return VINF_SUCCESS; 319 } 320 return VERR_INVALID_PARAMETER; 321 } 322 323 void SetPtr(void RT_FAR *pv, uint32_t cb) 324 { 325 type = VMMDevHGCMParmType_LinAddr; 326 u.Pointer.size = cb; 327 u.Pointer.u.linearAddr = (uintptr_t)pv; 328 } 329 # endif /** __cplusplus */ 330 } HGCMFunctionParameter64; 331 # pragma pack() 332 AssertCompileSize(HGCMFunctionParameter64, 4+12); 333 334 /* Redefine the structure type for the guest code. */ 335 # ifndef VBOX_HGCM_HOST_CODE 336 # if ARCH_BITS == 64 337 # define HGCMFunctionParameter HGCMFunctionParameter64 338 # elif ARCH_BITS == 32 339 # define HGCMFunctionParameter HGCMFunctionParameter32 340 # else 341 # error "Unsupported sizeof (void *)" 342 # endif 343 # endif /* !VBOX_HGCM_HOST_CODE */ 344 345 # else /* !VBOX_WITH_64_BITS_GUESTS */ 346 347 /** 348 * HGCM function parameter, 32-bit client. 349 * 350 * @todo If this is the same as HGCMFunctionParameter32, why the duplication? 351 */ 352 # pragma pack(4) /* We force structure dword packing here for hysterical raisins. Saves us 4 bytes, at the cost of 353 misaligning the value64 member of every other parameter structure. */ 354 typedef struct 355 { 356 HGCMFunctionParameterType type; 357 union 358 { 359 uint32_t value32; 360 uint64_t value64; 361 struct 362 { 363 uint32_t size; 364 365 union 366 { 367 RTGCPHYS32 physAddr; 368 RTGCPTR32 linearAddr; 369 } u; 370 } Pointer; 371 struct 372 { 373 uint32_t size; /**< Size of the buffer described by the page list. */ 374 uint32_t offset; /**< Relative to the request header, valid if size != 0. */ 375 } PageList; 376 } u; 377 # ifdef __cplusplus 378 void SetUInt32(uint32_t u32) 379 { 380 type = VMMDevHGCMParmType_32bit; 381 u.value64 = 0; /* init unused bits to 0 */ 382 u.value32 = u32; 383 } 384 385 int GetUInt32(uint32_t *pu32) 386 { 387 if (type == VMMDevHGCMParmType_32bit) 388 { 389 *pu32 = u.value32; 390 return VINF_SUCCESS; 391 } 392 return VERR_INVALID_PARAMETER; 393 } 394 395 void SetUInt64(uint64_t u64) 396 { 397 type = VMMDevHGCMParmType_64bit; 398 u.value64 = u64; 399 } 400 401 int GetUInt64(uint64_t *pu64) 402 { 403 if (type == VMMDevHGCMParmType_64bit) 404 { 405 *pu64 = u.value64; 406 return VINF_SUCCESS; 407 } 408 return VERR_INVALID_PARAMETER; 409 } 410 411 void SetPtr(void *pv, uint32_t cb) 412 { 413 type = VMMDevHGCMParmType_LinAddr; 414 u.Pointer.size = cb; 415 u.Pointer.u.linearAddr = (uintptr_t)pv; 416 } 417 # endif /* __cplusplus */ 418 } HGCMFunctionParameter; 419 # pragma pack() 420 AssertCompileSize(HGCMFunctionParameter, 4+8); 421 # endif /* !VBOX_WITH_64_BITS_GUESTS */ 422 117 423 118 424
Note:
See TracChangeset
for help on using the changeset viewer.