ReactOS  0.4.10-dev-2-g0fbaea8
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 void KiSystemCallEntry64();
39 void KiSystemCallEntry32();
40 
41 /* FUNCTIONS *****************************************************************/
42 
43 VOID
44 NTAPI
46 {
47  /* Check for large page support */
49  {
50  /* FIXME: Support this */
51  DPRINT("Large Page support detected but not yet taken advantage of!\n");
52  }
53 
54  /* Check for global page support */
56  {
57  /* FIXME: Support this */
58  DPRINT("Global Page support detected but not yet taken advantage of!\n");
59  }
60 
61  /* Check if we have MTRR */
62  if (KeFeatureBits & KF_MTRR)
63  {
64  /* FIXME: Support this */
65  DPRINT("MTRR support detected but not yet taken advantage of!\n");
66  }
67 
68  /* Check for PAT and/or MTRR support */
69  if (KeFeatureBits & KF_PAT)
70  {
71  /* FIXME: Support this */
72  DPRINT("PAT support detected but not yet taken advantage of!\n");
73  }
74 
75  /* Allocate the IOPM save area. */
76 // Ki386IopmSaveArea = ExAllocatePoolWithTag(PagedPool,
77 // PAGE_SIZE * 2,
78 // TAG('K', 'e', ' ', ' '));
79 // if (!Ki386IopmSaveArea)
80 // {
81 // /* Bugcheck. We need this for V86/VDM support. */
82 // KeBugCheckEx(NO_PAGES_AVAILABLE, 2, PAGE_SIZE * 2, 0, 0);
83 // }
84 
85 }
86 
87 VOID
88 NTAPI
90  IN ULONG ProcessorNumber,
91  IN PKTHREAD IdleThread,
92  IN PVOID DpcStack)
93 {
94  KDESCRIPTOR GdtDescriptor = {{0},0,0}, IdtDescriptor = {{0},0,0};
95  PKGDTENTRY64 TssEntry;
96  USHORT Tr = 0;
97 
98  /* Zero out the PCR */
99  RtlZeroMemory(Pcr, sizeof(KIPCR));
100 
101  /* Set pointers to ourselves */
102  Pcr->Self = (PKPCR)Pcr;
103  Pcr->CurrentPrcb = &Pcr->Prcb;
104 
105  /* Set the PCR Version */
106  Pcr->MajorVersion = PCR_MAJOR_VERSION;
107  Pcr->MinorVersion = PCR_MINOR_VERSION;
108 
109  /* Set the PRCB Version */
110  Pcr->Prcb.MajorVersion = 1;
111  Pcr->Prcb.MinorVersion = 1;
112 
113  /* Set the Build Type */
114  Pcr->Prcb.BuildType = 0;
115 #ifndef CONFIG_SMP
116  Pcr->Prcb.BuildType |= PRCB_BUILD_UNIPROCESSOR;
117 #endif
118 #if DBG
119  Pcr->Prcb.BuildType |= PRCB_BUILD_DEBUG;
120 #endif
121 
122  /* Set the Processor Number and current Processor Mask */
123  Pcr->Prcb.Number = (UCHAR)ProcessorNumber;
124  Pcr->Prcb.SetMember = 1ULL << ProcessorNumber;
125 
126  /* Get GDT and IDT descriptors */
127  __sgdt(&GdtDescriptor.Limit);
128  __sidt(&IdtDescriptor.Limit);
129  Pcr->GdtBase = (PVOID)GdtDescriptor.Base;
130  Pcr->IdtBase = (PKIDTENTRY)IdtDescriptor.Base;
131 
132  /* Get TSS Selector */
133  __str(&Tr);
134  ASSERT(Tr == KGDT64_SYS_TSS);
135 
136  /* Get TSS Entry */
137  TssEntry = KiGetGdtEntry(Pcr->GdtBase, Tr);
138 
139  /* Get the KTSS itself */
140  Pcr->TssBase = KiGetGdtDescriptorBase(TssEntry);
141 
142  Pcr->Prcb.RspBase = Pcr->TssBase->Rsp0; // FIXME
143 
144  /* Set DPC Stack */
145  Pcr->Prcb.DpcStack = DpcStack;
146 
147  /* Setup the processor set */
148  Pcr->Prcb.MultiThreadProcessorSet = Pcr->Prcb.SetMember;
149 
150  /* Clear DR6/7 to cleanup bootloader debugging */
151  Pcr->Prcb.ProcessorState.SpecialRegisters.KernelDr6 = 0;
152  Pcr->Prcb.ProcessorState.SpecialRegisters.KernelDr7 = 0;
153 
154  /* Set the Current Thread */
155  Pcr->Prcb.CurrentThread = IdleThread;
156 
157  /* Start us out at PASSIVE_LEVEL */
158  Pcr->Irql = PASSIVE_LEVEL;
160 }
161 
162 VOID
163 NTAPI
165 {
166  ULONG64 Pat;
167  ULONG FeatureBits;
168 
169  /* Initialize gs */
171 
172  /* Set GS base */
175 
176  /* Detect and set the CPU Type */
178 
179  /* Get the processor features for this CPU */
180  FeatureBits = KiGetFeatureBits();
181 
182  /* Check if we support all needed features */
183  if ((FeatureBits & REQUIRED_FEATURE_BITS) != REQUIRED_FEATURE_BITS)
184  {
185  /* If not, bugcheck system */
186  FrLdrDbgPrint("CPU doesn't have needed features! Has: 0x%x, required: 0x%x\n",
187  FeatureBits, REQUIRED_FEATURE_BITS);
188  KeBugCheck(0);
189  }
190 
191  /* Set DEP to always on */
192  SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_ALWAYSON;
193  FeatureBits |= KF_NX_ENABLED;
194 
195  /* Save feature bits */
196  Pcr->Prcb.FeatureBits = FeatureBits;
197 
198  /* Enable fx save restore support */
200 
201  /* Enable XMMI exceptions */
203 
204  /* Enable Write-Protection */
206 
207  /* Disable fpu monitoring */
209 
210  /* Disable x87 fpu exceptions */
212 
213  /* LDT is unused */
214  __lldt(0);
215 
216  /* Set the systemcall entry points */
219 
221  ((ULONG64)(KGDT64_R3_CMCODE|RPL_MASK) << 48));
222 
223  /* Set the flags to be cleared when doing a syscall */
225 
226  /* Enable syscall instruction and no-execute support */
228 
229  /* Initialize the PAT */
230  Pat = (PAT_WB << 0) | (PAT_WC << 8) | (PAT_UCM << 16) | (PAT_UC << 24) |
231  (PAT_WB << 32) | (PAT_WC << 40) | (PAT_UCM << 48) | (PAT_UC << 56);
232  __writemsr(MSR_PAT, Pat);
233 }
234 
235 VOID
236 FASTCALL
238  IN UINT64 Stack)
239 {
240  PKGDTENTRY64 TssEntry;
241 
242  /* Get pointer to the GDT entry */
243  TssEntry = KiGetGdtEntry(KeGetPcr()->GdtBase, KGDT64_SYS_TSS);
244 
245  /* Initialize the GDT entry */
246  KiInitGdtEntry(TssEntry, (ULONG64)Tss, sizeof(KTSS64), AMD64_TSS, 0);
247 
248  /* Zero out the TSS */
249  RtlZeroMemory(Tss, sizeof(KTSS64));
250 
251  /* FIXME: I/O Map? */
252  Tss->IoMapBase = 0x68;
253 
254  /* Setup ring 0 stack pointer */
255  Tss->Rsp0 = Stack;
256 
257  /* Setup a stack for Double Fault Traps */
258  Tss->Ist[1] = (ULONG64)KiDoubleFaultStack;
259 
260  /* Setup a stack for CheckAbort Traps */
261  Tss->Ist[2] = (ULONG64)KiDoubleFaultStack;
262 
263  /* Setup a stack for NMI Traps */
264  Tss->Ist[3] = (ULONG64)KiDoubleFaultStack;
265 
266  /* Load the task register */
267  __ltr(KGDT64_SYS_TSS);
268 }
269 
270 VOID
271 NTAPI
274  IN PKPRCB Prcb,
275  IN PLOADER_PARAMETER_BLOCK LoaderBlock)
276 {
277  /* Set boot-level flags */
278  KeI386CpuType = Prcb->CpuType;
279  KeI386CpuStep = Prcb->CpuStep;
281  KeProcessorLevel = (USHORT)Prcb->CpuType;
282  if (Prcb->CpuID)
283  KeProcessorRevision = Prcb->CpuStep;
284 
285  /* Set basic CPU Features that user mode can read */
286  SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
287  SharedUserData->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] = TRUE;
288  SharedUserData->ProcessorFeatures[PF_PPC_MOVEMEM_64BIT_OK] = TRUE;
289  SharedUserData->ProcessorFeatures[PF_PAE_ENABLED] = TRUE; // ???
290  SharedUserData->ProcessorFeatures[PF_NX_ENABLED] = TRUE;
291  SharedUserData->ProcessorFeatures[PF_FASTFAIL_AVAILABLE] = TRUE;
292  SharedUserData->ProcessorFeatures[PF_XSAVE_ENABLED] = TRUE;
293  SharedUserData->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] =
294  (Prcb->FeatureBits & KF_MMX) ? TRUE: FALSE;
295  SharedUserData->ProcessorFeatures[PF_XMMI_INSTRUCTIONS_AVAILABLE] =
296  ((Prcb->FeatureBits & KF_FXSR) && (Prcb->FeatureBits & KF_XMMI)) ? TRUE: FALSE;
298  ((Prcb->FeatureBits & KF_FXSR) && (Prcb->FeatureBits & KF_XMMI64)) ? TRUE: FALSE;
299  SharedUserData->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] =
300  (Prcb->FeatureBits & KF_3DNOW) ? TRUE: FALSE;
301  SharedUserData->ProcessorFeatures[PF_SSE3_INSTRUCTIONS_AVAILABLE] =
302  (Prcb->FeatureBits & KF_SSE3) ? TRUE: FALSE;
303  SharedUserData->ProcessorFeatures[PF_COMPARE_EXCHANGE128] =
304  (Prcb->FeatureBits & KF_CMPXCHG16B) ? TRUE: FALSE;
305 
306  /* Set the default NX policy (opt-in) */
307  SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTIN;
308 
309  /* Check if NPX is always on */
310  if (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=ALWAYSON"))
311  {
312  /* Set it always on */
313  SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_ALWAYSON;
314  Prcb->FeatureBits |= KF_NX_ENABLED;
315  }
316  else if (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=OPTOUT"))
317  {
318  /* Set it in opt-out mode */
319  SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTOUT;
320  Prcb->FeatureBits |= KF_NX_ENABLED;
321  }
322  else if ((strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=OPTIN")) ||
323  (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE")))
324  {
325  /* Set the feature bits */
326  Prcb->FeatureBits |= KF_NX_ENABLED;
327  }
328  else if ((strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=ALWAYSOFF")) ||
329  (strstr(KeLoaderBlock->LoadOptions, "EXECUTE")))
330  {
331  /* Set disabled mode */
332  SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_ALWAYSOFF;
333  Prcb->FeatureBits |= KF_NX_DISABLED;
334  }
335 }
336 
338 
339 void
341 {
342  PLDR_DATA_TABLE_ENTRY LdrEntry;
344  ULONG i;
345 
346  /* Initialize the list head */
348 
349  /* Loop the first 3 entries */
350  for (Entry = LoaderBlock->LoadOrderListHead.Flink, i = 0;
351  Entry != &LoaderBlock->LoadOrderListHead && i < 3;
352  Entry = Entry->Flink, i++)
353  {
354  /* Get the data table entry */
355  LdrEntry = CONTAINING_RECORD(Entry,
357  InLoadOrderLinks);
358 
359  /* Copy the entry */
360  LdrCoreEntries[i] = *LdrEntry;
361 
362  /* Insert the copy into the list */
363  InsertTailList(&PsLoadedModuleList, &LdrCoreEntries[i].InLoadOrderLinks);
364  }
365 }
366 
367 VOID
368 NTAPI
370 {
371  CCHAR Cpu;
372  PKTHREAD InitialThread;
373  ULONG64 InitialStack;
374  PKIPCR Pcr;
375 
376  /* HACK */
377  FrLdrDbgPrint = LoaderBlock->u.I386.CommonDataArea;
378  //FrLdrDbgPrint("Hello from KiSystemStartup!!!\n");
379 
380  /* Save the loader block */
381  KeLoaderBlock = LoaderBlock;
382 
383  /* Get the current CPU number */
384  Cpu = KeNumberProcessors++; // FIXME
385 
386  /* LoaderBlock initialization for Cpu 0 */
387  if (Cpu == 0)
388  {
389  /* Set the initial stack, idle thread and process */
390  LoaderBlock->KernelStack = (ULONG_PTR)P0BootStack;
391  LoaderBlock->Thread = (ULONG_PTR)&KiInitialThread;
392  LoaderBlock->Process = (ULONG_PTR)&KiInitialProcess.Pcb;
393  LoaderBlock->Prcb = (ULONG_PTR)&KiInitialPcr.Prcb;
394  }
395 
396  /* Get Pcr from loader block */
397  Pcr = CONTAINING_RECORD(LoaderBlock->Prcb, KIPCR, Prcb);
398 
399  /* Set the PRCB for this Processor */
400  KiProcessorBlock[Cpu] = &Pcr->Prcb;
401 
402  /* Align stack to 16 bytes */
403  LoaderBlock->KernelStack &= ~(16 - 1);
404 
405  /* Save the initial thread and stack */
406  InitialStack = LoaderBlock->KernelStack; // Checkme
407  InitialThread = (PKTHREAD)LoaderBlock->Thread;
408 
409  /* Set us as the current process */
410  InitialThread->ApcState.Process = (PVOID)LoaderBlock->Process;
411 
412  /* Initialize the PCR */
413  KiInitializePcr(Pcr, Cpu, InitialThread, (PVOID)KiDoubleFaultStack);
414 
415  /* Initialize the CPU features */
416  KiInitializeCpu(Pcr);
417 
418  /* Initial setup for the boot CPU */
419  if (Cpu == 0)
420  {
421  /* Initialize the module list (ntos, hal, kdcom) */
422  KiInitModuleList(LoaderBlock);
423 
424  /* Setup the TSS descriptors and entries */
425  KiInitializeTss(Pcr->TssBase, InitialStack);
426 
427  /* Setup the IDT */
429 
430  /* Initialize debugging system */
432 
433  /* Check for break-in */
435  }
436 
437  DPRINT1("Pcr = %p, Gdt = %p, Idt = %p, Tss = %p\n",
438  Pcr, Pcr->GdtBase, Pcr->IdtBase, Pcr->TssBase);
439 
440  /* Acquire lock */
441  while (InterlockedBitTestAndSet64((PLONG64)&KiFreezeExecutionLock, 0))
442  {
443  /* Loop until lock is free */
444  while ((*(volatile KSPIN_LOCK*)&KiFreezeExecutionLock) & 1);
445  }
446 
447  /* Initialize the Processor with HAL */
449 
450  /* Set processor as active */
451  KeActiveProcessors |= 1ULL << Cpu;
452 
453  /* Release lock */
454  InterlockedAnd64((PLONG64)&KiFreezeExecutionLock, 0);
455 
456  /* Raise to HIGH_LEVEL */
458 
459  /* Machine specific kernel initialization */
460  if (Cpu == 0) KiInitializeKernelMachineDependent(&Pcr->Prcb, LoaderBlock);
461 
462  /* Switch to new kernel stack and start kernel bootstrapping */
463  KiSwitchToBootStack(InitialStack & ~3);
464 }
465 
VOID NTAPI KiInitMachineDependent(VOID)
Definition: kiinit.c:45
#define CR0_MP
Definition: asm.h:246
DWORD *typedef PVOID
Definition: winlogon.h:52
#define PF_COMPARE_EXCHANGE128
__INTRIN_INLINE void __writecr4(unsigned int Data)
Definition: intrin_x86.h:1685
VOID FASTCALL KiInitializeTss(IN PKTSS64 Tss, IN UINT64 Stack)
Definition: kiinit.c:237
#define IN
Definition: typedefs.h:38
#define InterlockedAnd64
Definition: interlocked.h:87
#define TRUE
Definition: types.h:120
#define PAT_UCM
Definition: ketypes.h:206
#define REQUIRED_FEATURE_BITS
Definition: kiinit.c:16
struct _Entry Entry
Definition: kefuncs.h:640
union _KGDTENTRY64 * GdtBase
Definition: ketypes.h:860
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define NX_SUPPORT_POLICY_OPTIN
Definition: ketypes.h:1085
VOID NTAPI KeInitExceptions(VOID)
Definition: except.c:59
#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
VOID FORCEINLINE KiInitGdtEntry(PKGDTENTRY64 Entry, ULONG64 Base, ULONG Size, UCHAR Type, UCHAR Dpl)
Definition: intrin_i.h:48
#define MSR_SYSCALL_MASK
Definition: ketypes.h:186
ULONG KeFeatureBits
Definition: krnlinit.c:22
void KiInitializeSegments()
#define MSR_PAT
Definition: ketypes.h:215
VOID KeSetCurrentIrql(KIRQL NewIrql)
Definition: mpsirql.c:51
#define InsertTailList(ListHead, Entry)
#define FASTCALL
Definition: nt_native.h:50
#define PRCB_BUILD_DEBUG
Definition: ketypes.h:242
PVOID Base
Definition: ketypes.h:486
static LDR_DATA_TABLE_ENTRY LdrCoreEntries[3]
Definition: kiinit.c:337
#define MSR_LSTAR
Definition: ketypes.h:184
#define KeGetPcr()
Definition: ke.h:25
#define CR0_NE
Definition: asm.h:250
#define NX_SUPPORT_POLICY_ALWAYSON
Definition: ketypes.h:1084
VOID NTAPI KiInitializePcr(IN PKIPCR Pcr, IN ULONG ProcessorNumber, IN PKTHREAD IdleThread, IN PVOID DpcStack)
Definition: kiinit.c:89
USHORT Limit
Definition: ketypes.h:485
UCHAR DECLSPEC_ALIGN(16)
Definition: kiinit.c:32
struct _KTSS64 * TssBase
Definition: ketypes.h:861
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define KF_LARGE_PAGE
Definition: ketypes.h:148
ULONG_PTR P0BootStack
Definition: kiinit.c:34
struct _KTHREAD * PKTHREAD
Definition: nt_native.h:28
GLenum GLclampf GLint i
Definition: glfuncs.h:14
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:1083
#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
#define KF_XMMI
Definition: ketypes.h:156
__INTRIN_INLINE void __sidt(void *Destination)
Definition: intrin_x86.h:1925
KAPC_STATE ApcState
Definition: ketypes.h:1668
#define NX_SUPPORT_POLICY_OPTOUT
Definition: ketypes.h:1086
BOOLEAN NTAPI KdPollBreakIn(VOID)
Definition: kdmain.c:367
#define PF_XMMI_INSTRUCTIONS_AVAILABLE
#define RPL_MASK
Definition: ketypes.h:69
__INTRIN_INLINE void __writecr0(unsigned int Data)
Definition: intrin_x86.h:1675
PPC_QUAL unsigned long long __readmsr()
Definition: intrin_ppc.h:741
#define MSR_STAR
Definition: ketypes.h:183
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1469
PVOID FORCEINLINE KiGetGdtDescriptorBase(PKGDTENTRY Entry)
Definition: intrin_i.h:20
void KiInitModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:340
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:139
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
USHORT KeProcessorArchitecture
Definition: krnlinit.c:19
USHORT KeProcessorRevision
Definition: krnlinit.c:21
#define CR4_XMMEXCPT
Definition: ketypes.h:93
if(!(yy_init))
Definition: macro.lex.yy.c:717
char CCHAR
Definition: typedefs.h:50
void KiSystemCallEntry64()
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:34
#define PF_FASTFAIL_AVAILABLE
#define KF_MTRR
Definition: ketypes.h:149
VOID NTAPI KiInitializeCpu(PKIPCR Pcr)
Definition: kiinit.c:164
ULONG KeI386CpuType
Definition: cpu.c:28
#define PF_XSAVE_ENABLED
VOID NTAPI KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:369
PKGDTENTRY64 FORCEINLINE KiGetGdtEntry(PVOID pGdt, USHORT Selector)
Definition: intrin_i.h:13
#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
unsigned __int64 ULONG64
Definition: imports.h:198
#define SharedUserData
#define MSR_SCE
Definition: ketypes.h:211
unsigned char UCHAR
Definition: xmlstorage.h:181
#define AMD64_TSS
Definition: ke.h:81
ULONG KeI386CpuStep
Definition: cpu.c:29
#define PF_SSE3_INSTRUCTIONS_AVAILABLE
KPRCB Prcb
Definition: ketypes.h:889
#define KGDT64_SYS_TSS
Definition: ketypes.h:77
ULONG(* FrLdrDbgPrint)(const char *Format,...)
Definition: kiinit.c:23
VOID KiSwitchToBootStack(IN ULONG_PTR InitialStack)
Definition: ke.h:796
Definition: btrfs_drv.h:1762
#define KF_NX_DISABLED
Definition: ketypes.h:166
__INTRIN_INLINE unsigned long __readcr0(void)
Definition: intrin_x86.h:1697
Definition: typedefs.h:117
#define EFLAGS_TF
Definition: ketypes.h:125
KPROCESS Pcb
Definition: pstypes.h:1193
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:1718
KAFFINITY KeActiveProcessors
Definition: krnlinit.c:23
#define MSR_EFER
Definition: ketypes.h:182
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:202
ULONG KiGetFeatureBits()
union _KIDTENTRY64 * IdtBase
Definition: ketypes.h:869
#define PCR_MINOR_VERSION
Definition: ke.h:277
#define PAT_WB
Definition: ketypes.h:205
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
#define PF_RDTSC_INSTRUCTION_AVAILABLE
#define MSR_GS_BASE
Definition: ketypes.h:188
#define KF_XMMI64
Definition: ketypes.h:159
#define KF_CMPXCHG16B
Definition: ketypes.h:163
#define EFLAGS_DF
Definition: strlen.c:26
BOOLEAN NTAPI KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kdinit.c:174
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
VOID KiSetProcessorType()
#define PRCB_BUILD_UNIPROCESSOR
Definition: ketypes.h:243
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
VOID NTAPI INIT_FUNCTION KiInitializeKernelMachineDependent(IN PKPRCB Prcb, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kiinit.c:273
#define MSR_CSTAR
Definition: ketypes.h:185
#define PAT_UC
Definition: ketypes.h:201
#define PF_NX_ENABLED
#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:261
#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 KF_GLOBAL_PAGE
Definition: ketypes.h:147
unsigned long long UINT64
#define MSR_GS_SWAP
Definition: ketypes.h:189
#define KF_NX_ENABLED
Definition: ketypes.h:167
__int64 * PLONG64
Definition: basetsd.h:185
#define PF_3DNOW_INSTRUCTIONS_AVAILABLE
#define MSR_NXE
Definition: ketypes.h:214
#define PCR_MAJOR_VERSION
Definition: ke.h:278
#define CR0_WP
Definition: asm.h:251
#define PF_MMX_INSTRUCTIONS_AVAILABLE
#define INIT_FUNCTION
Definition: ntoskrnl.h:11
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:1196