|
HyperDbg Debugger
|
VMX Instruction and operation headers. More...
Go to the source code of this file.
Classes | |
| union | _HYPERCALL_INPUT_VALUE |
| Hypercalls for Hyper-V. More... | |
Macros | |
| #define | VMCS_SIZE 4096 |
| VMCS Region Size. | |
| #define | VMXON_SIZE 4096 |
| VMXON Region Size. | |
| #define | HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS 0x40000000 |
| CPUID RCX(s) - Based on Hyper-V. | |
| #define | HYPERV_CPUID_INTERFACE 0x40000001 |
| #define | HYPERV_CPUID_VERSION 0x40000002 |
| #define | HYPERV_CPUID_FEATURES 0x40000003 |
| #define | HYPERV_CPUID_ENLIGHTMENT_INFO 0x40000004 |
| #define | HYPERV_CPUID_IMPLEMENT_LIMITS 0x40000005 |
| #define | HYPERV_HYPERVISOR_PRESENT_BIT 0x80000000 |
| #define | HYPERV_CPUID_MIN 0x40000005 |
| #define | HYPERV_CPUID_MAX 0x4000ffff |
| #define | GUEST_INTR_STATE_STI 0x00000001 |
| GUEST_INTERRUPTIBILITY_INFO flags. | |
| #define | GUEST_INTR_STATE_MOV_SS 0x00000002 |
| #define | GUEST_INTR_STATE_SMI 0x00000004 |
| #define | GUEST_INTR_STATE_NMI 0x00000008 |
| #define | GUEST_INTR_STATE_ENCLAVE_INTR 0x00000010 |
| #define | SHADOW_INT_MOV_SS 0x01 |
| Interrupt shadow states. | |
| #define | SHADOW_INT_STI 0x02 |
| #define | VMM_STACK_SIZE 0x8000 |
| Stack Size. | |
| #define | IS_VALID_DEBUG_REGISTER(DebugRegister) |
| #define | HYPERV_CPUID_VENDOR_MICROSOFT_EBX 0x7263694d |
| Hyper-V CPUID leaves. | |
| #define | HYPERV_CPUID_VENDOR_MICROSOFT_ECX 0x666f736f |
| #define | HYPERV_CPUID_VENDOR_MICROSOFT_EDX 0x76482074 |
| #define | VMCS_GUEST_DEBUGCTL_HIGH 0x00002803 |
| #define | VIRTUAL_PROCESSOR_ID 0x00000000 |
Typedefs | |
| typedef union _HYPERCALL_INPUT_VALUE | HYPERCALL_INPUT_VALUE |
| Hypercalls for Hyper-V. | |
| typedef union _HYPERCALL_INPUT_VALUE * | PHYPERCALL_INPUT_VALUE |
| typedef enum _MOV_TO_DEBUG_REG | MOV_TO_DEBUG_REG |
| MOV to debug registers states. | |
Functions | |
| BOOLEAN | VmxIsTopLevelHypervisorHyperV () |
| checks if the current top level hypervisor is Hyper-V | |
| BOOLEAN | VmxCheckVmxSupport () |
| Check whether VMX Feature is supported or not. | |
| BOOLEAN | VmxInitialize () |
| Initialize the VMX operation. | |
| BOOLEAN | VmxPerformVirtualizationOnAllCores () |
| Initialize essential VMX Operation tasks. | |
| BOOLEAN | VmxTerminate () |
| Broadcast to terminate VMX on all logical cores. | |
| BOOLEAN | VmxPerformVirtualizationOnSpecificCore () |
| Allocates Vmx regions for all logical cores (Vmxon region and Vmcs region). | |
| BOOLEAN | VmxLoadVmcs (_In_ VIRTUAL_MACHINE_STATE *VCpu) |
| BOOLEAN | VmxClearVmcsState (_In_ VIRTUAL_MACHINE_STATE *VCpu) |
| BOOLEAN | VmxCheckIsOnVmxRoot () |
| It can deterministically check whether the caller is on vmx-root mode or not. | |
| BOOLEAN | VmxVirtualizeCurrentSystem (PVOID GuestStack) |
| Initialize VMX Operation. | |
| BOOLEAN | VmxSetupVmcs (_In_ VIRTUAL_MACHINE_STATE *VCpu, _In_ PVOID GuestStack) |
| VOID | VmxPerformVmptrst () |
| Implementation of VMPTRST instruction. | |
| VOID | VmxPerformVmresume () |
| Resume VM using the VMRESUME instruction. | |
| VOID | VmxPerformVmxoff (VIRTUAL_MACHINE_STATE *VCpu) |
| Prepare and execute Vmxoff instruction. | |
| VOID | VmxPerformTermination () |
| Terminate Vmx on all logical cores. | |
| VOID | VmxHandleXsetbv (VIRTUAL_MACHINE_STATE *VCpu) |
| Handling XSETBV Instruction vm-exits. | |
| VOID | VmxHandleVmxPreemptionTimerVmexit (VIRTUAL_MACHINE_STATE *VCpu) |
| Handling VMX Preemption Timer vm-exits. | |
| VOID | VmxHandleTripleFaults (VIRTUAL_MACHINE_STATE *VCpu) |
| Handling triple fault VM-exits. | |
| VOID | VmxFixCr4AndCr0Bits () |
| Fix values for cr0 and cr4 bits. | |
| VOID | VmxCompatibleMicroSleep (UINT64 ns) |
| VMX-root compatible micro sleep. | |
| UINT64 | VmxReturnStackPointerForVmxoff () |
| Get the RIP of guest (VMCS_GUEST_RIP) in the case of return from VMXOFF. | |
| UINT64 | VmxReturnInstructionPointerForVmxoff () |
| Get the RIP of guest (VMCS_GUEST_RIP) in the case of return from VMXOFF. | |
| BOOLEAN | VmxGetCurrentExecutionMode () |
| Check current execution mode (vmx-root and non-root). | |
| BOOLEAN | VmxGetCurrentLaunchState () |
| Check if the VMX is launched or not. | |
| UINT32 | VmxCompatibleStrlen (const CHAR *S) |
| implementation of vmx-root mode compatible strlen | |
| UINT32 | VmxCompatibleWcslen (const WCHAR *S) |
| implementation of vmx-root mode compatible wcslen | |
| INT32 | VmxCompatibleStrcmp (const CHAR *Address1, const CHAR *Address2, SIZE_T Num, BOOLEAN IsStrncmp) |
| implementation of vmx-root mode compatible strcmp and strncmp | |
| INT32 | VmxCompatibleWcscmp (const WCHAR *Address1, const WCHAR *Address2, SIZE_T Num, BOOLEAN IsWcsncmp) |
| implementation of vmx-root mode compatible wcscmp and wcsncmp | |
| INT32 | VmxCompatibleMemcmp (const CHAR *Address1, const CHAR *Address2, SIZE_T Count) |
| implementation of vmx-root mode compatible memcmp | |
VMX Instruction and operation headers.
| #define GUEST_INTR_STATE_ENCLAVE_INTR 0x00000010 |
| #define GUEST_INTR_STATE_MOV_SS 0x00000002 |
| #define GUEST_INTR_STATE_NMI 0x00000008 |
| #define GUEST_INTR_STATE_SMI 0x00000004 |
| #define GUEST_INTR_STATE_STI 0x00000001 |
GUEST_INTERRUPTIBILITY_INFO flags.
| #define HYPERV_CPUID_ENLIGHTMENT_INFO 0x40000004 |
| #define HYPERV_CPUID_FEATURES 0x40000003 |
| #define HYPERV_CPUID_IMPLEMENT_LIMITS 0x40000005 |
| #define HYPERV_CPUID_INTERFACE 0x40000001 |
| #define HYPERV_CPUID_MAX 0x4000ffff |
| #define HYPERV_CPUID_MIN 0x40000005 |
| #define HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS 0x40000000 |
CPUID RCX(s) - Based on Hyper-V.
| #define HYPERV_CPUID_VENDOR_MICROSOFT_EBX 0x7263694d |
Hyper-V CPUID leaves.
| #define HYPERV_CPUID_VENDOR_MICROSOFT_ECX 0x666f736f |
| #define HYPERV_CPUID_VENDOR_MICROSOFT_EDX 0x76482074 |
| #define HYPERV_CPUID_VERSION 0x40000002 |
| #define HYPERV_HYPERVISOR_PRESENT_BIT 0x80000000 |
| #define IS_VALID_DEBUG_REGISTER | ( | DebugRegister | ) |
| #define SHADOW_INT_MOV_SS 0x01 |
Interrupt shadow states.
| #define SHADOW_INT_STI 0x02 |
| #define VIRTUAL_PROCESSOR_ID 0x00000000 |
| #define VMCS_GUEST_DEBUGCTL_HIGH 0x00002803 |
Guest IA32_DEBUGCTL.
| #define VMCS_SIZE 4096 |
VMCS Region Size.
| #define VMM_STACK_SIZE 0x8000 |
Stack Size.
| #define VMXON_SIZE 4096 |
VMXON Region Size.
| typedef union _HYPERCALL_INPUT_VALUE HYPERCALL_INPUT_VALUE |
Hypercalls for Hyper-V.
| typedef enum _MOV_TO_DEBUG_REG MOV_TO_DEBUG_REG |
MOV to debug registers states.
| typedef union _HYPERCALL_INPUT_VALUE * PHYPERCALL_INPUT_VALUE |
| enum _MOV_TO_DEBUG_REG |
MOV to debug registers states.
| Enumerator | |
|---|---|
| AccessToDebugRegister | |
| AccessFromDebugRegister | |
| enum HYPERCALL_CODE |
Hyper-V Hypercalls.
| BOOLEAN VmxCheckIsOnVmxRoot | ( | ) |
It can deterministically check whether the caller is on vmx-root mode or not.
| BOOLEAN VmxCheckVmxSupport | ( | ) |
Check whether VMX Feature is supported or not.
| BOOLEAN VmxClearVmcsState | ( | _In_ VIRTUAL_MACHINE_STATE * | VCpu | ) |
implementation of vmx-root mode compatible memcmp
| Address1 | |
| Address2 | |
| Count |
| VOID VmxCompatibleMicroSleep | ( | UINT64 | Us | ) |
VMX-root compatible micro sleep.
| Us | Delay in micro seconds |
| INT32 VmxCompatibleStrcmp | ( | const CHAR * | Address1, |
| const CHAR * | Address2, | ||
| SIZE_T | Num, | ||
| BOOLEAN | IsStrncmp ) |
implementation of vmx-root mode compatible strcmp and strncmp
| Address1 | |
| Address2 | |
| Num | param IsStrncmp |
implementation of vmx-root mode compatible strlen
| S |
| INT32 VmxCompatibleWcscmp | ( | const WCHAR * | Address1, |
| const WCHAR * | Address2, | ||
| SIZE_T | Num, | ||
| BOOLEAN | IsWcsncmp ) |
implementation of vmx-root mode compatible wcscmp and wcsncmp
| Address1 | |
| Address2 | |
| Num | |
| IsWcsncmp |
| UINT32 VmxCompatibleWcslen | ( | const WCHAR * | S | ) |
implementation of vmx-root mode compatible wcslen
| S |
| VOID VmxFixCr4AndCr0Bits | ( | ) |
Fix values for cr0 and cr4 bits.
The Cr4 And Cr0 Bits During VMX Operation Preventing Them From Any Change (https://revers.engineering/day-2-entering-vmx-operation/)
| BOOLEAN VmxGetCurrentExecutionMode | ( | ) |
Check current execution mode (vmx-root and non-root).
| BOOLEAN VmxGetCurrentLaunchState | ( | ) |
| VOID VmxHandleTripleFaults | ( | VIRTUAL_MACHINE_STATE * | VCpu | ) |
Handling triple fault VM-exits.
| VCpu | The virtual processor's state |
| VOID VmxHandleVmxPreemptionTimerVmexit | ( | VIRTUAL_MACHINE_STATE * | VCpu | ) |
Handling VMX Preemption Timer vm-exits.
| VCpu | The virtual processor's state |
| VOID VmxHandleXsetbv | ( | VIRTUAL_MACHINE_STATE * | VCpu | ) |
Handling XSETBV Instruction vm-exits.
| VCpu |
| BOOLEAN VmxInitialize | ( | ) |
Initialize the VMX operation.
| BOOLEAN VmxIsTopLevelHypervisorHyperV | ( | ) |
checks if the current top level hypervisor is Hyper-V
| BOOLEAN VmxLoadVmcs | ( | _In_ VIRTUAL_MACHINE_STATE * | VCpu | ) |
| VOID VmxPerformTermination | ( | ) |
Terminate Vmx on all logical cores.
| BOOLEAN VmxPerformVirtualizationOnAllCores | ( | ) |
Initialize essential VMX Operation tasks.
| BOOLEAN VmxPerformVirtualizationOnSpecificCore | ( | ) |
Allocates Vmx regions for all logical cores (Vmxon region and Vmcs region).
| VOID VmxPerformVmptrst | ( | ) |
Implementation of VMPTRST instruction.
| VOID VmxPerformVmresume | ( | ) |
Resume VM using the VMRESUME instruction.
| VOID VmxPerformVmxoff | ( | VIRTUAL_MACHINE_STATE * | VCpu | ) |
Prepare and execute Vmxoff instruction.
| VCpu | The virtual processor's state |
| UINT64 VmxReturnInstructionPointerForVmxoff | ( | ) |
Get the RIP of guest (VMCS_GUEST_RIP) in the case of return from VMXOFF.
| UINT64 VmxReturnStackPointerForVmxoff | ( | ) |
Get the RIP of guest (VMCS_GUEST_RIP) in the case of return from VMXOFF.
| BOOLEAN VmxSetupVmcs | ( | _In_ VIRTUAL_MACHINE_STATE * | VCpu, |
| _In_ PVOID | GuestStack ) |
| BOOLEAN VmxTerminate | ( | ) |
Broadcast to terminate VMX on all logical cores.
Initialize VMX Operation.
| GuestStack | Guest stack for the this core (VMCS_GUEST_RSP) |