VMAll.cpp revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/** @file
*
* VM - Virtual Machine All Contexts.
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_VM
#include "VMInternal.h"
/**
* Sets the error message.
*
* @returns rc. Meaning you can do:
* @code
* return VM_SET_ERROR(pVM, VERR_OF_YOUR_CHOICE, "descriptive message");
* @codeend
* @param pVM VM handle. Must be non-NULL.
* @param rc VBox status code.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Error message format string.
* @param ... Error message arguments.
* @thread Any
*/
{
return rc;
}
/**
* Sets the error message.
*
* @returns rc. Meaning you can do:
* @code
* return VM_SET_ERROR(pVM, VERR_OF_YOUR_CHOICE, "descriptive message");
* @codeend
* @param pVM VM handle. Must be non-NULL.
* @param rc VBox status code.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Error message format string.
* @param args Error message arguments.
* @thread Any
*/
{
#ifdef IN_RING3
/*
* Switch to EMT.
*/
VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3SetErrorV, 7, /* ASSUMES 3 source pos args! */
#else
/*
* We're already on the EMT thread and can safely create a VMERROR chunk.
*/
# ifdef IN_GC
# else
# endif
#endif
return rc;
}
/**
* Copies the error to a VMERROR structure.
*
* This is mainly intended for Ring-0 and GC where the error must be copied to
* memory accessible from ring-3. But it's just possible that we might add
* APIs for retrieving the VMERROR copy later.
*
* @param pVM VM handle. Must be non-NULL.
* @param rc VBox status code.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Error message format string.
* @param args Error message arguments.
* @thread EMT
*/
{
#if 0 /// @todo implement Ring-0 and GC VMSetError
/*
* Create the untranslated message copy.
*/
/* free any old message. */
/* calc reasonable start size. */
+ cchFile + 1
+ cchFunction + 1
+ cchFormat + 32;
/* allocate it */
void *pv;
if (VBOX_SUCCESS(rc2))
{
/* initialize it. */
if (cchFile)
{
}
if (cchFunction)
{
}
/* format the message (pErr might be reallocated) */
/* done. */
}
#endif
}