Changeset 81590 in vbox for trunk/include
- Timestamp:
- Oct 30, 2019 2:13:37 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 134345
- Location:
- trunk/include/VBox/vmm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmdev.h
r81575 r81590 5725 5725 5726 5726 5727 /** @def PDMDEVINS_2_DATA 5728 * This is a safer edition of PDMINS_2_DATA that checks that the size of the 5729 * target type is same as PDMDEVREG::cbInstanceShared in strict builds. 5730 * 5731 * @note Do no use this macro in common code working on a core structure which 5732 * device specific code has expanded. 5733 */ 5734 #if defined(VBOX_STRICT) && defined(RT_COMPILER_SUPPORTS_LAMBDA) 5735 # define PDMDEVINS_2_DATA(a_pDevIns, a_PtrType) \ 5736 ([](PPDMDEVINS a_pLambdaDevIns) -> a_PtrType \ 5737 { \ 5738 a_PtrType pLambdaRet = (a_PtrType)(a_pLambdaDevIns)->CTX_SUFF(pvInstanceData); \ 5739 Assert(sizeof(*pLambdaRet) == a_pLambdaDevIns->pReg->cbInstanceShared); \ 5740 return pLambdaRet; \ 5741 }(a_pDevIns)) 5742 #else 5743 # define PDMDEVINS_2_DATA(a_pDevIns, a_PtrType) ( (a_PtrType)(a_pDevIns)->CTX_SUFF(pvInstanceData) ) 5744 #endif 5745 5746 /** @def PDMDEVINS_2_DATA_CC 5747 * This is a safer edition of PDMINS_2_DATA_CC that checks that the size of the 5748 * target type is same as PDMDEVREG::cbInstanceCC in strict builds. 5749 * 5750 * @note Do no use this macro in common code working on a core structure which 5751 * device specific code has expanded. 5752 */ 5753 #if defined(VBOX_STRICT) && defined(RT_COMPILER_SUPPORTS_LAMBDA) 5754 # define PDMDEVINS_2_DATA_CC(a_pDevIns, a_PtrType) \ 5755 ([](PPDMDEVINS a_pLambdaDevIns) -> a_PtrType \ 5756 { \ 5757 a_PtrType pLambdaRet = (a_PtrType)&(a_pLambdaDevIns)->achInstanceData[0]; \ 5758 Assert(sizeof(*pLambdaRet) == a_pLambdaDevIns->pReg->cbInstanceCC); \ 5759 return pLambdaRet; \ 5760 }(a_pDevIns)) 5761 #else 5762 # define PDMDEVINS_2_DATA_CC(a_pDevIns, a_PtrType) ( (a_PtrType)(void *)&(a_pDevIns)->achInstanceData[0] ) 5763 #endif 5764 5765 5727 5766 #ifdef IN_RING3 5728 5767 -
trunk/include/VBox/vmm/pdmins.h
r80531 r81590 51 51 /** @def PDMINS_2_DATA 52 52 * Gets the shared instance data for a PDM device, USB device, or driver instance. 53 * @note For devices using PDMDEVINS_2_DATA is highly recommended. 53 54 */ 54 55 #define PDMINS_2_DATA(pIns, type) ( (type)(pIns)->CTX_SUFF(pvInstanceData) ) … … 56 57 /** @def PDMINS_2_DATA_CC 57 58 * Gets the current context instance data for a PDM device, USB device, or driver instance. 59 * @note For devices using PDMDEVINS_2_DATA_CC is highly recommended. 58 60 */ 59 61 #define PDMINS_2_DATA_CC(pIns, type) ( (type)(void *)&(pIns)->achInstanceData[0] )
Note:
See TracChangeset
for help on using the changeset viewer.