Initialize the host GDT.
102{
103
104
105
106
107
108 RtlCopyBytes(AllocatedHostGdt, OsGdtBase, OsGdtLimit + 1);
109
110
111
112
113 RtlZeroBytes(AllocatedHostTss, sizeof(TASK_STATE_SEGMENT_64));
114
115#if USE_INTERRUPT_STACK_TABLE == TRUE
116
118
119
120
121
123 EndOfStack = ((
UINT64)((ULONG_PTR)(EndOfStack) & ~(16 - 1)));
124
125 LogDebugInfo(
"Host Interrupt Stack, from: %llx, to: %llx", HostStack, EndOfStack);
126
127 AllocatedHostTss->Rsp0 = EndOfStack;
128 AllocatedHostTss->Rsp1 = EndOfStack;
129 AllocatedHostTss->Rsp2 = EndOfStack;
130 AllocatedHostTss->Ist1 = EndOfStack;
131 AllocatedHostTss->Ist2 = EndOfStack;
132 AllocatedHostTss->Ist3 = EndOfStack;
133 AllocatedHostTss->Ist4 = EndOfStack;
134 AllocatedHostTss->Ist5 = EndOfStack;
135 AllocatedHostTss->Ist6 = EndOfStack;
136 AllocatedHostTss->Ist7 = EndOfStack;
137
138#else
139
140 UNREFERENCED_PARAMETER(HostStack);
141
142#endif
143
144
145
146
147 SEGMENT_DESCRIPTOR_64 * GdtTssDesc = (SEGMENT_DESCRIPTOR_64 *)&AllocatedHostGdt[TrSelector];
148
149
150
151
153 GdtTssDesc->BaseAddressLow = (Base >> 00) & 0xFFFF;
154 GdtTssDesc->BaseAddressMiddle = (Base >> 16) & 0xFF;
155 GdtTssDesc->BaseAddressHigh = (Base >> 24) & 0xFF;
156 GdtTssDesc->BaseAddressUpper = (Base >> 32) & 0xFFFFFFFF;
157
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195}
#define LogDebugInfo(format,...)
Log, initialize boot information and debug information.
Definition HyperDbgHyperLogIntrinsics.h:155
#define HOST_INTERRUPT_STACK_SIZE
Size of host interrupt stack.
Definition Segmentation.h:35