Changeset 83281 in vbox
- Timestamp:
- Mar 13, 2020 1:02:08 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
include/VBox/vmm/pdmdev.h (modified) (6 diffs)
-
src/VBox/Devices/testcase/tstDevicePdmDevHlp.cpp (modified) (6 diffs)
-
src/VBox/VMM/VMMR3/PDMDevHlp.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmdev.h
r83263 r83281 44 44 #include <VBox/vmm/ssm.h> 45 45 #include <VBox/vmm/cfgm.h> 46 #include <VBox/vmm/cpum.h> 46 47 #include <VBox/vmm/dbgf.h> 48 #include <VBox/vmm/pgm.h> /* PGMR3HandlerPhysicalTypeRegister() argument types. */ 47 49 #include <VBox/err.h> /* VINF_EM_DBG_STOP, also 120+ source files expecting this. */ 48 50 #include <iprt/stdarg.h> … … 2086 2088 2087 2089 /** Current PDMDEVHLPR3 version number. */ 2088 #define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 4 2, 0)2090 #define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 43, 0) 2089 2091 2090 2092 /** … … 3905 3907 DECLR3CALLBACKMEMBER(void, pfnPhysBulkReleasePageMappingLocks,(PPDMDEVINS pDevIns, uint32_t cPages, PPGMPAGEMAPLOCK paLocks)); 3906 3908 3909 /** 3910 * Returns the micro architecture used for the guest. 3911 * 3912 * @returns CPU micro architecture enum. 3913 * @param pDevIns The device instance. 3914 */ 3915 DECLR3CALLBACKMEMBER(CPUMMICROARCH, pfnCpuGetGuestMicroarch,(PPDMDEVINS pDevIns)); 3916 3907 3917 /** Space reserved for future members. 3908 3918 * @{ */ … … 4115 4125 */ 4116 4126 DECLR3CALLBACKMEMBER(void *, pfnQueryGenericUserObject,(PPDMDEVINS pDevIns, PCRTUUID pUuid)); 4127 4128 /** 4129 * Register a physical page access handler type. 4130 * 4131 * @returns VBox status code. 4132 * @param pDevIns The device instance. 4133 * @param enmKind The kind of access handler. 4134 * @param pfnHandlerR3 Pointer to the ring-3 handler callback. 4135 * @param pszModR0 The name of the ring-0 module, NULL is an alias for 4136 * the main ring-0 module. 4137 * @param pszHandlerR0 The name of the ring-0 handler, NULL if the ring-3 4138 * handler should be called. 4139 * @param pszPfHandlerR0 The name of the ring-0 \#PF handler, NULL if the 4140 * ring-3 handler should be called. 4141 * @param pszModRC The name of the raw-mode context module, NULL is an 4142 * alias for the main RC module. 4143 * @param pszHandlerRC The name of the raw-mode context handler, NULL if 4144 * the ring-3 handler should be called. 4145 * @param pszPfHandlerRC The name of the raw-mode context \#PF handler, NULL 4146 * if the ring-3 handler should be called. 4147 * @param pszDesc The type description. 4148 * @param phType Where to return the type handle (cross context 4149 * safe). 4150 */ 4151 DECLR3CALLBACKMEMBER(int, pfnPGMHandlerPhysicalTypeRegister, (PPDMDEVINS pDevIns, PGMPHYSHANDLERKIND enmKind, 4152 R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3, 4153 const char *pszHandlerR0, const char *pszPfHandlerR0, 4154 const char *pszHandlerRC, const char *pszPfHandlerRC, 4155 const char *pszDesc, PPGMPHYSHANDLERTYPE phType)); 4117 4156 4118 4157 /** @} */ … … 6197 6236 { 6198 6237 pDevIns->CTX_SUFF(pHlp)->pfnPhysBulkReleasePageMappingLocks(pDevIns, cPages, paLocks); 6238 } 6239 6240 /** 6241 * @copydoc PDMDEVHLPR3::pfnCpuGetGuestMicroarch 6242 */ 6243 DECLINLINE(CPUMMICROARCH) PDMDevHlpCpuGetGuestMicroarch(PPDMDEVINS pDevIns) 6244 { 6245 return pDevIns->CTX_SUFF(pHlp)->pfnCpuGetGuestMicroarch(pDevIns); 6199 6246 } 6200 6247 … … 7684 7731 } 7685 7732 7733 /** 7734 * @copydoc PDMDEVHLPR3::pfnPGMHandlerPhysicalTypeRegister 7735 */ 7736 DECLINLINE(int) PDMDevHlpPGMHandlerPhysicalTypeRegister(PPDMDEVINS pDevIns, PGMPHYSHANDLERKIND enmKind, 7737 R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3, 7738 const char *pszHandlerR0, const char *pszPfHandlerR0, 7739 const char *pszHandlerRC, const char *pszPfHandlerRC, 7740 const char *pszDesc, PPGMPHYSHANDLERTYPE phType) 7741 { 7742 return pDevIns->pHlpR3->pfnPGMHandlerPhysicalTypeRegister(pDevIns, enmKind, pfnHandlerR3, 7743 pszHandlerR0, pszPfHandlerR0, 7744 pszHandlerRC, pszPfHandlerRC, 7745 pszDesc, phType); 7746 } 7747 7686 7748 /** Wrapper around SSMR3GetU32 for simplifying getting enum values saved as uint32_t. */ 7687 7749 # define PDMDEVHLP_SSM_GET_ENUM32_RET(a_pHlp, a_pSSM, a_enmDst, a_EnumType) \ -
trunk/src/VBox/Devices/testcase/tstDevicePdmDevHlp.cpp
r83264 r83281 2692 2692 2693 2693 2694 /** @interface_method_impl{PDMDEVHLPR3,pfnPGMHandlerPhysicalTypeRegister} */ 2695 static DECLCALLBACK(int) pdmR3DevHlp_PGMHandlerPhysicalTypeRegister(PPDMDEVINS pDevIns, PGMPHYSHANDLERKIND enmKind, 2696 R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3, 2697 const char *pszHandlerR0, const char *pszPfHandlerR0, 2698 const char *pszHandlerRC, const char *pszPfHandlerRC, 2699 const char *pszDesc, PPGMPHYSHANDLERTYPE phType) 2700 { 2701 PDMDEV_ASSERT_DEVINS(pDevIns); 2702 RT_NOREF(enmKind, pfnHandlerR3, pszHandlerR0, pszPfHandlerR0, pszHandlerRC, pszPfHandlerRC, pszDesc, phType); 2703 LogFlow(("pdmR3DevHlp_PGMHandlerPhysicalTypeRegister: caller='%s'/%d: enmKind=%d pfnHandlerR3=%p pszHandlerR0=%p:{%s} pszPfHandlerR0=%p:{%s} pszHandlerRC=%p:{%s} pszPfHandlerRC=%p:{%s} pszDesc=%p:{%s} phType=%p\n", 2704 pDevIns->pReg->szName, pDevIns->iInstance, pfnHandlerR3, 2705 pszHandlerR0, pszHandlerR0, pszPfHandlerR0, pszPfHandlerR0, 2706 pszHandlerRC, pszHandlerRC, pszPfHandlerRC, pszPfHandlerRC, 2707 pszDesc, pszDesc, phType)); 2708 2709 int rc = VERR_NOT_IMPLEMENTED; 2710 AssertFailed(); 2711 2712 LogRel(("pdmR3DevHlp_PGMHandlerPhysicalTypeRegister: caller='%s'/%d: returns %Rrc\n", 2713 pDevIns->pReg->szName, pDevIns->iInstance, rc)); 2714 return rc; 2715 } 2716 2717 2694 2718 /** @interface_method_impl{PDMDEVHLPR3,pfnPhysRead} */ 2695 2719 static DECLCALLBACK(int) pdmR3DevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead) … … 2814 2838 2815 2839 Log(("pdmR3DevHlp_PhysBulkReleasePageMappingLocks: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance)); 2840 } 2841 2842 2843 /** @interface_method_impl{PDMDEVHLPR3,pfnCpuGetGuestMicroarch} */ 2844 static DECLCALLBACK(CPUMMICROARCH) pdmR3DevHlp_CpuGetGuestMicroarch(PPDMDEVINS pDevIns) 2845 { 2846 PDMDEV_ASSERT_DEVINS(pDevIns); 2847 LogFlow(("pdmR3DevHlp_CpuGetGuestMicroarch: caller='%s'/%d\n", 2848 pDevIns->pReg->szName, pDevIns->iInstance)); 2849 2850 CPUMMICROARCH enmMicroarch = kCpumMicroarch_Intel_P6; 2851 2852 Log(("pdmR3DevHlp_CpuGetGuestMicroarch: caller='%s'/%d: returns %u\n", pDevIns->pReg->szName, pDevIns->iInstance, enmMicroarch)); 2853 return enmMicroarch; 2816 2854 } 2817 2855 … … 4627 4665 4628 4666 /** @interface_method_impl{PDMDEVHLPR3,pfnIommuRegister} */ 4629 static DECLCALLBACK(int) pdmR3DevHlp_IommuRegister(PPDMDEVINS pDevIns, PPDMIOMMUREG pIommuReg, PCPDMIOMMUHLP*ppIommuHlp)4667 static DECLCALLBACK(int) pdmR3DevHlp_IommuRegister(PPDMDEVINS pDevIns, PPDMIOMMUREGR3 pIommuReg, PCPDMIOMMUHLPR3 *ppIommuHlp) 4630 4668 { 4631 4669 PDMDEV_ASSERT_DEVINS(pDevIns); … … 4636 4674 * Validate input. 4637 4675 */ 4638 AssertMsgReturn(pIommuReg->u32Version == PDM_IOMMUREG _VERSION,4639 ("%s/%d: u32Version=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIommuReg->u32Version, PDM_IOMMUREG _VERSION),4676 AssertMsgReturn(pIommuReg->u32Version == PDM_IOMMUREGR3_VERSION, 4677 ("%s/%d: u32Version=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIommuReg->u32Version, PDM_IOMMUREGR3_VERSION), 4640 4678 VERR_INVALID_PARAMETER); 4641 4679 4642 4680 /** @todo IOMMU: Validate other parameters */ 4643 4681 4644 AssertMsgReturn(pIommuReg->u32TheEnd == PDM_IOMMUREG _VERSION,4645 ("%s/%d: u32TheEnd=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIommuReg->u32TheEnd, PDM_IOMMUREG _VERSION),4682 AssertMsgReturn(pIommuReg->u32TheEnd == PDM_IOMMUREGR3_VERSION, 4683 ("%s/%d: u32TheEnd=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIommuReg->u32TheEnd, PDM_IOMMUREGR3_VERSION), 4646 4684 VERR_INVALID_PARAMETER); 4647 4685 AssertPtrReturn(ppIommuHlp, VERR_INVALID_POINTER); … … 5301 5339 pdmR3DevHlp_PhysBulkGCPhys2CCPtrReadOnly, 5302 5340 pdmR3DevHlp_PhysBulkReleasePageMappingLocks, 5341 pdmR3DevHlp_CpuGetGuestMicroarch, 5303 5342 NULL, 5304 5343 NULL, … … 5329 5368 pdmR3DevHlp_GetSupDrvSession, 5330 5369 pdmR3DevHlp_QueryGenericUserObject, 5370 pdmR3DevHlp_PGMHandlerPhysicalTypeRegister, 5331 5371 PDM_DEVHLPR3_VERSION /* the end */ 5332 5372 }; -
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r83263 r83281 732 732 733 733 734 /** @interface_method_impl{PDMDEVHLPR3,pfnPGMHandlerPhysicalTypeRegister} */ 735 static DECLCALLBACK(int) pdmR3DevHlp_PGMHandlerPhysicalTypeRegister(PPDMDEVINS pDevIns, PGMPHYSHANDLERKIND enmKind, 736 R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3, 737 const char *pszHandlerR0, const char *pszPfHandlerR0, 738 const char *pszHandlerRC, const char *pszPfHandlerRC, 739 const char *pszDesc, PPGMPHYSHANDLERTYPE phType) 740 { 741 PDMDEV_ASSERT_DEVINS(pDevIns); 742 PVM pVM = pDevIns->Internal.s.pVMR3; 743 LogFlow(("pdmR3DevHlp_PGMHandlerPhysicalTypeRegister: caller='%s'/%d: enmKind=%d pfnHandlerR3=%p pszHandlerR0=%p:{%s} pszPfHandlerR0=%p:{%s} pszHandlerRC=%p:{%s} pszPfHandlerRC=%p:{%s} pszDesc=%p:{%s} phType=%p\n", 744 pDevIns->pReg->szName, pDevIns->iInstance, pfnHandlerR3, 745 pszHandlerR0, pszHandlerR0, pszPfHandlerR0, pszPfHandlerR0, 746 pszHandlerRC, pszHandlerRC, pszPfHandlerRC, pszPfHandlerRC, 747 pszDesc, pszDesc, phType)); 748 749 int rc = PGMR3HandlerPhysicalTypeRegister(pVM, enmKind, pfnHandlerR3, 750 pDevIns->pReg->pszR0Mod, pszHandlerR0, pszPfHandlerR0, 751 pDevIns->pReg->pszRCMod, pszHandlerRC, pszPfHandlerRC, 752 pszDesc, phType); 753 754 Log(("pdmR3DevHlp_PGMHandlerPhysicalTypeRegister: caller='%s'/%d: returns %Rrc\n", 755 pDevIns->pReg->szName, pDevIns->iInstance, rc)); 756 return rc; 757 } 758 759 734 760 /** @interface_method_impl{PDMDEVHLPR3,pfnPhysRead} */ 735 761 static DECLCALLBACK(int) pdmR3DevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead) … … 920 946 921 947 Log(("pdmR3DevHlp_PhysBulkReleasePageMappingLocks: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance)); 948 } 949 950 951 /** @interface_method_impl{PDMDEVHLPR3,pfnCpuGetGuestMicroarch} */ 952 static DECLCALLBACK(CPUMMICROARCH) pdmR3DevHlp_CpuGetGuestMicroarch(PPDMDEVINS pDevIns) 953 { 954 PDMDEV_ASSERT_DEVINS(pDevIns); 955 PVM pVM = pDevIns->Internal.s.pVMR3; 956 LogFlow(("pdmR3DevHlp_CpuGetGuestMicroarch: caller='%s'/%d\n", 957 pDevIns->pReg->szName, pDevIns->iInstance)); 958 959 CPUMMICROARCH enmMicroarch = CPUMGetGuestMicroarch(pVM); 960 961 Log(("pdmR3DevHlp_CpuGetGuestMicroarch: caller='%s'/%d: returns %u\n", pDevIns->pReg->szName, pDevIns->iInstance, enmMicroarch)); 962 return enmMicroarch; 922 963 } 923 964 … … 4194 4235 pdmR3DevHlp_PhysBulkGCPhys2CCPtrReadOnly, 4195 4236 pdmR3DevHlp_PhysBulkReleasePageMappingLocks, 4237 pdmR3DevHlp_CpuGetGuestMicroarch, 4196 4238 0, 4197 4239 0, … … 4222 4264 pdmR3DevHlp_GetSupDrvSession, 4223 4265 pdmR3DevHlp_QueryGenericUserObject, 4266 pdmR3DevHlp_PGMHandlerPhysicalTypeRegister, 4224 4267 PDM_DEVHLPR3_VERSION /* the end */ 4225 4268 }; … … 4365 4408 pDevIns->pReg->szName, pDevIns->iInstance, pUuid)); 4366 4409 return NULL; 4410 } 4411 4412 4413 /** @interface_method_impl{PDMDEVHLPR3,pfnPGMHandlerPhysicalTypeRegister} */ 4414 static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_PGMHandlerPhysicalTypeRegister(PPDMDEVINS pDevIns, PGMPHYSHANDLERKIND enmKind, 4415 R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3, 4416 const char *pszHandlerR0, const char *pszPfHandlerR0, 4417 const char *pszHandlerRC, const char *pszPfHandlerRC, 4418 const char *pszDesc, PPGMPHYSHANDLERTYPE phType) 4419 { 4420 PDMDEV_ASSERT_DEVINS(pDevIns); 4421 RT_NOREF(enmKind, pfnHandlerR3, pszHandlerR0, pszPfHandlerR0, pszHandlerRC, pszPfHandlerRC, pszDesc, phType); 4422 AssertReleaseMsgFailed(("Untrusted device called trusted helper! '%s'/%d\n", 4423 pDevIns->pReg->szName, pDevIns->iInstance)); 4424 return VERR_ACCESS_DENIED; 4367 4425 } 4368 4426 … … 4679 4737 pdmR3DevHlp_PhysBulkGCPhys2CCPtrReadOnly, 4680 4738 pdmR3DevHlp_PhysBulkReleasePageMappingLocks, 4739 pdmR3DevHlp_CpuGetGuestMicroarch, 4681 4740 0, 4682 4741 0, … … 4707 4766 pdmR3DevHlp_Untrusted_GetSupDrvSession, 4708 4767 pdmR3DevHlp_Untrusted_QueryGenericUserObject, 4768 pdmR3DevHlp_Untrusted_PGMHandlerPhysicalTypeRegister, 4709 4769 PDM_DEVHLPR3_VERSION /* the end */ 4710 4770 };
Note:
See TracChangeset
for help on using the changeset viewer.

