VirtualBox

source: vbox/trunk/include/VBox/hwaccm.h@ 8006

Last change on this file since 8006 was 7497, checked in by vboxsync, 16 years ago

Missing header

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1/** @file
2 * HWACCM - Intel/AMD VM Hardware Support Manager
3 */
4
5/*
6 * Copyright (C) 2006-2007 innotek GmbH
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBox_hwaccm_h
27#define ___VBox_hwaccm_h
28
29#include <VBox/cdefs.h>
30#include <VBox/types.h>
31#include <VBox/pgm.h>
32#include <iprt/mp.h>
33
34
35/** @defgroup grp_hwaccm The VM Hardware Manager API
36 * @{
37 */
38
39/**
40 * HWACCM state
41 */
42typedef enum HWACCMSTATE
43{
44 /* Not yet set */
45 HWACCMSTATE_UNINITIALIZED = 0,
46 /* Enabled */
47 HWACCMSTATE_ENABLED,
48 /* Disabled */
49 HWACCMSTATE_DISABLED,
50 /** The usual 32-bit hack. */
51 HWACCMSTATE_32BIT_HACK = 0x7fffffff
52} HWACCMSTATE;
53
54__BEGIN_DECLS
55
56/**
57 * Query HWACCM state (enabled/disabled)
58 *
59 * @returns 0 - disabled, 1 - enabled
60 * @param pVM The VM to operate on.
61 */
62#define HWACCMIsEnabled(a) (a->fHWACCMEnabled)
63
64#ifdef IN_RING0
65/** @defgroup grp_hwaccm_r0 The VM Hardware Manager API
66 * @ingroup grp_hwaccm
67 * @{
68 */
69
70/**
71 * Does global Ring-0 HWACCM initialization.
72 *
73 * @returns VBox status code.
74 */
75HWACCMR0DECL(int) HWACCMR0Init();
76
77/**
78 * Does global Ring-0 HWACCM termination.
79 *
80 * @returns VBox status code.
81 */
82HWACCMR0DECL(int) HWACCMR0Term();
83
84/**
85 * Does Ring-0 per VM HWACCM initialization.
86 *
87 * This is mainly to check that the Host CPU mode is compatible
88 * with VMX or SVM.
89 *
90 * @returns VBox status code.
91 * @param pVM The VM to operate on.
92 */
93HWACCMR0DECL(int) HWACCMR0InitVM(PVM pVM);
94
95/**
96 * Does Ring-0 per VM HWACCM termination.
97 *
98 * @returns VBox status code.
99 * @param pVM The VM to operate on.
100 */
101HWACCMR0DECL(int) HWACCMR0TermVM(PVM pVM);
102
103/**
104 * Sets up HWACCM on all cpus.
105 *
106 * @returns VBox status code.
107 * @param pVM The VM to operate on.
108 * @param enmNewHwAccmState New hwaccm state
109 *
110 */
111HWACCMR0DECL(int) HWACCMR0EnableAllCpus(PVM pVM, HWACCMSTATE enmNewHwAccmState);
112
113/** @} */
114#endif
115
116
117#ifdef IN_RING3
118/** @defgroup grp_hwaccm_r3 The VM Hardware Manager API
119 * @ingroup grp_hwaccm
120 * @{
121 */
122
123/**
124 * Checks if internal events are pending
125 *
126 * @returns boolean
127 * @param pVM The VM to operate on.
128 */
129HWACCMR3DECL(bool) HWACCMR3IsEventPending(PVM pVM);
130
131/**
132 * Initializes the HWACCM.
133 *
134 * @returns VBox status code.
135 * @param pVM The VM to operate on.
136 */
137HWACCMR3DECL(int) HWACCMR3Init(PVM pVM);
138
139/**
140 * Initialize VT-x or AMD-V
141 *
142 * @returns VBox status code.
143 * @param pVM The VM handle.
144 */
145HWACCMR3DECL(int) HWACCMR3InitFinalizeR0(PVM pVM);
146
147/**
148 * Applies relocations to data and code managed by this
149 * component. This function will be called at init and
150 * whenever the VMM need to relocate it self inside the GC.
151 *
152 * The HWACCM will update the addresses used by the switcher.
153 *
154 * @param pVM The VM.
155 */
156HWACCMR3DECL(void) HWACCMR3Relocate(PVM pVM);
157
158/**
159 * Terminates the VMXM.
160 *
161 * Termination means cleaning up and freeing all resources,
162 * the VM it self is at this point powered off or suspended.
163 *
164 * @returns VBox status code.
165 * @param pVM The VM to operate on.
166 */
167HWACCMR3DECL(int) HWACCMR3Term(PVM pVM);
168
169/**
170 * VMXM reset callback.
171 *
172 * @param pVM The VM which is reset.
173 */
174HWACCMR3DECL(void) HWACCMR3Reset(PVM pVM);
175
176
177/**
178 * Checks if we can currently use hardware accelerated raw mode.
179 *
180 * @returns boolean
181 * @param pVM The VM to operate on.
182 * @param pCtx Partial VM execution context
183 */
184HWACCMR3DECL(bool) HWACCMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx);
185
186
187/**
188 * Checks if we are currently using hardware accelerated raw mode.
189 *
190 * @returns boolean
191 * @param pVM The VM to operate on.
192 */
193HWACCMR3DECL(bool) HWACCMR3IsActive(PVM pVM);
194
195/**
196 * Checks hardware accelerated raw mode is allowed.
197 *
198 * @returns boolean
199 * @param pVM The VM to operate on.
200 */
201HWACCMR3DECL(bool) HWACCMR3IsAllowed(PVM pVM);
202
203/**
204 * Notification callback which is called whenever there is a chance that a CR3
205 * value might have changed.
206 * This is called by PGM.
207 *
208 * @param pVM The VM to operate on.
209 * @param enmShadowMode New paging mode.
210 */
211HWACCMR3DECL(void) HWACCMR3PagingModeChanged(PVM pVM, PGMMODE enmShadowMode);
212
213/** @} */
214#endif
215
216#ifdef IN_RING0
217/** @addtogroup grp_hwaccm_r0
218 * @{
219 */
220
221/**
222 * Sets up a VT-x or AMD-V session
223 *
224 * @returns VBox status code.
225 * @param pVM The VM to operate on.
226 */
227HWACCMR0DECL(int) HWACCMR0SetupVM(PVM pVM);
228
229
230/**
231 * Runs guest code in a VMX/SVM VM.
232 *
233 * @returns VBox status code.
234 * @param pVM The VM to operate on.
235 */
236HWACCMR0DECL(int) HWACCMR0RunGuestCode(PVM pVM);
237
238/**
239 * Enters the VT-x or AMD-V session
240 *
241 * @returns VBox status code.
242 * @param pVM The VM to operate on.
243 */
244HWACCMR0DECL(int) HWACCMR0Enter(PVM pVM);
245
246
247/**
248 * Leaves the VT-x or AMD-V session
249 *
250 * @returns VBox status code.
251 * @param pVM The VM to operate on.
252 */
253HWACCMR0DECL(int) HWACCMR0Leave(PVM pVM);
254
255
256/** @} */
257#endif
258
259
260/** @} */
261__END_DECLS
262
263
264#endif
265
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use