VirtualBox

Changeset 23011 in vbox for trunk/src/VBox/VMM/VM.cpp


Ignore:
Timestamp:
Sep 14, 2009 3:57:38 PM (15 years ago)
Author:
vboxsync
Message:

VMM,VMMDev: Some VMMR3ReqCall refactoring.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VM.cpp

    r23009 r23011  
    764764    for (VMCPUID idCpu = 1; idCpu < pVM->cCpus; idCpu++)
    765765    {
    766         PVMREQ pReq;
    767         rc = VMR3ReqCallU(pUVM, idCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    768                           (PFNRT)vmR3RegisterEMT, 2, pVM, idCpu);
    769         if (RT_SUCCESS(rc))
    770             rc = pReq->iStatus;
    771         VMR3ReqFree(pReq);
     766        rc = VMR3ReqCallWaitU(pUVM, idCpu, (PFNRT)vmR3RegisterEMT, 2, pVM, idCpu);
    772767        if (RT_FAILURE(rc))
    773768            return rc;
     
    11961191     * work upfront).
    11971192     */
    1198     PVMREQ pReq;
    1199     int rc = VMR3ReqCallU(pVM->pUVM, VMCPUID_ALL, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    1200                           (PFNRT)vmR3PowerOn, 1, pVM);
    1201     if (RT_SUCCESS(rc))
    1202     {
    1203         rc = pReq->iStatus;
    1204         VMR3ReqFree(pReq);
    1205     }
    1206 
     1193    int rc = VMR3ReqCallWaitU(pVM->pUVM, VMCPUID_ALL, (PFNRT)vmR3PowerOn, 1, pVM);
    12071194    LogFlow(("VMR3PowerOn: returns %Rrc\n", rc));
    12081195    return rc;
     
    12891276     * actual suspending after the other ones have stopped running guest code.
    12901277     */
    1291     PVMREQ pReq;
    1292     int rc = VMR3ReqCallU(pVM->pUVM, VMCPUID_ALL_REVERSE, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    1293                           (PFNRT)vmR3Suspend, 2, pVM, fFatal);
    1294     if (RT_SUCCESS(rc))
    1295     {
    1296         rc = pReq->iStatus;
    1297         VMR3ReqFree(pReq);
    1298     }
    1299 
    1300     return rc;
     1278    return VMR3ReqCallWaitU(pVM->pUVM, VMCPUID_ALL_REVERSE, (PFNRT)vmR3Suspend, 2, pVM, fFatal);
    13011279}
    13021280
     
    13871365     * work upfront).
    13881366     */
    1389     PVMREQ pReq;
    1390     int rc = VMR3ReqCallU(pVM->pUVM, VMCPUID_ALL, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    1391                           (PFNRT)vmR3Resume, 1, pVM);
    1392     if (RT_SUCCESS(rc))
    1393     {
    1394         rc = pReq->iStatus;
    1395         VMR3ReqFree(pReq);
    1396     }
    1397 
     1367    int rc = VMR3ReqCallWaitU(pVM->pUVM, VMCPUID_ALL, (PFNRT)vmR3Resume, 1, pVM);
    13981368    LogFlow(("VMR3Resume: returns %Rrc\n", rc));
    13991369    return rc;
     
    15131483    SSMAFTER    enmAfter = fContinueAfterwards ? SSMAFTER_CONTINUE : SSMAFTER_DESTROY;
    15141484    PSSMHANDLE  pSSM;
    1515     PVMREQ      pReq;
    1516     int rc = VMR3ReqCallU(pVM->pUVM, 0 /*idDstCpu*/, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    1517                           (PFNRT)vmR3Save, 6, pVM, pszFilename, enmAfter, pfnProgress, pvUser, &pSSM);
    1518     if (RT_SUCCESS(rc))
    1519     {
    1520         rc = pReq->iStatus;
    1521         VMR3ReqFree(pReq);
    1522     }
     1485    int rc = VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/,
     1486                              (PFNRT)vmR3Save, 6, pVM, pszFilename, enmAfter, pfnProgress, pvUser, &pSSM);
    15231487    if (    RT_SUCCESS(rc)
    15241488        &&  pSSM)
     
    15331497            rc = vmR3SuspendCommon(pVM, false /*fFatal*/);
    15341498            if (RT_SUCCESS(rc))
    1535             {
    1536                 rc = VMR3ReqCallU(pVM->pUVM, 0 /*idDstCpu*/, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    1537                                   (PFNRT)vmR3SaveLiveStep2, 2, pVM, pSSM);
    1538                 if (RT_SUCCESS(rc))
    1539                 {
    1540                     rc = pReq->iStatus;
    1541                     VMR3ReqFree(pReq);
    1542                 }
    1543             }
     1499                rc = VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)vmR3SaveLiveStep2, 2, pVM, pSSM);
    15441500        }
    15451501        else
     
    16771633     * Request the operation in EMT.
    16781634     */
    1679     PVMREQ pReq;
    1680     int rc = VMR3ReqCallU(pVM->pUVM, 0 /*idDstCpu*/, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    1681                           (PFNRT)vmR3Load, 4, pVM, pszFilename, pfnProgress, pvUser);
    1682     if (RT_SUCCESS(rc))
    1683     {
    1684         rc = pReq->iStatus;
    1685         VMR3ReqFree(pReq);
    1686     }
    1687 
     1635    int rc = VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/,
     1636                              (PFNRT)vmR3Load, 4, pVM, pszFilename, pfnProgress, pvUser);
    16881637    LogFlow(("VMR3Load: returns %Rrc\n", rc));
    16891638    return rc;
     
    18591808     * Request the operation in EMT. (in reverse order as VCPU 0 does the actual work)
    18601809     */
    1861     PVMREQ pReq = NULL;
    1862     int rc = VMR3ReqCallU(pVM->pUVM, VMCPUID_ALL_REVERSE, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    1863                           (PFNRT)vmR3PowerOff, 1, pVM);
    1864     if (RT_SUCCESS(rc))
    1865     {
    1866         rc = pReq->iStatus;
    1867         VMR3ReqFree(pReq);
    1868     }
    1869     else
    1870         Assert(pReq == NULL);
    1871 
     1810    int rc = VMR3ReqCallWaitU(pVM->pUVM, VMCPUID_ALL_REVERSE, (PFNRT)vmR3PowerOff, 1, pVM);
    18721811    LogFlow(("VMR3PowerOff: returns %Rrc\n", rc));
    18731812    return rc;
     
    19441883        for (VMCPUID idCpu = 1; idCpu < pVM->cCpus; idCpu++)
    19451884        {
    1946             PVMREQ pReq = NULL;
    1947             int rc = VMR3ReqCallU(pUVM, idCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    1948                                   (PFNRT)vmR3Destroy, 1, pVM);
    1949             if (RT_SUCCESS(rc))
    1950                 rc = pReq->iStatus;
     1885            int rc = VMR3ReqCallWaitU(pUVM, idCpu, (PFNRT)vmR3Destroy, 1, pVM);
    19511886            AssertLogRelRC(rc);
    1952             VMR3ReqFree(pReq);
    19531887        }
    19541888    }
     
    19561890    {
    19571891        /* vmR3Destroy on all EMTs, ending with EMT(0). */
    1958         PVMREQ pReq = NULL;
    1959         int rc = VMR3ReqCallU(pUVM, VMCPUID_ALL_REVERSE, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    1960                               (PFNRT)vmR3Destroy, 1, pVM);
    1961         if (RT_SUCCESS(rc))
    1962             rc = pReq->iStatus;
     1892        int rc = VMR3ReqCallWaitU(pUVM, VMCPUID_ALL_REVERSE, (PFNRT)vmR3Destroy, 1, pVM);
    19631893        AssertLogRelRC(rc);
    1964         VMR3ReqFree(pReq);
    19651894
    19661895        /* Wait for EMTs and destroy the UVM. */
     
    25362465     * and wait for it to be processed. (in reverse order as VCPU 0 does the real cleanup)
    25372466     */
    2538     PVMREQ pReq = NULL;
    2539     int rc = VMR3ReqCallU(pVM->pUVM, VMCPUID_ALL_REVERSE, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
    2540                           (PFNRT)vmR3Reset, 1, pVM);
    2541     if (RT_SUCCESS(rc))
    2542         rc = pReq->iStatus;
     2467    int rc = VMR3ReqCallWaitU(pVM->pUVM, VMCPUID_ALL_REVERSE, (PFNRT)vmR3Reset, 1, pVM);
    25432468    AssertLogRelRC(rc);
    2544     VMR3ReqFree(pReq);
    2545 
    25462469    return rc;
    25472470}
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