ReactOS 0.4.15-dev-6047-gb29e82d
kiinit.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/ke/amd64/kiinit.c
5 * PURPOSE: Kernel Initialization for x86 CPUs
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 * Timo Kreuzer (timo.kreuzer@reactos.org)
8 */
9
10/* INCLUDES *****************************************************************/
11
12#include <ntoskrnl.h>
13#define NDEBUG
14#include <debug.h>
15
16#define REQUIRED_FEATURE_BITS (KF_RDTSC|KF_CR4|KF_CMPXCHG8B|KF_XMMI|KF_XMMI64| \
17 KF_LARGE_PAGE|KF_FAST_SYSCALL|KF_GLOBAL_PAGE| \
18 KF_CMOV|KF_PAT|KF_MMX|KF_FXSR|KF_NX_BIT|KF_MTRR)
19
20/* GLOBALS *******************************************************************/
21
22/* Function pointer for early debug prints */
23ULONG (*FrLdrDbgPrint)(const char *Format, ...);
24
25/* Spinlocks used only on X86 */
27
28
30
31/* Boot and double-fault/NMI/DPC stack */
32UCHAR DECLSPEC_ALIGN(16) P0BootStackData[KERNEL_STACK_SIZE] = {0};
33UCHAR DECLSPEC_ALIGN(16) KiDoubleFaultStackData[KERNEL_STACK_SIZE] = {0};
36
38
42
43/* FUNCTIONS *****************************************************************/
44
45CODE_SEG("INIT")
46VOID
49{
50 /* Check for large page support */
52 {
53 /* FIXME: Support this */
54 DPRINT("Large Page support detected but not yet taken advantage of!\n");
55 }
56
57 /* Check for global page support */
59 {
60 /* FIXME: Support this */
61 DPRINT("Global Page support detected but not yet taken advantage of!\n");
62 }
63
64 /* Check if we have MTRR */
66 {
67 /* FIXME: Support this */
68 DPRINT("MTRR support detected but not yet taken advantage of!\n");
69 }
70
71 /* Check for PAT and/or MTRR support */
73 {
74 /* FIXME: Support this */
75 DPRINT("PAT support detected but not yet taken advantage of!\n");
76 }
77
78// /* Allocate the IOPM save area */
79// Ki386IopmSaveArea = ExAllocatePoolWithTag(PagedPool,
80// IOPM_SIZE,
81// ' eK');
82// if (!Ki386IopmSaveArea)
83// {
84// /* Bugcheck. We need this for V86/VDM support. */
85// KeBugCheckEx(NO_PAGES_AVAILABLE, 2, IOPM_SIZE, 0, 0);
86// }
87
88}
89
90VOID
93 IN ULONG ProcessorNumber,
94 IN PKTHREAD IdleThread,
95 IN PVOID DpcStack)
96{
97 KDESCRIPTOR GdtDescriptor = {{0},0,0}, IdtDescriptor = {{0},0,0};
98 PKGDTENTRY64 TssEntry;
99 USHORT Tr = 0;
100
101 /* Zero out the PCR */
102 RtlZeroMemory(Pcr, sizeof(KIPCR));
103
104 /* Set pointers to ourselves */
105 Pcr->Self = (PKPCR)Pcr;
106 Pcr->CurrentPrcb = &Pcr->Prcb;
107
108 /* Set the PCR Version */
109 Pcr->MajorVersion = PCR_MAJOR_VERSION;
110 Pcr->MinorVersion = PCR_MINOR_VERSION;
111
112 /* Set the PRCB Version */
113 Pcr->Prcb.MajorVersion = PRCB_MAJOR_VERSION;
114 Pcr->Prcb.MinorVersion = PRCB_MINOR_VERSION;
115
116 /* Set the Build Type */
117 Pcr->Prcb.BuildType = 0;
118#ifndef CONFIG_SMP
119 Pcr->Prcb.BuildType |= PRCB_BUILD_UNIPROCESSOR;
120#endif
121#if DBG
122 Pcr->Prcb.BuildType |= PRCB_BUILD_DEBUG;
123#endif
124
125 /* Set the Processor Number and current Processor Mask */
126 Pcr->Prcb.Number = (UCHAR)ProcessorNumber;
127 Pcr->Prcb.SetMember = 1ULL << ProcessorNumber;
128
129 /* Get GDT and IDT descriptors */
130 __sgdt(&GdtDescriptor.Limit);
131 __sidt(&IdtDescriptor.Limit);
132 Pcr->GdtBase = (PVOID)GdtDescriptor.Base;
133 Pcr->IdtBase = (PKIDTENTRY)IdtDescriptor.Base;
134
135 /* Get TSS Selector */
136 __str(&Tr);
137 ASSERT(Tr == KGDT64_SYS_TSS);
138
139 /* Get TSS Entry */
140 TssEntry = KiGetGdtEntry(Pcr->GdtBase, Tr);
141
142 /* Get the KTSS itself */
143 Pcr->TssBase = KiGetGdtDescriptorBase(TssEntry);
144
145 Pcr->Prcb.RspBase = Pcr->TssBase->Rsp0; // FIXME
146
147 /* Set DPC Stack */
148 Pcr->Prcb.DpcStack = DpcStack;
149
150 /* Setup the processor set */
151 Pcr->Prcb.MultiThreadProcessorSet = Pcr->Prcb.SetMember;
152
153 /* Clear DR6/7 to cleanup bootloader debugging */
154 Pcr->Prcb.ProcessorState.SpecialRegisters.KernelDr6 = 0;
155 Pcr->Prcb.ProcessorState.SpecialRegisters.KernelDr7 = 0;
156
157 /* Initialize MXCSR (all exceptions masked) */
158 Pcr->Prcb.MxCsr = INITIAL_MXCSR;
159
160 /* Set the Current Thread */
161 Pcr->Prcb.CurrentThread = IdleThread;
162
163 /* Start us out at PASSIVE_LEVEL */
164 Pcr->Irql = PASSIVE_LEVEL;
166}
167
168VOID
169NTAPI
171{
172 ULONG64 Pat;
173 ULONG FeatureBits;
174
175 /* Initialize gs */
177
178 /* Set GS base */
181
182 /* Detect and set the CPU Type */
184
185 /* Get the processor features for this CPU */
186 FeatureBits = KiGetFeatureBits();
187
188 /* Check if we support all needed features */
189 if ((FeatureBits & REQUIRED_FEATURE_BITS) != REQUIRED_FEATURE_BITS)
190 {
191 /* If not, bugcheck system */
192 FrLdrDbgPrint("CPU doesn't have needed features! Has: 0x%x, required: 0x%x\n",
193 FeatureBits, REQUIRED_FEATURE_BITS);
194 KeBugCheck(0);
195 }
196
197 /* Set DEP to always on */
199 FeatureBits |= KF_NX_ENABLED;
200
201 /* Save feature bits */
202 Pcr->Prcb.FeatureBits = FeatureBits;
203
204 /* Enable fx save restore support */
206
207 /* Enable XMMI exceptions */
209
210 /* Enable Write-Protection */
212
213 /* Disable fpu monitoring */
215
216 /* Disable x87 fpu exceptions */
218
219 /* LDT is unused */
220 __lldt(0);
221
222 /* Set the systemcall entry points */
225
228
229 /* Set the flags to be cleared when doing a syscall */
231
232 /* Enable syscall instruction and no-execute support */
234
235 /* Initialize the PAT */
236 Pat = (PAT_WB << 0) | (PAT_WC << 8) | (PAT_UCM << 16) | (PAT_UC << 24) |
237 (PAT_WB << 32) | (PAT_WC << 40) | (PAT_UCM << 48) | (PAT_UC << 56);
238 __writemsr(MSR_PAT, Pat);
239
240 /* Initialize MXCSR */
242}
243
244VOID
248{
249 PKGDTENTRY64 TssEntry;
250
251 /* Get pointer to the GDT entry */
252 TssEntry = KiGetGdtEntry(KeGetPcr()->GdtBase, KGDT64_SYS_TSS);
253
254 /* Initialize the GDT entry */
255 KiInitGdtEntry(TssEntry, (ULONG64)Tss, sizeof(KTSS64), AMD64_TSS, 0);
256
257 /* Zero out the TSS */
258 RtlZeroMemory(Tss, sizeof(KTSS64));
259
260 /* FIXME: I/O Map? */
261 Tss->IoMapBase = 0x68;
262
263 /* Setup ring 0 stack pointer */
264 Tss->Rsp0 = Stack;
265
266 /* Setup a stack for Double Fault Traps */
267 Tss->Ist[1] = (ULONG64)KiDoubleFaultStack;
268
269 /* Setup a stack for CheckAbort Traps */
270 Tss->Ist[2] = (ULONG64)KiDoubleFaultStack;
271
272 /* Setup a stack for NMI Traps */
273 Tss->Ist[3] = (ULONG64)KiDoubleFaultStack;
274
275 /* Load the task register */
276 __ltr(KGDT64_SYS_TSS);
277}
278
279CODE_SEG("INIT")
280VOID
281NTAPI
283 IN PKPRCB Prcb,
284 IN PLOADER_PARAMETER_BLOCK LoaderBlock)
285{
286 /* Set boot-level flags */
287 KeI386CpuType = Prcb->CpuType;
288 KeI386CpuStep = Prcb->CpuStep;
290 KeProcessorLevel = (USHORT)Prcb->CpuType;
291 if (Prcb->CpuID)
292 KeProcessorRevision = Prcb->CpuStep;
293
294 /* Set basic CPU Features that user mode can read */
295 SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
297 SharedUserData->ProcessorFeatures[PF_PPC_MOVEMEM_64BIT_OK] = TRUE;
298 SharedUserData->ProcessorFeatures[PF_PAE_ENABLED] = TRUE; // ???
299 SharedUserData->ProcessorFeatures[PF_NX_ENABLED] = TRUE;
300 SharedUserData->ProcessorFeatures[PF_FASTFAIL_AVAILABLE] = TRUE;
301 SharedUserData->ProcessorFeatures[PF_XSAVE_ENABLED] = TRUE;
303 (Prcb->FeatureBits & KF_MMX) ? TRUE: FALSE;
305 ((Prcb->FeatureBits & KF_FXSR) && (Prcb->FeatureBits & KF_XMMI)) ? TRUE: FALSE;
307 ((Prcb->FeatureBits & KF_FXSR) && (Prcb->FeatureBits & KF_XMMI64)) ? TRUE: FALSE;
309 (Prcb->FeatureBits & KF_3DNOW) ? TRUE: FALSE;
311 (Prcb->FeatureBits & KF_SSE3) ? TRUE: FALSE;
312 SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE128] =
313 (Prcb->FeatureBits & KF_CMPXCHG16B) ? TRUE: FALSE;
314
315 /* Set the default NX policy (opt-in) */
316 SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTIN;
317
318 /* Check if NPX is always on */
319 if (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=ALWAYSON"))
320 {
321 /* Set it always on */
323 Prcb->FeatureBits |= KF_NX_ENABLED;
324 }
325 else if (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=OPTOUT"))
326 {
327 /* Set it in opt-out mode */
328 SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTOUT;
329 Prcb->FeatureBits |= KF_NX_ENABLED;
330 }
331 else if ((strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=OPTIN")) ||
332 (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE")))
333 {
334 /* Set the feature bits */
335 Prcb->FeatureBits |= KF_NX_ENABLED;
336 }
337 else if ((strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=ALWAYSOFF")) ||
338 (strstr(KeLoaderBlock->LoadOptions, "EXECUTE")))
339 {
340 /* Set disabled mode */
342 Prcb->FeatureBits |= KF_NX_DISABLED;
343 }
344}
345
347
348void
350{
351 PLDR_DATA_TABLE_ENTRY LdrEntry;
353 ULONG i;
354
355 /* Initialize the list head */
357
358 /* Loop the first 3 entries */
359 for (Entry = LoaderBlock->LoadOrderListHead.Flink, i = 0;
360 Entry != &LoaderBlock->LoadOrderListHead && i < 3;
361 Entry = Entry->Flink, i++)
362 {
363 /* Get the data table entry */
364 LdrEntry = CONTAINING_RECORD(Entry,
366 InLoadOrderLinks);
367
368 /* Copy the entry */
369 LdrCoreEntries[i] = *LdrEntry;
370
371 /* Insert the copy into the list */
373 }
374}
375
376CODE_SEG("INIT")
378VOID
379NTAPI
381{
382 CCHAR Cpu;
383 PKTHREAD InitialThread;
384 ULONG64 InitialStack;
385 PKIPCR Pcr;
386
387 /* Boot cycles timestamp */
389
390 /* HACK */
391 FrLdrDbgPrint = LoaderBlock->u.I386.CommonDataArea;
392 //FrLdrDbgPrint("Hello from KiSystemStartup!!!\n");
393
394 /* Save the loader block */
395 KeLoaderBlock = LoaderBlock;
396
397 /* Get the current CPU number */
398 Cpu = KeNumberProcessors++; // FIXME
399
400 /* LoaderBlock initialization for Cpu 0 */
401 if (Cpu == 0)
402 {
403 /* Set the initial stack, idle thread and process */
404 LoaderBlock->KernelStack = (ULONG_PTR)P0BootStack;
405 LoaderBlock->Thread = (ULONG_PTR)&KiInitialThread;
406 LoaderBlock->Process = (ULONG_PTR)&KiInitialProcess.Pcb;
407 LoaderBlock->Prcb = (ULONG_PTR)&KiInitialPcr.Prcb;
408 }
409
410 /* Get Pcr from loader block */
411 Pcr = CONTAINING_RECORD(LoaderBlock->Prcb, KIPCR, Prcb);
412
413 /* Set the PRCB for this Processor */
414 KiProcessorBlock[Cpu] = &Pcr->Prcb;
415
416 /* Align stack to 16 bytes */
417 LoaderBlock->KernelStack &= ~(16 - 1);
418
419 /* Save the initial thread and stack */
420 InitialStack = LoaderBlock->KernelStack; // Checkme
421 InitialThread = (PKTHREAD)LoaderBlock->Thread;
422
423 /* Set us as the current process */
424 InitialThread->ApcState.Process = (PVOID)LoaderBlock->Process;
425
426 /* Initialize the PCR */
427 KiInitializePcr(Pcr, Cpu, InitialThread, (PVOID)KiDoubleFaultStack);
428
429 /* Initialize the CPU features */
430 KiInitializeCpu(Pcr);
431
432 /* Initial setup for the boot CPU */
433 if (Cpu == 0)
434 {
435 /* Initialize the module list (ntos, hal, kdcom) */
436 KiInitModuleList(LoaderBlock);
437
438 /* Setup the TSS descriptors and entries */
439 KiInitializeTss(Pcr->TssBase, InitialStack);
440
441 /* Setup the IDT */
443
444 /* Initialize debugging system */
446
447 /* Check for break-in */
449 }
450
451 DPRINT1("Pcr = %p, Gdt = %p, Idt = %p, Tss = %p\n",
452 Pcr, Pcr->GdtBase, Pcr->IdtBase, Pcr->TssBase);
453
454 /* Acquire lock */
455 while (InterlockedBitTestAndSet64((PLONG64)&KiFreezeExecutionLock, 0))
456 {
457 /* Loop until lock is free */
458 while ((*(volatile KSPIN_LOCK*)&KiFreezeExecutionLock) & 1);
459 }
460
461 /* Initialize the Processor with HAL */
463
464 /* Set processor as active */
465 KeActiveProcessors |= 1ULL << Cpu;
466
467 /* Release lock */
469
470 /* Raise to HIGH_LEVEL */
472
473 /* Machine specific kernel initialization */
474 if (Cpu == 0) KiInitializeKernelMachineDependent(&Pcr->Prcb, LoaderBlock);
475
476 /* Switch to new kernel stack and start kernel bootstrapping */
477 KiSwitchToBootStack(InitialStack & ~3);
478}
479
unsigned long long UINT64
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
FORCEINLINE PVOID KiGetGdtDescriptorBase(PKGDTENTRY Entry)
Definition: intrin_i.h:20
FORCEINLINE VOID KiInitGdtEntry(PKGDTENTRY64 Entry, ULONG64 Base, ULONG Size, UCHAR Type, UCHAR Dpl)
Definition: intrin_i.h:48
void KiInitializeSegments()
ULONG_PTR P0BootStack
Definition: kiinit.c:34
void KiSystemCallEntry32()
ULONG(* FrLdrDbgPrint)(const char *Format,...)
Definition: kiinit.c:23
VOID FASTCALL KiInitializeTss(IN PKTSS64 Tss, IN UINT64 Stack)
Definition: kiinit.c:246
DECLSPEC_NORETURN VOID NTAPI KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:380
KSPIN_LOCK KiFreezeExecutionLock
Definition: kiinit.c:26
ULONGLONG BootCyclesEnd
Definition: kiinit.c:37
VOID NTAPI KiInitializePcr(IN PKIPCR Pcr, IN ULONG ProcessorNumber, IN PKTHREAD IdleThread, IN PVOID DpcStack)
Definition: kiinit.c:92
static LDR_DATA_TABLE_ENTRY LdrCoreEntries[3]
Definition: kiinit.c:346
void KiInitModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:349
VOID NTAPI KiInitMachineDependent(VOID)
Definition: kiinit.c:48
VOID NTAPI KiInitializeKernelMachineDependent(IN PKPRCB Prcb, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:282
void KiSystemCallEntry64()
ULONG_PTR KiDoubleFaultStack
Definition: kiinit.c:35
#define REQUIRED_FEATURE_BITS
Definition: kiinit.c:16
KIPCR KiInitialPcr
Definition: kiinit.c:29
VOID NTAPI KiInitializeCpu(PKIPCR Pcr)
Definition: kiinit.c:170
ULONGLONG BootCycles
Definition: kiinit.c:37
FORCEINLINE PKGDTENTRY KiGetGdtEntry(IN PVOID pGdt, IN USHORT Selector)
Definition: winldr.c:69
#define DPRINT1
Definition: precomp.h:8
__int64 * PLONG64
Definition: basetsd.h:185
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1431
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ULONG_PTR
Definition: config.h:101
#define InsertTailList(ListHead, Entry)
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
KIRQL FASTCALL KfRaiseIrql(IN KIRQL NewIrql)
Definition: pic.c:187
VOID NTAPI HalInitializeProcessor(IN ULONG ProcessorNumber, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: processor.c:48
#define InterlockedAnd64
Definition: interlocked.h:87
PPC_QUAL void __writemsr(const unsigned long Value)
Definition: intrin_ppc.h:748
PPC_QUAL unsigned long long __readmsr()
Definition: intrin_ppc.h:741
PPC_QUAL unsigned long long __rdtsc(void)
Definition: intrin_ppc.h:688
__INTRIN_INLINE unsigned long __readcr4(void)
Definition: intrin_x86.h:1825
__INTRIN_INLINE unsigned long __readcr0(void)
Definition: intrin_x86.h:1804
__INTRIN_INLINE void __writecr0(unsigned int Data)
Definition: intrin_x86.h:1789
__INTRIN_INLINE void __sidt(void *Destination)
Definition: intrin_x86.h:2023
__INTRIN_INLINE void __writecr4(unsigned int Data)
Definition: intrin_x86.h:1799
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
BOOLEAN NTAPI KdInitSystem(_In_ ULONG BootPhase, _In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kdinit.c:142
BOOLEAN NTAPI KdPollBreakIn(VOID)
Definition: kdlock.c:75
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:29
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
unsigned __int64 ULONG64
Definition: imports.h:198
#define EFLAGS_DF
Definition: strlen.c:26
VOID KeSetCurrentIrql(KIRQL NewIrql)
Definition: mpsirql.c:51
#define CR0_NE
Definition: asm.h:250
#define CR0_WP
Definition: asm.h:251
#define CR0_MP
Definition: asm.h:246
#define PAT_UC
Definition: ketypes.h:205
#define PRCB_MINOR_VERSION
Definition: ketypes.h:245
#define KGDT64_SYS_TSS
Definition: ketypes.h:77
#define CR4_XMMEXCPT
Definition: ketypes.h:93
#define MSR_SCE
Definition: ketypes.h:215
#define MSR_PAT
Definition: ketypes.h:219
#define MSR_GS_SWAP
Definition: ketypes.h:193
#define KGDT64_R0_CODE
Definition: ketypes.h:72
#define MSR_EFER
Definition: ketypes.h:186
#define EFLAGS_TF
Definition: ketypes.h:125
#define PRCB_MAJOR_VERSION
Definition: ketypes.h:246
#define MSR_SYSCALL_MASK
Definition: ketypes.h:190
#define KGDT64_R3_CMCODE
Definition: ketypes.h:74
#define MSR_STAR
Definition: ketypes.h:187
#define EFLAGS_IF_MASK
Definition: ketypes.h:143
#define MSR_LSTAR
Definition: ketypes.h:188
#define MSR_GS_BASE
Definition: ketypes.h:192
#define PAT_WB
Definition: ketypes.h:209
#define PAT_UCM
Definition: ketypes.h:210
#define PRCB_BUILD_UNIPROCESSOR
Definition: ketypes.h:248
#define CR4_FXSR
Definition: ketypes.h:92
#define MSR_NXE
Definition: ketypes.h:218
#define PRCB_BUILD_DEBUG
Definition: ketypes.h:247
#define RPL_MASK
Definition: ketypes.h:69
#define MSR_CSTAR
Definition: ketypes.h:189
#define PAT_WC
Definition: ketypes.h:206
#define DBG_STATUS_CONTROL_C
Definition: kdtypes.h:39
#define KF_MTRR
Definition: ketypes.h:149
#define KF_CMPXCHG16B
Definition: ketypes.h:163
#define KF_NX_DISABLED
Definition: ketypes.h:166
#define KF_XMMI64
Definition: ketypes.h:159
#define KF_NX_ENABLED
Definition: ketypes.h:167
#define KF_3DNOW
Definition: ketypes.h:157
#define KF_FXSR
Definition: ketypes.h:154
#define KF_LARGE_PAGE
Definition: ketypes.h:148
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114
#define KF_XMMI
Definition: ketypes.h:156
#define KF_MMX
Definition: ketypes.h:151
#define KF_SSE3
Definition: ketypes.h:162
#define KF_PAT
Definition: ketypes.h:153
#define KF_GLOBAL_PAGE
Definition: ketypes.h:147
struct _KTHREAD * PKTHREAD
Definition: nt_native.h:28
#define FASTCALL
Definition: nt_native.h:50
#define DECLSPEC_ALIGN(x)
Definition: ntbasedef.h:251
#define DECLSPEC_NORETURN
Definition: ntbasedef.h:176
DECLSPEC_NORETURN VOID KiSwitchToBootStack(IN ULONG_PTR InitialStack)
Definition: ke.h:827
ULONG KiGetFeatureBits(VOID)
Definition: cpu.c:150
ULONG KeI386CpuType
Definition: cpu.c:22
VOID KiSetProcessorType(VOID)
Definition: cpu.c:97
#define AMD64_TSS
Definition: ke.h:85
ULONG KeI386CpuStep
Definition: cpu.c:23
EPROCESS KiInitialProcess
Definition: krnlinit.c:45
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
ETHREAD KiInitialThread
Definition: krnlinit.c:44
KAFFINITY KeActiveProcessors
Definition: krnlinit.c:23
ULONG KeFeatureBits
Definition: krnlinit.c:22
VOID NTAPI KeInitExceptions(VOID)
Definition: except.c:59
USHORT KeProcessorLevel
Definition: krnlinit.c:20
USHORT KeProcessorRevision
Definition: krnlinit.c:21
USHORT KeProcessorArchitecture
Definition: krnlinit.c:19
unsigned short USHORT
Definition: pedump.c:61
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:21
#define KERNEL_STACK_SIZE
#define PCR_MINOR_VERSION
Definition: ke.h:286
struct _KPCR * PKPCR
#define PCR_MAJOR_VERSION
Definition: ke.h:287
#define SharedUserData
#define INITIAL_MXCSR
#define KeGetPcr()
Definition: ke.h:26
#define DPRINT
Definition: sndvol32.h:71
base of all file and directory entries
Definition: entries.h:83
KPROCESS Pcb
Definition: pstypes.h:1262
PVOID Base
Definition: ketypes.h:491
USHORT Limit
Definition: ketypes.h:490
KPRCB Prcb
Definition: ketypes.h:894
union _KGDTENTRY64 * GdtBase
Definition: ketypes.h:865
struct _KTSS64 * TssBase
Definition: ketypes.h:866
union _KIDTENTRY64 * IdtBase
Definition: ketypes.h:874
ULONG FeatureBits
Definition: ketypes.h:804
KAPC_STATE ApcState
Definition: ketypes.h:1718
Definition: btrfs_drv.h:1876
Definition: typedefs.h:120
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
char CCHAR
Definition: typedefs.h:51
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus(_In_ ULONG Status)
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
#define PF_PAE_ENABLED
#define NX_SUPPORT_POLICY_ALWAYSOFF
Definition: ketypes.h:1149
#define PF_XSAVE_ENABLED
#define PF_3DNOW_INSTRUCTIONS_AVAILABLE
#define PF_MMX_INSTRUCTIONS_AVAILABLE
#define PF_XMMI64_INSTRUCTIONS_AVAILABLE
#define PF_PPC_MOVEMEM_64BIT_OK
#define PF_XMMI_INSTRUCTIONS_AVAILABLE
#define NX_SUPPORT_POLICY_OPTIN
Definition: ketypes.h:1151
#define NX_SUPPORT_POLICY_OPTOUT
Definition: ketypes.h:1152
#define NX_SUPPORT_POLICY_ALWAYSON
Definition: ketypes.h:1150
#define PF_COMPARE_EXCHANGE_DOUBLE
#define PF_FASTFAIL_AVAILABLE
#define PF_SSE3_INSTRUCTIONS_AVAILABLE
#define PF_RDTSC_INSTRUCTION_AVAILABLE
#define PF_NX_ENABLED
#define PF_COMPARE_EXCHANGE128
unsigned char UCHAR
Definition: xmlstorage.h:181
void _mm_setcsr(unsigned int a)
Definition: xmmintrin.h:542