ReactOS 0.4.16-dev-1493-ge7358c5
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 /* Check if XSAVE is supported */
211 if (FeatureBits & KF_XSTATE)
212 {
213 /* Enable CR4.OSXSAVE[Bit 18] */
215 }
216
217 /* LDT is unused */
218 __lldt(0);
219
220 /* Set the systemcall entry points */
223
226
227 /* Set the flags to be cleared when doing a syscall */
229
230 /* Enable syscall instruction and no-execute support */
232
233 /* Initialize the PAT */
234 Pat = (PAT_WB << 0) | (PAT_WC << 8) | (PAT_UCM << 16) | (PAT_UC << 24) |
235 (PAT_WB << 32) | (PAT_WC << 40) | (PAT_UCM << 48) | (PAT_UC << 56);
236 __writemsr(MSR_PAT, Pat);
237
238 /* Initialize MXCSR */
240
242}
243
244static
245VOID
247 _In_ PKIPCR Pcr,
248 _Out_ PKTSS64 Tss,
249 _In_ PVOID InitialStack,
250 _In_ PVOID DoubleFaultStack,
251 _In_ PVOID NmiStack)
252{
253 PKGDTENTRY64 TssEntry;
254
255 /* Get pointer to the GDT entry */
256 TssEntry = KiGetGdtEntry(Pcr->GdtBase, KGDT64_SYS_TSS);
257
258 /* Initialize the GDT entry */
259 KiInitGdtEntry(TssEntry, (ULONG64)Tss, sizeof(KTSS64), AMD64_TSS, 0);
260
261 /* Zero out the TSS */
262 RtlZeroMemory(Tss, sizeof(KTSS64));
263
264 /* FIXME: I/O Map? */
265 Tss->IoMapBase = 0x68;
266
267 /* Setup ring 0 stack pointer */
268 Tss->Rsp0 = (ULONG64)InitialStack;
269
270 /* Setup a stack for Double Fault Traps */
271 Tss->Ist[1] = (ULONG64)DoubleFaultStack;
272
273 /* Setup a stack for CheckAbort Traps */
274 Tss->Ist[2] = (ULONG64)DoubleFaultStack;
275
276 /* Setup a stack for NMI Traps */
277 Tss->Ist[3] = (ULONG64)NmiStack;
278}
279
280CODE_SEG("INIT")
281VOID
283 _In_ ULONG ProcessorNumber,
284 _Out_ PKIPCR Pcr,
285 _In_ PKGDTENTRY64 GdtBase,
286 _In_ PKIDTENTRY64 IdtBase,
287 _In_ PKTSS64 TssBase,
288 _In_ PKTHREAD IdleThread,
289 _In_ PVOID KernelStack,
290 _In_ PVOID DpcStack,
291 _In_ PVOID DoubleFaultStack,
292 _In_ PVOID NmiStack)
293{
294 /* Initialize the PCR */
295 KiInitializePcr(Pcr,
296 ProcessorNumber,
297 GdtBase,
298 IdtBase,
299 TssBase,
300 IdleThread,
301 DpcStack);
302
303
304 /* Setup the TSS descriptor and entries */
305 KiInitializeTss(Pcr,
306 TssBase,
307 KernelStack,
308 DoubleFaultStack,
309 NmiStack);
310}
311
312CODE_SEG("INIT")
313static
314VOID
317{
318 KDESCRIPTOR GdtDescriptor = {{0},0,0}, IdtDescriptor = {{0},0,0};
319 PKGDTENTRY64 TssEntry;
320 PKTSS64 TssBase;
321
322 /* Set the initial stack, idle thread and process for processor 0 */
323 LoaderBlock->KernelStack = (ULONG_PTR)KiP0BootStack;
324 LoaderBlock->Thread = (ULONG_PTR)&KiInitialThread;
325 LoaderBlock->Process = (ULONG_PTR)&KiInitialProcess.Pcb;
326 LoaderBlock->Prcb = (ULONG_PTR)&KiInitialPcr.Prcb;
327
328 /* Get GDT and IDT descriptors */
329 __sgdt(&GdtDescriptor.Limit);
330 __sidt(&IdtDescriptor.Limit);
331
332 /* Get the boot TSS from the GDT */
333 TssEntry = KiGetGdtEntry(GdtDescriptor.Base, KGDT64_SYS_TSS);
334 TssBase = KiGetGdtDescriptorBase(TssEntry);
335
336 /* Initialize PCR and TSS */
339 GdtDescriptor.Base,
340 IdtDescriptor.Base,
341 TssBase,
347}
348
349CODE_SEG("INIT")
350VOID
351NTAPI
353 IN PKPRCB Prcb,
354 IN PLOADER_PARAMETER_BLOCK LoaderBlock)
355{
356 ULONG64 FeatureBits = KeFeatureBits;
357
358 /* Set boot-level flags */
359 KeI386CpuType = Prcb->CpuType;
360 KeI386CpuStep = Prcb->CpuStep;
362 KeProcessorLevel = (USHORT)Prcb->CpuType;
363 if (Prcb->CpuID)
364 KeProcessorRevision = Prcb->CpuStep;
365
366 /* Set basic CPU Features that user mode can read */
368 SharedUserData->ProcessorFeatures[PF_FLOATING_POINT_EMULATED] = FALSE;
369 SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
371 (FeatureBits & KF_MMX) ? TRUE : FALSE;
373 ((FeatureBits & KF_FXSR) && (FeatureBits & KF_XMMI)) ? TRUE : FALSE;
375 (FeatureBits & KF_3DNOW) ? TRUE : FALSE;
377 SharedUserData->ProcessorFeatures[PF_PAE_ENABLED] = TRUE; // ???
379 ((FeatureBits & KF_FXSR) && (FeatureBits & KF_XMMI64)) ? TRUE : FALSE;
380 SharedUserData->ProcessorFeatures[PF_SSE_DAZ_MODE_AVAILABLE] = FALSE; // ???
381 SharedUserData->ProcessorFeatures[PF_NX_ENABLED] = TRUE;
383 (FeatureBits & KF_SSE3) ? TRUE : FALSE;
384 SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE128] =
385 (FeatureBits & KF_CMPXCHG16B) ? TRUE : FALSE;
386 SharedUserData->ProcessorFeatures[PF_COMPARE64_EXCHANGE128] = FALSE; // ???
387 SharedUserData->ProcessorFeatures[PF_CHANNELS_ENABLED] = FALSE; // ???
388 SharedUserData->ProcessorFeatures[PF_XSAVE_ENABLED] =
389 (FeatureBits & KF_XSTATE) ? TRUE : FALSE;
391 (FeatureBits & KF_SLAT) ? TRUE : FALSE;
392 SharedUserData->ProcessorFeatures[PF_VIRT_FIRMWARE_ENABLED] =
393 (FeatureBits & KF_VIRT_FIRMWARE_ENABLED) ? TRUE : FALSE;
394 SharedUserData->ProcessorFeatures[PF_RDWRFSGSBASE_AVAILABLE] =
395 (FeatureBits & KF_RDWRFSGSBASE) ? TRUE : FALSE;
396 SharedUserData->ProcessorFeatures[PF_FASTFAIL_AVAILABLE] = TRUE;
398 (FeatureBits & KF_RDRAND) ? TRUE : FALSE;
400 (FeatureBits & KF_RDTSCP) ? TRUE : FALSE;
401 SharedUserData->ProcessorFeatures[PF_RDPID_INSTRUCTION_AVAILABLE] = FALSE; // ???
403 (FeatureBits & KF_SSSE3) ? TRUE : FALSE;
405 (FeatureBits & KF_SSE4_1) ? TRUE : FALSE;
407 (FeatureBits & KF_SSE4_2) ? TRUE : FALSE;
409 (FeatureBits & KF_AVX) ? TRUE : FALSE;
411 (FeatureBits & KF_AVX2) ? TRUE : FALSE;
413 (FeatureBits & KF_AVX512F) ? TRUE : FALSE;
414
415 /* Set the default NX policy (opt-in) */
416 SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTIN;
417
418 /* Check if NPX is always on */
419 if (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=ALWAYSON"))
420 {
421 /* Set it always on */
423 Prcb->FeatureBits |= KF_NX_ENABLED;
424 }
425 else if (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=OPTOUT"))
426 {
427 /* Set it in opt-out mode */
428 SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTOUT;
429 Prcb->FeatureBits |= KF_NX_ENABLED;
430 }
431 else if ((strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=OPTIN")) ||
432 (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE")))
433 {
434 /* Set the feature bits */
435 Prcb->FeatureBits |= KF_NX_ENABLED;
436 }
437 else if ((strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=ALWAYSOFF")) ||
438 (strstr(KeLoaderBlock->LoadOptions, "EXECUTE")))
439 {
440 /* Set disabled mode */
442 Prcb->FeatureBits |= KF_NX_DISABLED;
443 }
444
445#if DBG
446 /* Print applied kernel features/policies and boot CPU features */
447 KiReportCpuFeatures(Prcb);
448#endif
449}
450
452
453void
455{
456 PLDR_DATA_TABLE_ENTRY LdrEntry;
458 ULONG i;
459
460 /* Initialize the list head */
462
463 /* Loop the first 3 entries */
464 for (Entry = LoaderBlock->LoadOrderListHead.Flink, i = 0;
465 Entry != &LoaderBlock->LoadOrderListHead && i < 3;
466 Entry = Entry->Flink, i++)
467 {
468 /* Get the data table entry */
469 LdrEntry = CONTAINING_RECORD(Entry,
471 InLoadOrderLinks);
472
473 /* Copy the entry */
474 LdrCoreEntries[i] = *LdrEntry;
475
476 /* Insert the copy into the list */
478 }
479}
480
481CODE_SEG("INIT")
483VOID
484NTAPI
486{
487 CCHAR Cpu;
488 PKTHREAD InitialThread;
489 ULONG64 InitialStack;
490 PKIPCR Pcr;
491
492 /* Boot cycles timestamp */
494
495 /* HACK */
496 FrLdrDbgPrint = LoaderBlock->u.I386.CommonDataArea;
497 //FrLdrDbgPrint("Hello from KiSystemStartup!!!\n");
498
499 /* Get the current CPU number */
500 Cpu = KeNumberProcessors++; // FIXME
501
502 /* LoaderBlock initialization for Cpu 0 */
503 if (Cpu == 0)
504 {
505 /* Save the loader block */
506 KeLoaderBlock = LoaderBlock;
507
508 /* Prepare LoaderBlock, PCR, TSS with the P0 boot data */
509 KiInitializeP0BootStructures(LoaderBlock);
510 }
511
512 /* Get Pcr from loader block */
513 Pcr = CONTAINING_RECORD(LoaderBlock->Prcb, KIPCR, Prcb);
514
515 /* Set the PRCB for this Processor */
516 KiProcessorBlock[Cpu] = &Pcr->Prcb;
517
518 /* Save the initial thread */
519 InitialThread = (PKTHREAD)LoaderBlock->Thread;
520
521 /* Set us as the current process */
522 InitialThread->ApcState.Process = (PVOID)LoaderBlock->Process;
523
524 /* Initialize the CPU features */
525 KiInitializeCpu(Pcr);
526
527 /* Initial setup for the boot CPU */
528 if (Cpu == 0)
529 {
530 /* Set global feature bits */
531 KeFeatureBits = (ULONG64)Pcr->Prcb.FeatureBitsHigh << 32 |
532 Pcr->Prcb.FeatureBits;
533
534 /* Initialize the module list (ntos, hal, kdcom) */
535 KiInitModuleList(LoaderBlock);
536
537 /* Setup the IDT */
539
540 /* Initialize debugging system */
542
543 /* Check for break-in */
545 }
546
547 DPRINT1("Pcr = %p, Gdt = %p, Idt = %p, Tss = %p\n",
548 Pcr, Pcr->GdtBase, Pcr->IdtBase, Pcr->TssBase);
549
550 /* Acquire lock */
551 while (InterlockedBitTestAndSet64((PLONG64)&KiFreezeExecutionLock, 0))
552 {
553 /* Loop until lock is free */
554 while ((*(volatile KSPIN_LOCK*)&KiFreezeExecutionLock) & 1);
555 }
556
557 /* Initialize the Processor with HAL */
559
560 /* Set processor as active */
561 KeActiveProcessors |= 1ULL << Cpu;
562
563 /* Release lock */
565
566 /* Raise to HIGH_LEVEL */
568
569 /* Machine specific kernel initialization */
570 if (Cpu == 0) KiInitializeKernelMachineDependent(&Pcr->Prcb, LoaderBlock);
571
572 /* Initialize extended state management */
574
575 /* Calculate the initial stack pointer */
576 InitialStack = ALIGN_DOWN_BY(LoaderBlock->KernelStack - KeXStateLength, 64);
577
578 /* Switch to new kernel stack and start kernel bootstrapping */
579 KiSwitchToBootStack(InitialStack);
580}
581
#define CODE_SEG(...)
#define ALIGN_DOWN_BY(size, align)
#define EFLAGS_TF
Definition: SystemCall.c:10
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
ULONG64 KeFeatureBits
Definition: krnlinit.c:22
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:485
static VOID KiInitializeP0BootStructures(_Inout_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:315
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:451
void KiInitModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:454
VOID NTAPI KiInitMachineDependent(VOID)
Definition: kiinit.c:48
VOID NTAPI KiInitializeKernelMachineDependent(IN PKPRCB Prcb, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:352
void KiSystemCallEntry64()
static VOID KiInitializeTss(_In_ PKIPCR Pcr, _Out_ PKTSS64 Tss, _In_ PVOID InitialStack, _In_ PVOID DoubleFaultStack, _In_ PVOID NmiStack)
Definition: kiinit.c:246
#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:282
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:1434
#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:102
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:1839
__INTRIN_INLINE unsigned long __readcr0(void)
Definition: intrin_x86.h:1818
__INTRIN_INLINE void __writecr0(unsigned int Data)
Definition: intrin_x86.h:1803
__INTRIN_INLINE void __sidt(void *Destination)
Definition: intrin_x86.h:2046
__INTRIN_INLINE void __writecr4(unsigned int Data)
Definition: intrin_x86.h:1813
BOOLEAN NTAPI KdInitSystem(_In_ ULONG BootPhase, _In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kdinit.c:164
BOOLEAN NTAPI KdPollBreakIn(VOID)
Definition: kdlock.c:75
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:28
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 PAT_UC
Definition: ketypes.h:275
#define KF_SSE4_2
Definition: ketypes.h:74
#define CR0_NE
Definition: ketypes.h:144
#define KF_SSSE3
Definition: ketypes.h:72
#define KF_MTRR
Definition: ketypes.h:37
#define CR0_WP
Definition: ketypes.h:145
#define PRCB_MINOR_VERSION
Definition: ketypes.h:330
#define EFLAGS_NESTED_TASK
Definition: ketypes.h:199
#define KGDT64_SYS_TSS
Definition: ketypes.h:132
#define CR4_XMMEXCPT
Definition: ketypes.h:163
#define KF_XSTATE
Definition: ketypes.h:55
#define CR0_MP
Definition: ketypes.h:140
#define KF_VIRT_FIRMWARE_ENABLED
Definition: ketypes.h:59
#define KF_CMPXCHG16B
Definition: ketypes.h:52
#define MSR_SCE
Definition: ketypes.h:285
#define MSR_PAT
Definition: ketypes.h:289
#define MSR_GS_SWAP
Definition: ketypes.h:263
#define KF_NX_DISABLED
Definition: ketypes.h:62
#define KGDT64_R0_CODE
Definition: ketypes.h:127
#define KF_XMMI64
Definition: ketypes.h:48
#define MSR_EFER
Definition: ketypes.h:256
#define CR4_XSAVE
Definition: ketypes.h:165
#define KF_SSE4_1
Definition: ketypes.h:73
#define KF_RDWRFSGSBASE
Definition: ketypes.h:60
#define PRCB_MAJOR_VERSION
Definition: ketypes.h:331
#define MSR_SYSCALL_MASK
Definition: ketypes.h:260
#define KGDT64_R3_CMCODE
Definition: ketypes.h:129
#define KF_NX_ENABLED
Definition: ketypes.h:63
#define MSR_STAR
Definition: ketypes.h:257
#define KF_3DNOW
Definition: ketypes.h:45
#define EFLAGS_IF_MASK
Definition: ketypes.h:213
#define KF_FXSR
Definition: ketypes.h:42
#define KF_RDRAND
Definition: ketypes.h:64
#define KF_LARGE_PAGE
Definition: ketypes.h:36
#define KF_AVX
Definition: ketypes.h:77
#define MSR_LSTAR
Definition: ketypes.h:258
#define MSR_GS_BASE
Definition: ketypes.h:262
#define PAT_WB
Definition: ketypes.h:279
#define PAT_UCM
Definition: ketypes.h:280
#define PRCB_BUILD_UNIPROCESSOR
Definition: ketypes.h:333
#define KF_XMMI
Definition: ketypes.h:44
#define CR4_FXSR
Definition: ketypes.h:162
#define KF_MMX
Definition: ketypes.h:39
#define KF_SSE3
Definition: ketypes.h:51
#define MSR_NXE
Definition: ketypes.h:288
#define KF_SLAT
Definition: ketypes.h:58
#define KF_PAT
Definition: ketypes.h:41
#define PRCB_BUILD_DEBUG
Definition: ketypes.h:332
#define KF_AVX2
Definition: ketypes.h:78
#define RPL_MASK
Definition: ketypes.h:124
#define KF_RDTSCP
Definition: ketypes.h:66
#define KF_GLOBAL_PAGE
Definition: ketypes.h:35
#define MSR_CSTAR
Definition: ketypes.h:259
#define PAT_WC
Definition: ketypes.h:276
#define KF_AVX512F
Definition: ketypes.h:79
#define DBG_STATUS_CONTROL_C
Definition: kdtypes.h:39
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
struct _KTHREAD * PKTHREAD
Definition: nt_native.h:28
#define DECLSPEC_ALIGN(x)
Definition: ntbasedef.h:263
#define DECLSPEC_NORETURN
Definition: ntbasedef.h:179
VOID NTAPI KiInitializeXStateConfiguration(_In_ ULONG Processor)
Initializes the extended state configuration for the current processor.
Definition: xstate.c:231
DECLSPEC_NORETURN VOID KiSwitchToBootStack(IN ULONG_PTR InitialStack)
Definition: ke.h:897
ULONG64 KiGetFeatureBits(VOID)
Evaluates the KeFeatureFlag bits for the current CPU.
Definition: cpu.c:166
ULONG KeI386CpuType
Definition: cpu.c:25
VOID KiSetProcessorType(VOID)
Definition: cpu.c:100
SIZE_T KeXStateLength
Definition: stubs.c:18
#define AMD64_TSS
Definition: ke.h:85
ULONG KeI386CpuStep
Definition: cpu.c:26
EPROCESS KiInitialProcess
Definition: krnlinit.c:41
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:31
ETHREAD KiInitialThread
Definition: krnlinit.c:40
KAFFINITY KeActiveProcessors
Definition: processor.c:16
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
CCHAR KeNumberProcessors
Definition: processor.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:73
base of all file and directory entries
Definition: entries.h:83
KPROCESS Pcb
Definition: pstypes.h:1263
KTHREAD Tcb
Definition: pstypes.h:1104
PVOID Base
Definition: ketypes.h:585
USHORT Limit
Definition: ketypes.h:584
KPRCB Prcb
Definition: ketypes.h:993
union _KGDTENTRY64 * GdtBase
Definition: ketypes.h:964
struct _KTSS64 * TssBase
Definition: ketypes.h:965
union _KIDTENTRY64 * IdtBase
Definition: ketypes.h:973
ULONG FeatureBits
Definition: ketypes.h:897
KAPC_STATE ApcState
Definition: ketypes.h:1906
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
#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
#define PF_AVX2_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:163
#define PF_SSSE3_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:159
#define NX_SUPPORT_POLICY_OPTOUT
#define NX_SUPPORT_POLICY_ALWAYSON
#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