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

Implementation of exported functions from hypervisor. More...

#include "pch.h"

Functions

VOID VmFuncPerformRipIncrement (UINT32 CoreId)
 Perform the incrementation of RIP.
 
VOID VmFuncSuppressRipIncrement (UINT32 CoreId)
 Suppress the incrementation of RIP.
 
VOID VmFuncChangeMtfUnsettingState (UINT32 CoreId, BOOLEAN Set)
 Suppress unsetting MTF.
 
VOID VmFuncChangeIgnoreOneMtfState (UINT32 CoreId, BOOLEAN Set)
 Change ignore one MTF state.
 
VOID VmFuncRegisterMtfBreak (UINT32 CoreId)
 Register for break in the case of an MTF.
 
VOID VmFuncUnRegisterMtfBreak (UINT32 CoreId)
 Unregister for break in the case of an MTF.
 
VOID VmFuncSetMonitorTrapFlag (BOOLEAN Set)
 Set the monitor trap flag.
 
VOID VmFuncSetRflagTrapFlag (BOOLEAN Set)
 Set Rflag's trap flag.
 
VOID VmFuncSetLoadDebugControls (BOOLEAN Set)
 Set LOAD DEBUG CONTROLS on Vm-entry controls.
 
VOID VmFuncSetSaveDebugControls (BOOLEAN Set)
 Set SAVE DEBUG CONTROLS on Vm-exit controls.
 
VOID VmFuncSetPmcVmexit (BOOLEAN Set)
 Set vm-exit for rdpmc instructions.
 
VOID VmFuncSetMovControlRegsExiting (BOOLEAN Set, UINT64 ControlRegister, UINT64 MaskRegister)
 Set vm-exit for mov-to-cr0/4.
 
VOID VmFuncSetMovToCr3Vmexit (UINT32 CoreId, BOOLEAN Set)
 Set vm-exit for mov-to-cr3.
 
VOID VmFuncWriteExceptionBitmap (UINT32 BitmapMask)
 Write on exception bitmap in VMCS DO NOT CALL IT DIRECTLY, instead use HvSetExceptionBitmap.
 
UINT32 VmFuncReadExceptionBitmap ()
 Read exception bitmap in VMCS.
 
VOID VmFuncSetInterruptWindowExiting (BOOLEAN Set)
 Set Interrupt-window exiting.
 
VOID VmFuncSetNmiWindowExiting (BOOLEAN Set)
 Set NMI-window exiting.
 
VOID VmFuncSetNmiExiting (BOOLEAN Set)
 Set the NMI Exiting.
 
VOID VmFuncSetExceptionBitmap (UINT32 CoreId, UINT32 IdtIndex)
 Set exception bitmap in VMCS.
 
VOID VmFuncUnsetExceptionBitmap (UINT32 CoreId, UINT32 IdtIndex)
 Unset exception bitmap in VMCS.
 
VOID VmFuncSetExternalInterruptExiting (UINT32 CoreId, BOOLEAN Set)
 Set the External Interrupt Exiting.
 
VOID VmFuncSetRdtscExiting (UINT32 CoreId, BOOLEAN Set)
 Set the RDTSC/P Exiting.
 
VOID VmFuncSetMovDebugRegsExiting (UINT32 CoreId, BOOLEAN Set)
 Set or unset the Mov to Debug Registers Exiting.
 
UINT64 VmFuncGetLastVmexitRip (UINT32 CoreId)
 get the last vm-exit RIP
 
VOID VmFuncInjectPendingExternalInterrupts (UINT32 CoreId)
 Inject pending external interrupts.
 
UINT16 VmFuncGetCsSelector ()
 Read CS selector.
 
UINT64 VmFuncGetRflags ()
 Read guest's RFLAGS.
 
VOID VmFuncSetRflags (UINT64 Rflags)
 Set guest's RFLAGS.
 
UINT64 VmFuncGetRip ()
 Read guest's RIP.
 
VOID VmFuncSetRip (UINT64 Rip)
 Set guest's RIP.
 
UINT64 VmFuncGetInterruptibilityState ()
 Read guest's interruptibility state.
 
UINT64 VmFuncClearSteppingBits (UINT64 Interruptibility)
 Clear STI and MOV SS bits.
 
VOID VmFuncSetInterruptibilityState (UINT64 InterruptibilityState)
 Set guest's interruptibility state.
 
BOOLEAN VmFuncNmiBroadcastRequest (UINT32 CoreId)
 Broadcast NMI requests.
 
BOOLEAN VmFuncNmiBroadcastInvalidateEptSingleContext (UINT32 CoreId)
 Broadcast NMI requests for single-context EPT invalidation.
 
BOOLEAN VmFuncNmiBroadcastInvalidateEptAllContexts (UINT32 CoreId)
 Broadcast NMI requests for all contexts EPT invalidation.
 
VOID VmFuncInvalidateEptSingleContext (UINT32 CoreId)
 Requests for single-context EPT invalidation.
 
VOID VmFuncInvalidateEptAllContexts ()
 Requests for all contexts EPT invalidation.
 
VOID VmFuncCheckAndEnableExternalInterrupts (UINT32 CoreId)
 Check and enable external interrupts.
 
VOID VmFuncDisableExternalInterruptsAndInterruptWindow (UINT32 CoreId)
 Disable external-interrupts and interrupt window.
 
BOOLEAN VmFuncInitVmm (VMM_CALLBACKS *VmmCallbacks)
 Initializes hypervisor.
 
VOID VmFuncUninitVmm ()
 Uninitialize Terminate Vmx on all logical cores.
 
BOOLEAN VmFuncVmxGetCurrentExecutionMode ()
 Get the current VMX operation state.
 
BOOLEAN VmFuncQueryModeExecTrap ()
 Get the current state of mode exec trap mechanism.
 
VOID VmFuncSetTriggerEventForVmcalls (BOOLEAN Set)
 Set triggering events for VMCALLs.
 
VOID VmFuncSetTriggerEventForCpuids (BOOLEAN Set)
 Set triggering events for CPUIDs.
 
UINT32 VmFuncVmxCompatibleStrlen (const CHAR *s)
 VMX-root compatible strlen.
 
UINT32 VmFuncVmxCompatibleWcslen (const wchar_t *s)
 VMX-root compatible strlen.
 
VOID VmFuncEventInjectPageFaultWithCr2 (UINT32 CoreId, UINT64 Address, UINT32 PageFaultCode)
 Inject #PF and configure CR2 register.
 
VOID VmFuncEventInjectPageFaultRangeAddress (UINT32 CoreId, UINT64 AddressFrom, UINT64 AddressTo, UINT32 PageFaultCode)
 Inject a range of page-faults.
 
VOID VmFuncEventInjectInterruption (UINT32 InterruptionType, UINT32 Vector, BOOLEAN DeliverErrorCode, UINT32 ErrorCode)
 Inject interrupt/faults/exceptions.
 
NTSTATUS VmFuncVmxVmcall (unsigned long long VmcallNumber, unsigned long long OptionalParam1, unsigned long long OptionalParam2, unsigned long long OptionalParam3)
 Export for running VMX VMCALLs.
 
VOID VmFuncVmxBroadcastInitialize ()
 Export for initialize the VMX Broadcast mechanism.
 
VOID VmFuncVmxBroadcastUninitialize ()
 Export for uninitialize the VMX Broadcast mechanism.
 
VOID VmFuncEventInjectBreakpoint ()
 Inject #BP to the guest (Event Injection)
 
INT32 VmFuncVmxCompatibleStrcmp (const CHAR *Address1, const CHAR *Address2)
 VMX-root compatible strcmp.
 
INT32 VmFuncVmxCompatibleStrncmp (const CHAR *Address1, const CHAR *Address2, SIZE_T Num)
 VMX-root compatible strncmp.
 
INT32 VmFuncVmxCompatibleWcscmp (const wchar_t *Address1, const wchar_t *Address2)
 VMX-root compatible wcscmp.
 
INT32 VmFuncVmxCompatibleWcsncmp (const wchar_t *Address1, const wchar_t *Address2, SIZE_T Num)
 VMX-root compatible wcsncmp.
 
INT32 VmFuncVmxCompatibleMemcmp (const CHAR *Address1, const CHAR *Address2, size_t Count)
 VMX-root compatible memcmp.
 
VOID VmFuncEnableMtfAndChangeExternalInterruptState (UINT32 CoreId)
 Enables MTF and adjust external interrupt state.
 
VOID VmFuncEnableAndCheckForPreviousExternalInterrupts (UINT32 CoreId)
 Checks to enable and reinject previous interrupts.
 

Detailed Description

Implementation of exported functions from hypervisor.

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

Function Documentation

◆ VmFuncChangeIgnoreOneMtfState()

VOID VmFuncChangeIgnoreOneMtfState ( UINT32 CoreId,
BOOLEAN Set )

Change ignore one MTF state.

Parameters
CoreIdTarget core's ID
SetState of setting or unsetting
Returns
VOID
61{
62 g_GuestState[CoreId].IgnoreOneMtf = Set;
63}
VIRTUAL_MACHINE_STATE * g_GuestState
Save the state and variables related to virtualization on each to logical core.
Definition GlobalVariables.h:38
BOOLEAN IgnoreOneMtf
Definition State.h:299

◆ VmFuncChangeMtfUnsettingState()

VOID VmFuncChangeMtfUnsettingState ( UINT32 CoreId,
BOOLEAN Set )

Suppress unsetting MTF.

Parameters
CoreIdTarget core's ID
SetState of setting or unsetting
Returns
VOID
48{
49 g_GuestState[CoreId].IgnoreMtfUnset = Set;
50}
BOOLEAN IgnoreMtfUnset
Definition State.h:294

◆ VmFuncCheckAndEnableExternalInterrupts()

VOID VmFuncCheckAndEnableExternalInterrupts ( UINT32 CoreId)

Check and enable external interrupts.

Parameters
CoreIdTarget core's ID
Returns
VOID
506{
508}
VOID HvCheckAndEnableExternalInterrupts(VIRTUAL_MACHINE_STATE *VCpu)
Check and enable external interrupts.
Definition Hv.c:1271

◆ VmFuncClearSteppingBits()

UINT64 VmFuncClearSteppingBits ( UINT64 Interruptibility)

Clear STI and MOV SS bits.

Returns
UINT64
410{
411 return HvClearSteppingBits(Interruptibility);
412}
UINT64 HvClearSteppingBits(UINT64 Interruptibility)
Clear STI and MOV SS bits.
Definition Hv.c:1220

◆ VmFuncDisableExternalInterruptsAndInterruptWindow()

VOID VmFuncDisableExternalInterruptsAndInterruptWindow ( UINT32 CoreId)

Disable external-interrupts and interrupt window.

Parameters
CoreId
Returns
VOID
519{
521}
VOID HvDisableExternalInterruptsAndInterruptWindow(VIRTUAL_MACHINE_STATE *VCpu)
Disable external-interrupts and interrupt window.
Definition Hv.c:1300

◆ VmFuncEnableAndCheckForPreviousExternalInterrupts()

VOID VmFuncEnableAndCheckForPreviousExternalInterrupts ( UINT32 CoreId)

Checks to enable and reinject previous interrupts.

Parameters
UINT32CoreId
Returns
VOID
813{
815}
VOID HvEnableAndCheckForPreviousExternalInterrupts(VIRTUAL_MACHINE_STATE *VCpu)
Checks to enable and reinject previous interrupts.
Definition Hv.c:1072

◆ VmFuncEnableMtfAndChangeExternalInterruptState()

VOID VmFuncEnableMtfAndChangeExternalInterruptState ( UINT32 CoreId)

Enables MTF and adjust external interrupt state.

Parameters
UINT32CoreId
Returns
VOID
800{
802}
VOID HvEnableMtfAndChangeExternalInterruptState(VIRTUAL_MACHINE_STATE *VCpu)
Enables MTF and adjust external interrupt state.
Definition Hv.c:1389

◆ VmFuncEventInjectBreakpoint()

VOID VmFuncEventInjectBreakpoint ( )

Inject #BP to the guest (Event Injection)

Returns
VOID
720{
722}
VOID EventInjectBreakpoint()
Inject #BP to the guest (Event Injection)
Definition Events.c:46

◆ VmFuncEventInjectInterruption()

VOID VmFuncEventInjectInterruption ( UINT32 InterruptionType,
UINT32 Vector,
BOOLEAN DeliverErrorCode,
UINT32 ErrorCode )

Inject interrupt/faults/exceptions.

Parameters
InterruptionType
Vector
DeliverErrorCode
ErrorCode
Returns
VOID
666{
667 EventInjectInterruption(InterruptionType,
668 Vector,
669 DeliverErrorCode,
670 ErrorCode);
671}
VOID EventInjectInterruption(INTERRUPT_TYPE InterruptionType, EXCEPTION_VECTORS Vector, BOOLEAN DeliverErrorCode, UINT32 ErrorCode)
Injects interruption to a guest.
Definition Events.c:24

◆ VmFuncEventInjectPageFaultRangeAddress()

VOID VmFuncEventInjectPageFaultRangeAddress ( UINT32 CoreId,
UINT64 AddressFrom,
UINT64 AddressTo,
UINT32 PageFaultCode )

Inject a range of page-faults.

Parameters
CoreIdTarget core's ID
AddressFromPage-fault address (from)
AddressToPage-fault address (to)
AddressPage-fault address
PageFaultCodePage-fault error code
Returns
VOID
647{
648 EventInjectPageFaultRangeAddress(&g_GuestState[CoreId], AddressFrom, AddressTo, PageFaultCode);
649}
VOID EventInjectPageFaultRangeAddress(VIRTUAL_MACHINE_STATE *VCpu, UINT64 AddressFrom, UINT64 AddressTo, UINT32 PageFaultCode)
Inject a range of page-faults.
Definition Events.c:237

◆ VmFuncEventInjectPageFaultWithCr2()

VOID VmFuncEventInjectPageFaultWithCr2 ( UINT32 CoreId,
UINT64 Address,
UINT32 PageFaultCode )

Inject #PF and configure CR2 register.

Parameters
CoreIdTarget core's ID
AddressPage-fault address
PageFaultCodePage-fault error code
Returns
VOID
627{
628 EventInjectPageFaultWithCr2(&g_GuestState[CoreId], Address, PageFaultCode);
629}
VOID EventInjectPageFaultWithCr2(VIRTUAL_MACHINE_STATE *VCpu, UINT64 Address, UINT32 PageFaultCode)
Inject page-fault with an address as cr2.
Definition Events.c:281
UINT64 Address
Definition HyperDbgScriptImports.h:67

◆ VmFuncGetCsSelector()

UINT16 VmFuncGetCsSelector ( )

Read CS selector.

Returns
UINT16
342{
343 return HvGetCsSelector();
344}
UINT16 HvGetCsSelector()
Read CS selector.
Definition Hv.c:1132

◆ VmFuncGetInterruptibilityState()

UINT64 VmFuncGetInterruptibilityState ( )

Read guest's interruptibility state.

Returns
UINT64
399{
401}
UINT64 HvGetInterruptibilityState()
Read guest's interruptibility state.
Definition Hv.c:1205

◆ VmFuncGetLastVmexitRip()

UINT64 VmFuncGetLastVmexitRip ( UINT32 CoreId)

get the last vm-exit RIP

Parameters
CoreIdTarget core's ID
Returns
UINT64
319{
320 return g_GuestState[CoreId].LastVmexitRip;
321}
UINT64 LastVmexitRip
Definition State.h:309

◆ VmFuncGetRflags()

UINT64 VmFuncGetRflags ( )

Read guest's RFLAGS.

Returns
UINT64
353{
354 return HvGetRflags();
355}
UINT64 HvGetRflags()
Read guest's RFLAGS.
Definition Hv.c:1151

◆ VmFuncGetRip()

UINT64 VmFuncGetRip ( )

Read guest's RIP.

Returns
UINT64
376{
377 return HvGetRip();
378}
UINT64 HvGetRip()
Read guest's RIP.
Definition Hv.c:1178

◆ VmFuncInitVmm()

BOOLEAN VmFuncInitVmm ( VMM_CALLBACKS * VmmCallbacks)

Initializes hypervisor.

Parameters
VmmCallbacks
Returns
BOOLEAN Shows whether the initialization was successful or not
531{
532 return HvInitVmm(VmmCallbacks);
533}
BOOLEAN HvInitVmm(VMM_CALLBACKS *VmmCallbacks)
Initializes the hypervisor.
Definition Hv.c:1322

◆ VmFuncInjectPendingExternalInterrupts()

VOID VmFuncInjectPendingExternalInterrupts ( UINT32 CoreId)

Inject pending external interrupts.

Parameters
CoreIdTarget core's ID
Returns
VOID
331{
333}
VOID HvInjectPendingExternalInterrupts(VIRTUAL_MACHINE_STATE *VCpu)
Inject pending external interrupts.
Definition Hv.c:1249

◆ VmFuncInvalidateEptAllContexts()

VOID VmFuncInvalidateEptAllContexts ( )

Requests for all contexts EPT invalidation.

Returns
VOID
490{
491 //
492 // Broadcast NMI requests
493 //
495}
UCHAR EptInveptAllContexts()
Invalidates all contexts in EPT cache table.
Definition Invept.c:54

◆ VmFuncInvalidateEptSingleContext()

VOID VmFuncInvalidateEptSingleContext ( UINT32 CoreId)

Requests for single-context EPT invalidation.

Parameters
CoreIdTarget core's ID
Returns
VOID
479{
480 EptInveptSingleContext(g_GuestState[CoreId].EptPointer.AsUInt);
481}
UCHAR EptInveptSingleContext(_In_ UINT64 EptPointer)
Invalidates a single context in ept cache table.
Definition Invept.c:40

◆ VmFuncNmiBroadcastInvalidateEptAllContexts()

BOOLEAN VmFuncNmiBroadcastInvalidateEptAllContexts ( UINT32 CoreId)

Broadcast NMI requests for all contexts EPT invalidation.

Parameters
CoreIdTarget core's ID
Returns
BOOLEAN
464{
465 //
466 // Broadcast NMI requests
467 //
469}
BOOLEAN VmxBroadcastNmi(VIRTUAL_MACHINE_STATE *VCpu, NMI_BROADCAST_ACTION_TYPE VmxBroadcastAction)
Broadcast NMI in vmx-root mode.
Definition VmxBroadcast.c:143
@ NMI_BROADCAST_ACTION_INVALIDATE_EPT_CACHE_ALL_CONTEXTS
Definition State.h:54

◆ VmFuncNmiBroadcastInvalidateEptSingleContext()

BOOLEAN VmFuncNmiBroadcastInvalidateEptSingleContext ( UINT32 CoreId)

Broadcast NMI requests for single-context EPT invalidation.

Parameters
CoreIdTarget core's ID
Returns
BOOLEAN
449{
450 //
451 // Broadcast NMI requests
452 //
454}
@ NMI_BROADCAST_ACTION_INVALIDATE_EPT_CACHE_SINGLE_CONTEXT
Definition State.h:53

◆ VmFuncNmiBroadcastRequest()

BOOLEAN VmFuncNmiBroadcastRequest ( UINT32 CoreId)

Broadcast NMI requests.

Parameters
CoreIdTarget core's ID
Returns
BOOLEAN
434{
435 //
436 // Broadcast NMI requests
437 //
439}
@ NMI_BROADCAST_ACTION_REQUEST
Definition State.h:52

◆ VmFuncPerformRipIncrement()

VOID VmFuncPerformRipIncrement ( UINT32 CoreId)

Perform the incrementation of RIP.

Parameters
CoreIdTarget core's ID
Returns
VOID
23{
25}
VOID HvPerformRipIncrement(VIRTUAL_MACHINE_STATE *VCpu)
Perform the incrementation of RIP.
Definition Hv.c:337

◆ VmFuncQueryModeExecTrap()

BOOLEAN VmFuncQueryModeExecTrap ( )

Get the current state of mode exec trap mechanism.

Returns
BOOLEAN
564{
566}
BOOLEAN g_ExecTrapInitialized
Showes whether the execution trap handler is allowed to trigger an event or not.
Definition GlobalVariables.h:149

◆ VmFuncReadExceptionBitmap()

UINT32 VmFuncReadExceptionBitmap ( )

Read exception bitmap in VMCS.

Should be called in vmx-root

Returns
UINT32
204{
205 return HvReadExceptionBitmap();
206}
UINT32 HvReadExceptionBitmap()
Read exception bitmap in VMCS.
Definition Hv.c:587

◆ VmFuncRegisterMtfBreak()

VOID VmFuncRegisterMtfBreak ( UINT32 CoreId)

Register for break in the case of an MTF.

Parameters
CoreIdTarget core's ID
Returns
VOID
74{
76}
#define TRUE
Definition BasicTypes.h:55
BOOLEAN RegisterBreakOnMtf
Definition State.h:298

◆ VmFuncSetExceptionBitmap()

VOID VmFuncSetExceptionBitmap ( UINT32 CoreId,
UINT32 IdtIndex )

Set exception bitmap in VMCS.

Should be called in vmx-root

Parameters
CoreIdTarget core's ID
IdtIndexInterrupt Descriptor Table index of exception
Returns
VOID
254{
255 HvSetExceptionBitmap(&g_GuestState[CoreId], IdtIndex);
256}
VOID HvSetExceptionBitmap(VIRTUAL_MACHINE_STATE *VCpu, UINT32 IdtIndex)
Set exception bitmap in VMCS.
Definition Hv.c:1022

◆ VmFuncSetExternalInterruptExiting()

VOID VmFuncSetExternalInterruptExiting ( UINT32 CoreId,
BOOLEAN Set )

Set the External Interrupt Exiting.

Parameters
CoreIdTarget core's ID
SetSet or unset the External Interrupt Exiting
Returns
VOID
281{
283}
VOID HvSetExternalInterruptExiting(VIRTUAL_MACHINE_STATE *VCpu, BOOLEAN Set)
Set the External Interrupt Exiting.
Definition Hv.c:1055

◆ VmFuncSetInterruptibilityState()

VOID VmFuncSetInterruptibilityState ( UINT64 InterruptibilityState)

Set guest's interruptibility state.

Parameters
InterruptibilityState
Returns
VOID
422{
423 HvSetInterruptibilityState(InterruptibilityState);
424}
VOID HvSetInterruptibilityState(UINT64 InterruptibilityState)
Set guest's interruptibility state.
Definition Hv.c:1236

◆ VmFuncSetInterruptWindowExiting()

VOID VmFuncSetInterruptWindowExiting ( BOOLEAN Set)

Set Interrupt-window exiting.

Parameters
SetSet or unset the Interrupt-window exiting
Returns
VOID
216{
218}
VOID HvSetInterruptWindowExiting(BOOLEAN Set)
Set Interrupt-window exiting.
Definition Hv.c:606

◆ VmFuncSetLoadDebugControls()

VOID VmFuncSetLoadDebugControls ( BOOLEAN Set)

Set LOAD DEBUG CONTROLS on Vm-entry controls.

Parameters
SetSet or unset
Returns
VOID
123{
125}
VOID HvSetLoadDebugControls(BOOLEAN Set)
Set LOAD DEBUG CONTROLS on Vm-entry controls.
Definition Hv.c:402

◆ VmFuncSetMonitorTrapFlag()

VOID VmFuncSetMonitorTrapFlag ( BOOLEAN Set)

Set the monitor trap flag.

Parameters
SetSet or unset the MTFs
Returns
VOID
99{
101}
VOID HvSetMonitorTrapFlag(BOOLEAN Set)
Set the monitor trap flag.
Definition Hv.c:349

◆ VmFuncSetMovControlRegsExiting()

VOID VmFuncSetMovControlRegsExiting ( BOOLEAN Set,
UINT64 ControlRegister,
UINT64 MaskRegister )

Set vm-exit for mov-to-cr0/4.

Should be called in vmx-root

Parameters
Setor unset the vm-exits
ControlRegister
MaskRegister
Returns
VOID
163{
164 HvSetMovControlRegsExiting(Set, ControlRegister, MaskRegister);
165}
VOID HvSetMovControlRegsExiting(BOOLEAN Set, UINT64 ControlRegister, UINT64 MaskRegister)
Set vm-exit for mov-to-cr0/4.
Definition Hv.c:543

◆ VmFuncSetMovDebugRegsExiting()

VOID VmFuncSetMovDebugRegsExiting ( UINT32 CoreId,
BOOLEAN Set )

Set or unset the Mov to Debug Registers Exiting.

Parameters
CoreIdTarget core's ID
SetSet or unset the Mov to Debug Registers Exiting
Returns
VOID
307{
309}
VOID HvSetMovDebugRegsExiting(VIRTUAL_MACHINE_STATE *VCpu, BOOLEAN Set)
Set or unset the Mov to Debug Registers Exiting.
Definition Hv.c:1121

◆ VmFuncSetMovToCr3Vmexit()

VOID VmFuncSetMovToCr3Vmexit ( UINT32 CoreId,
BOOLEAN Set )

Set vm-exit for mov-to-cr3.

Should be called in vmx-root

Parameters
CoreIdtarget core id
SetSet or unset the vm-exits
Returns
VOID
178{
179 HvSetMovToCr3Vmexit(&g_GuestState[CoreId], Set);
180}
VOID HvSetMovToCr3Vmexit(VIRTUAL_MACHINE_STATE *VCpu, BOOLEAN Set)
Set vm-exit for mov-to-cr3.
Definition Hv.c:558

◆ VmFuncSetNmiExiting()

VOID VmFuncSetNmiExiting ( BOOLEAN Set)

Set the NMI Exiting.

Parameters
SetSet or unset the NMI Exiting
Returns
VOID
240{
241 HvSetNmiExiting(Set);
242}
VOID HvSetNmiExiting(BOOLEAN Set)
Set the NMI Exiting.
Definition Hv.c:953

◆ VmFuncSetNmiWindowExiting()

VOID VmFuncSetNmiWindowExiting ( BOOLEAN Set)

Set NMI-window exiting.

Parameters
SetSet or unset the NMI-window exiting
Returns
VOID
228{
230}
VOID HvSetNmiWindowExiting(BOOLEAN Set)
Set NMI-window exiting.
Definition Hv.c:714

◆ VmFuncSetPmcVmexit()

VOID VmFuncSetPmcVmexit ( BOOLEAN Set)

Set vm-exit for rdpmc instructions.

Should be called in vmx-root

Parameters
SetSet or unset the vm-exits
Returns
VOID
148{
149 HvSetPmcVmexit(Set);
150}
VOID HvSetPmcVmexit(BOOLEAN Set)
Set vm-exit for rdpmc instructions.
Definition Hv.c:509

◆ VmFuncSetRdtscExiting()

VOID VmFuncSetRdtscExiting ( UINT32 CoreId,
BOOLEAN Set )

Set the RDTSC/P Exiting.

Parameters
CoreIdTarget core's ID
SetSet or unset the RDTSC/P Exiting
Returns
VOID
294{
295 HvSetRdtscExiting(&g_GuestState[CoreId], Set);
296}
VOID HvSetRdtscExiting(VIRTUAL_MACHINE_STATE *VCpu, BOOLEAN Set)
Set the RDTSC/P Exiting.
Definition Hv.c:1108

◆ VmFuncSetRflags()

VOID VmFuncSetRflags ( UINT64 Rflags)

Set guest's RFLAGS.

Parameters
Rflags
Returns
VOID
365{
366 HvSetRflags(Rflags);
367}
VOID HvSetRflags(UINT64 Rflags)
Set guest's RFLAGS.
Definition Hv.c:1167

◆ VmFuncSetRflagTrapFlag()

VOID VmFuncSetRflagTrapFlag ( BOOLEAN Set)

Set Rflag's trap flag.

Parameters
SetSet or unset the TF
Returns
VOID
111{
113}
VOID HvSetRflagTrapFlag(BOOLEAN Set)
Set the rflag's trap flag.
Definition Hv.c:381

◆ VmFuncSetRip()

VOID VmFuncSetRip ( UINT64 Rip)

Set guest's RIP.

Parameters
Rip
Returns
VOID
388{
389 HvSetRip(Rip);
390}
VOID HvSetRip(UINT64 Rip)
Set guest's RIP.
Definition Hv.c:1194

◆ VmFuncSetSaveDebugControls()

VOID VmFuncSetSaveDebugControls ( BOOLEAN Set)

Set SAVE DEBUG CONTROLS on Vm-exit controls.

Parameters
SetSet or unset
Returns
VOID
135{
137}
VOID HvSetSaveDebugControls(BOOLEAN Set)
Set SAVE DEBUG CONTROLS on Vm-exit controls.
Definition Hv.c:433

◆ VmFuncSetTriggerEventForCpuids()

VOID VmFuncSetTriggerEventForCpuids ( BOOLEAN Set)

Set triggering events for CPUIDs.

Parameters
SetSet or unset the trigger
Returns
VOID
588{
590}
BOOLEAN g_TriggerEventForCpuids
Showes whether the cpuid handler is allowed to trigger an event or not.
Definition GlobalVariables.h:138

◆ VmFuncSetTriggerEventForVmcalls()

VOID VmFuncSetTriggerEventForVmcalls ( BOOLEAN Set)

Set triggering events for VMCALLs.

Parameters
SetSet or unset the trigger
Returns
VOID
576{
578}
BOOLEAN g_TriggerEventForVmcalls
Showes whether the vmcall handler is allowed to trigger an event or not.
Definition GlobalVariables.h:131

◆ VmFuncSuppressRipIncrement()

VOID VmFuncSuppressRipIncrement ( UINT32 CoreId)

Suppress the incrementation of RIP.

Parameters
CoreIdTarget core's ID
Returns
VOID
35{
37}
VOID HvSuppressRipIncrement(VIRTUAL_MACHINE_STATE *VCpu)
Suppress the incrementation of RIP.
Definition Hv.c:324

◆ VmFuncUninitVmm()

VOID VmFuncUninitVmm ( )

Uninitialize Terminate Vmx on all logical cores.

Returns
VOID
542{
544}
VOID VmxPerformTermination()
Terminate Vmx on all logical cores.
Definition Vmx.c:1200

◆ VmFuncUnRegisterMtfBreak()

VOID VmFuncUnRegisterMtfBreak ( UINT32 CoreId)

Unregister for break in the case of an MTF.

Parameters
CoreIdTarget core's ID
Returns
VOID
87{
89}
#define FALSE
Definition BasicTypes.h:54

◆ VmFuncUnsetExceptionBitmap()

VOID VmFuncUnsetExceptionBitmap ( UINT32 CoreId,
UINT32 IdtIndex )

Unset exception bitmap in VMCS.

Should be called in vmx-root

Parameters
CoreIdTarget core's ID
IdtIndexInterrupt Descriptor Table index of exception
Returns
VOID
268{
269 HvUnsetExceptionBitmap(&g_GuestState[CoreId], IdtIndex);
270}
VOID HvUnsetExceptionBitmap(VIRTUAL_MACHINE_STATE *VCpu, UINT32 IdtIndex)
Unset exception bitmap in VMCS.
Definition Hv.c:1039

◆ VmFuncVmxBroadcastInitialize()

VOID VmFuncVmxBroadcastInitialize ( )

Export for initialize the VMX Broadcast mechanism.

Returns
VOID
698{
700}
VOID VmxBroadcastInitialize()
Initialize the VMX Broadcast mechanism.
Definition VmxBroadcast.c:20

◆ VmFuncVmxBroadcastUninitialize()

VOID VmFuncVmxBroadcastUninitialize ( )

Export for uninitialize the VMX Broadcast mechanism.

Returns
VOID
709{
711}
VOID VmxBroadcastUninitialize()
Uninitialize the VMX Broadcast mechanism.
Definition VmxBroadcast.c:57

◆ VmFuncVmxCompatibleMemcmp()

INT32 VmFuncVmxCompatibleMemcmp ( const CHAR * Address1,
const CHAR * Address2,
size_t Count )

VMX-root compatible memcmp.

Parameters
Address1
Address2
Count
Returns
INT32
788{
789 return VmxCompatibleMemcmp(Address1, Address2, Count);
790}
INT32 VmxCompatibleMemcmp(const CHAR *Address1, const CHAR *Address2, size_t Count)
implementation of vmx-root mode compatible memcmp
Definition Vmx.c:1748

◆ VmFuncVmxCompatibleStrcmp()

INT32 VmFuncVmxCompatibleStrcmp ( const CHAR * Address1,
const CHAR * Address2 )

VMX-root compatible strcmp.

Parameters
Address1
Address2
Returns
INT32
733{
734 return VmxCompatibleStrcmp(Address1, Address2, NULL_ZERO, FALSE);
735}
#define NULL_ZERO
Definition BasicTypes.h:51
INT32 VmxCompatibleStrcmp(const CHAR *Address1, const CHAR *Address2, SIZE_T Num, BOOLEAN IsStrncmp)
implementation of vmx-root mode compatible strcmp and strncmp
Definition Vmx.c:1472

◆ VmFuncVmxCompatibleStrlen()

UINT32 VmFuncVmxCompatibleStrlen ( const CHAR * s)

VMX-root compatible strlen.

Parameters
sA pointer to the string
Returns
UINT32
600{
601 return VmxCompatibleStrlen(s);
602}
UINT32 VmxCompatibleStrlen(const CHAR *S)
implementation of vmx-root mode compatible strlen
Definition Vmx.c:1290

◆ VmFuncVmxCompatibleStrncmp()

INT32 VmFuncVmxCompatibleStrncmp ( const CHAR * Address1,
const CHAR * Address2,
SIZE_T Num )

VMX-root compatible strncmp.

Parameters
Address1
Address2
Num
Returns
INT32
747{
748 return VmxCompatibleStrcmp(Address1, Address2, Num, TRUE);
749}

◆ VmFuncVmxCompatibleWcscmp()

INT32 VmFuncVmxCompatibleWcscmp ( const wchar_t * Address1,
const wchar_t * Address2 )

VMX-root compatible wcscmp.

Parameters
Address1
Address2
Returns
INT32
760{
761 return VmxCompatibleWcscmp(Address1, Address2, NULL_ZERO, FALSE);
762}
INT32 VmxCompatibleWcscmp(const wchar_t *Address1, const wchar_t *Address2, SIZE_T Num, BOOLEAN IsWcsncmp)
implementation of vmx-root mode compatible wcscmp and wcsncmp
Definition Vmx.c:1610

◆ VmFuncVmxCompatibleWcslen()

UINT32 VmFuncVmxCompatibleWcslen ( const wchar_t * s)

VMX-root compatible strlen.

Parameters
sA pointer to the string
Returns
UINT32
612{
613 return VmxCompatibleWcslen(s);
614}
UINT32 VmxCompatibleWcslen(const wchar_t *S)
implementation of vmx-root mode compatible wcslen
Definition Vmx.c:1379

◆ VmFuncVmxCompatibleWcsncmp()

INT32 VmFuncVmxCompatibleWcsncmp ( const wchar_t * Address1,
const wchar_t * Address2,
SIZE_T Num )

VMX-root compatible wcsncmp.

Parameters
Address1
Address2
Num
Returns
INT32
774{
775 return VmxCompatibleWcscmp(Address1, Address2, Num, TRUE);
776}

◆ VmFuncVmxGetCurrentExecutionMode()

BOOLEAN VmFuncVmxGetCurrentExecutionMode ( )

Get the current VMX operation state.

Returns
BOOLEAN
553{
555}
BOOLEAN VmxGetCurrentExecutionMode()
Check current execution mode (vmx-root and non-root)
Definition Vmx.c:222

◆ VmFuncVmxVmcall()

NTSTATUS VmFuncVmxVmcall ( unsigned long long VmcallNumber,
unsigned long long OptionalParam1,
unsigned long long OptionalParam2,
unsigned long long OptionalParam3 )

Export for running VMX VMCALLs.

Parameters
VmcallNumber
OptionalParam1
OptionalParam2
OptionalParam3
Returns
NTSTATUS
687{
688 return AsmVmxVmcall(VmcallNumber, OptionalParam1, OptionalParam2, OptionalParam3);
689}
NTSTATUS AsmVmxVmcall(unsigned long long VmcallNumber, unsigned long long OptionalParam1, unsigned long long OptionalParam2, long long OptionalParam3)
Request Vmcall.

◆ VmFuncWriteExceptionBitmap()

VOID VmFuncWriteExceptionBitmap ( UINT32 BitmapMask)

Write on exception bitmap in VMCS DO NOT CALL IT DIRECTLY, instead use HvSetExceptionBitmap.

Should be called in vmx-root

Parameters
BitmapMaskThe content to write on exception bitmap
Returns
VOID
192{
193 HvWriteExceptionBitmap(BitmapMask);
194}
VOID HvWriteExceptionBitmap(UINT32 BitmapMask)
Write on exception bitmap in VMCS DO NOT CALL IT DIRECTLY, instead use HvSetExceptionBitmap.
Definition Hv.c:572