Changeset 81519 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Oct 24, 2019 1:25:31 PM (5 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r81475 r81519 1544 1544 1545 1545 /** 1546 * PDMDevHlpCallR0 helper.1547 *1548 * @returns See PFNPDMDEVREQHANDLERR0.1549 * @param pGVM The global (ring-0) VM structure. (For validation.)1550 * @param pReq Pointer to the request buffer.1551 */1552 VMMR0_INT_DECL(int) PDMR0DeviceCallReqHandler(PGVM pGVM, PPDMDEVICECALLREQHANDLERREQ pReq)1553 {1554 /*1555 * Validate input and make the call.1556 */1557 int rc = GVMMR0ValidateGVM(pGVM);1558 if (RT_SUCCESS(rc))1559 {1560 AssertPtrReturn(pReq, VERR_INVALID_POINTER);1561 AssertMsgReturn(pReq->Hdr.cbReq == sizeof(*pReq), ("%#x != %#x\n", pReq->Hdr.cbReq, sizeof(*pReq)), VERR_INVALID_PARAMETER);1562 1563 PPDMDEVINS pDevIns = pReq->pDevInsR0;1564 AssertPtrReturn(pDevIns, VERR_INVALID_POINTER);1565 AssertReturn(pDevIns->Internal.s.pGVM == pGVM, VERR_INVALID_PARAMETER);1566 1567 PFNPDMDEVREQHANDLERR0 pfnReqHandlerR0 = pReq->pfnReqHandlerR0;1568 AssertPtrReturn(pfnReqHandlerR0, VERR_INVALID_POINTER);1569 1570 rc = pfnReqHandlerR0(pDevIns, pReq->uOperation, pReq->u64Arg);1571 }1572 return rc;1573 }1574 1575 1576 /**1577 1546 * Worker for PDMR0DeviceCreate that does the actual instantiation. 1578 1547 * … … 1948 1917 * @param pGVM The global (ring-0) VM structure. 1949 1918 * @param pReq Pointer to the request buffer. 1950 * @thread EMT(0) 1951 */ 1952 VMMR0_INT_DECL(int) PDMR0DeviceGenCallReqHandler(PGVM pGVM, PPDMDEVICEGENCALLREQ pReq )1919 * @thread EMT(0), except for PDMDEVICEGENCALL_REQUEST which can be any EMT. 1920 */ 1921 VMMR0_INT_DECL(int) PDMR0DeviceGenCallReqHandler(PGVM pGVM, PPDMDEVICEGENCALLREQ pReq, VMCPUID idCpu) 1953 1922 { 1954 1923 /* … … 1957 1926 AssertReturn(pReq->Hdr.cbReq == sizeof(*pReq), VERR_INVALID_PARAMETER); 1958 1927 1959 int rc = GVMMR0ValidateGVMandEMT(pGVM, 0);1928 int rc = GVMMR0ValidateGVMandEMT(pGVM, idCpu); 1960 1929 AssertRCReturn(rc, rc); 1961 1930 … … 1973 1942 case PDMDEVICEGENCALL_CONSTRUCT: 1974 1943 AssertMsgBreakStmt(pGVM->enmVMState < VMSTATE_CREATED, ("enmVMState=%d\n", pGVM->enmVMState), rc = VERR_INVALID_STATE); 1944 AssertReturn(idCpu == 0, VERR_VM_THREAD_NOT_EMT); 1975 1945 if (pDevIns->pReg->pfnConstruct) 1976 1946 rc = pDevIns->pReg->pfnConstruct(pDevIns); … … 1980 1950 AssertMsgBreakStmt(pGVM->enmVMState < VMSTATE_CREATED || pGVM->enmVMState >= VMSTATE_DESTROYING, 1981 1951 ("enmVMState=%d\n", pGVM->enmVMState), rc = VERR_INVALID_STATE); 1952 AssertReturn(idCpu == 0, VERR_VM_THREAD_NOT_EMT); 1982 1953 if (pDevIns->pReg->pfnDestruct) 1983 1954 { … … 1985 1956 rc = VINF_SUCCESS; 1986 1957 } 1958 break; 1959 1960 case PDMDEVICEGENCALL_REQUEST: 1961 if (pDevIns->pReg->pfnRequest) 1962 rc = pDevIns->pReg->pfnRequest(pDevIns, pReq->Params.Req.uReq, pReq->Params.Req.uArg); 1963 else 1964 rc = VERR_INVALID_FUNCTION; 1987 1965 break; 1988 1966 -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r81333 r81519 1980 1980 } 1981 1981 1982 case VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER:1983 {1984 if (!pReqHdr || u64Arg || idCpu != NIL_VMCPUID)1985 return VERR_INVALID_PARAMETER;1986 rc = PDMR0DeviceCallReqHandler(pGVM, (PPDMDEVICECALLREQHANDLERREQ)pReqHdr);1987 VMM_CHECK_SMAP_CHECK2(pGVM, RT_NOTHING);1988 break;1989 }1990 1991 1982 case VMMR0_DO_PDM_DEVICE_CREATE: 1992 1983 { … … 2000 1991 case VMMR0_DO_PDM_DEVICE_GEN_CALL: 2001 1992 { 2002 if (!pReqHdr || u64Arg || idCpu != 0)2003 return VERR_INVALID_PARAMETER; 2004 rc = PDMR0DeviceGenCallReqHandler(pGVM, (PPDMDEVICEGENCALLREQ)pReqHdr );1993 if (!pReqHdr || u64Arg) 1994 return VERR_INVALID_PARAMETER; 1995 rc = PDMR0DeviceGenCallReqHandler(pGVM, (PPDMDEVICEGENCALLREQ)pReqHdr, idCpu); 2005 1996 VMM_CHECK_SMAP_CHECK2(pGVM, RT_NOTHING); 2006 1997 break; -
trunk/src/VBox/VMM/VMMR3/PDM.cpp
r81513 r81519 818 818 LogFlow(("pdmR3DevTerm: Destroying (ring-0) - device '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance)); 819 819 PDMDEVICEGENCALLREQ Req; 820 RT_ZERO(Req.Params); 820 821 Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 821 822 Req.Hdr.cbReq = sizeof(Req); -
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r81475 r81519 3425 3425 { 3426 3426 PDMDEV_ASSERT_DEVINS(pDevIns); 3427 PVM pVM = pDevIns->Internal.s.pVMR3; 3428 VM_ASSERT_EMT(pVM); 3427 PVM pVM = pDevIns->Internal.s.pVMR3; 3428 PVMCPU pVCpu = VMMGetCpu(pVM); 3429 AssertReturn(pVCpu, VERR_VM_THREAD_IS_EMT); 3429 3430 LogFlow(("pdmR3DevHlp_CallR0: caller='%s'/%d: uOperation=%#x u64Arg=%#RX64\n", 3430 3431 pDevIns->pReg->szName, pDevIns->iInstance, uOperation, u64Arg)); … … 3438 3439 if (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0) 3439 3440 { 3440 char szSymbol[ sizeof("devR0") + sizeof(pDevIns->pReg->szName) + sizeof("ReqHandler")]; 3441 strcat(strcat(strcpy(szSymbol, "devR0"), pDevIns->pReg->szName), "ReqHandler"); 3442 szSymbol[sizeof("devR0") - 1] = RT_C_TO_UPPER(szSymbol[sizeof("devR0") - 1]); 3443 3444 PFNPDMDRVREQHANDLERR0 pfnReqHandlerR0; 3445 rc = pdmR3DevGetSymbolR0Lazy(pDevIns, szSymbol, &pfnReqHandlerR0); 3446 if (RT_SUCCESS(rc)) 3447 { 3448 /* 3449 * Make the ring-0 call. 3450 */ 3451 PDMDEVICECALLREQHANDLERREQ Req; 3452 Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 3453 Req.Hdr.cbReq = sizeof(Req); 3454 Req.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 3455 Req.pfnReqHandlerR0 = pfnReqHandlerR0; 3456 Req.uOperation = uOperation; 3457 Req.u32Alignment = 0; 3458 Req.u64Arg = u64Arg; 3459 rc = SUPR3CallVMMR0Ex(VMCC_GET_VMR0_FOR_CALL(pVM), NIL_VMCPUID, VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER, 0, &Req.Hdr); 3460 } 3461 else 3462 pfnReqHandlerR0 = NIL_RTR0PTR; 3441 /* 3442 * Make the ring-0 call. 3443 */ 3444 PDMDEVICEGENCALLREQ Req; 3445 RT_ZERO(Req.Params); 3446 Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 3447 Req.Hdr.cbReq = sizeof(Req); 3448 Req.pDevInsR3 = pDevIns; 3449 Req.idxR0Device = pDevIns->Internal.s.idxR0Device; 3450 Req.enmCall = PDMDEVICEGENCALL_REQUEST; 3451 Req.Params.Req.uReq = uOperation; 3452 Req.Params.Req.uArg = u64Arg; 3453 rc = VMMR3CallR0Emt(pVM, pVCpu, VMMR0_DO_PDM_DEVICE_GEN_CALL, 0, &Req.Hdr); 3463 3454 } 3464 3455 else -
trunk/src/VBox/VMM/VMMR3/PDMDevice.cpp
r81150 r81519 479 479 { 480 480 PDMDEVICEGENCALLREQ Req; 481 RT_ZERO(Req.Params); 481 482 Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 482 483 Req.Hdr.cbReq = sizeof(Req);
Note:
See TracChangeset
for help on using the changeset viewer.