45 ULONG MXCsrMask = 0xFFBF;
141 KiCpuId(&CpuInfo, 0);
154 KiCpuId(&CpuInfo, 0);
170 PerfFreq.QuadPart + 500000) /
178 if ((CurrentSample->
MHz == CurrentSample[-1].
MHz) ||
179 (CurrentSample->
MHz == CurrentSample[-1].
MHz + 1) ||
180 (CurrentSample->
MHz == CurrentSample[-1].
MHz - 1))
197 TotalMHz += Samples[Sample].
MHz;
200 DPRINT1(
"Sampling CPU frequency failed. Using average of %lu MHz\n", CurrentSample[-1].MHz);
232 Ke386SaveFpuState(FxSaveArea);
253 KeBugCheckEx(MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED,
274 DPRINT1(
"ISR Time Limit not yet supported\n");
294 Pcr->NtTib.StackBase = 0;
295 Pcr->NtTib.StackLimit = 0;
296 Pcr->NtTib.Self =
NULL;
299 Pcr->PrcbData.CurrentThread = IdleThread;
302 Pcr->SelfPcr = (
PKPCR)Pcr;
303 Pcr->Prcb = &Pcr->PrcbData;
314 Pcr->PrcbData.BuildType = 0;
323 Pcr->PrcbData.Number = (
UCHAR)ProcessorNumber;
324 Pcr->PrcbData.SetMember = 1 << ProcessorNumber;
333 Pcr->GDT = (
PVOID)Gdt;
337 Pcr->PrcbData.DpcStack = DpcStack;
340 Pcr->PrcbData.MultiThreadProcessorSet = Pcr->PrcbData.SetMember;
360 if (NewEFlags == EFlags)
373 KiCpuId(&CpuInfo, 0);
374 if (CpuInfo.
Eax == 0)
383 if (Prcb->CpuType == 3)
394 KeBugCheckEx(UNSUPPORTED_PROCESSOR, 0x2, 0x00000010, 0, 0);
399 KeBugCheckEx(UNSUPPORTED_PROCESSOR, 0x2, 0x00000100, 0, 0);
403 KiCpuId(&CpuInfo, 1);
405 if (!(CpuInfo.
Edx & 0x00000001))
407 KeBugCheckEx(UNSUPPORTED_PROCESSOR, 0x2, 0x00000001, 0, 0);
422 KeBugCheckEx(UNSUPPORTED_PROCESSOR, 0x2, 0x00000001, 0, 0);
426 Prcb->FeatureBits = FeatureBits;
439 ULONG PageDirectory[2];
486 KiReportCpuFeatures();
512 Prcb->MultiThreadSetMaster = Prcb;
526 PageDirectory[0] = 0;
527 PageDirectory[1] = 0;
533 InitProcess->QuantumReset =
MAXCHAR;
550 InitThread->NextProcessor =
Number;
553 InitThread->Affinity = 1 <<
Number;
555 InitProcess->ActiveProcessors |= 1 <<
Number;
576 Prcb->CurrentThread = InitThread;
577 Prcb->NextThread =
NULL;
578 Prcb->IdleThread = InitThread;
598 if (!DpcStack)
KeBugCheckEx(NO_PAGES_AVAILABLE, 1, 0, 0, 0);
599 Prcb->DpcStack = DpcStack;
625 LoaderBlock->Prcb = 0;
716 PointerPte->
Write = 0;
756 InitialStack = LoaderBlock->KernelStack;
757 InitialThread = (
PKTHREAD)LoaderBlock->Thread;
766 if (Cpu)
goto AppCpuInit;
817 LoaderBlock->Prcb = 0;
char * strstr(char *String1, char *String2)
static VOID KiInitializePcr(_Out_ PKIPCR Pcr, _In_ ULONG ProcessorNumber, _In_ PKGDTENTRY64 GdtBase, _In_ PKIDTENTRY64 IdtBase, _In_ PKTSS64 TssBase, _In_ PKTHREAD IdleThread, _In_ PVOID DpcStack)
DECLSPEC_NORETURN VOID NTAPI KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
KSPIN_LOCK KiFreezeExecutionLock
VOID NTAPI KiInitMachineDependent(VOID)
VOID NTAPI KiInitializeKernel(IN PKPROCESS InitProcess, IN PKTHREAD InitThread, IN PVOID IdleStack, IN PKPRCB Prcb, IN CCHAR Number, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
VOID KiInitializeMachineType(VOID)
#define NT_SUCCESS(StatCode)
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeRaiseIrql(irql, oldIrql)
#define KeLowerIrql(oldIrql)
#define InitializeListHead(ListHead)
#define KeDelayExecutionThread(mode, foo, t)
#define KeInitializeSpinLock(sl)
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
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
VOID NTAPI HalInitializeProcessor(IN ULONG ProcessorNumber, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
LARGE_INTEGER NTAPI KeQueryPerformanceCounter(IN PLARGE_INTEGER PerformanceFreq)
#define KeGetCurrentThread
#define Ke386GetGlobalDescriptorTable
static VOID KiVerifyCpuFeatures(PKPRCB Prcb)
KSPIN_LOCK Ki486CompatibilityLock
DECLSPEC_NORETURN VOID NTAPI KiSystemStartupBootStack(VOID)
VOID FASTCALL KiGetMachineBootPointers(IN PKGDTENTRY *Gdt, IN PKIDTENTRY *Idt, IN PKIPCR *Pcr, IN PKTSS *Tss)
static VOID KiMarkPageAsReadOnly(PVOID Address)
ULONG_PTR KiDoubleFaultStack
#define InterlockedBitTestAndSet
void __cdecl _enable(void)
PPC_QUAL void __writefsdword(const unsigned long Offset, const unsigned long Data)
PPC_QUAL unsigned long __readfsdword(const unsigned long Offset)
PPC_QUAL unsigned long long __rdtsc(void)
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
__INTRIN_INLINE unsigned long __readcr0(void)
__INTRIN_INLINE uintptr_t __readeflags(void)
__INTRIN_INLINE void __invlpg(void *Address)
__INTRIN_INLINE void __writecr0(unsigned int Data)
__INTRIN_INLINE void __sidt(void *Destination)
BOOLEAN NTAPI KdInitSystem(_In_ ULONG BootPhase, _In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
BOOLEAN NTAPI KdPollBreakIn(VOID)
FORCEINLINE VOID KiReleasePrcbLock(IN PKPRCB Prcb)
FORCEINLINE VOID KiAcquirePrcbLock(IN PKPRCB Prcb)
PLOADER_PARAMETER_BLOCK KeLoaderBlock
#define PRCB_MINOR_VERSION
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
#define PRCB_MAJOR_VERSION
#define PRCB_BUILD_UNIPROCESSOR
#define KPCR_PRCB_SET_MEMBER
#define KPCR_SET_MEMBER_COPY
#define KPCR_PROCESSOR_NUMBER
#define DBG_STATUS_CONTROL_C
#define PROCESSOR_ARCHITECTURE_INTEL
#define EXCEPTION_CHAIN_END
struct _KTHREAD * PKTHREAD
struct _EPROCESS * PEPROCESS
struct _ETHREAD * PETHREAD
#define DECLSPEC_ALIGN(x)
#define DECLSPEC_NORETURN
VOID NTAPI ExpInitializeExecutive(IN ULONG Cpu, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
DECLSPEC_NORETURN VOID KiSwitchToBootStack(IN ULONG_PTR InitialStack)
VOID KiGetCacheInformation(VOID)
ULONG64 KiGetFeatureBits(VOID)
Evaluates the KeFeatureFlag bits for the current CPU.
VOID KiSetProcessorType(VOID)
VOID NTAPI KiInitializePAT(VOID)
VOID FASTCALL Ki386InitializeTss(IN PKTSS Tss, IN PKIDTENTRY Idt, IN PKGDTENTRY Gdt)
ULONG_PTR NTAPI Ki386EnableTargetLargePage(IN ULONG_PTR Context)
VOID NTAPI KiI386PentiumLockErrataFixup(VOID)
BOOLEAN NTAPI KiIsNpxErrataPresent(VOID)
ULONG_PTR NTAPI Ki386EnableXMMIExceptions(IN ULONG_PTR Context)
VOID NTAPI KiAmdK6InitializeMTRR(VOID)
ULONG_PTR NTAPI Ki386EnableFxsr(IN ULONG_PTR Context)
BOOLEAN NTAPI Ki386CreateIdentityMap(IN PLARGE_IDENTITY_MAP IdentityMap, IN PVOID StartPtr, IN ULONG Length)
VOID NTAPI Ki386EnableCurrentLargePage(IN ULONG_PTR StartAddress, IN ULONG Cr3)
VOID NTAPI KiRestoreFastSyscallReturnState(VOID)
BOOLEAN KiI386PentiumLockErrataPresent
ULONG_PTR NTAPI Ki386EnableGlobalPage(IN ULONG_PTR Context)
VOID NTAPI Ki386FreeIdentityMap(IN PLARGE_IDENTITY_MAP IdentityMap)
VOID NTAPI KiInitializeMTRR(IN BOOLEAN FinalCpu)
VOID NTAPI KiSetCR0Bits(VOID)
FORCEINLINE PFX_SAVE_AREA KiGetThreadNpxArea(IN PKTHREAD Thread)
KDESCRIPTOR KiIdtDescriptor
ULONG_PTR NTAPI Ki386EnableDE(IN ULONG_PTR Context)
LARGE_INTEGER KiTimeIncrementReciprocal
EPROCESS KiInitialProcess
ULONG KiAdjustDpcThreshold
PKPRCB KiProcessorBlock[]
ULONG KiTimeLimitIsrMicroseconds
ULONG KiMaximumDpcQueueDepth
VOID NTAPI KeInitializeThread(IN PKPROCESS Process, IN OUT PKTHREAD Thread, IN PKSYSTEM_ROUTINE SystemRoutine, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext, IN PCONTEXT Context, IN PVOID Teb, IN PVOID KernelStack)
KAFFINITY KeActiveProcessors
VOID NTAPI KeInitExceptions(VOID)
UCHAR KiTimeIncrementShiftCount
DECLSPEC_NORETURN VOID KiIdleLoop(VOID)
VOID NTAPI KiInitSystem(VOID)
LARGE_INTEGER NTAPI KiComputeReciprocal(IN LONG Divisor, OUT PUCHAR Shift)
VOID NTAPI KiSaveProcessorControlState(OUT PKPROCESSOR_STATE ProcessorState)
VOID NTAPI KeInitializeProcess(struct _KPROCESS *Process, KPRIORITY Priority, KAFFINITY Affinity, PULONG_PTR DirectoryTableBase, IN BOOLEAN Enable)
USHORT KeProcessorRevision
VOID NTAPI KiInitSpinLocks(IN PKPRCB Prcb, IN CCHAR Number)
LIST_ENTRY KiProcessListHead
USHORT KeProcessorArchitecture
PVOID NTAPI MmCreateKernelStack(BOOLEAN GuiStack, UCHAR Node)
ULONG_PTR NTAPI KeIpiGenericCall(_In_ PKIPI_BROADCAST_WORKER Function, _In_ ULONG_PTR Argument)
VOID FASTCALL RtlPrefetchMemoryNonTemporal(IN PVOID Source, IN SIZE_T Length)
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
VOID NTAPI PoInitializePrcb(IN PKPRCB Prcb)
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
FORCEINLINE VOID KeMemoryBarrier(VOID)
#define KERNEL_STACK_SIZE
#define PCR_MINOR_VERSION
#define PCR_MAJOR_VERSION
union _FX_SAVE_AREA::@2458 U
struct _KGDTENTRY::@2451::@2452 Bytes
union _KGDTENTRY::@2451 HighWord
VOID NTAPI KeSetSystemAffinityThread(IN KAFFINITY Affinity)
VOID NTAPI KeRevertToUserAffinityThread(VOID)
KPRIORITY NTAPI KeSetPriorityThread(IN PKTHREAD Thread, IN KPRIORITY Priority)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus(_In_ ULONG Status)
#define ALIGN_DOWN_POINTER_BY(ptr, align)
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
#define HalQuerySystemInformation
@ HalFrameBufferCachingInformation
#define NX_SUPPORT_POLICY_ALWAYSOFF
#define PF_3DNOW_INSTRUCTIONS_AVAILABLE
#define PF_MMX_INSTRUCTIONS_AVAILABLE
#define PF_XMMI64_INSTRUCTIONS_AVAILABLE
#define PF_XMMI_INSTRUCTIONS_AVAILABLE
#define NX_SUPPORT_POLICY_OPTIN
#define NX_SUPPORT_POLICY_OPTOUT
#define NX_SUPPORT_POLICY_ALWAYSON
#define PF_FLOATING_POINT_PRECISION_ERRATA
#define PF_COMPARE_EXCHANGE_DOUBLE
#define PF_RDTSC_INSTRUCTION_AVAILABLE