ReactOS  0.4.15-dev-5499-g1341c38
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 */
23 ULONG (*FrLdrDbgPrint)(const char *Format, ...);
24 
25 /* Spinlocks used only on X86 */
27 
28 
30 
31 /* Boot and double-fault/NMI/DPC stack */
32 UCHAR DECLSPEC_ALIGN(16) P0BootStackData[KERNEL_STACK_SIZE] = {0};
33 UCHAR DECLSPEC_ALIGN(16) KiDoubleFaultStackData[KERNEL_STACK_SIZE] = {0};
36 
38 
40 void KiSystemCallEntry64();
41 void KiSystemCallEntry32();
42 
43 /* FUNCTIONS *****************************************************************/
44 
45 CODE_SEG("INIT")
46 VOID
47 NTAPI
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 */
65  if (KeFeatureBits & KF_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 */
72  if (KeFeatureBits & KF_PAT)
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 
90 VOID
91 NTAPI
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 
168 VOID
169 NTAPI
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 */
198  SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_ALWAYSON;
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 
227  ((ULONG64)(KGDT64_R3_CMCODE|RPL_MASK) << 48));
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 
244 VOID
245 FASTCALL
247  IN UINT64 Stack)
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 
279 CODE_SEG("INIT")
280 VOID
281 NTAPI
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;
296  SharedUserData->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] = 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;
302  SharedUserData->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] =
303  (Prcb->FeatureBits & KF_MMX) ? TRUE: FALSE;
304  SharedUserData->ProcessorFeatures[PF_XMMI_INSTRUCTIONS_AVAILABLE] =
305  ((Prcb->FeatureBits & KF_FXSR) && (Prcb->FeatureBits & KF_XMMI)) ? TRUE: FALSE;
307  ((Prcb->FeatureBits & KF_FXSR) && (Prcb->FeatureBits & KF_XMMI64)) ? TRUE: FALSE;
308  SharedUserData->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] =
309  (Prcb->FeatureBits & KF_3DNOW) ? TRUE: FALSE;
310  SharedUserData->ProcessorFeatures[PF_SSE3_INSTRUCTIONS_AVAILABLE] =
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 */
322  SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_ALWAYSON;
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 */
341  SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_ALWAYSOFF;
342  Prcb->FeatureBits |= KF_NX_DISABLED;
343  }
344 }
345 
347 
348 void
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 */
372  InsertTailList(&PsLoadedModuleList, &LdrCoreEntries[i].InLoadOrderLinks);
373  }
374 }
375 
376 CODE_SEG("INIT")
378 VOID
379 NTAPI
381 {
382  CCHAR Cpu;
383  PKTHREAD InitialThread;
384  ULONG64 InitialStack;
385  PKIPCR Pcr;
386 
387  /* Boot cycles timestamp */
388  BootCycles = __rdtsc();
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 
VOID NTAPI KiInitMachineDependent(VOID)
Definition: kiinit.c:48
FORCEINLINE PVOID KiGetGdtDescriptorBase(PKGDTENTRY Entry)
Definition: intrin_i.h:20
#define PF_COMPARE_EXCHANGE128
__INTRIN_INLINE void __writecr4(unsigned int Data)
Definition: intrin_x86.h:1799
VOID FASTCALL KiInitializeTss(IN PKTSS64 Tss, IN UINT64 Stack)
Definition: kiinit.c:246
#define IN
Definition: typedefs.h:39
#define InterlockedAnd64
Definition: interlocked.h:87
#define PAT_UCM
Definition: ketypes.h:210
#define REQUIRED_FEATURE_BITS
Definition: kiinit.c:16
#define CR0_NE
Definition: asm.h:250
ULONGLONG BootCyclesEnd
Definition: kiinit.c:37
struct _Entry Entry
Definition: kefuncs.h:629
DECLSPEC_NORETURN VOID KiSwitchToBootStack(IN ULONG_PTR InitialStack)
Definition: ke.h:827
union _KGDTENTRY64 * GdtBase
Definition: ketypes.h:865
void _mm_setcsr(unsigned int a)
Definition: xmmintrin.h:542
#define TRUE
Definition: types.h:120
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define NX_SUPPORT_POLICY_OPTIN
Definition: ketypes.h:1151
VOID NTAPI KeInitExceptions(VOID)
Definition: except.c:59
ULONG KiGetFeatureBits(VOID)
Definition: cpu.c:150
#define PF_PPC_MOVEMEM_64BIT_OK
#define CR4_FXSR
Definition: ketypes.h:92
#define PF_COMPARE_EXCHANGE_DOUBLE
void KiSystemCallEntry32()
#define KF_MMX
Definition: ketypes.h:151
#define MSR_SYSCALL_MASK
Definition: ketypes.h:190
PPC_QUAL unsigned long long __rdtsc(void)
Definition: intrin_ppc.h:688
ULONG KeFeatureBits
Definition: krnlinit.c:22
void KiInitializeSegments()
#define MSR_PAT
Definition: ketypes.h:219
VOID KeSetCurrentIrql(KIRQL NewIrql)
Definition: mpsirql.c:51
#define InsertTailList(ListHead, Entry)
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define FASTCALL
Definition: nt_native.h:50
#define PRCB_BUILD_DEBUG
Definition: ketypes.h:247
PVOID Base
Definition: ketypes.h:491
static LDR_DATA_TABLE_ENTRY LdrCoreEntries[3]
Definition: kiinit.c:346
#define MSR_LSTAR
Definition: ketypes.h:188
#define DECLSPEC_NORETURN
Definition: ntbasedef.h:176
#define KeGetPcr()
Definition: ke.h:26
#define NX_SUPPORT_POLICY_ALWAYSON
Definition: ketypes.h:1150
VOID NTAPI KiInitializePcr(IN PKIPCR Pcr, IN ULONG ProcessorNumber, IN PKTHREAD IdleThread, IN PVOID DpcStack)
Definition: kiinit.c:92
USHORT Limit
Definition: ketypes.h:490
UCHAR DECLSPEC_ALIGN(16)
Definition: kiinit.c:32
struct _KTSS64 * TssBase
Definition: ketypes.h:866
uint32_t ULONG_PTR
Definition: typedefs.h:65
ULONG(* FrLdrDbgPrint)(const char *Format,...)
Definition: kiinit.c:23
#define KF_LARGE_PAGE
Definition: ketypes.h:148
ULONG_PTR P0BootStack
Definition: kiinit.c:34
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:636
struct _KTHREAD * PKTHREAD
Definition: nt_native.h:28
VOID NTAPI KiInitializeKernelMachineDependent(IN PKPRCB Prcb, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:282
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define NX_SUPPORT_POLICY_ALWAYSOFF
Definition: ketypes.h:1149
#define FALSE
Definition: types.h:117
VOID NTAPI HalInitializeProcessor(IN ULONG ProcessorNumber, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: processor.c:48
#define KF_PAT
Definition: ketypes.h:153
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1427
#define KF_XMMI
Definition: ketypes.h:156
__INTRIN_INLINE void __sidt(void *Destination)
Definition: intrin_x86.h:2023
KAPC_STATE ApcState
Definition: ketypes.h:1718
#define NX_SUPPORT_POLICY_OPTOUT
Definition: ketypes.h:1152
#define PF_XMMI_INSTRUCTIONS_AVAILABLE
#define RPL_MASK
Definition: ketypes.h:69
__INTRIN_INLINE void __writecr0(unsigned int Data)
Definition: intrin_x86.h:1789
PPC_QUAL unsigned long long __readmsr()
Definition: intrin_ppc.h:741
#define MSR_STAR
Definition: ketypes.h:187
void * PVOID
Definition: retypes.h:9
void KiInitModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:349
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:29
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define ULL(a, b)
Definition: format_msg.c:27
ULONG_PTR KiDoubleFaultStack
Definition: kiinit.c:35
KIRQL FASTCALL KfRaiseIrql(IN KIRQL NewIrql)
Definition: pic.c:187
#define EFLAGS_IF_MASK
Definition: ketypes.h:143
DECLSPEC_NORETURN VOID NTAPI KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:380
USHORT KeProcessorArchitecture
Definition: krnlinit.c:19
USHORT KeProcessorRevision
Definition: krnlinit.c:21
#define CR4_XMMEXCPT
Definition: ketypes.h:93
#define ASSERT(a)
Definition: mode.c:44
char CCHAR
Definition: typedefs.h:51
void KiSystemCallEntry64()
uint64_t ULONGLONG
Definition: typedefs.h:67
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:21
#define PF_FASTFAIL_AVAILABLE
#define KF_MTRR
Definition: ketypes.h:149
VOID NTAPI KiInitializeCpu(PKIPCR Pcr)
Definition: kiinit.c:170
ULONG KeI386CpuType
Definition: cpu.c:22
#define PF_XSAVE_ENABLED
#define KERNEL_STACK_SIZE
#define KF_FXSR
Definition: ketypes.h:154
#define KF_3DNOW
Definition: ketypes.h:157
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114
#define KGDT64_R0_CODE
Definition: ketypes.h:72
#define INITIAL_MXCSR
unsigned __int64 ULONG64
Definition: imports.h:198
#define SharedUserData
#define MSR_SCE
Definition: ketypes.h:215
unsigned char UCHAR
Definition: xmlstorage.h:181
#define AMD64_TSS
Definition: ke.h:85
ULONG KeI386CpuStep
Definition: cpu.c:23
#define PF_SSE3_INSTRUCTIONS_AVAILABLE
KPRCB Prcb
Definition: ketypes.h:894
#define KGDT64_SYS_TSS
Definition: ketypes.h:77
Definition: btrfs_drv.h:1876
#define KF_NX_DISABLED
Definition: ketypes.h:166
__INTRIN_INLINE unsigned long __readcr0(void)
Definition: intrin_x86.h:1804
Definition: typedefs.h:119
#define EFLAGS_TF
Definition: ketypes.h:125
KPROCESS Pcb
Definition: pstypes.h:1262
ULONGLONG BootCycles
Definition: kiinit.c:37
KIPCR KiInitialPcr
Definition: kiinit.c:29
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
__INTRIN_INLINE unsigned long __readcr4(void)
Definition: intrin_x86.h:1825
BOOLEAN NTAPI KdPollBreakIn(VOID)
Definition: kdlock.c:75
KAFFINITY KeActiveProcessors
Definition: krnlinit.c:23
#define MSR_EFER
Definition: ketypes.h:186
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
EPROCESS KiInitialProcess
Definition: krnlinit.c:45
PPC_QUAL void __writemsr(const unsigned long Value)
Definition: intrin_ppc.h:748
#define PAT_WC
Definition: ketypes.h:206
union _KIDTENTRY64 * IdtBase
Definition: ketypes.h:874
FORCEINLINE VOID KiInitGdtEntry(PKGDTENTRY64 Entry, ULONG64 Base, ULONG Size, UCHAR Type, UCHAR Dpl)
Definition: intrin_i.h:48
#define PCR_MINOR_VERSION
Definition: ke.h:286
#define PAT_WB
Definition: ketypes.h:209
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
#define PF_RDTSC_INSTRUCTION_AVAILABLE
#define MSR_GS_BASE
Definition: ketypes.h:192
#define KF_XMMI64
Definition: ketypes.h:159
#define KF_CMPXCHG16B
Definition: ketypes.h:163
#define EFLAGS_DF
Definition: strlen.c:26
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
unsigned short USHORT
Definition: pedump.c:61
#define PF_PAE_ENABLED
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
ETHREAD KiInitialThread
Definition: krnlinit.c:44
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define PRCB_BUILD_UNIPROCESSOR
Definition: ketypes.h:248
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
BOOLEAN NTAPI KdInitSystem(_In_ ULONG BootPhase, _In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kdinit.c:142
#define MSR_CSTAR
Definition: ketypes.h:189
#define PAT_UC
Definition: ketypes.h:205
#define PF_NX_ENABLED
#define CR0_WP
Definition: asm.h:251
#define DPRINT1
Definition: precomp.h:8
#define KF_SSE3
Definition: ketypes.h:162
USHORT KeProcessorLevel
Definition: krnlinit.c:20
#define DBG_STATUS_CONTROL_C
Definition: kdtypes.h:39
#define PF_XMMI64_INSTRUCTIONS_AVAILABLE
unsigned int ULONG
Definition: retypes.h:1
KSPIN_LOCK KiFreezeExecutionLock
Definition: kiinit.c:26
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define ULONG_PTR
Definition: config.h:101
struct _KPCR * PKPCR
#define KGDT64_R3_CMCODE
Definition: ketypes.h:74
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus(_In_ ULONG Status)
#define PRCB_MINOR_VERSION
Definition: ketypes.h:245
#define KF_GLOBAL_PAGE
Definition: ketypes.h:147
unsigned long long UINT64
#define MSR_GS_SWAP
Definition: ketypes.h:193
#define DPRINT
Definition: sndvol32.h:71
VOID KiSetProcessorType(VOID)
Definition: cpu.c:97
#define CR0_MP
Definition: asm.h:246
#define KF_NX_ENABLED
Definition: ketypes.h:167
__int64 * PLONG64
Definition: basetsd.h:185
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
#define PF_3DNOW_INSTRUCTIONS_AVAILABLE
#define MSR_NXE
Definition: ketypes.h:218
#define PCR_MAJOR_VERSION
Definition: ke.h:287
base of all file and directory entries
Definition: entries.h:82
#define PRCB_MAJOR_VERSION
Definition: ketypes.h:246
FORCEINLINE PKGDTENTRY KiGetGdtEntry(IN PVOID pGdt, IN USHORT Selector)
Definition: winldr.c:69
#define PF_MMX_INSTRUCTIONS_AVAILABLE
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char * Format
Definition: acpixf.h:1220