Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

gvmm.h

Go to the documentation of this file.
/* $Id: gvmm.h 29865 2008-04-18 15:16:47Z umoeller $ */
/** @file
 * GVMM - The Global VM Manager.
 */

/*
 * Copyright (C) 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;
 * you can redistribute it and/or modify it under the terms of the GNU
 * 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_gvmm_h
#define ___VBox_gvmm_h

#include <VBox/cdefs.h>
#include <VBox/types.h>
#include <VBox/sup.h>

__BEGIN_DECLS

/** @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.
 */
/** @def GVMMR0DECL
 * Ring 0 VM export or import declaration.
 * @param   type    The return type of the function declaration.
 */
#ifdef IN_GVMM_R0
# define GVMMR0DECL(type)    DECLEXPORT(type) VBOXCALL
#else
00055 # define GVMMR0DECL(type)    DECLIMPORT(type) VBOXCALL
#endif

/** @def NIL_GVM_HANDLE
 * The nil GVM VM handle value (VM::hSelf).
 */
00061 #define NIL_GVM_HANDLE 0


/**
 * The scheduler statistics
 */
00067 typedef struct GVMMSTATSSCHED
{
    /** The number of calls to GVMMR0SchedHalt. */
00070     uint64_t        cHaltCalls;
    /** The number of times we did go to sleep in GVMMR0SchedHalt. */
00072     uint64_t        cHaltBlocking;
    /** The number of times we timed out in GVMMR0SchedHalt. */
00074     uint64_t        cHaltTimeouts;
    /** The number of times we didn't go to sleep in GVMMR0SchedHalt. */
00076     uint64_t        cHaltNotBlocking;
    /** The number of wake ups done during GVMMR0SchedHalt. */
00078     uint64_t        cHaltWakeUps;

    /** The number of calls to GVMMR0WakeUp. */
00081     uint64_t        cWakeUpCalls;
    /** The number of times the EMT thread wasn't actually halted when GVMMR0WakeUp was called. */
00083     uint64_t        cWakeUpNotHalted;
    /** The number of wake ups done during GVMMR0WakeUp (not counting the explicit one). */
00085     uint64_t        cWakeUpWakeUps;

    /** The number of calls to GVMMR0SchedPoll. */
00088     uint64_t        cPollCalls;
    /** The number of times the EMT has halted in a GVMMR0SchedPoll call. */
00090     uint64_t        cPollHalts;
    /** The number of wake ups done during GVMMR0SchedPoll. */
00092     uint64_t        cPollWakeUps;
00093     uint64_t        u64Alignment; /**< padding */
} GVMMSTATSSCHED;
/** Pointer to the GVMM scheduler statistics. */
00096 typedef GVMMSTATSSCHED *PGVMMSTATSSCHED;

/**
 * The GMM statistics.
 */
00101 typedef struct GVMMSTATS
{
    /** The VM statistics if a VM was specified. */
00104     GVMMSTATSSCHED  SchedVM;
    /** The sum statistics of all VMs accessible to the caller. */
00106     GVMMSTATSSCHED  SchedSum;
    /** The number of VMs accessible to the caller. */
00108     uint32_t        cVMs;
    /** Alignment padding. */
00110     uint32_t        u32Padding;
} GVMMSTATS;
/** Pointer to the GVMM statistics. */
00113 typedef GVMMSTATS *PGVMMSTATS;
/** Const pointer to the GVMM statistics. */
00115 typedef const GVMMSTATS *PCGVMMSTATS;



GVMMR0DECL(int)     GVMMR0Init(void);
GVMMR0DECL(void)    GVMMR0Term(void);
GVMMR0DECL(int)     GVMMR0SetConfig(PSUPDRVSESSION pSession, const char *pszName, uint64_t u64Value);
GVMMR0DECL(int)     GVMMR0QueryConfig(PSUPDRVSESSION pSession, const char *pszName, uint64_t *pu64Value);

GVMMR0DECL(int)     GVMMR0CreateVM(PSUPDRVSESSION pSession, PVM *ppVM);
GVMMR0DECL(int)     GVMMR0InitVM(PVM pVM);
GVMMR0DECL(int)     GVMMR0DestroyVM(PVM pVM);
GVMMR0DECL(PGVM)    GVMMR0ByHandle(uint32_t hGVM);
GVMMR0DECL(PGVM)    GVMMR0ByVM(PVM pVM);
GVMMR0DECL(int)     GVMMR0ByVMAndEMT(PVM pVM, PGVM *ppGVM);
GVMMR0DECL(PVM)     GVMMR0GetVMByHandle(uint32_t hGVM);
GVMMR0DECL(PVM)     GVMMR0GetVMByEMT(RTNATIVETHREAD hEMT);
GVMMR0DECL(int)     GVMMR0SchedHalt(PVM pVM, uint64_t u64ExpireGipTime);
GVMMR0DECL(int)     GVMMR0SchedWakeUp(PVM pVM);
GVMMR0DECL(int)     GVMMR0SchedPoll(PVM pVM, bool fYield);
GVMMR0DECL(int)     GVMMR0QueryStatistics(PGVMMSTATS pStats, PSUPDRVSESSION pSession, PVM pVM);
GVMMR0DECL(int)     GVMMR0ResetStatistics(PCGVMMSTATS pStats, PSUPDRVSESSION pSession, PVM pVM);


/**
 * Request packet for calling GVMMR0CreateVM.
 */
00142 typedef struct GVMMCREATEVMREQ
{
    /** The request header. */
00145     SUPVMMR0REQHDR  Hdr;
    /** The support driver session. (IN) */
00147     PSUPDRVSESSION  pSession;
    /** Pointer to the ring-3 mapping of the shared VM structure on return. (OUT) */
00149     PVMR3           pVMR3;
    /** Pointer to the ring-0 mapping of the shared VM structure on return. (OUT) */
00151     PVMR0           pVMR0;
} GVMMCREATEVMREQ;
/** Pointer to a GVMMR0CreateVM request packet. */
00154 typedef GVMMCREATEVMREQ *PGVMMCREATEVMREQ;

GVMMR0DECL(int)     GVMMR0CreateVMReq(PGVMMCREATEVMREQ pReq);


/**
 * Request buffer for GVMMR0QueryStatisticsReq / VMMR0_DO_GVMM_QUERY_STATISTICS.
 * @see GVMMR0QueryStatistics.
 */
00163 typedef struct GVMMQUERYSTATISTICSSREQ
{
    /** The header. */
00166     SUPVMMR0REQHDR  Hdr;
    /** The support driver session. */
00168     PSUPDRVSESSION  pSession;
    /** The statistics. */
00170     GVMMSTATS       Stats;
} GVMMQUERYSTATISTICSSREQ;
/** Pointer to a GVMMR0QueryStatisticsReq / VMMR0_DO_GVMM_QUERY_STATISTICS request buffer. */
00173 typedef GVMMQUERYSTATISTICSSREQ *PGVMMQUERYSTATISTICSSREQ;

GVMMR0DECL(int)     GVMMR0QueryStatisticsReq(PVM pVM, PGVMMQUERYSTATISTICSSREQ pReq);


/**
 * Request buffer for GVMMR0ResetStatisticsReq / VMMR0_DO_GVMM_RESET_STATISTICS.
 * @see GVMMR0ResetStatistics.
 */
00182 typedef struct GVMMRESETSTATISTICSSREQ
{
    /** The header. */
00185     SUPVMMR0REQHDR  Hdr;
    /** The support driver session. */
00187     PSUPDRVSESSION  pSession;
    /** The statistics to reset.
     * Any non-zero entry will be reset (if permitted). */
00190     GVMMSTATS       Stats;
} GVMMRESETSTATISTICSSREQ;
/** Pointer to a GVMMR0ResetStatisticsReq / VMMR0_DO_GVMM_RESET_STATISTICS request buffer. */
00193 typedef GVMMRESETSTATISTICSSREQ *PGVMMRESETSTATISTICSSREQ;

GVMMR0DECL(int)     GVMMR0ResetStatisticsReq(PVM pVM, PGVMMRESETSTATISTICSSREQ pReq);


/** @} */

__END_DECLS

#endif


Generated by  Doxygen 1.6.0   Back to index