vmm.h revision 1bd0025f8e699b37641beaddb205c61394ef7def
/** @file
* VMM - The Virtual Machine Monitor. (VMM)
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* 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 (GPL) 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.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef ___VBox_vmm_h
#define ___VBox_vmm_h
/** @defgroup grp_vmm The Virtual Machine Monitor API
* @{
*/
/**
* World switcher identifiers.
*/
typedef enum VMMSWITCHER
{
/** The usual invalid 0. */
VMMSWITCHER_INVALID = 0,
/** Switcher for 32-bit host to 32-bit shadow paging. */
/** Switcher for 32-bit host paging to PAE shadow paging. */
/** Switcher for 32-bit host paging to AMD64 shadow paging. */
/** Switcher for PAE host to 32-bit shadow paging. */
/** Switcher for PAE host to PAE shadow paging. */
/** Switcher for PAE host paging to AMD64 shadow paging. */
/** Switcher for AMD64 host paging to 32-bit shadow paging. */
/** Switcher for AMD64 host paging to PAE shadow paging. */
/** Switcher for AMD64 host paging to AMD64 shadow paging. */
/** Used to make a count for array declarations and suchlike. */
/** The usual 32-bit paranoia. */
VMMSWITCHER_32BIT_HACK = 0x7fffffff
} VMMSWITCHER;
/**
* VMMRZCallRing3 operations.
*/
typedef enum VMMCALLRING3
{
/** Invalid operation. */
VMMCALLRING3_INVALID = 0,
/** Acquire the PDM lock. */
/** Call PDMR3QueueFlushWorker. */
/** Acquire the PGM lock. */
/** Grow the PGM shadow page pool. */
/** Maps a chunk into ring-3. */
/** Allocates more handy pages. */
/** Acquire the MM hypervisor heap lock. */
/** Replay the REM handler notifications. */
/** Set the VM error message. */
/** Set the VM runtime error message. */
/** Signal a ring 0 assertion. */
/** Ring switch to force preemption. */
/** The usual 32-bit hack. */
VMMCALLRING3_32BIT_HACK = 0x7fffffff
} VMMCALLRING3;
/**
* VMMR3AtomicExecuteHandler callback function.
*
* @returns VBox status code.
* @param pVM Pointer to the shared VM structure.
* @param pvUser User specified argument
*
* @todo missing prefix.
*/
/** Pointer to a FNMMATOMICHANDLER(). */
typedef FNATOMICHANDLER *PFNATOMICHANDLER;
/**
* Rendezvous callback.
*
* @returns VBox strict status code - EM scheduling. Do not return
* informational status code other than the ones used by EM for
* scheduling.
*
* @param pVM The VM handle.
* @param pVCpu The handle of the calling virtual CPU.
* @param pvUser The user argument.
*/
/** Pointer to a rendezvous callback function. */
typedef FNVMMEMTRENDEZVOUS *PFNVMMEMTRENDEZVOUS;
VMMDECL(void) VMMTrashVolatileXMMRegs(void);
/** @def VMMIsHwVirtExtForced
* Checks if forced to use the hardware assisted virtualization extensions.
*
* This is intended for making setup decisions where we can save resources when
* using hardware assisted virtualization.
*
* @returns true / false.
* @param pVM Pointer to the shared VM structure.
*/
#ifdef IN_RING3
/** @defgroup grp_vmm_r3 The VMM Host Context Ring 3 API
* @ingroup grp_vmm
* @{
*/
VMMR3DECL(int) VMMR3EmtRendezvous(PVM pVM, uint32_t fFlags, PFNVMMEMTRENDEZVOUS pfnRendezvous, void *pvUser);
/** @defgroup grp_VMMR3EmtRendezvous_fFlags VMMR3EmtRendezvous flags
* @{ */
/** Execution type mask. */
/** Invalid execution type. */
#define VMMEMTRENDEZVOUS_FLAGS_TYPE_INVALID UINT32_C(0)
/** Let the EMTs execute the callback one by one (in no particular order). */
/** Let all the EMTs execute the callback at the same time. */
/** Only execute the callback on one EMT (no particular one). */
/** Let the EMTs execute the callback one by one in ascending order. */
/** Let the EMTs execute the callback one by one in descending order. */
/** Stop after the first error.
* This is not valid for any execution type where more than one EMT is active
* at a time. */
/** The valid flags. */
/** @} */
VMMR3DECL(int) VMMR3ReadR0Stack(PVM pVM, VMCPUID idCpu, RTHCUINTPTR pAddress, void *pvBuf, size_t cbRead);
/** @} */
#endif /* IN_RING3 */
/** @defgroup grp_vmm_r0 The VMM Host Context Ring 0 API
* @ingroup grp_vmm
* @{
*/
/**
* The VMMR0Entry() codes.
*/
typedef enum VMMR0OPERATION
{
/** Run guest context. */
/** Run guest code using the available hardware acceleration technology. */
/** Official NOP that we use for profiling. */
/** Official slow iocl NOP that we use for profiling. */
/** Ask the GVMM to create a new VM. */
/** Ask the GVMM to destroy the VM. */
/** Call GVMMR0SchedHalt(). */
/** Call GVMMR0SchedWakeUp(). */
/** Call GVMMR0SchedPoke(). */
/** Call GVMMR0SchedWakeUpAndPokeCpus(). */
/** Call GVMMR0SchedPoll(). */
/** Call GVMMR0QueryStatistics(). */
/** Call GVMMR0ResetStatistics(). */
/** Call GVMMR0RegisterVCpu(). */
/** Call VMMR0 Per VM Init. */
/** Call VMMR0 Per VM Termination. */
/** Setup the hardware accelerated raw-mode session. */
/** Attempt to enable or disable hardware accelerated raw-mode. */
/** Calls function in the hypervisor.
* The caller must setup the hypervisor context so the call will be performed.
* The difference between VMMR0_DO_RUN_GC and this one is the handling of
* the return GC code. The return code will not be interpreted by this operation.
*/
/** Call PGMR0PhysAllocateHandyPages(). */
/** Call GMMR0InitialReservation(). */
/** Call GMMR0UpdateReservation(). */
/** Call GMMR0AllocatePages(). */
/** Call GMMR0FreePages(). */
/** Call GMMR0BalloonedPages(). */
/** Call GMMR0DeflatedBalloon(). */
/** Call GMMR0MapUnmapChunk(). */
/** Call GMMR0SeedChunk(). */
/** Set a GVMM or GMM configuration value. */
/** Query a GVMM or GMM configuration value. */
/** The start of the R0 service operations. */
/** Call INTNETR0Open(). */
/** Call INTNETR0IfClose(). */
/** Call INTNETR0IfGetRing3Buffer(). */
/** Call INTNETR0IfSetPromiscuousMode(). */
/** Call INTNETR0IfSetMacAddress(). */
/** Call INTNETR0IfSetActive(). */
/** Call INTNETR0IfSend(). */
/** Call INTNETR0IfWait(). */
/** The end of the R0 service operations. */
/** Official call we use for testing Ring-0 APIs. */
/** Test the 32->64 bits switcher. */
/** The usual 32-bit type blow up. */
VMMR0_DO_32BIT_HACK = 0x7fffffff
/**
* Request buffer for VMMR0_DO_GCFGM_SET_VALUE and VMMR0_DO_GCFGM_QUERY_VALUE.
* @todo Move got GCFGM.h when it's implemented.
*/
typedef struct GCFGMVALUEREQ
{
/** The request header.*/
/** The support driver session handle. */
/** The value.
* This is input for the set request and output for the query. */
/** The variable name.
* This is fixed sized just to make things simple for the mock-up. */
char szName[48];
/** Pointer to a VMMR0_DO_GCFGM_SET_VALUE and VMMR0_DO_GCFGM_QUERY_VALUE request buffer.
* @todo Move got GCFGM.h when it's implemented.
*/
typedef GCFGMVALUEREQ *PGCFGMVALUEREQ;
VMMR0DECL(int) VMMR0EntryEx(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION);
#ifdef LOG_ENABLED
#else
#define VMMR0LogFlushDisable(pVCpu) do { } while(0)
#define VMMR0LogFlushEnable(pVCpu) do { } while(0)
#endif
/** @} */
#ifdef IN_RC
/** @defgroup grp_vmm_rc The VMM Raw-Mode Context API
* @ingroup grp_vmm
* @{
*/
/** @} */
#endif /* IN_RC */
/** @defgroup grp_vmm_rz The VMM Raw-Mode and Ring-0 Context API
* @ingroup grp_vmm
* @{
*/
/** @} */
#endif
/** @} */
#endif