VirtualBox

source: vbox/trunk/include/VBox/gvmm.h@ 6561

Last change on this file since 6561 was 5999, checked in by vboxsync, 17 years ago

The Giant CDDL Dual-License Header Change.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.6 KB
Line 
1/* $Id: gvmm.h 5999 2007-12-07 15:05:06Z vboxsync $ */
2/** @file
3 * GVMM - The Global VM Manager.
4 */
5
6/*
7 * Copyright (C) 2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef ___VBox_gvmm_h
28#define ___VBox_gvmm_h
29
30#include <VBox/cdefs.h>
31#include <VBox/types.h>
32#include <VBox/sup.h>
33
34__BEGIN_DECLS
35
36/** @defgroup grp_GVMM GVMM - The Global VM Manager.
37 * @{
38 */
39
40/** @def IN_GVMM_R0
41 * Used to indicate whether we're inside the same link module as the ring 0
42 * part of the Global VM Manager or not.
43 */
44/** @def GVMMR0DECL
45 * Ring 0 VM export or import declaration.
46 * @param type The return type of the function declaration.
47 */
48#ifdef IN_GVMM_R0
49# define GVMMR0DECL(type) DECLEXPORT(type) VBOXCALL
50#else
51# define GVMMR0DECL(type) DECLIMPORT(type) VBOXCALL
52#endif
53
54/** @def NIL_GVM_HANDLE
55 * The nil GVM VM handle value (VM::hSelf).
56 */
57#define NIL_GVM_HANDLE 0
58
59
60/**
61 * The scheduler statistics
62 */
63typedef struct GVMMSTATSSCHED
64{
65 /** The number of calls to GVMMR0SchedHalt. */
66 uint64_t cHaltCalls;
67 /** The number of times we did go to sleep in GVMMR0SchedHalt. */
68 uint64_t cHaltBlocking;
69 /** The number of times we timed out in GVMMR0SchedHalt. */
70 uint64_t cHaltTimeouts;
71 /** The number of times we didn't go to sleep in GVMMR0SchedHalt. */
72 uint64_t cHaltNotBlocking;
73 /** The number of wake ups done during GVMMR0SchedHalt. */
74 uint64_t cHaltWakeUps;
75
76 /** The number of calls to GVMMR0WakeUp. */
77 uint64_t cWakeUpCalls;
78 /** The number of times the EMT thread wasn't actually halted when GVMMR0WakeUp was called. */
79 uint64_t cWakeUpNotHalted;
80 /** The number of wake ups done during GVMMR0WakeUp (not counting the explicit one). */
81 uint64_t cWakeUpWakeUps;
82
83 /** The number of calls to GVMMR0SchedPoll. */
84 uint64_t cPollCalls;
85 /** The number of times the EMT has halted in a GVMMR0SchedPoll call. */
86 uint64_t cPollHalts;
87 /** The number of wake ups done during GVMMR0SchedPoll. */
88 uint64_t cPollWakeUps;
89 uint64_t u64Alignment; /**< padding */
90} GVMMSTATSSCHED;
91/** Pointer to the GVMM scheduler statistics. */
92typedef GVMMSTATSSCHED *PGVMMSTATSSCHED;
93
94/**
95 * The GMM statistics.
96 */
97typedef struct GVMMSTATS
98{
99 /** The VM statistics if a VM was specified. */
100 GVMMSTATSSCHED SchedVM;
101 /** The sum statistics of all VMs accessible to the caller. */
102 GVMMSTATSSCHED SchedSum;
103 /** The number of VMs accessible to the caller. */
104 uint32_t cVMs;
105 /** Alignment padding. */
106 uint32_t u32Padding;
107} GVMMSTATS;
108/** Pointer to the GVMM statistics. */
109typedef GVMMSTATS *PGVMMSTATS;
110/** Const pointer to the GVMM statistics. */
111typedef const GVMMSTATS *PCGVMMSTATS;
112
113
114
115GVMMR0DECL(int) GVMMR0Init(void);
116GVMMR0DECL(void) GVMMR0Term(void);
117GVMMR0DECL(int) GVMMR0SetConfig(PSUPDRVSESSION pSession, const char *pszName, uint64_t u64Value);
118GVMMR0DECL(int) GVMMR0QueryConfig(PSUPDRVSESSION pSession, const char *pszName, uint64_t *pu64Value);
119
120GVMMR0DECL(int) GVMMR0CreateVM(PSUPDRVSESSION pSession, PVM *ppVM);
121GVMMR0DECL(int) GVMMR0DisassociateEMTFromVM(PVM pVM);
122GVMMR0DECL(int) GVMMR0InitVM(PVM pVM);
123GVMMR0DECL(int) GVMMR0AssociateEMTWithVM(PVM pVM);
124GVMMR0DECL(int) GVMMR0DestroyVM(PVM pVM);
125GVMMR0DECL(PGVM) GVMMR0ByHandle(uint32_t hGVM);
126GVMMR0DECL(PGVM) GVMMR0ByVM(PVM pVM);
127GVMMR0DECL(int) GVMMR0ByVMAndEMT(PVM pVM, PGVM *ppGVM);
128GVMMR0DECL(PVM) GVMMR0GetVMByHandle(uint32_t hGVM);
129GVMMR0DECL(PVM) GVMMR0GetVMByEMT(RTNATIVETHREAD hEMT);
130GVMMR0DECL(int) GVMMR0SchedHalt(PVM pVM, uint64_t u64ExpireGipTime);
131GVMMR0DECL(int) GVMMR0SchedWakeUp(PVM pVM);
132GVMMR0DECL(int) GVMMR0SchedPoll(PVM pVM, bool fYield);
133GVMMR0DECL(int) GVMMR0QueryStatistics(PGVMMSTATS pStats, PSUPDRVSESSION pSession, PVM pVM);
134GVMMR0DECL(int) GVMMR0ResetStatistics(PCGVMMSTATS pStats, PSUPDRVSESSION pSession, PVM pVM);
135
136
137/**
138 * Request packet for calling GVMMR0CreateVM.
139 */
140typedef struct GVMMCREATEVMREQ
141{
142 /** The request header. */
143 SUPVMMR0REQHDR Hdr;
144 /** The support driver session. (IN) */
145 PSUPDRVSESSION pSession;
146 /** Pointer to the ring-3 mapping of the shared VM structure on return. (OUT) */
147 PVMR3 pVMR3;
148 /** Pointer to the ring-0 mapping of the shared VM structure on return. (OUT) */
149 PVMR0 pVMR0;
150} GVMMCREATEVMREQ;
151/** Pointer to a GVMMR0CreateVM request packet. */
152typedef GVMMCREATEVMREQ *PGVMMCREATEVMREQ;
153
154GVMMR0DECL(int) GVMMR0CreateVMReq(PGVMMCREATEVMREQ pReq);
155
156
157/**
158 * Request buffer for GVMMR0QueryStatisticsReq / VMMR0_DO_GVMM_QUERY_STATISTICS.
159 * @see GVMMR0QueryStatistics.
160 */
161typedef struct GVMMQUERYSTATISTICSSREQ
162{
163 /** The header. */
164 SUPVMMR0REQHDR Hdr;
165 /** The support driver session. */
166 PSUPDRVSESSION pSession;
167 /** The statistics. */
168 GVMMSTATS Stats;
169} GVMMQUERYSTATISTICSSREQ;
170/** Pointer to a GVMMR0QueryStatisticsReq / VMMR0_DO_GVMM_QUERY_STATISTICS request buffer. */
171typedef GVMMQUERYSTATISTICSSREQ *PGVMMQUERYSTATISTICSSREQ;
172
173GVMMR0DECL(int) GVMMR0QueryStatisticsReq(PVM pVM, PGVMMQUERYSTATISTICSSREQ pReq);
174
175
176/**
177 * Request buffer for GVMMR0ResetStatisticsReq / VMMR0_DO_GVMM_RESET_STATISTICS.
178 * @see GVMMR0ResetStatistics.
179 */
180typedef struct GVMMRESETSTATISTICSSREQ
181{
182 /** The header. */
183 SUPVMMR0REQHDR Hdr;
184 /** The support driver session. */
185 PSUPDRVSESSION pSession;
186 /** The statistics to reset.
187 * Any non-zero entry will be reset (if permitted). */
188 GVMMSTATS Stats;
189} GVMMRESETSTATISTICSSREQ;
190/** Pointer to a GVMMR0ResetStatisticsReq / VMMR0_DO_GVMM_RESET_STATISTICS request buffer. */
191typedef GVMMRESETSTATISTICSSREQ *PGVMMRESETSTATISTICSSREQ;
192
193GVMMR0DECL(int) GVMMR0ResetStatisticsReq(PVM pVM, PGVMMRESETSTATISTICSSREQ pReq);
194
195
196/** @} */
197
198__END_DECLS
199
200#endif
201
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette