gvmm.h revision f122ecc2f8ed224251d82882edced7839e10b1e3
/* $Id$ */
/** @file
* GVMM - The Global VM Manager. (VMM)
*/
/*
* Copyright (C) 2007 Oracle Corporation
*
* 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.
*/
#ifndef ___VBox_gvmm_h
#define ___VBox_gvmm_h
/** @defgroup grp_GVMM GVMM - The Global VM Manager.
* @{
*/
/** @def IN_GVMM_R0
* Used to indicate whether we're inside the same link module as the ring 0
* part of the Global VM Manager or not.
*/
#ifdef DOXYGEN_RUNNING
# define IN_GVMM_R0
#endif
/** @def GVMMR0DECL
* Ring 0 VM export or import declaration.
* @param type The return type of the function declaration.
*/
#ifdef IN_GVMM_R0
#else
#endif
/** @def NIL_GVM_HANDLE
* The nil GVM VM handle value (VM::hSelf).
*/
#define NIL_GVM_HANDLE 0
/**
* The scheduler statistics
*/
typedef struct GVMMSTATSSCHED
{
/** The number of calls to GVMMR0SchedHalt. */
/** The number of times we did go to sleep in GVMMR0SchedHalt. */
/** The number of times we timed out in GVMMR0SchedHalt. */
/** The number of times we didn't go to sleep in GVMMR0SchedHalt. */
/** The number of wake ups done during GVMMR0SchedHalt. */
/** The number of calls to GVMMR0WakeUp. */
/** The number of times the EMT thread wasn't actually halted when GVMMR0WakeUp
* was called. */
/** The number of wake ups done during GVMMR0WakeUp (not counting the explicit
* one). */
/** The number of calls to GVMMR0Poke. */
/** The number of times the EMT thread wasn't actually busy when
* GVMMR0Poke was called. */
/** The number of calls to GVMMR0SchedPoll. */
/** The number of times the EMT has halted in a GVMMR0SchedPoll call. */
/** The number of wake ups done during GVMMR0SchedPoll. */
/** Pointer to the GVMM scheduler statistics. */
typedef GVMMSTATSSCHED *PGVMMSTATSSCHED;
/**
* The GMM statistics.
*/
typedef struct GVMMSTATS
{
/** The VM statistics if a VM was specified. */
/** The sum statistics of all VMs accessible to the caller. */
/** The number of VMs accessible to the caller. */
/** The number of emulation threads in those VMs. */
} GVMMSTATS;
/** Pointer to the GVMM statistics. */
typedef GVMMSTATS *PGVMMSTATS;
/** Const pointer to the GVMM statistics. */
typedef const GVMMSTATS *PCGVMMSTATS;
GVMMR0DECL(int) GVMMR0Init(void);
GVMMR0DECL(void) GVMMR0Term(void);
GVMMR0DECL(int) GVMMR0QueryConfig(PSUPDRVSESSION pSession, const char *pszName, uint64_t *pu64Value);
/**
* Request packet for calling GVMMR0CreateVM.
*/
typedef struct GVMMCREATEVMREQ
{
/** The request header. */
/** The support driver session. (IN) */
/** Number of virtual CPUs for the new VM. (IN) */
/** Pointer to the ring-3 mapping of the shared VM structure on return. (OUT) */
/** Pointer to the ring-0 mapping of the shared VM structure on return. (OUT) */
/** Pointer to a GVMMR0CreateVM request packet. */
typedef GVMMCREATEVMREQ *PGVMMCREATEVMREQ;
/**
* Request buffer for GVMMR0SchedWakeUpAndPokeCpusReq / VMMR0_DO_GVMM_SCHED_WAKE_UP_AND_POKE_CPUS.
* @see GVMMR0SchedWakeUpAndPokeCpus.
*/
typedef struct GVMMSCHEDWAKEUPANDPOKECPUSREQ /* nice and unreadable... */
{
/** The header. */
/** The sleeper set. */
/** The set of virtual CPUs to poke. */
/** Pointer to a GVMMR0QueryStatisticsReq / VMMR0_DO_GVMM_QUERY_STATISTICS request buffer. */
/**
* Request buffer for GVMMR0QueryStatisticsReq / VMMR0_DO_GVMM_QUERY_STATISTICS.
* @see GVMMR0QueryStatistics.
*/
typedef struct GVMMQUERYSTATISTICSSREQ
{
/** The header. */
/** The support driver session. */
/** The statistics. */
/** Pointer to a GVMMR0QueryStatisticsReq / VMMR0_DO_GVMM_QUERY_STATISTICS request buffer. */
/**
* Request buffer for GVMMR0ResetStatisticsReq / VMMR0_DO_GVMM_RESET_STATISTICS.
* @see GVMMR0ResetStatistics.
*/
typedef struct GVMMRESETSTATISTICSSREQ
{
/** The header. */
/** The support driver session. */
/** The statistics to reset.
* Any non-zero entry will be reset (if permitted). */
/** Pointer to a GVMMR0ResetStatisticsReq / VMMR0_DO_GVMM_RESET_STATISTICS request buffer. */
/** @} */
#endif