ReactOS 0.4.15-dev-7711-g5627da4
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) KiP0BootStackData[KERNEL_STACK_SIZE] = {0};
33UCHAR DECLSPEC_ALIGN(16) KiP0DoubleFaultStackData[KERNEL_STACK_SIZE] = {0};
35PVOID KiP0DoubleFaultStack = &KiP0DoubleFaultStackData[KERNEL_STACK_SIZE];
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
90static
91VOID
93 _Out_ PKIPCR Pcr,
94 _In_ ULONG ProcessorNumber,
95 _In_ PKGDTENTRY64 GdtBase,
96 _In_ PKIDTENTRY64 IdtBase,
97 _In_ PKTSS64 TssBase,
98 _In_ PKTHREAD IdleThread,
99 _In_ PVOID DpcStack)
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 /* Set GDT and IDT base */
130 Pcr->GdtBase = GdtBase;
131 Pcr->IdtBase = IdtBase;
132
133 /* Set TssBase */
134 Pcr->TssBase = TssBase;
135
136 Pcr->Prcb.RspBase = Pcr->TssBase->Rsp0; // FIXME
137
138 /* Set DPC Stack */
139 Pcr->Prcb.DpcStack = DpcStack;
140
141 /* Setup the processor set */
142 Pcr->Prcb.MultiThreadProcessorSet = Pcr->Prcb.SetMember;
143
144 /* Clear DR6/7 to cleanup bootloader debugging */
145 Pcr->Prcb.ProcessorState.SpecialRegisters.KernelDr6 = 0;
146 Pcr->Prcb.ProcessorState.SpecialRegisters.KernelDr7 = 0;
147
148 /* Initialize MXCSR (all exceptions masked) */
149 Pcr->Prcb.MxCsr = INITIAL_MXCSR;
150
151 /* Set the Current Thread */
152 Pcr->Prcb.CurrentThread = IdleThread;
153
154 /* Start us out at PASSIVE_LEVEL */
155 Pcr->Irql = PASSIVE_LEVEL;
156}
157
158VOID
159NTAPI
161{
162 ULONG64 Pat;
163 ULONG64 FeatureBits;
164
165 /* Initialize gs */
167
168 /* Set GS base */
171
172 /* Detect and set the CPU Type */
174
175 /* Get the processor features for this CPU */
176 FeatureBits = KiGetFeatureBits();
177
178 /* Check if we support all needed features */
179 if ((FeatureBits & REQUIRED_FEATURE_BITS) != REQUIRED_FEATURE_BITS)
180 {
181 /* If not, bugcheck system */
182 FrLdrDbgPrint("CPU doesn't have needed features! Has: 0x%x, required: 0x%x\n",
183 FeatureBits, REQUIRED_FEATURE_BITS);
184 KeBugCheck(0);
185 }
186
187 /* Set DEP to always on */
189 FeatureBits |= KF_NX_ENABLED;
190
191 /* Save feature bits */
192 Pcr->Prcb.FeatureBits = (ULONG)FeatureBits;
193 Pcr->Prcb.FeatureBitsHigh = FeatureBits >> 32;
194
195 /* Enable fx save restore support */
197
198 /* Enable XMMI exceptions */
200
201 /* Enable Write-Protection */
203
204 /* Disable fpu monitoring */
206
207 /* Disable x87 fpu exceptions */
209
210 /* LDT is unused */
211 __lldt(0);
212
213 /* Set the systemcall entry points */
216
219
220 /* Set the flags to be cleared when doing a syscall */
222
223 /* Enable syscall instruction and no-execute support */
225
226 /* Initialize the PAT */
227 Pat = (PAT_WB << 0) | (PAT_WC << 8) | (PAT_UCM << 16) | (PAT_UC << 24) |
228 (PAT_WB << 32) | (PAT_WC << 40) | (PAT_UCM << 48) | (PAT_UC << 56);
229 __writemsr(MSR_PAT, Pat);
230
231 /* Initialize MXCSR */
233
235}
236
237static
238VOID
240 _In_ PKIPCR Pcr,
241 _Out_ PKTSS64 Tss,
242 _In_ PVOID InitialStack,
243 _In_ PVOID DoubleFaultStack,
244 _In_ PVOID NmiStack)
245{
246 PKGDTENTRY64 TssEntry;
247
248 /* Get pointer to the GDT entry */
249 TssEntry = KiGetGdtEntry(Pcr->GdtBase, KGDT64_SYS_TSS);
250
251 /* Initialize the GDT entry */
252 KiInitGdtEntry(TssEntry, (ULONG64)Tss, sizeof(KTSS64), AMD64_TSS, 0);
253
254 /* Zero out the TSS */
255 RtlZeroMemory(Tss, sizeof(KTSS64));
256
257 /* FIXME: I/O Map? */
258 Tss->IoMapBase = 0x68;
259
260 /* Setup ring 0 stack pointer */
261 Tss->Rsp0 = (ULONG64)InitialStack;
262
263 /* Setup a stack for Double Fault Traps */
264 Tss->Ist[1] = (ULONG64)DoubleFaultStack;
265
266 /* Setup a stack for CheckAbort Traps */
267 Tss->Ist[2] = (ULONG64)DoubleFaultStack;
268
269 /* Setup a stack for NMI Traps */
270 Tss->Ist[3] = (ULONG64)NmiStack;
271}
272
273CODE_SEG("INIT")
274VOID
276 _In_ ULONG ProcessorNumber,
277 _Out_ PKIPCR Pcr,
278 _In_ PKGDTENTRY64 GdtBase,
279 _In_ PKIDTENTRY64 IdtBase,
280 _In_ PKTSS64 TssBase,
281 _In_ PKTHREAD IdleThread,
282 _In_ PVOID KernelStack,
283 _In_ PVOID DpcStack,
284 _In_ PVOID DoubleFaultStack,
285 _In_ PVOID NmiStack)
286{
287 /* Initialize the PCR */
288 KiInitializePcr(Pcr,
289 ProcessorNumber,
290 GdtBase,
291 IdtBase,
292 TssBase,
293 IdleThread,
294 DpcStack);
295
296
297 /* Setup the TSS descriptor and entries */
298 KiInitializeTss(Pcr,
299 TssBase,
300 KernelStack,
301 DoubleFaultStack,
302 NmiStack);
303}
304
305CODE_SEG("INIT")
306static
307VOID
310{
311 KDESCRIPTOR GdtDescriptor = {{0},0,0}, IdtDescriptor = {{0},0,0};
312 PKGDTENTRY64 TssEntry;
313 PKTSS64 TssBase;
314
315 /* Set the initial stack, idle thread and process for processor 0 */
316 LoaderBlock->KernelStack = (ULONG_PTR)KiP0BootStack;
317 LoaderBlock->Thread = (ULONG_PTR)&KiInitialThread;
318 LoaderBlock->Process = (ULONG_PTR)&KiInitialProcess.Pcb;
319 LoaderBlock->Prcb = (ULONG_PTR)&KiInitialPcr.Prcb;
320
321 /* Get GDT and IDT descriptors */
322 __sgdt(&GdtDescriptor.Limit);
323 __sidt(&IdtDescriptor.Limit);
324
325 /* Get the boot TSS from the GDT */
326 TssEntry = KiGetGdtEntry(GdtDescriptor.Base, KGDT64_SYS_TSS);
327 TssBase = KiGetGdtDescriptorBase(TssEntry);
328
329 /* Initialize PCR and TSS */
332 GdtDescriptor.Base,
333 IdtDescriptor.Base,
334 TssBase,
340}
341
342CODE_SEG("INIT")
343VOID
344NTAPI
346 IN PKPRCB Prcb,
347 IN PLOADER_PARAMETER_BLOCK LoaderBlock)
348{
349 ULONG64 FeatureBits;
350
351 /* Set boot-level flags */
352 KeI386CpuType = Prcb->CpuType;
353 KeI386CpuStep = Prcb->CpuStep;
355 KeProcessorLevel = (USHORT)Prcb->CpuType;
356 if (Prcb->CpuID)
357 KeProcessorRevision = Prcb->CpuStep;
358
359 FeatureBits = Prcb->FeatureBits | (ULONG64)Prcb->FeatureBitsHigh << 32;
360
361 /* Set basic CPU Features that user mode can read */
363 SharedUserData->ProcessorFeatures[PF_FLOATING_POINT_EMULATED] = FALSE;
364 SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
366 (FeatureBits & KF_MMX) ? TRUE : FALSE;
368 ((FeatureBits & KF_FXSR) && (FeatureBits & KF_XMMI)) ? TRUE : FALSE;
370 (FeatureBits & KF_3DNOW) ? TRUE : FALSE;
372 SharedUserData->ProcessorFeatures[PF_PAE_ENABLED] = TRUE; // ???
374 ((FeatureBits & KF_FXSR) && (FeatureBits & KF_XMMI64)) ? TRUE : FALSE;
375 SharedUserData->ProcessorFeatures[PF_SSE_DAZ_MODE_AVAILABLE] = FALSE; // ???
376 SharedUserData->ProcessorFeatures[PF_NX_ENABLED] = TRUE;
378 (FeatureBits & KF_SSE3) ? TRUE : FALSE;
379 SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE128] =
380 (FeatureBits & KF_CMPXCHG16B) ? TRUE : FALSE;
381 SharedUserData->ProcessorFeatures[PF_COMPARE64_EXCHANGE128] = FALSE; // ???
382 SharedUserData->ProcessorFeatures[PF_CHANNELS_ENABLED] = FALSE; // ???
383 SharedUserData->ProcessorFeatures[PF_XSAVE_ENABLED] = FALSE; // FIXME
385 (FeatureBits & KF_SLAT) ? TRUE : FALSE;
386 SharedUserData->ProcessorFeatures[PF_VIRT_FIRMWARE_ENABLED] =
387 (FeatureBits & KF_VIRT_FIRMWARE_ENABLED) ? TRUE : FALSE;
388 SharedUserData->ProcessorFeatures[PF_RDWRFSGSBASE_AVAILABLE] =
389 (FeatureBits & KF_RDWRFSGSBASE) ? TRUE : FALSE;
390 SharedUserData->ProcessorFeatures[PF_FASTFAIL_AVAILABLE] = TRUE;
392 (FeatureBits & KF_RDRAND) ? TRUE : FALSE;
394 (FeatureBits & KF_RDTSCP) ? TRUE : FALSE;
395 SharedUserData->ProcessorFeatures[PF_RDPID_INSTRUCTION_AVAILABLE] = FALSE; // ???
397 (FeatureBits & KF_SSSE3) ? TRUE : FALSE;
399 (FeatureBits & KF_SSE4_1) ? TRUE : FALSE;
401 (FeatureBits & KF_SSE4_2) ? TRUE : FALSE;
402 SharedUserData->ProcessorFeatures[PF_AVX_INSTRUCTIONS_AVAILABLE] = FALSE; // FIXME
403 SharedUserData->ProcessorFeatures[PF_AVX2_INSTRUCTIONS_AVAILABLE] = FALSE; // FIXME
404 SharedUserData->ProcessorFeatures[PF_AVX512F_INSTRUCTIONS_AVAILABLE] = FALSE; // FIXME
405
406 /* Set the default NX policy (opt-in) */
407 SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTIN;
408
409 /* Check if NPX is always on */
410 if (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=ALWAYSON"))
411 {
412 /* Set it always on */
414 Prcb->FeatureBits |= KF_NX_ENABLED;
415 }
416 else if (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=OPTOUT"))
417 {
418 /* Set it in opt-out mode */
419 SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTOUT;
420 Prcb->FeatureBits |= KF_NX_ENABLED;
421 }
422 else if ((strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=OPTIN")) ||
423 (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE")))
424 {
425 /* Set the feature bits */
426 Prcb->FeatureBits |= KF_NX_ENABLED;
427 }
428 else if ((strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=ALWAYSOFF")) ||
429 (strstr(KeLoaderBlock->LoadOptions, "EXECUTE")))
430 {
431 /* Set disabled mode */
433 Prcb->FeatureBits |= KF_NX_DISABLED;
434 }
435
436#if DBG
437 /* Print applied kernel features/policies and boot CPU features */
438 KiReportCpuFeatures(Prcb);
439#endif
440}
441
443
444void
446{
447 PLDR_DATA_TABLE_ENTRY LdrEntry;
449 ULONG i;
450
451 /* Initialize the list head */
453
454 /* Loop the first 3 entries */
455 for (Entry = LoaderBlock->LoadOrderListHead.Flink, i = 0;
456 Entry != &LoaderBlock->LoadOrderListHead && i < 3;
457 Entry = Entry->Flink, i++)
458 {
459 /* Get the data table entry */
460 LdrEntry = CONTAINING_RECORD(Entry,
462 InLoadOrderLinks);
463
464 /* Copy the entry */
465 LdrCoreEntries[i] = *LdrEntry;
466
467 /* Insert the copy into the list */
469 }
470}
471
472CODE_SEG("INIT")
474VOID
475NTAPI
477{
478 CCHAR Cpu;
479 PKTHREAD InitialThread;
480 ULONG64 InitialStack;
481 PKIPCR Pcr;
482
483 /* Boot cycles timestamp */
485
486 /* HACK */
487 FrLdrDbgPrint = LoaderBlock->u.I386.CommonDataArea;
488 //FrLdrDbgPrint("Hello from KiSystemStartup!!!\n");
489
490 /* Get the current CPU number */
491 Cpu = KeNumberProcessors++; // FIXME
492
493 /* LoaderBlock initialization for Cpu 0 */
494 if (Cpu == 0)
495 {
496 /* Save the loader block */
497 KeLoaderBlock = LoaderBlock;
498
499 /* Prepare LoaderBlock, PCR, TSS with the P0 boot data */
500 KiInitializeP0BootStructures(LoaderBlock);
501 }
502
503 /* Get Pcr from loader block */
504 Pcr = CONTAINING_RECORD(LoaderBlock->Prcb, KIPCR, Prcb);
505
506 /* Set the PRCB for this Processor */
507 KiProcessorBlock[Cpu] = &Pcr->Prcb;
508
509 /* Align stack to 16 bytes */
510 LoaderBlock->KernelStack &= ~(16 - 1);
511
512 /* Save the initial thread and stack */
513 InitialStack = LoaderBlock->KernelStack; // Checkme
514 InitialThread = (PKTHREAD)LoaderBlock->Thread;
515
516 /* Set us as the current process */
517 InitialThread->ApcState.Process = (PVOID)LoaderBlock->Process;
518
519 /* Initialize the CPU features */
520 KiInitializeCpu(Pcr);
521
522 /* Initial setup for the boot CPU */
523 if (Cpu == 0)
524 {
525 /* Initialize the module list (ntos, hal, kdcom) */
526 KiInitModuleList(LoaderBlock);
527
528 /* Setup the IDT */
530
531 /* Initialize debugging system */
533
534 /* Check for break-in */
536 }
537
538 DPRINT1("Pcr = %p, Gdt = %p, Idt = %p, Tss = %p\n",
539 Pcr, Pcr->GdtBase, Pcr->IdtBase, Pcr->TssBase);
540
541 /* Acquire lock */
542 while (InterlockedBitTestAndSet64((PLONG64)&KiFreezeExecutionLock, 0))
543 {
544 /* Loop until lock is free */
545 while ((*(volatile KSPIN_LOCK*)&KiFreezeExecutionLock) & 1);
546 }
547
548 /* Initialize the Processor with HAL */
550
551 /* Set processor as active */
552 KeActiveProcessors |= 1ULL << Cpu;
553
554 /* Release lock */
556
557 /* Raise to HIGH_LEVEL */
559
560 /* Machine specific kernel initialization */
561 if (Cpu == 0) KiInitializeKernelMachineDependent(&Pcr->Prcb, LoaderBlock);
562
563 /* Switch to new kernel stack and start kernel bootstrapping */
564 KiSwitchToBootStack(InitialStack & ~3);
565}
566
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
FORCEINLINE PKGDTENTRY64 KiGetGdtEntry(PVOID pGdt, USHORT Selector)
Definition: intrin_i.h:13
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()
static VOID KiInitializePcr(_Out_ PKIPCR Pcr, _In_ ULONG ProcessorNumber, _In_ PKGDTENTRY64 GdtBase, _In_ PKIDTENTRY64 IdtBase, _In_ PKTSS64 TssBase, _In_ PKTHREAD IdleThread, _In_ PVOID DpcStack)
Definition: kiinit.c:92
void KiSystemCallEntry32()
ULONG(* FrLdrDbgPrint)(const char *Format,...)
Definition: kiinit.c:23
DECLSPEC_NORETURN VOID NTAPI KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:476
static VOID KiInitializeP0BootStructures(_Inout_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:308
KSPIN_LOCK KiFreezeExecutionLock
Definition: kiinit.c:26
ULONGLONG BootCyclesEnd
Definition: kiinit.c:37
PVOID KiP0DoubleFaultStack
Definition: kiinit.c:35
static LDR_DATA_TABLE_ENTRY LdrCoreEntries[3]
Definition: kiinit.c:442
void KiInitModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:445
VOID NTAPI KiInitMachineDependent(VOID)
Definition: kiinit.c:48
VOID NTAPI KiInitializeKernelMachineDependent(IN PKPRCB Prcb, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:345
void KiSystemCallEntry64()
static VOID KiInitializeTss(_In_ PKIPCR Pcr, _Out_ PKTSS64 Tss, _In_ PVOID InitialStack, _In_ PVOID DoubleFaultStack, _In_ PVOID NmiStack)
Definition: kiinit.c:239
#define REQUIRED_FEATURE_BITS
Definition: kiinit.c:16
KIPCR KiInitialPcr
Definition: kiinit.c:29
VOID NTAPI KiInitializeCpu(PKIPCR Pcr)
Definition: kiinit.c:160
ULONGLONG BootCycles
Definition: kiinit.c:37
VOID KiInitializeProcessorBootStructures(_In_ ULONG ProcessorNumber, _Out_ PKIPCR Pcr, _In_ PKGDTENTRY64 GdtBase, _In_ PKIDTENTRY64 IdtBase, _In_ PKTSS64 TssBase, _In_ PKTHREAD IdleThread, _In_ PVOID KernelStack, _In_ PVOID DpcStack, _In_ PVOID DoubleFaultStack, _In_ PVOID NmiStack)
Definition: kiinit.c:275
PVOID KiP0BootStack
Definition: kiinit.c:34
#define DPRINT1
Definition: precomp.h:8
__int64 * PLONG64
Definition: basetsd.h:183
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
unsigned __int64 ULONG64
Definition: imports.h:198
#define EFLAGS_DF
Definition: strlen.c:26
VOID KeSetCurrentIrql(KIRQL NewIrql)
Definition: mpsirql.c:51
#define _Inout_
Definition: ms_sal.h:378
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#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:266
#define KF_SSE4_2
Definition: ketypes.h:74
#define KF_SSSE3
Definition: ketypes.h:72
#define KF_MTRR
Definition: ketypes.h:37
#define PRCB_MINOR_VERSION
Definition: ketypes.h:306
#define KGDT64_SYS_TSS
Definition: ketypes.h:138
#define CR4_XMMEXCPT
Definition: ketypes.h:154
#define KF_VIRT_FIRMWARE_ENABLED
Definition: ketypes.h:59
#define KF_CMPXCHG16B
Definition: ketypes.h:52
#define MSR_SCE
Definition: ketypes.h:276
#define MSR_PAT
Definition: ketypes.h:280
#define MSR_GS_SWAP
Definition: ketypes.h:254
#define KF_NX_DISABLED
Definition: ketypes.h:62
#define KGDT64_R0_CODE
Definition: ketypes.h:133
#define KF_XMMI64
Definition: ketypes.h:48
#define MSR_EFER
Definition: ketypes.h:247
#define EFLAGS_TF
Definition: ketypes.h:186
#define KF_SSE4_1
Definition: ketypes.h:73
#define KF_RDWRFSGSBASE
Definition: ketypes.h:60
#define PRCB_MAJOR_VERSION
Definition: ketypes.h:307
#define MSR_SYSCALL_MASK
Definition: ketypes.h:251
#define KGDT64_R3_CMCODE
Definition: ketypes.h:135
#define KF_NX_ENABLED
Definition: ketypes.h:63
#define MSR_STAR
Definition: ketypes.h:248
#define KF_3DNOW
Definition: ketypes.h:45
#define EFLAGS_IF_MASK
Definition: ketypes.h:204
#define KF_FXSR
Definition: ketypes.h:42
#define KF_RDRAND
Definition: ketypes.h:64
#define KF_LARGE_PAGE
Definition: ketypes.h:36
#define MSR_LSTAR
Definition: ketypes.h:249
#define MSR_GS_BASE
Definition: ketypes.h:253
#define PAT_WB
Definition: ketypes.h:270
#define PAT_UCM
Definition: ketypes.h:271
#define PRCB_BUILD_UNIPROCESSOR
Definition: ketypes.h:309
#define KF_XMMI
Definition: ketypes.h:44
#define CR4_FXSR
Definition: ketypes.h:153
#define KF_MMX
Definition: ketypes.h:39
#define KF_SSE3
Definition: ketypes.h:51
#define MSR_NXE
Definition: ketypes.h:279
#define KF_SLAT
Definition: ketypes.h:58
#define KF_PAT
Definition: ketypes.h:41
#define PRCB_BUILD_DEBUG
Definition: ketypes.h:308
#define RPL_MASK
Definition: ketypes.h:130
#define KF_RDTSCP
Definition: ketypes.h:66
#define KF_GLOBAL_PAGE
Definition: ketypes.h:35
#define MSR_CSTAR
Definition: ketypes.h:250
#define PAT_WC
Definition: ketypes.h:267
#define DBG_STATUS_CONTROL_C
Definition: kdtypes.h:39
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114
struct _KTHREAD * PKTHREAD
Definition: nt_native.h:28
#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:868
ULONG64 KiGetFeatureBits(VOID)
Evaluates the KeFeatureFlag bits for the current CPU.
Definition: cpu.c:165
ULONG KeI386CpuType
Definition: cpu.c:24
VOID KiSetProcessorType(VOID)
Definition: cpu.c:99
#define AMD64_TSS
Definition: ke.h:85
ULONG KeI386CpuStep
Definition: cpu.c:25
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:290
struct _KPCR * PKPCR
#define PCR_MAJOR_VERSION
Definition: ke.h:291
#define SharedUserData
#define INITIAL_MXCSR
#define DPRINT
Definition: sndvol32.h:71
base of all file and directory entries
Definition: entries.h:83
KPROCESS Pcb
Definition: pstypes.h:1262
KTHREAD Tcb
Definition: pstypes.h:1103
PVOID Base
Definition: ketypes.h:556
USHORT Limit
Definition: ketypes.h:555
KPRCB Prcb
Definition: ketypes.h:962
union _KGDTENTRY64 * GdtBase
Definition: ketypes.h:933
struct _KTSS64 * TssBase
Definition: ketypes.h:934
union _KIDTENTRY64 * IdtBase
Definition: ketypes.h:942
ULONG FeatureBits
Definition: ketypes.h:869
KAPC_STATE ApcState
Definition: ketypes.h:1778
Definition: btrfs_drv.h:1876
Definition: typedefs.h:120
#define NTAPI
Definition: typedefs.h:36
#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)
#define PF_RDWRFSGSBASE_AVAILABLE
Definition: ketypes.h:146
#define PF_CHANNELS_ENABLED
Definition: ketypes.h:140
#define PF_PAE_ENABLED
Definition: ketypes.h:133
#define PF_SECOND_LEVEL_ADDRESS_TRANSLATION
Definition: ketypes.h:144
#define NX_SUPPORT_POLICY_ALWAYSOFF
Definition: ketypes.h:1260
#define PF_XSAVE_ENABLED
Definition: ketypes.h:141
#define PF_3DNOW_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:131
#define PF_RDPID_INSTRUCTION_AVAILABLE
Definition: ketypes.h:157
#define PF_SSE4_2_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:161
#define PF_MMX_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:127
#define PF_XMMI64_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:134
#define PF_VIRT_FIRMWARE_ENABLED
Definition: ketypes.h:145
#define PF_XMMI_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:130
#define NX_SUPPORT_POLICY_OPTIN
Definition: ketypes.h:1262
#define PF_AVX2_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:163
#define PF_SSSE3_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:159
#define NX_SUPPORT_POLICY_OPTOUT
Definition: ketypes.h:1263
#define NX_SUPPORT_POLICY_ALWAYSON
Definition: ketypes.h:1261
#define PF_FLOATING_POINT_PRECISION_ERRATA
Definition: ketypes.h:124
#define PF_AVX_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:162
#define PF_COMPARE_EXCHANGE_DOUBLE
Definition: ketypes.h:126
#define PF_FASTFAIL_AVAILABLE
Definition: ketypes.h:147
#define PF_FLOATING_POINT_EMULATED
Definition: ketypes.h:125
#define PF_SSE3_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:137
#define PF_SSE_DAZ_MODE_AVAILABLE
Definition: ketypes.h:135
#define PF_AVX512F_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:164
#define PF_RDRAND_INSTRUCTION_AVAILABLE
Definition: ketypes.h:152
#define PF_RDTSC_INSTRUCTION_AVAILABLE
Definition: ketypes.h:132
#define PF_NX_ENABLED
Definition: ketypes.h:136
#define PF_COMPARE64_EXCHANGE128
Definition: ketypes.h:139
#define PF_COMPARE_EXCHANGE128
Definition: ketypes.h:138
#define PF_SSE4_1_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:160
#define PF_RDTSCP_INSTRUCTION_AVAILABLE
Definition: ketypes.h:156
unsigned char UCHAR
Definition: xmlstorage.h:181
void _mm_setcsr(unsigned int a)
Definition: xmmintrin.h:542