Headers for implement allocations for VMX Regions (VMXON Region, VMCS, MSR Bitmap and etc.)
More...
Go to the source code of this file.
Headers for implement allocations for VMX Regions (VMXON Region, VMCS, MSR Bitmap and etc.)
- Author
- Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
- Version
- 0.9
- Date
- 2024-06-03
- Copyright
- This project is released under the GNU Public License v3.
◆ _Success_()
_Success_ |
( |
return ! | = FALSE | ) |
|
◆ VmxAllocateHostGdt()
Allocate a buffer for host GDT.
- Parameters
-
- Returns
- BOOLEAN Returns true if allocation was successful otherwise returns false
333{
335
336
337
338
340 {
342 }
343
344
345
346
348
350 {
351 LogError(
"Err, insufficient memory in allocating host GDT");
353 }
354
355 LogDebugInfo(
"Host GDT virtual address : 0x%llx", VCpu->HostGdt);
356
358}
#define NULL64_ZERO
Definition BasicTypes.h:52
#define TRUE
Definition BasicTypes.h:55
#define FALSE
Definition BasicTypes.h:54
unsigned __int64 UINT64
Definition BasicTypes.h:21
unsigned int UINT32
Definition BasicTypes.h:48
#define LogDebugInfo(format,...)
Log, initialize boot information and debug information.
Definition HyperDbgHyperLogIntrinsics.h:155
#define LogError(format,...)
Log in the case of error.
Definition HyperDbgHyperLogIntrinsics.h:113
PVOID PlatformMemAllocateZeroedNonPagedPool(SIZE_T NumberOfBytes)
Allocate a non-paged buffer (zeroed)
Definition Mem.c:69
#define HOST_GDT_DESCRIPTOR_COUNT
Maximum number of entries in GDT.
Definition Segmentation.h:29
◆ VmxAllocateHostIdt()
Allocate a buffer for host IDT.
- Parameters
-
- Returns
- BOOLEAN Returns true if allocation was successful otherwise returns false
298{
300
301
302
303
305 {
307 }
308
309
310
311
313
315 {
316 LogError(
"Err, insufficient memory in allocating host IDT");
318 }
319
320 LogDebugInfo(
"Host IDT virtual address : 0x%llx", VCpu->HostIdt);
321
323}
#define HOST_IDT_DESCRIPTOR_COUNT
Maximum number of interrupt entries in IDT.
Definition IdtEmulation.h:29
◆ VmxAllocateHostInterruptStack()
Allocate a buffer for host interrupt stack.
- Parameters
-
- Returns
- BOOLEAN Returns true if allocation was successful otherwise returns false
395{
397
399 {
400 LogError(
"Err, insufficient memory in allocating host interrupt stack");
402 }
403
404 LogDebugInfo(
"Host interrupt stack virtual address : 0x%llx", VCpu->HostInterruptStack);
405
407}
#define HOST_INTERRUPT_STACK_SIZE
Size of host interrupt stack.
Definition Segmentation.h:35
◆ VmxAllocateHostTss()
Allocate a buffer for host TSS.
- Parameters
-
- Returns
- BOOLEAN Returns true if allocation was successful otherwise returns false
368{
370
371
372
373
375
377 {
378 LogError(
"Err, insufficient memory in allocating host TSS");
380 }
381
382 LogDebugInfo(
"Host TSS virtual address : 0x%llx", VCpu->HostTss);
383
385}
◆ VmxAllocateInvalidMsrBimap()
UINT64 * VmxAllocateInvalidMsrBimap |
( |
| ) |
|
Allocates a buffer and tests for the MSRs that cause #GP.
- Returns
- UINT64 Allocated buffer for MSR Bitmap
265{
266 UINT64 * InvalidMsrBitmap;
267
269
270 if (InvalidMsrBitmap == NULL)
271 {
273 }
274
275 for (
UINT32 i = 0; i < 0x1000; ++i)
276 {
277 __try
278 {
279 __readmsr(i);
280 }
281 __except (EXCEPTION_EXECUTE_HANDLER)
282 {
283 SetBit(i, (
unsigned long *)InvalidMsrBitmap);
284 }
285 }
286
287 return InvalidMsrBitmap;
288}
void SetBit(int BitNumber, unsigned long *addr)
set the bit
Definition Bitwise.c:46
NULL()
Definition test-case-generator.py:530
◆ VmxAllocateIoBitmaps()
Allocate a buffer for I/O Bitmap.
- Parameters
-
- Returns
- BOOLEAN Returns true if allocation was successful otherwise returns false
222{
223
224
225
227
229 {
230 LogError(
"Err, insufficient memory in allocating I/O Bitmaps A");
232 }
233
235
236 LogDebugInfo(
"I/O Bitmap A Virtual Address : 0x%llx", VCpu->IoBitmapVirtualAddressA);
237 LogDebugInfo(
"I/O Bitmap A Physical Address : 0x%llx", VCpu->IoBitmapPhysicalAddressA);
238
239
240
241
243
245 {
246 LogError(
"Err, insufficient memory in allocating I/O Bitmaps B");
248 }
249
251
252 LogDebugInfo(
"I/O Bitmap B virtual address : 0x%llx", VCpu->IoBitmapVirtualAddressB);
253 LogDebugInfo(
"I/O Bitmap B physical address : 0x%llx", VCpu->IoBitmapPhysicalAddressB);
254
256}
_Use_decl_annotations_ UINT64 VirtualAddressToPhysicalAddress(_In_ PVOID VirtualAddress)
Converts Virtual Address to Physical Address.
Definition Conversion.c:154
◆ VmxAllocateMsrBitmap()
Allocate a buffer for Msr Bitmap.
- Parameters
-
VCpu | The virtual processor's state |
- Returns
- BOOLEAN Returns true if allocation was successful otherwise returns false
193{
194
195
196
197
199
201 {
202 LogError(
"Err, insufficient memory in allocating MSR Bitmaps");
204 }
205
207
208 LogDebugInfo(
"MSR Bitmap virtual address : 0x%llx", VCpu->MsrBitmapVirtualAddress);
209 LogDebugInfo(
"MSR Bitmap physical address : 0x%llx", VCpu->MsrBitmapPhysicalAddress);
210
212}
◆ VmxAllocateVmmStack()
Allocate VMM Stack.
- Parameters
-
VCpu | The virtual processor's state |
- Returns
- BOOLEAN Returns true if allocation was successful otherwise returns false
168{
169
170
171
173
175 {
176 LogError(
"Err, insufficient memory in allocating vmm stack");
178 }
179
180 LogDebugInfo(
"VMM Stack for logical processor : 0x%llx", VCpu->VmmStack);
181
183}
#define VMM_STACK_SIZE
Stack Size.
Definition Vmx.h:140