VirtualBox

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

Last change on this file since 21217 was 21217, checked in by vboxsync, 15 years ago

include/VBox/*.h: Mark which components the header files relate to.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.3 KB
Line 
1/* $Id: gvmm.h 21217 2009-07-04 14:26:39Z vboxsync $ */
2/** @file
3 * GVMM - The Global VM Manager. (VMM)
4 */
5
6/*
7 * Copyright (C) 2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27 * Clara, CA 95054 USA or visit http://www.sun.com if you need
28 * additional information or have any questions.
29 */
30
31#ifndef ___VBox_gvmm_h
32#define ___VBox_gvmm_h
33
34#include <VBox/cdefs.h>
35#include <VBox/types.h>
36#include <VBox/sup.h>
37
38RT_C_DECLS_BEGIN
39
40/** @defgroup grp_GVMM GVMM - The Global VM Manager.
41 * @{
42 */
43
44/** @def IN_GVMM_R0
45 * Used to indicate whether we're inside the same link module as the ring 0
46 * part of the Global VM Manager or not.
47 */
48#ifdef DOXYGEN_RUNNING
49# define IN_GVMM_R0
50#endif
51/** @def GVMMR0DECL
52 * Ring 0 VM export or import declaration.
53 * @param type The return type of the function declaration.
54 */
55#ifdef IN_GVMM_R0
56# define GVMMR0DECL(type) DECLEXPORT(type) VBOXCALL
57#else
58# define GVMMR0DECL(type) DECLIMPORT(type) VBOXCALL
59#endif
60
61/** @def NIL_GVM_HANDLE
62 * The nil GVM VM handle value (VM::hSelf).
63 */
64#define NIL_GVM_HANDLE 0
65
66
67/**
68 * The scheduler statistics
69 */
70typedef struct GVMMSTATSSCHED
71{
72 /** The number of calls to GVMMR0SchedHalt. */
73 uint64_t cHaltCalls;
74 /** The number of times we did go to sleep in GVMMR0SchedHalt. */
75 uint64_t cHaltBlocking;
76 /** The number of times we timed out in GVMMR0SchedHalt. */
77 uint64_t cHaltTimeouts;
78 /** The number of times we didn't go to sleep in GVMMR0SchedHalt. */
79 uint64_t cHaltNotBlocking;
80 /** The number of wake ups done during GVMMR0SchedHalt. */
81 uint64_t cHaltWakeUps;
82
83 /** The number of calls to GVMMR0WakeUp. */
84 uint64_t cWakeUpCalls;
85 /** The number of times the EMT thread wasn't actually halted when GVMMR0WakeUp
86 * was called. */
87 uint64_t cWakeUpNotHalted;
88 /** The number of wake ups done during GVMMR0WakeUp (not counting the explicit
89 * one). */
90 uint64_t cWakeUpWakeUps;
91
92 /** The number of calls to GVMMR0Poke. */
93 uint64_t cPokeCalls;
94 /** The number of times the EMT thread wasn't actually busy when
95 * GVMMR0Poke was called. */
96 uint64_t cPokeNotBusy;
97
98 /** The number of calls to GVMMR0SchedPoll. */
99 uint64_t cPollCalls;
100 /** The number of times the EMT has halted in a GVMMR0SchedPoll call. */
101 uint64_t cPollHalts;
102 /** The number of wake ups done during GVMMR0SchedPoll. */
103 uint64_t cPollWakeUps;
104
105 uint64_t u64Alignment; /**< padding */
106} GVMMSTATSSCHED;
107/** Pointer to the GVMM scheduler statistics. */
108typedef GVMMSTATSSCHED *PGVMMSTATSSCHED;
109
110/**
111 * The GMM statistics.
112 */
113typedef struct GVMMSTATS
114{
115 /** The VM statistics if a VM was specified. */
116 GVMMSTATSSCHED SchedVM;
117 /** The sum statistics of all VMs accessible to the caller. */
118 GVMMSTATSSCHED SchedSum;
119 /** The number of VMs accessible to the caller. */
120 uint32_t cVMs;
121 /** The number of emulation threads in those VMs. */
122 uint32_t cEMTs;
123} GVMMSTATS;
124/** Pointer to the GVMM statistics. */
125typedef GVMMSTATS *PGVMMSTATS;
126/** Const pointer to the GVMM statistics. */
127typedef const GVMMSTATS *PCGVMMSTATS;
128
129
130
131GVMMR0DECL(int) GVMMR0Init(void);
132GVMMR0DECL(void) GVMMR0Term(void);
133GVMMR0DECL(int) GVMMR0SetConfig(PSUPDRVSESSION pSession, const char *pszName, uint64_t u64Value);
134GVMMR0DECL(int) GVMMR0QueryConfig(PSUPDRVSESSION pSession, const char *pszName, uint64_t *pu64Value);
135
136GVMMR0DECL(int) GVMMR0CreateVM(PSUPDRVSESSION pSession, uint32_t cCpus, PVM *ppVM);
137GVMMR0DECL(int) GVMMR0InitVM(PVM pVM);
138GVMMR0DECL(void) GVMMR0DoneInitVM(PVM pVM);
139GVMMR0DECL(bool) GVMMR0DoingTermVM(PVM pVM, PGVM pGVM);
140GVMMR0DECL(int) GVMMR0DestroyVM(PVM pVM);
141GVMMR0DECL(int) GVMMR0RegisterVCpu(PVM pVM, VMCPUID idCpu);
142GVMMR0DECL(PGVM) GVMMR0ByHandle(uint32_t hGVM);
143GVMMR0DECL(PGVM) GVMMR0ByVM(PVM pVM);
144GVMMR0DECL(int) GVMMR0ByVMAndEMT(PVM pVM, VMCPUID idCpu, PGVM *ppGVM);
145GVMMR0DECL(PVM) GVMMR0GetVMByHandle(uint32_t hGVM);
146GVMMR0DECL(PVM) GVMMR0GetVMByEMT(RTNATIVETHREAD hEMT);
147GVMMR0DECL(int) GVMMR0SchedHalt(PVM pVM, VMCPUID idCpu, uint64_t u64ExpireGipTime);
148GVMMR0DECL(int) GVMMR0SchedWakeUp(PVM pVM, VMCPUID idCpu);
149GVMMR0DECL(int) GVMMR0SchedWakeUpEx(PVM pVM, VMCPUID idCpu, bool fTakeUsedLock);
150GVMMR0DECL(int) GVMMR0SchedPoke(PVM pVM, VMCPUID idCpu);
151GVMMR0DECL(int) GVMMR0SchedPokeEx(PVM pVM, VMCPUID idCpu, bool fTakeUsedLock);
152GVMMR0DECL(int) GVMMR0SchedWakeUpAndPokeCpus(PVM pVM, PCVMCPUSET pSleepSet, PCVMCPUSET pPokeSet);
153GVMMR0DECL(int) GVMMR0SchedPoll(PVM pVM, VMCPUID idCpu, bool fYield);
154GVMMR0DECL(int) GVMMR0QueryStatistics(PGVMMSTATS pStats, PSUPDRVSESSION pSession, PVM pVM);
155GVMMR0DECL(int) GVMMR0ResetStatistics(PCGVMMSTATS pStats, PSUPDRVSESSION pSession, PVM pVM);
156
157
158/**
159 * Request packet for calling GVMMR0CreateVM.
160 */
161typedef struct GVMMCREATEVMREQ
162{
163 /** The request header. */
164 SUPVMMR0REQHDR Hdr;
165 /** The support driver session. (IN) */
166 PSUPDRVSESSION pSession;
167 /** Number of virtual CPUs for the new VM. (IN) */
168 uint32_t cCpus;
169 /** Pointer to the ring-3 mapping of the shared VM structure on return. (OUT) */
170 PVMR3 pVMR3;
171 /** Pointer to the ring-0 mapping of the shared VM structure on return. (OUT) */
172 PVMR0 pVMR0;
173} GVMMCREATEVMREQ;
174/** Pointer to a GVMMR0CreateVM request packet. */
175typedef GVMMCREATEVMREQ *PGVMMCREATEVMREQ;
176
177GVMMR0DECL(int) GVMMR0CreateVMReq(PGVMMCREATEVMREQ pReq);
178
179
180/**
181 * Request buffer for GVMMR0SchedWakeUpAndPokeCpusReq / VMMR0_DO_GVMM_SCHED_WAKE_UP_AND_POKE_CPUS.
182 * @see GVMMR0SchedWakeUpAndPokeCpus.
183 */
184typedef struct GVMMSCHEDWAKEUPANDPOKECPUSREQ /* nice and unreadable... */
185{
186 /** The header. */
187 SUPVMMR0REQHDR Hdr;
188 /** The sleeper set. */
189 VMCPUSET SleepSet;
190 /** The set of virtual CPUs to poke. */
191 VMCPUSET PokeSet;
192} GVMMSCHEDWAKEUPANDPOKECPUSREQ;
193/** Pointer to a GVMMR0QueryStatisticsReq / VMMR0_DO_GVMM_QUERY_STATISTICS request buffer. */
194typedef GVMMSCHEDWAKEUPANDPOKECPUSREQ *PGVMMSCHEDWAKEUPANDPOKECPUSREQ;
195
196GVMMR0DECL(int) GVMMR0SchedWakeUpAndPokeCpusReq(PVM pVM, PGVMMSCHEDWAKEUPANDPOKECPUSREQ pReq);
197
198
199/**
200 * Request buffer for GVMMR0QueryStatisticsReq / VMMR0_DO_GVMM_QUERY_STATISTICS.
201 * @see GVMMR0QueryStatistics.
202 */
203typedef struct GVMMQUERYSTATISTICSSREQ
204{
205 /** The header. */
206 SUPVMMR0REQHDR Hdr;
207 /** The support driver session. */
208 PSUPDRVSESSION pSession;
209 /** The statistics. */
210 GVMMSTATS Stats;
211} GVMMQUERYSTATISTICSSREQ;
212/** Pointer to a GVMMR0QueryStatisticsReq / VMMR0_DO_GVMM_QUERY_STATISTICS request buffer. */
213typedef GVMMQUERYSTATISTICSSREQ *PGVMMQUERYSTATISTICSSREQ;
214
215GVMMR0DECL(int) GVMMR0QueryStatisticsReq(PVM pVM, PGVMMQUERYSTATISTICSSREQ pReq);
216
217
218/**
219 * Request buffer for GVMMR0ResetStatisticsReq / VMMR0_DO_GVMM_RESET_STATISTICS.
220 * @see GVMMR0ResetStatistics.
221 */
222typedef struct GVMMRESETSTATISTICSSREQ
223{
224 /** The header. */
225 SUPVMMR0REQHDR Hdr;
226 /** The support driver session. */
227 PSUPDRVSESSION pSession;
228 /** The statistics to reset.
229 * Any non-zero entry will be reset (if permitted). */
230 GVMMSTATS Stats;
231} GVMMRESETSTATISTICSSREQ;
232/** Pointer to a GVMMR0ResetStatisticsReq / VMMR0_DO_GVMM_RESET_STATISTICS request buffer. */
233typedef GVMMRESETSTATISTICSSREQ *PGVMMRESETSTATISTICSSREQ;
234
235GVMMR0DECL(int) GVMMR0ResetStatisticsReq(PVM pVM, PGVMMRESETSTATISTICSSREQ pReq);
236
237
238/** @} */
239
240RT_C_DECLS_END
241
242#endif
243
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use