HyperDbg Debugger
Loading...
Searching...
No Matches
VmxMechanisms.c File Reference

VMX based mechanisms. More...

#include "pch.h"

Functions

VOID VmxMechanismCreateImmediateVmexitByVmxPreemptionTimer ()
 Create an immediate vm-exit after vm-entry by using VMX Preemption Timer.
 
VOID VmxMechanismDisableImmediateVmexitByVmxPreemptionTimer ()
 Disable the immediate vm-exit after vm-entry by using VMX Preemption Timer.
 
VOID VmxMechanismCreateImmediateVmexitBySelfIpi ()
 Create an immediate vm-exit after vm-entry by using self-ipi.
 
VOID VmxMechanismCreateImmediateVmexit (VIRTUAL_MACHINE_STATE *VCpu)
 Create an immediate vm-exit after vm-entry.
 
VOID VmxMechanismHandleImmediateVmexit (VIRTUAL_MACHINE_STATE *VCpu)
 Handle immediate vm-exit after vm-entry.
 

Detailed Description

VMX based mechanisms.

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.1
Date
2021-12-16

Function Documentation

◆ VmxMechanismCreateImmediateVmexit()

VOID VmxMechanismCreateImmediateVmexit ( VIRTUAL_MACHINE_STATE * VCpu)

Create an immediate vm-exit after vm-entry.

Parameters
CurrentCoreIndex
Returns
VOID
75{
76 //
77 // I didn't test vm-exit by preemption timer as my machine
78 // or maybe VMware workstation's nested virtualization didn't
79 // support VMX Preemption Timer, that's why we use self-ipi
80 // method by default
81 //
82
83 //
84 // Indicate wait for an immediate vm-exit
85 //
87
88 //
89 // Self-ipi current core
90 //
92
93 //
94 // Set vm-exit on external interrupts
95 //
97}
#define TRUE
Definition BasicTypes.h:55
VOID HvSetExternalInterruptExiting(VIRTUAL_MACHINE_STATE *VCpu, BOOLEAN Set)
Set the External Interrupt Exiting.
Definition Hv.c:1055
VOID VmxMechanismCreateImmediateVmexitBySelfIpi()
Create an immediate vm-exit after vm-entry by using self-ipi.
Definition VmxMechanisms.c:59
BOOLEAN WaitForImmediateVmexit
Definition State.h:295

◆ VmxMechanismCreateImmediateVmexitBySelfIpi()

VOID VmxMechanismCreateImmediateVmexitBySelfIpi ( )

Create an immediate vm-exit after vm-entry by using self-ipi.

Returns
VOID
60{
61 //
62 // Send self-ipi on the target vector using xAPIC or x2APIC
63 //
65}
VOID ApicSelfIpi(UINT32 Vector)
Self IPI the current core.
Definition Apic.c:114
#define IMMEDIATE_VMEXIT_MECHANISM_VECTOR_FOR_SELF_IPI
Definition VmxMechanisms.h:18

◆ VmxMechanismCreateImmediateVmexitByVmxPreemptionTimer()

VOID VmxMechanismCreateImmediateVmexitByVmxPreemptionTimer ( )

Create an immediate vm-exit after vm-entry by using VMX Preemption Timer.

Returns
VOID
21{
22 //
23 // Activate VMX preemption timer on pin-based controls
24 //
26
27 //
28 // Setting VMX preemption timer to 0, cause and immediate
29 // vm-exit and architecturally guarantees that no instruction
30 // get a chance to be executed
31 //
33}
VOID CounterSetPreemptionTimer(UINT32 TimerValue)
Set the timer value for preemption timer.
Definition Counters.c:80
VOID HvSetVmxPreemptionTimerExiting(BOOLEAN Set)
Set the VMX preemption timer.
Definition Hv.c:989

◆ VmxMechanismDisableImmediateVmexitByVmxPreemptionTimer()

VOID VmxMechanismDisableImmediateVmexitByVmxPreemptionTimer ( )

Disable the immediate vm-exit after vm-entry by using VMX Preemption Timer.

Returns
VOID
43{
45
46 //
47 // Disable the VMX preemption timer on pin-based controls
48 //
50}
#define FALSE
Definition BasicTypes.h:54
VOID CounterClearPreemptionTimer()
Clears the preemption timer.
Definition Counters.c:94

◆ VmxMechanismHandleImmediateVmexit()

VOID VmxMechanismHandleImmediateVmexit ( VIRTUAL_MACHINE_STATE * VCpu)

Handle immediate vm-exit after vm-entry.

Parameters
VCpuThe virtual processor's state
Returns
VOID
107{
108 //
109 // Not waiting for immediate vm-exit anymore
110 //
112
113 //
114 // Set vm-exit on external interrupts
115 //
117}