VM.cpp revision 2cc5c0b8760cd2bc5cd60ef8651ba0885ae34727
/* $Id$ */
/** @file
* VM - Virtual Machine
*/
/*
* Copyright (C) 2006-2007 innotek 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_VM
#include <VBox/pdmcritsect.h>
#include "VMInternal.h"
#include <iprt/semaphore.h>
#include <stdlib.h> /* getenv */
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/**
* VM destruction callback registration record.
*/
typedef struct VMATDTOR
{
/** Pointer to the next record in the list. */
/** Pointer to the callback function. */
/** The user argument. */
void *pvUser;
} VMATDTOR;
/** Pointer to a VM destruction callback registration record. */
/*******************************************************************************
* Global Variables *
*******************************************************************************/
/** Pointer to the list of VMs. */
static PVM g_pVMsHead;
/** Pointer to the list of at VM destruction callbacks. */
static PVMATDTOR g_pVMAtDtorHead;
/** Lock the g_pVMAtDtorHead list. */
#define VM_ATDTOR_LOCK() do { } while (0)
/** Unlock the g_pVMAtDtorHead list. */
#define VM_ATDTOR_UNLOCK() do { } while (0)
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
static int vmR3Create(PVM pVM, PFNVMATERROR pfnVMAtError, void *pvUserVM, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM);
static void vmR3CallVMAtError(PFNVMATERROR pfnVMAtError, void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszError, ...);
static DECLCALLBACK(int) vmR3Save(PVM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser);
static DECLCALLBACK(int) vmR3Load(PVM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser);
static DECLCALLBACK(int) vmR3AtRuntimeErrorRegister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser);
static DECLCALLBACK(int) vmR3AtRuntimeErrorDeregister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser);
/**
* Do global VMM init.
*
* @returns VBox status code.
*/
VMR3DECL(int) VMR3GlobalInit(void)
{
/*
* Only once.
*/
static bool fDone = false;
if (fDone)
return VINF_SUCCESS;
/*
* We're done.
*/
fDone = true;
return VINF_SUCCESS;
}
/**
* Creates a virtual machine by calling the supplied configuration constructor.
*
* On successful returned the VM is powered, i.e. VMR3PowerOn() should be
* called to start the execution.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pfnVMAtError Pointer to callback function for setting VM errors.
* This is called in the EM.
* @param pvUserVM The user argument passed to pfnVMAtError.
* @param pfnCFGMConstructor Pointer to callback function for constructing the VM configuration tree.
* This is called in the EM.
* @param pvUserCFGM The user argument passed to pfnCFGMConstructor.
* @param ppVM Where to store the 'handle' of the created VM.
*/
VMR3DECL(int) VMR3Create(PFNVMATERROR pfnVMAtError, void *pvUserVM, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM, PVM *ppVM)
{
LogFlow(("VMR3Create: pfnVMAtError=%p pvUserVM=%p pfnCFGMConstructor=%p pvUserCFGM=%p ppVM=%p\n", pfnVMAtError, pvUserVM, pfnCFGMConstructor, pvUserCFGM, ppVM));
/*
* Because of the current hackiness of the applications
* we'll have to initialize global stuff from here.
* Later the applications will take care of this in a proper way.
*/
static bool fGlobalInitDone = false;
if (!fGlobalInitDone)
{
int rc = VMR3GlobalInit();
if (VBOX_FAILURE(rc))
return rc;
fGlobalInitDone = true;
}
/*
* Init support library.
*/
PSUPDRVSESSION pSession = 0;
if (VBOX_SUCCESS(rc))
{
/*
* Allocate memory for the VM structure.
*/
if (VBOX_SUCCESS(rc))
{
/*
* Do basic init of the VM structure.
*/
/*
* Initialize STAM.
*/
if (VBOX_SUCCESS(rc))
{
/*
* Create the EMT thread and make it do VM initialization and go sleep
* in EM waiting for requests.
*/
if (VBOX_SUCCESS(rc))
{
/*
* Issue a VM Create request and wait for it to complete.
*/
rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Create, 5, pVM, pfnVMAtError, pvUserVM, pfnCFGMConstructor, pvUserCFGM);
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
return VINF_SUCCESS;
}
}
else
const char *pszError;
/*
* An error occurred during VM creation. Set the error message directly
* using the initial callback, as the callback list doesn't exist yet.
*/
switch (rc)
{
#ifdef RT_OS_LINUX
"Please disable the KVM kernel extension, recompile "
"your kernel and reboot");
#else
#endif
break;
default:
}
/* Forcefully terminate the emulation thread. */
VMR3NotifyFF(pVM, false);
}
}
/* cleanup the heap. */
/* free the VM memory */
}
else
{
rc = VERR_NO_MEMORY;
N_("Failed to allocate %d bytes of low memory for the VM structure"),
AssertMsgFailed(("Failed to allocate %d bytes of low memory for the VM structure!\n", RT_ALIGN(sizeof(*pVM), PAGE_SIZE)));
}
/* terminate SUPLib */
}
else
{
const char *pszError;
/*
* An error occurred at support library initialization time (before the
* VM could be created). Set the error message directly using the
* initial callback, as the callback list doesn't exist yet.
*/
switch (rc)
{
#ifdef RT_OS_LINUX
"Re-setup the kernel module by executing "
#else
#endif
break;
break;
#ifdef RT_OS_LINUX
"user. Make sure that the user has write permissions for "
"will need to logout for the change to take effect.");
#else
#endif
break;
#ifdef RT_OS_LINUX
"reason. Re-setup the kernel module by executing "
#else
#endif
break;
case VERR_NO_MEMORY:
break;
case VERR_VERSION_MISMATCH:
"version of VirtualBox. You can correct this by stopping all "
"running instances of VirtualBox and reinstalling the software.");
break;
default:
}
}
return rc;
}
/**
* Wrapper for getting a correct va_list.
*/
static void vmR3CallVMAtError(PFNVMATERROR pfnVMAtError, void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszError, ...)
{
}
/**
* Initializes the VM.
*/
static int vmR3Create(PVM pVM, PFNVMATERROR pfnVMAtError, void *pvUserVM, PFNCFGMCONSTRUCTOR pfnCFGMConstructor, void *pvUserCFGM)
{
int rc = VINF_SUCCESS;
/* Register error callback if specified. */
if (pfnVMAtError)
if (VBOX_SUCCESS(rc))
{
/*
* Init the configuration.
*/
if (VBOX_SUCCESS(rc))
{
/*
* If executing in fake suplib mode disable RR3 and RR0 in the config.
*/
{
}
/*
* Check if the required minimum of resources are available.
*/
/** @todo Check if the required minimum of resources are available. */
if (VBOX_SUCCESS(rc))
{
/*
* Init the Ring-3 components and do a round of relocations with 0 delta.
*/
if (VBOX_SUCCESS(rc))
{
VMR3Relocate(pVM, 0);
LogFlow(("Ring-3 init succeeded\n"));
/*
* Init the Ring-0 components.
*/
if (VBOX_SUCCESS(rc))
{
/* Relocate again, because some switcher fixups depends on R0 init results. */
VMR3Relocate(pVM, 0);
/*
* Init the tcp debugger console if we're building
* with debugger support.
*/
if ( VBOX_SUCCESS(rc)
|| rc == VERR_NET_ADDRESS_IN_USE)
{
/*
* Init the Guest Context components.
*/
if (VBOX_SUCCESS(rc))
{
/*
* Set the state and link into the global list.
*/
g_pVMsHead = pVM;
return VINF_SUCCESS;
}
}
//..
}
}
//..
}
/* Clean CFGM. */
}
//..
}
return rc;
}
/**
* Initializes all R3 components of the VM
*/
{
int rc;
/*
* Init all R3 components, the order here might be important.
*/
if (VBOX_SUCCESS(rc))
{
STAM_REG(pVM, &pVM->StatTotalInGC, STAMTYPE_PROFILE_ADV, "/PROF/VM/InGC", STAMUNIT_TICKS_PER_CALL, "Profiling the total time spent in GC.");
STAM_REG(pVM, &pVM->StatSwitcherToGC, STAMTYPE_PROFILE_ADV, "/PROF/VM/SwitchToGC", STAMUNIT_TICKS_PER_CALL, "Profiling switching to GC.");
STAM_REG(pVM, &pVM->StatSwitcherToHC, STAMTYPE_PROFILE_ADV, "/PROF/VM/SwitchToHC", STAMUNIT_TICKS_PER_CALL, "Profiling switching to HC.");
STAM_REL_REG(pVM, &pVM->vm.s.StatHaltYield, STAMTYPE_PROFILE, "/PROF/VM/Halt/Yield", STAMUNIT_TICKS_PER_CALL, "Profiling halted state yielding.");
STAM_REL_REG(pVM, &pVM->vm.s.StatHaltBlock, STAMTYPE_PROFILE, "/PROF/VM/Halt/Block", STAMUNIT_TICKS_PER_CALL, "Profiling halted state blocking.");
STAM_REL_REG(pVM, &pVM->vm.s.StatHaltTimers,STAMTYPE_PROFILE, "/PROF/VM/Halt/Timers", STAMUNIT_TICKS_PER_CALL, "Profiling halted state timer tasks.");
STAM_REL_REG(pVM, &pVM->vm.s.StatHaltPoll, STAMTYPE_PROFILE, "/PROF/VM/Halt/Poll", STAMUNIT_TICKS_PER_CALL, "Profiling halted state poll tasks.");
STAM_REG(pVM, &pVM->StatSwitcherSaveRegs, STAMTYPE_PROFILE_ADV, "/VM/Switcher/ToGC/SaveRegs", STAMUNIT_TICKS_PER_CALL,"Profiling switching to GC.");
STAM_REG(pVM, &pVM->StatSwitcherSysEnter, STAMTYPE_PROFILE_ADV, "/VM/Switcher/ToGC/SysEnter", STAMUNIT_TICKS_PER_CALL,"Profiling switching to GC.");
STAM_REG(pVM, &pVM->StatSwitcherDebug, STAMTYPE_PROFILE_ADV, "/VM/Switcher/ToGC/Debug", STAMUNIT_TICKS_PER_CALL,"Profiling switching to GC.");
STAM_REG(pVM, &pVM->StatSwitcherCR0, STAMTYPE_PROFILE_ADV, "/VM/Switcher/ToGC/CR0", STAMUNIT_TICKS_PER_CALL, "Profiling switching to GC.");
STAM_REG(pVM, &pVM->StatSwitcherCR4, STAMTYPE_PROFILE_ADV, "/VM/Switcher/ToGC/CR4", STAMUNIT_TICKS_PER_CALL, "Profiling switching to GC.");
STAM_REG(pVM, &pVM->StatSwitcherLgdt, STAMTYPE_PROFILE_ADV, "/VM/Switcher/ToGC/Lgdt", STAMUNIT_TICKS_PER_CALL, "Profiling switching to GC.");
STAM_REG(pVM, &pVM->StatSwitcherLidt, STAMTYPE_PROFILE_ADV, "/VM/Switcher/ToGC/Lidt", STAMUNIT_TICKS_PER_CALL, "Profiling switching to GC.");
STAM_REG(pVM, &pVM->StatSwitcherLldt, STAMTYPE_PROFILE_ADV, "/VM/Switcher/ToGC/Lldt", STAMUNIT_TICKS_PER_CALL, "Profiling switching to GC.");
STAM_REG(pVM, &pVM->StatSwitcherTSS, STAMTYPE_PROFILE_ADV, "/VM/Switcher/ToGC/TSS", STAMUNIT_TICKS_PER_CALL, "Profiling switching to GC.");
STAM_REG(pVM, &pVM->StatSwitcherJmpCR3, STAMTYPE_PROFILE_ADV, "/VM/Switcher/ToGC/JmpCR3", STAMUNIT_TICKS_PER_CALL,"Profiling switching to GC.");
STAM_REG(pVM, &pVM->StatSwitcherRstrRegs, STAMTYPE_PROFILE_ADV, "/VM/Switcher/ToGC/RstrRegs", STAMUNIT_TICKS_PER_CALL,"Profiling switching to GC.");
STAM_REG(pVM, &pVM->vm.s.StatReqAllocNew, STAMTYPE_COUNTER, "/VM/Req/AllocNew", STAMUNIT_OCCURENCES, "Number of VMR3ReqAlloc returning a new packet.");
STAM_REG(pVM, &pVM->vm.s.StatReqAllocRaces, STAMTYPE_COUNTER, "/VM/Req/AllocRaces", STAMUNIT_OCCURENCES, "Number of VMR3ReqAlloc causing races.");
STAM_REG(pVM, &pVM->vm.s.StatReqAllocRecycled, STAMTYPE_COUNTER, "/VM/Req/AllocRecycled", STAMUNIT_OCCURENCES, "Number of VMR3ReqAlloc returning a recycled packet.");
STAM_REG(pVM, &pVM->vm.s.StatReqFree, STAMTYPE_COUNTER, "/VM/Req/Free", STAMUNIT_OCCURENCES, "Number of VMR3ReqFree calls.");
STAM_REG(pVM, &pVM->vm.s.StatReqFreeOverflow, STAMTYPE_COUNTER, "/VM/Req/FreeOverflow", STAMUNIT_OCCURENCES, "Number of times the request was actually freed.");
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
{
if (VBOX_SUCCESS(rc))
if (VBOX_SUCCESS(rc))
if (VBOX_SUCCESS(rc))
if (VBOX_SUCCESS(rc))
if (VBOX_SUCCESS(rc))
if (VBOX_SUCCESS(rc))
if (VBOX_SUCCESS(rc))
{
return VINF_SUCCESS;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
//int rc2 = CPUMR3Term(pVM);
//AssertRC(rc2);
}
/* MMR3Term is not called here because it'll kill the heap. */
}
return rc;
}
/**
* Initializes all R0 components of the VM
*/
{
LogFlow(("vmR3InitRing0:\n"));
/*
* Check for FAKE suplib mode.
*/
int rc = VINF_SUCCESS;
{
/*
* Call the VMMR0 component and let it do the init.
*/
}
else
Log(("vmR3InitRing0: skipping because of VBOX_SUPLIB_FAKE=fake\n"));
/*
* Do notifications and return.
*/
if (VBOX_SUCCESS(rc))
return rc;
}
/**
* Initializes all GC components of the VM
*/
{
LogFlow(("vmR3InitGC:\n"));
/*
* Check for FAKE suplib mode.
*/
int rc = VINF_SUCCESS;
{
/*
* Call the VMMR0 component and let it do the init.
*/
}
else
Log(("vmR3InitGC: skipping because of VBOX_SUPLIB_FAKE=fake\n"));
/*
* Do notifications and return.
*/
if (VBOX_SUCCESS(rc))
return rc;
}
/**
* Do init completed notifications.
* This notifications can fail.
*
* @param pVM The VM handle.
* @param enmWhat What's completed.
*/
{
return VINF_SUCCESS;
}
/**
* Calls the relocation functions for all VMM components so they can update
* any GC pointers. When this function is called all the basic VM members
* have been updated and the actual memory relocation have been done
*
* This is used both on init and on runtime relocations.
*
* @param pVM VM handle.
* @param offDelta Relocation delta relative to old location.
*/
{
/*
* The order here is very important!
*/
}
/**
* Power on the virtual machine.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM to power on.
* @thread Any thread.
* @vmstate Created
* @vmstateto Running
*/
{
/*
* Validate input.
*/
if (!pVM)
{
AssertMsgFailed(("Invalid VM pointer\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Request the operation in EMT.
*/
if (VBOX_SUCCESS(rc))
{
}
return rc;
}
/**
* Power on the virtual machine.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM to power on.
* @thread EMT
*/
{
/*
* Validate input.
*/
{
return VERR_VM_INVALID_VM_STATE;
}
/*
* Change the state, notify the components and resume the execution.
*/
return VINF_SUCCESS;
}
/**
* Suspends a running VM.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM to suspend.
* @thread Any thread.
* @vmstate Running
* @vmstateto Suspended
*/
{
/*
* Validate input.
*/
if (!pVM)
{
AssertMsgFailed(("Invalid VM pointer\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Request the operation in EMT.
*/
if (VBOX_SUCCESS(rc))
{
}
return rc;
}
/**
* Suspends a running VM and prevent state saving until the VM is resumed or stopped.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM to suspend.
* @thread Any thread.
* @vmstate Running
* @vmstateto Suspended
*/
{
return VMR3Suspend(pVM);
}
/**
* Suspends a running VM.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM to suspend.
* @thread EMT
*/
{
/*
* Validate input.
*/
{
return VERR_VM_INVALID_VM_STATE;
}
/*
* Change the state, notify the components and resume the execution.
*/
return VINF_EM_SUSPEND;
}
/**
* Resume VM execution.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM The VM to resume.
* @thread Any thread.
* @vmstate Suspended
* @vmstateto Running
*/
{
/*
* Validate input.
*/
if (!pVM)
{
AssertMsgFailed(("Invalid VM pointer\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Request the operation in EMT.
*/
if (VBOX_SUCCESS(rc))
{
}
return rc;
}
/**
* Resume VM execution.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM The VM to resume.
* @thread EMT
*/
{
/*
* Validate input.
*/
{
return VERR_VM_INVALID_VM_STATE;
}
/*
* Change the state, notify the components and resume the execution.
*/
return VINF_EM_RESUME;
}
/**
* Save current VM state.
*
* To save and terminate the VM, the VM must be suspended before the call.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM which state should be saved.
* @param pszFilename Name of the save state file.
* @param pfnProgress Progress callback. Optional.
* @param pvUser User argument for the progress callback.
* @thread Any thread.
* @vmstate Suspended
* @vmstateto Unchanged state.
*/
{
LogFlow(("VMR3Save: pVM=%p pszFilename=%p:{%s} pfnProgress=%p pvUser=%p\n", pVM, pszFilename, pszFilename, pfnProgress, pvUser));
/*
* Validate input.
*/
if (!pVM)
{
AssertMsgFailed(("Invalid VM pointer\n"));
return VERR_INVALID_PARAMETER;
}
if (!pszFilename)
{
AssertMsgFailed(("Must specify a filename to save the state to, wise guy!\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Request the operation in EMT.
*/
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Save, 4, pVM, pszFilename, pfnProgress, pvUser);
if (VBOX_SUCCESS(rc))
{
}
return rc;
}
/**
* Save current VM state.
*
* To save and terminate the VM, the VM must be suspended before the call.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM which state should be saved.
* @param pszFilename Name of the save state file.
* @param pfnProgress Progress callback. Optional.
* @param pvUser User argument for the progress callback.
* @thread EMT
*/
static DECLCALLBACK(int) vmR3Save(PVM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser)
{
LogFlow(("vmR3Save: pVM=%p pszFilename=%p:{%s} pfnProgress=%p pvUser=%p\n", pVM, pszFilename, pszFilename, pfnProgress, pvUser));
/*
* Validate input.
*/
{
return VERR_VM_INVALID_VM_STATE;
}
/* If we are in an inconsistent state, then we don't allow state saving. */
{
LogRel(("VMM: vmR3Save: saving the VM state is not allowed at this moment\n"));
return VERR_VM_SAVE_STATE_NOT_ALLOWED;
}
/*
* Change the state and perform the save.
*/
/** @todo implement progress support in SSM */
return rc;
}
/**
* Loads a new VM state.
*
* To restore a saved state on VM startup, call this function and then
* resume the VM instead of powering it on.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM which state should be saved.
* @param pszFilename Name of the save state file.
* @param pfnProgress Progress callback. Optional.
* @param pvUser User argument for the progress callback.
* @thread Any thread.
* @vmstate Created, Suspended
* @vmstateto Suspended
*/
{
LogFlow(("VMR3Load: pVM=%p pszFilename=%p:{%s} pfnProgress=%p pvUser=%p\n", pVM, pszFilename, pszFilename, pfnProgress, pvUser));
/*
* Validate input.
*/
if (!pVM)
{
AssertMsgFailed(("Invalid VM pointer\n"));
return VERR_INVALID_PARAMETER;
}
if (!pszFilename)
{
AssertMsgFailed(("Must specify a filename to load the state from, wise guy!\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Request the operation in EMT.
*/
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Load, 4, pVM, pszFilename, pfnProgress, pvUser);
if (VBOX_SUCCESS(rc))
{
}
return rc;
}
/**
* Loads a new VM state.
*
* To restore a saved state on VM startup, call this function and then
* resume the VM instead of powering it on.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM which state should be saved.
* @param pszFilename Name of the save state file.
* @param pfnProgress Progress callback. Optional.
* @param pvUser User argument for the progress callback.
* @thread EMT.
*/
static DECLCALLBACK(int) vmR3Load(PVM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser)
{
LogFlow(("vmR3Load: pVM=%p pszFilename=%p:{%s} pfnProgress=%p pvUser=%p\n", pVM, pszFilename, pszFilename, pfnProgress, pvUser));
/*
* Validate input.
*/
{
return VMSetError(pVM, VERR_VM_INVALID_VM_STATE, RT_SRC_POS, N_("Invalid VM state (%s) for restoring state from '%s'"),
}
/*
* Change the state and perform the load.
*/
if (VBOX_SUCCESS(rc))
{
/* Not paranoia anymore; the saved guest might use different hypervisor selectors. We must call VMR3Relocate. */
VMR3Relocate(pVM, 0);
}
else
{
rc = VMSetError(pVM, rc, RT_SRC_POS, N_("Failed to restore VM state from '%s' (%Vrc)"), pszFilename, rc);
}
return rc;
}
/**
* Power Off the VM.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM which should be destroyed.
* @thread Any thread.
* @vmstate Suspended, Running, Guru Mediation, Load Failure
* @vmstateto Off
*/
{
/*
* Validate input.
*/
if (!pVM)
{
AssertMsgFailed(("Invalid VM pointer\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Request the operation in EMT.
*/
if (VBOX_SUCCESS(rc))
{
}
return rc;
}
/**
* Power Off the VM.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM which should be destroyed.
* @thread EMT.
*/
{
/*
* Validate input.
*/
{
return VERR_VM_INVALID_VM_STATE;
}
/*
* For debugging purposes, we will log a summary of the guest state at this point.
*/
{
/** @todo make the state dumping at VMR3PowerOff optional. */
RTLogRelPrintf("****************** Guest state at power off ******************\n");
RTLogRelPrintf("***\n");
RTLogRelPrintf("***\n");
RTLogRelPrintf("***\n");
/** @todo dump guest call stack. */
#if 1 // temporary while debugging #1589
RTLogRelPrintf("***\n");
if ( CPUMGetGuestSS(pVM) == 0
{
RTLogRelPrintf("***\n"
"ss:sp=0000:%04x ", esp);
if (VBOX_SUCCESS(rc))
RTLogRelPrintf("0000:%04x TO 0000:%04x:\n"
"%.*Rhxd\n",
0x100, abBuf);
else
/* grub ... */
{
if (VBOX_SUCCESS(rc))
RTLogRelPrintf("0000:8000 TO 0000:87ff:\n"
"%.*Rhxd\n",
0x800, abBuf);
}
/* microsoft cdrom hang ... */
if (true)
{
if (VBOX_SUCCESS(rc))
RTLogRelPrintf("2000:0000 TO 2000:01ff:\n"
"%.*Rhxd\n",
0x200, abBuf);
}
}
#endif
RTLogRelPrintf("************** End of Guest state at power off ***************\n");
}
/*
* Change the state to OFF and notify the components.
*/
return VINF_EM_OFF;
}
/**
* Destroys the VM.
* The VM must be powered off (or never really powered on) to call this function.
* The VM handle is destroyed and can no longer be used up successful return.
*
* @returns 0 on success.
* @returns VBox error code on failure.
* @param pVM VM which should be destroyed.
* @thread Any thread but the emulation thread.
* @vmstate Off, Created
* @vmstateto N/A
*/
{
/*
* Validate input.
*/
if (!pVM)
return VERR_INVALID_PARAMETER;
{
return VERR_VM_INVALID_VM_STATE;
}
/*
* Unlink the VM and change it's state to destroying.
*/
/** @todo lock this when we start having multiple machines in a process... */
{
}
if (!pCur)
{
return VERR_INVALID_PARAMETER;
}
if (pPrev)
else
/*
* Notify registered at destruction listeners.
* (That's the debugger console.)
*/
g_pVMsHead = pVM;
/*
* If we are the EMT we'll delay the cleanup till later.
*/
{
}
else
{
/*
* Request EMT to do the larger part of the destruction.
*/
while (rc == VERR_TIMEOUT)
if (VBOX_SUCCESS(rc))
/*
* Wait for the EMT thread to terminate.
*/
do
{
VMR3NotifyFF(pVM, false);
&& rc == VERR_TIMEOUT);
/*
* Now do the final bit where the heap and VM structures are freed up.
*/
}
LogFlow(("VMR3Destroy: returns VINF_SUCCESS\n"));
return VINF_SUCCESS;
}
/**
* Internal destruction worker. This will do nearly all of the
* job, including quitting the emulation thread.
*
* @returns VBox status.
* @param pVM VM handle.
*/
{
/*
* Dump statistics to the log.
*/
#if defined(VBOX_WITH_STATISTICS) || defined(LOG_ENABLED)
#endif
#ifdef VBOX_WITH_STATISTICS
#else
LogRel(("************************* Statistics *************************\n"));
LogRel(("********************* End of statistics **********************\n"));
#endif
/*
* Destroy the VM components.
*/
/* MM is destroyed later in vmR3DestroyFinalBit() for heap reasons. */
/*
* We're done in this thread.
*/
return VINF_EM_TERMINATE;
}
/**
* Does the final part of the VM destruction.
* This is called by EMT in it's final stage or by the VMR3Destroy caller.
*
* @param pVM VM Handle.
*/
{
/*
* Free the event semaphores associated with the request packets.s
*/
unsigned cReqs = 0;
{
{
}
}
/*
* Kill all queued requests. (There really shouldn't be any!)
*/
for (unsigned i = 0; i < 10; i++)
{
AssertMsg(!pReqHead, ("This isn't supposed to happen! VMR3Destroy caller has to serialize this.\n"));
if (!pReqHead)
break;
{
RTThreadSleep(2);
}
/* give them a chance to respond before we free the request memory. */
RTThreadSleep(32);
}
/*
* Modify state and then terminate MM.
* (MM must be delayed until this point so we don't destroy the callbacks and the request packet.)
*/
/*
* Free the VM structure.
*/
}
/**
* Enumerates the VMs in this process.
*
* @returns Pointer to the next VM.
* @returns NULL when no more VMs.
* @param pVMPrev The previous VM
* Use NULL to start the enumeration.
*/
{
/*
* This is quick and dirty. It has issues with VM being
* destroyed during the enumeration.
*/
if (pVMPrev)
return g_pVMsHead;
}
/**
* Registers an at VM destruction callback.
*
* @returns VBox status code.
* @param pfnAtDtor Pointer to callback.
* @param pvUser User argument.
*/
{
/*
* Check if already registered.
*/
while (pCur)
{
{
return VERR_INVALID_PARAMETER;
}
/* next */
}
/*
* Allocate new entry.
*/
if (!pVMAtDtor)
return VERR_NO_MEMORY;
return VINF_SUCCESS;
}
/**
* Deregisters an at VM destruction callback.
*
* @returns VBox status code.
* @param pfnAtDtor Pointer to callback.
*/
{
/*
* Find it, unlink it and free it.
*/
while (pCur)
{
{
if (pPrev)
else
return VINF_SUCCESS;
}
/* next */
}
return VERR_INVALID_PARAMETER;
}
/**
* Walks the list of at VM destructor callbacks.
* @param pVM The VM which is about to be destroyed.
*/
{
/*
* Find it, unlink it and free it.
*/
}
/**
* Reset the current VM.
*
* @returns VBox status code.
* @param pVM VM to reset.
*/
{
int rc = VINF_SUCCESS;
/*
* Check the state.
*/
if (!pVM)
return VERR_INVALID_PARAMETER;
{
return VERR_VM_INVALID_VM_STATE;
}
/*
* Queue reset request to the emulation thread
* and wait for it to be processed.
*/
while (rc == VERR_TIMEOUT)
if (VBOX_SUCCESS(rc))
return rc;
}
/**
* Worker which checks integrity of some internal structures.
* This is yet another attempt to track down that AVL tree crash.
*/
{
#ifdef VBOX_STRICT
#endif
}
/**
* Reset request processor.
*
* This is called by the emulation thread as a response to the
* reset request issued by VMR3Reset().
*
* @returns VBox status code.
* @param pVM VM to reset.
*/
{
/*
* As a safety precaution we temporarily change the state while resetting.
* (If VMR3Reset was not called from EMT we might have change state... let's ignore that fact for now.)
*/
/*
* Reset the VM components.
*/
#ifdef LOG_ENABLED
/*
* Debug logging.
*/
RTLogPrintf("\n\nThe VM was reset:\n");
#endif
/*
* Restore the state.
*/
return VINF_EM_RESET;
}
/**
* Walks the list of at VM reset callbacks and calls them
*
* @returns VBox status code.
* Any failure is fatal.
* @param pVM The VM which is being reset.
*/
{
/*
* Walk the list and call them all.
*/
int rc = VINF_SUCCESS;
{
/* do the call */
{
case VMATRESETTYPE_DEV:
break;
case VMATRESETTYPE_INTERNAL:
break;
case VMATRESETTYPE_EXTERNAL:
break;
default:
return VERR_INTERNAL_ERROR;
}
if (VBOX_FAILURE(rc))
{
return rc;
}
}
return VINF_SUCCESS;
}
/**
* Internal registration function
*/
{
/*
* Allocate restration structure.
*/
if (pNew)
{
/* fill data. */
/* insert */
return VINF_SUCCESS;
}
return VERR_NO_MEMORY;
}
/**
* Registers an at VM reset callback.
*
* @returns VBox status code.
* @param pVM The VM.
* @param pDevInst Device instance.
* @param pfnCallback Callback function.
* @param pvUser User argument.
* @param pszDesc Description (optional).
*/
VMR3DECL(int) VMR3AtResetRegister(PVM pVM, PPDMDEVINS pDevInst, PFNVMATRESET pfnCallback, void *pvUser, const char *pszDesc)
{
/*
* Validate.
*/
if (!pDevInst)
{
AssertMsgFailed(("pDevIns is NULL!\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Create the new entry.
*/
if (VBOX_SUCCESS(rc))
{
/*
* Fill in type data.
*/
}
return rc;
}
/**
* Registers an at VM reset internal callback.
*
* @returns VBox status code.
* @param pVM The VM.
* @param pfnCallback Callback function.
* @param pvUser User argument.
* @param pszDesc Description (optional).
*/
VMR3DECL(int) VMR3AtResetRegisterInternal(PVM pVM, PFNVMATRESETINT pfnCallback, void *pvUser, const char *pszDesc)
{
/*
* Validate.
*/
if (!pfnCallback)
{
AssertMsgFailed(("pfnCallback is NULL!\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Create the new entry.
*/
if (VBOX_SUCCESS(rc))
{
/*
* Fill in type data.
*/
}
return rc;
}
/**
* Registers an at VM reset external callback.
*
* @returns VBox status code.
* @param pVM The VM.
* @param pfnCallback Callback function.
* @param pvUser User argument.
* @param pszDesc Description (optional).
*/
VMR3DECL(int) VMR3AtResetRegisterExternal(PVM pVM, PFNVMATRESETEXT pfnCallback, void *pvUser, const char *pszDesc)
{
/*
* Validate.
*/
if (!pfnCallback)
{
AssertMsgFailed(("pfnCallback is NULL!\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Create the new entry.
*/
if (VBOX_SUCCESS(rc))
{
/*
* Fill in type data.
*/
}
return rc;
}
/**
* Unlinks and frees a callback.
*
* @returns Pointer to the next callback structure.
* @param pVM The VM.
* @param pCur The one to free.
* @param pPrev The one before pCur.
*/
{
/*
* Unlink it.
*/
if (pPrev)
{
if (!pNext)
}
else
{
if (!pNext)
}
/*
* Free it.
*/
return pNext;
}
/**
* Deregisters an at VM reset callback.
*
* @returns VBox status code.
* @param pVM The VM.
* @param pDevInst Device instance.
* @param pfnCallback Callback function.
*/
{
int rc = VERR_VM_ATRESET_NOT_FOUND;
while (pCur)
{
{
rc = VINF_SUCCESS;
}
else
{
}
}
return rc;
}
/**
* Deregisters an at VM reset internal callback.
*
* @returns VBox status code.
* @param pVM The VM.
* @param pfnCallback Callback function.
*/
{
int rc = VERR_VM_ATRESET_NOT_FOUND;
while (pCur)
{
{
rc = VINF_SUCCESS;
}
else
{
}
}
return rc;
}
/**
* Deregisters an at VM reset external callback.
*
* @returns VBox status code.
* @param pVM The VM.
* @param pfnCallback Callback function.
*/
{
int rc = VERR_VM_ATRESET_NOT_FOUND;
while (pCur)
{
{
rc = VINF_SUCCESS;
}
else
{
}
}
return rc;
}
/**
* Gets the current VM state.
*
* @returns The current VM state.
* @param pVM VM handle.
* @thread Any
*/
{
return pVM->enmVMState;
}
/**
* Gets the state name string for a VM state.
*
* @returns Pointer to the state name. (readonly)
* @param enmState The state.
*/
{
switch (enmState)
{
case VMSTATE_CREATING: return "CREATING";
case VMSTATE_CREATED: return "CREATED";
case VMSTATE_RUNNING: return "RUNNING";
case VMSTATE_LOADING: return "LOADING";
case VMSTATE_LOAD_FAILURE: return "LOAD_FAILURE";
case VMSTATE_SAVING: return "SAVING";
case VMSTATE_SUSPENDED: return "SUSPENDED";
case VMSTATE_RESETTING: return "RESETTING";
case VMSTATE_GURU_MEDITATION: return "GURU_MEDIATION";
case VMSTATE_OFF: return "OFF";
case VMSTATE_DESTROYING: return "DESTROYING";
case VMSTATE_TERMINATED: return "TERMINATED";
default:
return "Unknown!\n";
}
}
/**
* Sets the current VM state.
*
* @returns The current VM state.
* @param pVM VM handle.
* @param enmStateNew The new state.
*/
{
LogRel(("Changing the VM state from '%s' to '%s'.\n", VMR3GetStateName(enmStateOld), VMR3GetStateName(enmStateNew)));
/*
* Call the at state change callbacks.
*/
{
break;
("You are not allowed to change the state while in the change callback, except "
"from destroying the VM. There are restrictions in the way the state changes "
"are propagated up to the EM execution loop and it makes the program flow very "
"difficult to follow.\n"));
}
}
/**
* Registers a VM state change callback.
*
* You are not allowed to call any function which changes the VM state from a
* state callback, except VMR3Destroy().
*
* @returns VBox status code.
* @param pVM VM handle.
* @param pfnAtState Pointer to callback.
* @param pvUser User argument.
* @thread Any.
*/
{
/*
* Validate input.
*/
if (!pfnAtState)
{
AssertMsgFailed(("callback is required\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Make sure we're in EMT (to avoid the logging).
*/
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3AtStateRegister, 3, pVM, pfnAtState, pvUser);
if (VBOX_FAILURE(rc))
return rc;
return rc;
}
/**
* Registers a VM state change callback.
*
* @returns VBox status code.
* @param pVM VM handle.
* @param pfnAtState Pointer to callback.
* @param pvUser User argument.
* @thread EMT
*/
{
/*
* Allocate a new record.
*/
if (!pNew)
return VERR_NO_MEMORY;
/* fill */
/* insert */
return VINF_SUCCESS;
}
/**
* Deregisters a VM state change callback.
*
* @returns VBox status code.
* @param pVM VM handle.
* @param pfnAtState Pointer to callback.
* @param pvUser User argument.
* @thread Any.
*/
{
/*
* Validate input.
*/
if (!pfnAtState)
{
AssertMsgFailed(("callback is required\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Make sure we're in EMT (to avoid the logging).
*/
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3AtStateDeregister, 3, pVM, pfnAtState, pvUser);
if (VBOX_FAILURE(rc))
return rc;
return rc;
}
/**
* Deregisters a VM state change callback.
*
* @returns VBox status code.
* @param pVM VM handle.
* @param pfnAtState Pointer to callback.
* @param pvUser User argument.
* @thread EMT
*/
{
/*
* Search the list for the entry.
*/
while ( pCur
{
}
if (!pCur)
{
return VERR_FILE_NOT_FOUND;
}
/*
* Unlink it.
*/
if (pPrev)
{
}
else
{
}
/*
* Free it.
*/
return VINF_SUCCESS;
}
/**
* Registers a VM error callback.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pfnAtError Pointer to callback.
* @param pvUser User argument.
* @thread Any.
*/
{
/*
* Validate input.
*/
if (!pfnAtError)
{
AssertMsgFailed(("callback is required\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Make sure we're in EMT (to avoid the logging).
*/
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3AtErrorRegister, 3, pVM, pfnAtError, pvUser);
if (VBOX_FAILURE(rc))
return rc;
return rc;
}
/**
* Registers a VM error callback.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pfnAtError Pointer to callback.
* @param pvUser User argument.
* @thread EMT
*/
{
/*
* Allocate a new record.
*/
if (!pNew)
return VERR_NO_MEMORY;
/* fill */
/* insert */
return VINF_SUCCESS;
}
/**
* Deregisters a VM error callback.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pfnAtError Pointer to callback.
* @param pvUser User argument.
* @thread Any.
*/
{
/*
* Validate input.
*/
if (!pfnAtError)
{
AssertMsgFailed(("callback is required\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Make sure we're in EMT (to avoid the logging).
*/
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3AtErrorDeregister, 3, pVM, pfnAtError, pvUser);
if (VBOX_FAILURE(rc))
return rc;
return rc;
}
/**
* Deregisters a VM error callback.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pfnAtError Pointer to callback.
* @param pvUser User argument.
* @thread EMT
*/
{
/*
* Search the list for the entry.
*/
while ( pCur
{
}
if (!pCur)
{
return VERR_FILE_NOT_FOUND;
}
/*
* Unlink it.
*/
if (pPrev)
{
}
else
{
}
/*
* Free it.
*/
return VINF_SUCCESS;
}
/**
* Ellipsis to va_list wrapper for calling pfnAtError.
*/
static void vmR3SetErrorWorkerDoCall(PVM pVM, PVMATERROR pCur, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
{
}
/**
* This is a worker function for GC and Ring-0 calls to VMSetError and VMSetErrorV.
* The message is found in VMINT.
*
* @param pVM The VM handle.
* @thread EMT.
*/
{
AssertReleaseMsgFailed(("And we have a winner! You get to implement Ring-0 and GC VMSetErrorV! Contrats!\n"));
/*
* Unpack the error (if we managed to format one).
*/
const char *pszFunction = NULL;
const char *pszMessage;
if (pErr)
{
AssertCompile(sizeof(const char) == sizeof(uint8_t));
if (pErr->offFunction)
if (pErr->offMessage)
else
pszMessage = "No message!";
}
else
pszMessage = "No message! (Failed to allocate memory to put the error message in!)";
/*
* Call the at error callbacks.
*/
}
/**
* Worker which calls everyone listening to the VM error messages.
*
* @param pVM The VM handle.
* @param rc The VBox status code.
* @param RT_SRC_POS_DECL The source position of this error.
* @param pszFormat Format string.
* @param pArgs Pointer to the format arguments.
* @thread EMT
*/
DECLCALLBACK(void) vmR3SetErrorV(PVM pVM, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list *pArgs)
{
#ifdef LOG_ENABLED
/*
* Log the error.
*/
#endif
/*
* Make a copy of the message.
*/
/*
* Call the at error callbacks.
*/
{
}
}
/**
* Registers a VM runtime error callback.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pfnAtRuntimeError Pointer to callback.
* @param pvUser User argument.
* @thread Any.
*/
VMR3DECL(int) VMR3AtRuntimeErrorRegister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser)
{
LogFlow(("VMR3AtRuntimeErrorRegister: pfnAtRuntimeError=%p pvUser=%p\n", pfnAtRuntimeError, pvUser));
/*
* Validate input.
*/
if (!pfnAtRuntimeError)
{
AssertMsgFailed(("callback is required\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Make sure we're in EMT (to avoid the logging).
*/
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3AtRuntimeErrorRegister, 3, pVM, pfnAtRuntimeError, pvUser);
if (VBOX_FAILURE(rc))
return rc;
return rc;
}
/**
* Registers a VM runtime error callback.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pfnAtRuntimeError Pointer to callback.
* @param pvUser User argument.
* @thread EMT
*/
static DECLCALLBACK(int) vmR3AtRuntimeErrorRegister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser)
{
/*
* Allocate a new record.
*/
if (!pNew)
return VERR_NO_MEMORY;
/* fill */
/* insert */
return VINF_SUCCESS;
}
/**
* Deregisters a VM runtime error callback.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pfnAtRuntimeError Pointer to callback.
* @param pvUser User argument.
* @thread Any.
*/
VMR3DECL(int) VMR3AtRuntimeErrorDeregister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser)
{
LogFlow(("VMR3AtRuntimeErrorDeregister: pfnAtRuntimeError=%p pvUser=%p\n", pfnAtRuntimeError, pvUser));
/*
* Validate input.
*/
if (!pfnAtRuntimeError)
{
AssertMsgFailed(("callback is required\n"));
return VERR_INVALID_PARAMETER;
}
/*
* Make sure we're in EMT (to avoid the logging).
*/
int rc = VMR3ReqCall(pVM, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3AtRuntimeErrorDeregister, 3, pVM, pfnAtRuntimeError, pvUser);
if (VBOX_FAILURE(rc))
return rc;
return rc;
}
/**
* Deregisters a VM runtime error callback.
*
* @returns VBox status code.
* @param pVM The VM handle.
* @param pfnAtRuntimeError Pointer to callback.
* @param pvUser User argument.
* @thread EMT
*/
static DECLCALLBACK(int) vmR3AtRuntimeErrorDeregister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser)
{
LogFlow(("vmR3AtRuntimeErrorDeregister: pfnAtRuntimeError=%p pvUser=%p\n", pfnAtRuntimeError, pvUser));
/*
* Search the list for the entry.
*/
while ( pCur
{
}
if (!pCur)
{
return VERR_FILE_NOT_FOUND;
}
/*
* Unlink it.
*/
if (pPrev)
{
}
else
{
}
/*
* Free it.
*/
return VINF_SUCCESS;
}
/**
* Ellipsis to va_list wrapper for calling pfnAtRuntimeError.
*/
const char *pszErrorID,
const char *pszFormat, ...)
{
}
/**
* This is a worker function for GC and Ring-0 calls to VMSetError and VMSetErrorV.
* The message is found in VMINT.
*
* @param pVM The VM handle.
* @thread EMT.
*/
{
AssertReleaseMsgFailed(("And we have a winner! You get to implement Ring-0 and GC VMSetRuntimeErrorV! Contrats!\n"));
/*
* Unpack the error (if we managed to format one).
*/
const char *pszErrorID = NULL;
const char *pszMessage;
bool fFatal = false;
if (pErr)
{
AssertCompile(sizeof(const char) == sizeof(uint8_t));
if (pErr->offErrorID)
if (pErr->offMessage)
else
pszMessage = "No message!";
}
else
pszMessage = "No message! (Failed to allocate memory to put the error message in!)";
/*
* Call the at runtime error callbacks.
*/
}
/**
* Worker which calls everyone listening to the VM runtime error messages.
*
* @param pVM The VM handle.
* @param fFatal Whether it is a fatal error or not.
* @param pszErrorID Error ID string.
* @param pszFormat Format string.
* @param pArgs Pointer to the format arguments.
* @thread EMT
*/
const char *pszErrorID,
{
/*
* Make a copy of the message.
*/
/*
* Call the at error callbacks.
*/
{
}
}