HyperDbg Debugger
Loading...
Searching...
No Matches
IdtEmulation.h
Go to the documentation of this file.
1
12#pragma once
13
15// Constants //
17
23#define USE_DEFAULT_OS_IDT_AS_HOST_IDT FALSE
24
29#define HOST_IDT_DESCRIPTOR_COUNT 256
30
32// Structures //
34
35#pragma pack(push, 1)
36
42
43typedef struct _KIDT_ENTRY
44{
55#if defined _M_AMD64
56 ULONG HighestPart;
57 ULONG Reserved;
58#endif
60
61#pragma pack(pop)
62
68{
69 //
70 // general-purpose registers
71 //
72 union
73 {
74 UINT64 rax;
78 };
79 union
80 {
81 UINT64 rcx;
85 };
86 union
87 {
88 UINT64 rdx;
92 };
93 union
94 {
95 UINT64 rbx;
99 };
100 union
101 {
102 UINT64 rbp;
106 };
107 union
108 {
109 UINT64 rsi;
113 };
114 union
115 {
116 UINT64 rdi;
120 };
121 union
122 {
123 UINT64 r8;
127 };
128 union
129 {
130 UINT64 r9;
134 };
135 union
136 {
137 UINT64 r10;
141 };
142 union
143 {
144 UINT64 r11;
148 };
149 union
150 {
151 UINT64 r12;
155 };
156 union
157 {
158 UINT64 r13;
162 };
163 union
164 {
165 UINT64 r14;
169 };
170 union
171 {
172 UINT64 r15;
176 };
177
178 // interrupt vector
180
181 // _MACHINE_FRAME
182 UINT64 error;
183 UINT64 rip;
184 UINT64 cs;
185 UINT64 rflags;
186 UINT64 rsp;
187 UINT64 ss;
189
190//
191// remember to update this value in AsmInterruptHandlers.asm
192//
193static_assert(sizeof(INTERRUPT_TRAP_FRAME) == (0x78 + 0x38), "Size of INTERRUPT_TRAP_FRAME is not as expected");
194
200{
201 //
202 // whether an exception occurred or not
203 //
205
206 //
207 // interrupt vector
208 //
209 UINT64 Vector;
210
211 //
212 // error code
213 //
214 UINT64 Error;
216
218// Functions //
220
221VOID
223
224VOID
226 _In_ VMEXIT_INTERRUPT_INFORMATION InterruptExit);
227
228VOID
230 _In_ VMEXIT_INTERRUPT_INFORMATION InterruptExit);
231
232VOID
234
235VOID
237
238VOID
240 BOOLEAN ReadFromVmxRoot);
VOID IdtEmulationQueryIdtEntriesRequest(PINTERRUPT_DESCRIPTOR_TABLE_ENTRIES_PACKETS IdtQueryRequest, BOOLEAN ReadFromVmxRoot)
Perform query for IDT entries.
Definition IdtEmulation.c:23
VOID IdtEmulationHandleExceptionAndNmi(_Inout_ VIRTUAL_MACHINE_STATE *VCpu, _In_ VMEXIT_INTERRUPT_INFORMATION InterruptExit)
Handle NMI and exception vm-exits.
Definition IdtEmulation.c:336
struct _SIDT_ENTRY * PSIDT_ENTRY
VOID IdtEmulationHandleInterruptWindowExiting(_Inout_ VIRTUAL_MACHINE_STATE *VCpu)
Handle interrupt-window exitings.
Definition IdtEmulation.c:662
VOID IdtEmulationPrepareHostIdt(_Inout_ VIRTUAL_MACHINE_STATE *VCpu)
Prepare Host IDT.
Definition IdtEmulation.c:117
struct _INTERRUPT_TRAP_FRAME INTERRUPT_TRAP_FRAME
Trap frame for interrupts.
struct _HOST_EXCEPTION_INFO * PHOST_EXCEPTION_INFO
VOID IdtEmulationHandleExternalInterrupt(_Inout_ VIRTUAL_MACHINE_STATE *VCpu, _In_ VMEXIT_INTERRUPT_INFORMATION InterruptExit)
external-interrupt vm-exit handler
Definition IdtEmulation.c:512
struct _KIDT_ENTRY * PKIDT_ENTRY
struct _HOST_EXCEPTION_INFO HOST_EXCEPTION_INFO
Filled out when a host exception occurs.
VOID IdtEmulationHandleNmiWindowExiting(_Inout_ VIRTUAL_MACHINE_STATE *VCpu)
Handle NMI-window exitings.
Definition IdtEmulation.c:605
struct _KIDT_ENTRY KIDT_ENTRY
struct _SIDT_ENTRY SIDT_ENTRY
struct _INTERRUPT_TRAP_FRAME * PINTERRUPT_TRAP_FRAME
unsigned short UINT16
Definition BasicTypes.h:53
UCHAR BOOLEAN
Definition BasicTypes.h:35
unsigned short USHORT
Definition BasicTypes.h:30
unsigned char UINT8
Definition BasicTypes.h:52
unsigned int UINT32
Definition BasicTypes.h:54
unsigned long ULONG
Definition BasicTypes.h:31
struct _INTERRUPT_DESCRIPTOR_TABLE_ENTRIES_PACKETS * PINTERRUPT_DESCRIPTOR_TABLE_ENTRIES_PACKETS
struct _VIRTUAL_MACHINE_STATE VIRTUAL_MACHINE_STATE
The status of each core after and before VMX.
Filled out when a host exception occurs.
Definition IdtEmulation.h:200
BOOLEAN ExceptionOccurred
Definition IdtEmulation.h:204
UINT64 Vector
Definition IdtEmulation.h:209
UINT64 Error
Definition IdtEmulation.h:214
Trap frame for interrupts.
Definition IdtEmulation.h:68
UINT16 r11w
Definition IdtEmulation.h:146
UINT64 cs
Definition IdtEmulation.h:184
UINT8 al
Definition IdtEmulation.h:77
UINT16 r10w
Definition IdtEmulation.h:139
UINT16 r14w
Definition IdtEmulation.h:167
UINT64 rip
Definition IdtEmulation.h:183
UINT64 r8
Definition IdtEmulation.h:123
UINT8 r13b
Definition IdtEmulation.h:161
UINT64 rdi
Definition IdtEmulation.h:116
UINT8 sil
Definition IdtEmulation.h:112
UINT32 r13d
Definition IdtEmulation.h:159
UINT16 bx
Definition IdtEmulation.h:97
UINT64 ss
Definition IdtEmulation.h:187
UINT32 r8d
Definition IdtEmulation.h:124
UINT32 ebx
Definition IdtEmulation.h:96
UINT64 rdx
Definition IdtEmulation.h:88
UINT16 di
Definition IdtEmulation.h:118
UINT8 cl
Definition IdtEmulation.h:84
UINT32 r9d
Definition IdtEmulation.h:131
UINT64 r10
Definition IdtEmulation.h:137
UINT32 ebp
Definition IdtEmulation.h:103
UINT64 rbx
Definition IdtEmulation.h:95
UINT64 rsi
Definition IdtEmulation.h:109
UINT32 edi
Definition IdtEmulation.h:117
UINT16 bp
Definition IdtEmulation.h:104
UINT8 dil
Definition IdtEmulation.h:119
UINT16 si
Definition IdtEmulation.h:111
UINT64 rax
Definition IdtEmulation.h:74
UINT32 edx
Definition IdtEmulation.h:89
UINT16 dx
Definition IdtEmulation.h:90
UINT32 r14d
Definition IdtEmulation.h:166
UINT8 bl
Definition IdtEmulation.h:98
UINT64 r12
Definition IdtEmulation.h:151
UINT8 r14b
Definition IdtEmulation.h:168
UINT64 r14
Definition IdtEmulation.h:165
UINT8 dl
Definition IdtEmulation.h:91
UINT16 ax
Definition IdtEmulation.h:76
UINT64 rsp
Definition IdtEmulation.h:186
UINT8 r10b
Definition IdtEmulation.h:140
UINT32 r15d
Definition IdtEmulation.h:173
UINT64 rbp
Definition IdtEmulation.h:102
UINT16 r15w
Definition IdtEmulation.h:174
UINT64 r15
Definition IdtEmulation.h:172
UINT16 r9w
Definition IdtEmulation.h:132
UINT64 r11
Definition IdtEmulation.h:144
UINT16 r12w
Definition IdtEmulation.h:153
UINT32 ecx
Definition IdtEmulation.h:82
UINT64 error
Definition IdtEmulation.h:182
UINT16 r8w
Definition IdtEmulation.h:125
UINT32 r11d
Definition IdtEmulation.h:145
UINT32 r10d
Definition IdtEmulation.h:138
UINT8 bpl
Definition IdtEmulation.h:105
UINT8 r9b
Definition IdtEmulation.h:133
UINT64 r9
Definition IdtEmulation.h:130
UINT8 r8b
Definition IdtEmulation.h:126
UINT16 cx
Definition IdtEmulation.h:83
UINT32 eax
Definition IdtEmulation.h:75
UINT64 rcx
Definition IdtEmulation.h:81
UINT64 rflags
Definition IdtEmulation.h:185
UINT8 r11b
Definition IdtEmulation.h:147
UINT8 r15b
Definition IdtEmulation.h:175
UINT32 r12d
Definition IdtEmulation.h:152
UINT16 r13w
Definition IdtEmulation.h:160
UINT8 r12b
Definition IdtEmulation.h:154
UINT32 esi
Definition IdtEmulation.h:110
UINT64 r13
Definition IdtEmulation.h:158
UINT8 vector
Definition IdtEmulation.h:179
Definition IdtEmulation.h:44
ULONG SegmentSelector
Definition IdtEmulation.h:46
ULONG Reserved1
Definition IdtEmulation.h:47
ULONG Present
Definition IdtEmulation.h:53
ULONG Size
Definition IdtEmulation.h:50
ULONG Reserved2
Definition IdtEmulation.h:48
ULONG LowPart
Definition IdtEmulation.h:45
ULONG Dpl
Definition IdtEmulation.h:52
ULONG HighPart
Definition IdtEmulation.h:54
ULONG Type
Definition IdtEmulation.h:49
ULONG Reserved3
Definition IdtEmulation.h:51
Definition IdtEmulation.h:38
ULONG_PTR IdtBase
Definition IdtEmulation.h:40
USHORT IdtLimit
Definition IdtEmulation.h:39