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