third_party/virtualbox/src/VBox/VMM/VMMR3/VM.cpp
/**
 * Worker for VMR3SetRuntimeErrorWorker and vmR3SetRuntimeErrorV.
 *
 * This does the common parts after the error has been saved / retrieved.
 *
 * @returns VBox status code with modifications, see VMSetRuntimeErrorV.
 *
 * @param   pVM             The cross context VM structure.
 * @param   fFlags          The error flags.
 * @param   pszErrorId      Error ID string.
 * @param   pszFormat       Format string.
 * @param   pVa             Pointer to the format arguments.
 */


@returns VBox status code with modifications, see VMSetRuntimeErrorV.

@param   pVM             The cross context VM structure.
@param   fFlags          The error flags.
@param   pszErrorId      Error ID string.
@param   pszFormat       Format string.
@param   pVa             Pointer to the format arguments.
@returns VBox status code with modifications see VMSetRuntimeErrorV . @param pVM The cross context VM structure . @param fFlags The error flags . @param pszErrorId Error ID string . @param pszFormat Format string . @param pVa Pointer to the format arguments .
static int vmR3SetRuntimeErrorCommon(PVM pVM, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list *pVa)
{
    LogRel(("VM: Raising runtime error '%s' (fFlags=%#x)\n", pszErrorId, fFlags));
    PUVM pUVM = pVM->pUVM;
    int rc;
    if (fFlags & VMSETRTERR_FLAGS_FATAL)
        rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_DESCENDING | VMMEMTRENDEZVOUS_FLAGS_STOP_ON_ERROR,
                                vmR3SetRuntimeErrorChangeState, NULL);
    else if (fFlags & VMSETRTERR_FLAGS_SUSPEND)
        rc = VMR3Suspend(pUVM, VMSUSPENDREASON_RUNTIME_ERROR);
    else
        rc = VINF_SUCCESS;
    RTCritSectEnter(&pUVM->vm.s.AtErrorCritSect);
    ASMAtomicIncU32(&pUVM->vm.s.cRuntimeErrors);
    for (PVMATRUNTIMEERROR pCur = pUVM->vm.s.pAtRuntimeError; pCur; pCur = pCur->pNext)
    {
        va_list va;
        va_copy(va, *pVa);
        pCur->pfnAtRuntimeError(pUVM, pCur->pvUser, fFlags, pszErrorId, pszFormat, va);
        va_end(va);
    }
    RTCritSectLeave(&pUVM->vm.s.AtErrorCritSect);
    return rc;
}
static int vmR3SetRuntimeErrorCommon ( PVM pVM , uint32_t fFlags , const char * pszErrorId , const char * pszFormat , va_list * pVa ) { LogRel ( ( " \n " , pszErrorId , fFlags ) ) ; PUVM pUVM = pVM -> pUVM ; int rc ; if ( fFlags & VMSETRTERR_FLAGS_FATAL ) rc = VMMR3EmtRendezvous ( pVM , VMMEMTRENDEZVOUS_FLAGS_TYPE_DESCENDING | VMMEMTRENDEZVOUS_FLAGS_STOP_ON_ERROR , vmR3SetRuntimeErrorChangeState , NULL ) ; else if ( fFlags & VMSETRTERR_FLAGS_SUSPEND ) rc = VMR3Suspend ( pUVM , VMSUSPENDREASON_RUNTIME_ERROR ) ; else rc = VINF_SUCCESS ; RTCritSectEnter ( & pUVM -> vm . s . AtErrorCritSect ) ; ASMAtomicIncU32 ( & pUVM -> vm . s . cRuntimeErrors ) ; for ( PVMATRUNTIMEERROR pCur = pUVM -> vm . s . pAtRuntimeError ; pCur ; pCur = pCur -> pNext ) { va_list va ; va_copy ( va , * pVa ) ; pCur -> pfnAtRuntimeError ( pUVM , pCur -> pvUser , fFlags , pszErrorId , pszFormat , va ) ; va_end ( va ) ; } RTCritSectLeave ( & pUVM -> vm . s . AtErrorCritSect ) ; return rc ; }
Worker for VMR3SetRuntimeErrorWorker and vmR3SetRuntimeErrorV.
Worker for VMR3SetRuntimeErrorWorker and vmR3SetRuntimeErrorV .
/*
     * Take actions before the call.
     */ /*
     * Do the callback round.
     */