HyperDbg Debugger
Loading...
Searching...
No Matches
Mtf.h File Reference

Monitor Trap Flag Headers. More...

Go to the source code of this file.

Functions

VOID MtfHandleVmexit (VIRTUAL_MACHINE_STATE *VCpu)
 Handle Monitor Trap Flag vm-exits.

Detailed Description

Monitor Trap Flag Headers.

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

Function Documentation

◆ MtfHandleVmexit()

VOID MtfHandleVmexit ( VIRTUAL_MACHINE_STATE * VCpu)

Handle Monitor Trap Flag vm-exits.

Parameters
VCpuThe virtual processor's state
Returns
VOID
22{
23 BOOLEAN IsMtfHandled = FALSE;
24
25 //
26 // Redo the instruction
27 //
29
30 //
31 // Explicitly say that we want to unset MTFs
32 //
33 VCpu->IgnoreMtfUnset = FALSE;
34
35 //
36 // Check for KD related MTFs
37 //
39 {
40 //
41 // MTF is handled
42 //
43 IsMtfHandled = TRUE;
44 }
45
46 //
47 // *** Regular Monitor Trap Flag functionalities ***
48 //
49 if (VCpu->MtfEptHookRestorePoint)
50 {
51 //
52 // MTF is handled
53 //
54 IsMtfHandled = TRUE;
55
56 //
57 // Restore the previous state
58 //
60
61 //
62 // Set it to NULL
63 //
65
66 //
67 // Check for re-enabling external interrupts
68 //
70 }
71
72 //
73 // Check for ignored MTFs
74 //
75 if (VCpu->IgnoreOneMtf)
76 {
77 //
78 // MTF is handled
79 //
80 IsMtfHandled = TRUE;
81
82 VCpu->IgnoreOneMtf = FALSE;
83 }
84
85 //
86 // Check for possible unhandled MTFs to avoid setting unusable MTFs
87 //
88 if (!IsMtfHandled)
89 {
90 LogError("Err, why MTF occurred?!");
91 }
92
93 //
94 // Final check to unset MTF
95 //
96 if (!VCpu->IgnoreMtfUnset)
97 {
98 //
99 // We don't need MTF anymore if it set to disable MTF
100 //
102 }
103 else
104 {
105 //
106 // Set it to false to avoid future errors
107 //
108 VCpu->IgnoreMtfUnset = FALSE;
109 }
110}
BOOLEAN VmmCallbackHandleMtfCallback(UINT32 CoreId)
routine callback to handle MTF callback
Definition Callback.c:189
VOID EptHookHandleMonitorTrapFlag(VIRTUAL_MACHINE_STATE *VCpu)
Handle vm-exits for Monitor Trap Flag to restore previous state.
Definition EptHook.c:1983
VOID HvSuppressRipIncrement(VIRTUAL_MACHINE_STATE *VCpu)
Suppress the incrementation of RIP.
Definition Hv.c:320
VOID HvEnableAndCheckForPreviousExternalInterrupts(VIRTUAL_MACHINE_STATE *VCpu)
Checks to enable and reinject previous interrupts.
Definition Hv.c:1118
VOID HvSetMonitorTrapFlag(BOOLEAN Set)
Set the monitor trap flag.
Definition Hv.c:345
UCHAR BOOLEAN
Definition BasicTypes.h:35
#define TRUE
Definition BasicTypes.h:114
#define FALSE
Definition BasicTypes.h:113
#define LogError(format,...)
Log in the case of error.
Definition HyperDbgHyperLogIntrinsics.h:113
NULL()
Definition test-case-generator.py:530
BOOLEAN IgnoreMtfUnset
Definition State.h:315
BOOLEAN IgnoreOneMtf
Definition State.h:320
PEPT_HOOKED_PAGE_DETAIL MtfEptHookRestorePoint
Definition State.h:353
UINT32 CoreId
Definition State.h:328