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 |
|
---|
33 |
|
---|
34 | /** @defgroup grp_hwaccm The VM Hardware Manager API
|
---|
35 | * @{
|
---|
36 | */
|
---|
37 |
|
---|
38 |
|
---|
39 | __BEGIN_DECLS
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Query HWACCM state (enabled/disabled)
|
---|
43 | *
|
---|
44 | * @returns 0 - disabled, 1 - enabled
|
---|
45 | * @param pVM The VM to operate on.
|
---|
46 | */
|
---|
47 | #define HWACCMIsEnabled(a) (a->fHWACCMEnabled)
|
---|
48 |
|
---|
49 | #ifdef IN_RING0
|
---|
50 | /** @defgroup grp_hwaccm_r0 The VM Hardware Manager API
|
---|
51 | * @ingroup grp_hwaccm
|
---|
52 | * @{
|
---|
53 | */
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Does Ring-0 HWACCM initialization.
|
---|
57 | *
|
---|
58 | * This is mainly to check that the Host CPU mode is compatible
|
---|
59 | * with VMX or SVM.
|
---|
60 | *
|
---|
61 | * @returns VBox status code.
|
---|
62 | * @param pVM The VM to operate on.
|
---|
63 | */
|
---|
64 | HWACCMR0DECL(int) HWACCMR0Init(PVM pVM);
|
---|
65 |
|
---|
66 | /** @} */
|
---|
67 | #endif
|
---|
68 |
|
---|
69 |
|
---|
70 | #ifdef IN_RING3
|
---|
71 | /** @defgroup grp_hwaccm_r3 The VM Hardware Manager API
|
---|
72 | * @ingroup grp_hwaccm
|
---|
73 | * @{
|
---|
74 | */
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Checks if internal events are pending
|
---|
78 | *
|
---|
79 | * @returns boolean
|
---|
80 | * @param pVM The VM to operate on.
|
---|
81 | */
|
---|
82 | HWACCMR3DECL(bool) HWACCMR3IsEventPending(PVM pVM);
|
---|
83 |
|
---|
84 | /**
|
---|
85 | * Initializes the HWACCM.
|
---|
86 | *
|
---|
87 | * @returns VBox status code.
|
---|
88 | * @param pVM The VM to operate on.
|
---|
89 | */
|
---|
90 | HWACCMR3DECL(int) HWACCMR3Init(PVM pVM);
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * Applies relocations to data and code managed by this
|
---|
94 | * component. This function will be called at init and
|
---|
95 | * whenever the VMM need to relocate it self inside the GC.
|
---|
96 | *
|
---|
97 | * The HWACCM will update the addresses used by the switcher.
|
---|
98 | *
|
---|
99 | * @param pVM The VM.
|
---|
100 | */
|
---|
101 | HWACCMR3DECL(void) HWACCMR3Relocate(PVM pVM);
|
---|
102 |
|
---|
103 | /**
|
---|
104 | * Terminates the VMXM.
|
---|
105 | *
|
---|
106 | * Termination means cleaning up and freeing all resources,
|
---|
107 | * the VM it self is at this point powered off or suspended.
|
---|
108 | *
|
---|
109 | * @returns VBox status code.
|
---|
110 | * @param pVM The VM to operate on.
|
---|
111 | */
|
---|
112 | HWACCMR3DECL(int) HWACCMR3Term(PVM pVM);
|
---|
113 |
|
---|
114 | /**
|
---|
115 | * VMXM reset callback.
|
---|
116 | *
|
---|
117 | * @param pVM The VM which is reset.
|
---|
118 | */
|
---|
119 | HWACCMR3DECL(void) HWACCMR3Reset(PVM pVM);
|
---|
120 |
|
---|
121 |
|
---|
122 | /**
|
---|
123 | * Checks if we can currently use hardware accelerated raw mode.
|
---|
124 | *
|
---|
125 | * @returns boolean
|
---|
126 | * @param pVM The VM to operate on.
|
---|
127 | * @param pCtx Partial VM execution context
|
---|
128 | */
|
---|
129 | HWACCMR3DECL(bool) HWACCMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx);
|
---|
130 |
|
---|
131 |
|
---|
132 | /**
|
---|
133 | * Checks if we are currently using hardware accelerated raw mode.
|
---|
134 | *
|
---|
135 | * @returns boolean
|
---|
136 | * @param pVM The VM to operate on.
|
---|
137 | */
|
---|
138 | HWACCMR3DECL(bool) HWACCMR3IsActive(PVM pVM);
|
---|
139 |
|
---|
140 | /**
|
---|
141 | * Checks hardware accelerated raw mode is allowed.
|
---|
142 | *
|
---|
143 | * @returns boolean
|
---|
144 | * @param pVM The VM to operate on.
|
---|
145 | */
|
---|
146 | HWACCMR3DECL(bool) HWACCMR3IsAllowed(PVM pVM);
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * Notification callback which is called whenever there is a chance that a CR3
|
---|
150 | * value might have changed.
|
---|
151 | * This is called by PGM.
|
---|
152 | *
|
---|
153 | * @param pVM The VM to operate on.
|
---|
154 | * @param enmShadowMode New paging mode.
|
---|
155 | */
|
---|
156 | HWACCMR3DECL(void) HWACCMR3PagingModeChanged(PVM pVM, PGMMODE enmShadowMode);
|
---|
157 |
|
---|
158 | /** @} */
|
---|
159 | #endif
|
---|
160 |
|
---|
161 | #ifdef IN_RING0
|
---|
162 | /** @addtogroup grp_hwaccm_r0
|
---|
163 | * @{
|
---|
164 | */
|
---|
165 |
|
---|
166 | /**
|
---|
167 | * Does Ring-0 VMX initialization.
|
---|
168 | *
|
---|
169 | * @returns VBox status code.
|
---|
170 | * @param pVM The VM to operate on.
|
---|
171 | */
|
---|
172 | HWACCMR0DECL(int) HWACCMR0SetupVMX(PVM pVM);
|
---|
173 |
|
---|
174 |
|
---|
175 | /**
|
---|
176 | * Runs guest code in a VMX/SVM VM.
|
---|
177 | *
|
---|
178 | * @returns VBox status code.
|
---|
179 | * @param pVM The VM to operate on.
|
---|
180 | */
|
---|
181 | HWACCMR0DECL(int) HWACCMR0RunGuestCode(PVM pVM);
|
---|
182 |
|
---|
183 | /**
|
---|
184 | * Enable VMX or SVN
|
---|
185 | *
|
---|
186 | * @returns VBox status code.
|
---|
187 | * @param pVM The VM to operate on.
|
---|
188 | */
|
---|
189 | HWACCMR0DECL(int) HWACCMR0Enable(PVM pVM);
|
---|
190 |
|
---|
191 |
|
---|
192 | /**
|
---|
193 | * Disable VMX or SVN
|
---|
194 | *
|
---|
195 | * @returns VBox status code.
|
---|
196 | * @param pVM The VM to operate on.
|
---|
197 | */
|
---|
198 | HWACCMR0DECL(int) HWACCMR0Disable(PVM pVM);
|
---|
199 |
|
---|
200 |
|
---|
201 | /** @} */
|
---|
202 | #endif
|
---|
203 |
|
---|
204 |
|
---|
205 | /** @} */
|
---|
206 | __END_DECLS
|
---|
207 |
|
---|
208 |
|
---|
209 | #endif
|
---|
210 |
|
---|