Headers for broadcast in VMX-root mode.
More...
Go to the source code of this file.
Headers for broadcast in VMX-root mode.
- Author
- Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
- Version
- 0.1
- Date
- 2021-12-31
- Copyright
- This project is released under the GNU Public License v3.
◆ VmxBroadcastHandleNmiCallback()
BOOLEAN VmxBroadcastHandleNmiCallback |
( |
PVOID | Context, |
|
|
BOOLEAN | Handled ) |
Handles NMIs in kernel-mode.
- Parameters
-
- Returns
- BOOLEAN
93{
94 UNREFERENCED_PARAMETER(
Context);
95
97 CurrentCore = KeGetCurrentProcessorNumberEx(NULL);
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
120 {
121 return Handled;
122 }
123 else
124 {
125
126
127
128
130 }
131}
#define TRUE
Definition BasicTypes.h:55
unsigned long ULONG
Definition BasicTypes.h:37
VIRTUAL_MACHINE_STATE * g_GuestState
Save the state and variables related to virtualization on each to logical core.
Definition GlobalVariables.h:38
BOOLEAN VmxBroadcastNmiHandler(VIRTUAL_MACHINE_STATE *VCpu, BOOLEAN IsOnVmxNmiHandler)
Handle broadcast NMIs in vmx-root mode.
Definition VmxBroadcast.c:187
The status of each core after and before VMX.
Definition State.h:290
◆ VmxBroadcastInitialize()
VOID VmxBroadcastInitialize |
( |
| ) |
|
Initialize the VMX Broadcast mechanism.
- Returns
- VOID
21{
22
23
24
25
26
27
28
30
31#if USE_DEFAULT_OS_IDT_AS_HOST_IDT == TRUE
32
33
34
35
37
38#endif
39
40
41
42
44
45
46
47
49}
BOOLEAN ApicInitialize()
Initialize APIC.
Definition Apic.c:65
VOID BroadcastEnableNmiExitingAllCores()
routines to set vm-exit on all NMIs on all cores
Definition Broadcast.c:91
PVOID g_NmiHandlerForKeDeregisterNmiCallback
NMI handler pointer for KeDeregisterNmiCallback.
Definition GlobalVariables.h:94
BOOLEAN g_NmiBroadcastingInitialized
check for broadcasting NMI mechanism support and its initialization
Definition GlobalVariables.h:88
BOOLEAN VmxBroadcastHandleNmiCallback(PVOID Context, BOOLEAN Handled)
Handles NMIs in kernel-mode.
Definition VmxBroadcast.c:92
◆ VmxBroadcastNmi()
Broadcast NMI in vmx-root mode.
caller to this function should take actions to the current core the NMI won't be triggered for the current core
- Parameters
-
VCpu | The virtual processor's state |
VmxBroadcastAction | |
- Returns
- BOOLEAN
144{
145 ULONG ProcessorsCount;
146
147
148
149
151 {
153 }
154
155 ProcessorsCount = KeQueryActiveProcessorCount(0);
156
157
158
159
160 for (size_t i = 0; i < ProcessorsCount; i++)
161 {
163 {
165 VmxBroadcastAction,
167 }
168 }
169
170
171
172
174
176}
VOID ApicTriggerGenericNmi()
Trigger NMI on X2APIC or APIC based on Current system.
Definition Apic.c:47
#define FALSE
Definition BasicTypes.h:54
void SpinlockInterlockedCompareExchange(LONG volatile *Destination, LONG Exchange, LONG Comperand)
Interlocked spinlock that tries to change the value and makes sure that it changed the target value.
Definition Spinlock.c:88
UINT32 CoreId
Definition State.h:306
◆ VmxBroadcastNmiHandler()
Handle broadcast NMIs in vmx-root mode.
- Parameters
-
VCpu | The virtual processor's state |
IsOnVmxNmiHandler | |
- Returns
- BOOLEAN Shows whether it's handled by this routine or not
188{
191
192
193
194
195
197
199 {
201 goto ReturnIsHandled;
202 }
203
204
205
206
207
208 switch (BroadcastAction)
209 {
211
212
213
214
216
217 break;
218
220
221
222
223
226
227 break;
228
230
231
232
233
235
237
238 break;
239
241
242
243
244
247
248 break;
249
250 default:
251
253 LogError(
"Err, invalid NMI reason received");
254
255 break;
256 }
257
258ReturnIsHandled:
259 return IsHandled;
260}
UCHAR BOOLEAN
Definition BasicTypes.h:39
VOID VmmCallbackNmiBroadcastRequestHandler(UINT32 CoreId, BOOLEAN IsOnVmxNmiHandler)
routine callback to handle NMI requests
Definition Callback.c:247
#define LogError(format,...)
Log in the case of error.
Definition HyperDbgHyperLogIntrinsics.h:113
UCHAR EptInveptAllContexts()
Invalidates all contexts in EPT cache table.
Definition Invept.c:54
UCHAR EptInveptSingleContext(_In_ UINT64 EptPointer)
Invalidates a single context in ept cache table.
Definition Invept.c:40
volatile NMI_BROADCAST_ACTION_TYPE NmiBroadcastAction
Definition State.h:281
NMI_BROADCASTING_STATE NmiBroadcastingState
Definition State.h:329
EPT_POINTER EptPointer
Definition State.h:341
◆ VmxBroadcastUninitialize()
VOID VmxBroadcastUninitialize |
( |
| ) |
|
Uninitialize the VMX Broadcast mechanism.
- Returns
- VOID
58{
59
60
61
63
64#if USE_DEFAULT_OS_IDT_AS_HOST_IDT == TRUE
65
66
67
68
70
71#endif
72
73
74
75
77
78
79
80
82}
VOID ApicUninitialize()
Uninitialize APIC.
Definition Apic.c:98
VOID BroadcastDisableNmiExitingAllCores()
routines to set vm-exit on all NMIs on all cores
Definition Broadcast.c:105