ReactOS 0.4.17-dev-683-g0dafdc5
ke.h File Reference
#include "intrin_i.h"
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for ke.h:

Go to the source code of this file.

Classes

struct  _KIDT_INIT
 
struct  _KI_INTERRUPT_DISPATCH_ENTRY
 

Macros

#define X86_EFLAGS_TF   0x00000100 /* Trap flag */
 
#define X86_EFLAGS_IF   0x00000200 /* Interrupt Enable flag */
 
#define X86_EFLAGS_IOPL   0x00003000 /* I/O Privilege Level bits */
 
#define X86_EFLAGS_NT   0x00004000 /* Nested Task flag */
 
#define X86_EFLAGS_RF   0x00010000 /* Resume flag */
 
#define X86_EFLAGS_VM   0x00020000 /* Virtual Mode */
 
#define X86_EFLAGS_ID   0x00200000 /* CPUID detection flag */
 
#define X86_CR0_PE   0x00000001 /* enable Protected Mode */
 
#define X86_CR0_NE   0x00000020 /* enable native FPU error reporting */
 
#define X86_CR0_TS   0x00000008 /* enable exception on FPU instruction for task switch */
 
#define X86_CR0_EM   0x00000004 /* enable FPU emulation (disable FPU) */
 
#define X86_CR0_MP   0x00000002 /* enable FPU monitoring */
 
#define X86_CR0_WP   0x00010000 /* enable Write Protect (copy on write) */
 
#define X86_CR0_PG   0x80000000 /* enable Paging */
 
#define X86_CR4_PAE   0x00000020 /* enable physical address extensions */
 
#define X86_CR4_PGE   0x00000080 /* enable global pages */
 
#define X86_CR4_OSFXSR   0x00000200 /* enable FXSAVE/FXRSTOR instructions */
 
#define X86_CR4_OSXMMEXCPT   0x00000400 /* enable #XF exception */
 
#define X86_FEATURE_FPU   0x00000001 /* x87 FPU is present */
 
#define X86_FEATURE_VME   0x00000002 /* Virtual 8086 Extensions are present */
 
#define X86_FEATURE_DBG   0x00000004 /* Debugging extensions are present */
 
#define X86_FEATURE_PSE   0x00000008 /* Page Size Extension is present */
 
#define X86_FEATURE_TSC   0x00000010 /* time stamp counters are present */
 
#define X86_FEATURE_PAE   0x00000040 /* physical address extension is present */
 
#define X86_FEATURE_CX8   0x00000100 /* CMPXCHG8B instruction present */
 
#define X86_FEATURE_SYSCALL   0x00000800 /* SYSCALL/SYSRET support present */
 
#define X86_FEATURE_MTRR   0x00001000 /* Memory type range registers are present */
 
#define X86_FEATURE_PGE   0x00002000 /* Page Global Enable */
 
#define X86_FEATURE_CMOV   0x00008000 /* "Conditional move" instruction supported */
 
#define X86_FEATURE_PAT   0x00010000 /* Page Attribute Table is supported */
 
#define X86_FEATURE_DS   0x00200000 /* Debug Store is present */
 
#define X86_FEATURE_MMX   0x00800000 /* MMX extension present */
 
#define X86_FEATURE_FXSR   0x01000000 /* FXSAVE/FXRSTOR instructions present */
 
#define X86_FEATURE_SSE   0x02000000 /* SSE extension present */
 
#define X86_FEATURE_SSE2   0x04000000 /* SSE2 extension present */
 
#define X86_FEATURE_HT   0x10000000 /* Hyper-Threading present */
 
#define X86_FEATURE_SSE3   0x00000001 /* SSE3 is supported */
 
#define X86_FEATURE_MONITOR   0x00000008 /* SSE3 Monitor instructions supported */
 
#define X86_FEATURE_VMX   0x00000020 /* Virtual Machine eXtensions are available */
 
#define X86_FEATURE_SSSE3   0x00000200 /* Supplemental SSE3 are available */
 
#define X86_FEATURE_FMA3   0x00001000 /* Fused multiple-add supported */
 
#define X86_FEATURE_CX16   0x00002000 /* CMPXCHG16B instruction are available */
 
#define X86_FEATURE_PCID   0x00020000 /* Process Context IDentifiers are supported */
 
#define X86_FEATURE_SSE41   0x00080000 /* SSE 4.1 is supported */
 
#define X86_FEATURE_SSE42   0x00100000 /* SSE 4.2 is supported */
 
#define X86_FEATURE_POPCNT   0x00800000 /* POPCNT instruction is available */
 
#define X86_FEATURE_XSAVE   0x04000000 /* XSAVE family are available */
 
#define X86_FEATURE_NX   0x00100000 /* NX support present */
 
#define X86_EXT_FEATURE_SSE3   0x00000001 /* SSE3 extension present */
 
#define X86_EXT_FEATURE_3DNOW   0x40000000 /* 3DNOW! extension present */
 
#define FRAME_EDITED   0xFFF8
 
#define X86_MSR_GSBASE   0xC0000101
 
#define X86_MSR_KERNEL_GSBASE   0xC0000102
 
#define X86_MSR_EFER   0xC0000080
 
#define X86_MSR_STAR   0xC0000081
 
#define X86_MSR_LSTAR   0xC0000082
 
#define X86_MSR_CSTAR   0xC0000083
 
#define X86_MSR_SFMASK   0xC0000084
 
#define EFER_SCE   0x0001
 
#define EFER_LME   0x0100
 
#define EFER_LMA   0x0400
 
#define EFER_NXE   0x0800
 
#define EFER_SVME   0x1000
 
#define EFER_FFXSR   0x4000
 
#define AMD64_TSS   9
 
#define APIC_EOI_REGISTER   0xFFFFFFFFFFFE00B0ULL
 
#define KD_BREAKPOINT_TYPE   UCHAR
 
#define KD_BREAKPOINT_SIZE   sizeof(UCHAR)
 
#define KD_BREAKPOINT_VALUE   0xCC
 
#define KeGetTrapFrame(Thread)
 
#define KeGetContextSwitches(Prcb)    (Prcb->KeContextSwitches)
 
#define KiGetSecondLevelDCacheSize()   ((PKIPCR)KeGetPcr())->SecondLevelCacheSize
 
#define KeGetExceptionFrame(Thread)
 
#define KeGetTrapFrameInterruptState(TrapFrame)    BooleanFlagOn((TrapFrame)->EFlags, EFLAGS_INTERRUPT_MASK)
 
#define KeArchInitThreadWithContext(Thread, SystemRoutine, StartRoutine, StartContext, Context)    Ke386InitThreadWithContext(Thread,SystemRoutine,StartRoutine,StartContext,Context)
 

Typedefs

typedef struct _KIDT_INIT KIDT_INIT
 
typedef struct _KIDT_INITPKIDT_INIT
 
typedef struct _KI_INTERRUPT_DISPATCH_ENTRY KI_INTERRUPT_DISPATCH_ENTRY
 
typedef struct _KI_INTERRUPT_DISPATCH_ENTRYPKI_INTERRUPT_DISPATCH_ENTRY
 

Functions

FORCEINLINE ULONG_PTR KeGetContextPc (PCONTEXT Context)
 
FORCEINLINE VOID KeSetContextPc (PCONTEXT Context, ULONG_PTR ProgramCounter)
 
FORCEINLINE ULONG_PTR KeGetContextReturnRegister (PCONTEXT Context)
 
FORCEINLINE VOID KeSetContextReturnRegister (PCONTEXT Context, ULONG_PTR ReturnValue)
 
FORCEINLINE ULONG_PTR KeGetContextStackRegister (PCONTEXT Context)
 
FORCEINLINE ULONG_PTR KeGetContextFrameRegister (PCONTEXT Context)
 
FORCEINLINE VOID KeSetContextFrameRegister (PCONTEXT Context, ULONG_PTR Frame)
 
FORCEINLINE ULONG_PTR KeGetTrapFramePc (PKTRAP_FRAME TrapFrame)
 
FORCEINLINE PKTRAP_FRAME KiGetLinkedTrapFrame (PKTRAP_FRAME TrapFrame)
 
FORCEINLINE ULONG_PTR KeGetTrapFrameStackRegister (PKTRAP_FRAME TrapFrame)
 
FORCEINLINE ULONG_PTR KeGetTrapFrameFrameRegister (PKTRAP_FRAME TrapFrame)
 
FORCEINLINE ULONG64 KxQueryProcessorCycleTime (VOID)
 
FORCEINLINE BOOLEAN KeDisableInterrupts (VOID)
 
FORCEINLINE VOID KeRestoreInterrupts (BOOLEAN WereEnabled)
 
FORCEINLINE VOID KeInvalidateTlbEntry (IN PVOID Address)
 
FORCEINLINE VOID KeFlushProcessTb (VOID)
 
FORCEINLINE VOID KeSweepICache (IN PVOID BaseAddress, IN SIZE_T FlushSize)
 
FORCEINLINE VOID KiRundownThread (IN PKTHREAD Thread)
 
FORCEINLINE VOID KeRegisterInterruptHandler (IN ULONG Vector, IN PVOID Handler)
 
FORCEINLINE PVOID KeQueryInterruptHandler (IN ULONG Vector)
 
FORCEINLINE VOID KiSendEOI (VOID)
 
FORCEINLINE VOID KiEndInterrupt (IN KIRQL Irql, IN PKTRAP_FRAME TrapFrame)
 
FORCEINLINE BOOLEAN KiUserTrap (IN PKTRAP_FRAME TrapFrame)
 
FORCEINLINE VOID Ki386PerfEnd (VOID)
 
DECLSPEC_NORETURN VOID KiSwitchToBootStack (IN ULONG_PTR InitialStack)
 
VOID KiDivideErrorFault (VOID)
 
VOID KiDebugTrapOrFault (VOID)
 
VOID KiNmiInterrupt (VOID)
 
VOID KiBreakpointTrap (VOID)
 
VOID KiOverflowTrap (VOID)
 
VOID KiBoundFault (VOID)
 
VOID KiInvalidOpcodeFault (VOID)
 
VOID KiNpxNotAvailableFault (VOID)
 
VOID KiDoubleFaultAbort (VOID)
 
VOID KiNpxSegmentOverrunAbort (VOID)
 
VOID KiInvalidTssFault (VOID)
 
VOID KiSegmentNotPresentFault (VOID)
 
VOID KiStackFault (VOID)
 
VOID KiGeneralProtectionFault (VOID)
 
VOID KiPageFault (VOID)
 
VOID KiFloatingErrorFault (VOID)
 
VOID KiAlignmentFault (VOID)
 
VOID KiMcheckAbort (VOID)
 
VOID KiXmmException (VOID)
 
VOID KiApcInterrupt (VOID)
 
VOID KiRaiseAssertion (VOID)
 
VOID KiDebugServiceTrap (VOID)
 
VOID KiDpcInterrupt (VOID)
 
VOID KiIpiInterrupt (VOID)
 
VOID KiGdtPrepareForApplicationProcessorInit (ULONG Id)
 
VOID Ki386InitializeLdt (VOID)
 
VOID Ki386SetProcessorFeatures (VOID)
 
VOID KiGetCacheInformation (VOID)
 
VOID KiSetProcessorType (VOID)
 
ULONG64 KiGetFeatureBits (VOID)
 Evaluates the KeFeatureFlag bits for the current CPU.
 
VOID KiInitializeCpuFeatures (VOID)
 
ULONG KeAllocateGdtSelector (ULONG Desc[2])
 
VOID KeFreeGdtSelector (ULONG Entry)
 
VOID NtEarlyInitVdm (VOID)
 
VOID KeApplicationProcessorInitDispatcher (VOID)
 
VOID KeCreateApplicationProcessorIdleThread (ULONG Id)
 
VOID Ke386InitThreadWithContext (PKTHREAD Thread, PKSYSTEM_ROUTINE SystemRoutine, PKSTART_ROUTINE StartRoutine, PVOID StartContext, PCONTEXT Context)
 
NTHALAPI NTSTATUS NTAPI HalAllocateAdapterChannel (IN PADAPTER_OBJECT AdapterObject, IN PWAIT_CONTEXT_BLOCK Wcb, IN ULONG NumberOfMapRegisters, IN PDRIVER_CONTROL ExecutionRoutine)
 
FORCEINLINE PULONG_PTR KiGetUserModeStackAddress (void)
 
VOID KiGetTrapContext (_In_ PKTRAP_FRAME TrapFrame, _Out_ PCONTEXT Context)
 
VOID KiSetTrapContext (_Out_ PKTRAP_FRAME TrapFrame, _In_ PCONTEXT Context, _In_ KPROCESSOR_MODE RequestorMode)
 
DECLSPEC_NORETURN VOID KiUserCallbackExit (_In_ PKTRAP_FRAME TrapFrame)
 
DECLSPEC_NORETURN VOID KiExceptionExit (_In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame)
 
BOOLEAN KiProcessorFreezeHandler (_In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame)
 
VOID NTAPI KiInitializeXStateConfiguration (_In_ ULONG Processor)
 Initializes the extended state configuration for the current processor.
 

Variables

SIZE_T KeXStateLength
 
ULONG KeI386NpxPresent
 
ULONG KeI386XMMIPresent
 
ULONG KeI386FxsrPresent
 
ULONG KeI386CpuType
 
ULONG KeI386CpuStep
 
NTKERNELAPI volatile KSYSTEM_TIME KeTickCount
 

Macro Definition Documentation

◆ AMD64_TSS

#define AMD64_TSS   9

Definition at line 85 of file ke.h.

◆ APIC_EOI_REGISTER

#define APIC_EOI_REGISTER   0xFFFFFFFFFFFE00B0ULL

Definition at line 87 of file ke.h.

◆ EFER_FFXSR

#define EFER_FFXSR   0x4000

Definition at line 83 of file ke.h.

◆ EFER_LMA

#define EFER_LMA   0x0400

Definition at line 80 of file ke.h.

◆ EFER_LME

#define EFER_LME   0x0100

Definition at line 79 of file ke.h.

◆ EFER_NXE

#define EFER_NXE   0x0800

Definition at line 81 of file ke.h.

◆ EFER_SCE

#define EFER_SCE   0x0001

Definition at line 78 of file ke.h.

◆ EFER_SVME

#define EFER_SVME   0x1000

Definition at line 82 of file ke.h.

◆ FRAME_EDITED

#define FRAME_EDITED   0xFFF8

Definition at line 68 of file ke.h.

◆ KD_BREAKPOINT_SIZE

#define KD_BREAKPOINT_SIZE   sizeof(UCHAR)

Definition at line 124 of file ke.h.

◆ KD_BREAKPOINT_TYPE

#define KD_BREAKPOINT_TYPE   UCHAR

Definition at line 123 of file ke.h.

◆ KD_BREAKPOINT_VALUE

#define KD_BREAKPOINT_VALUE   0xCC

Definition at line 125 of file ke.h.

◆ KeArchInitThreadWithContext

#define KeArchInitThreadWithContext (   Thread,
  SystemRoutine,
  StartRoutine,
  StartContext,
  Context 
)     Ke386InitThreadWithContext(Thread,SystemRoutine,StartRoutine,StartContext,Context)

Definition at line 450 of file ke.h.

◆ KeGetContextSwitches

#define KeGetContextSwitches (   Prcb)     (Prcb->KeContextSwitches)

Definition at line 226 of file ke.h.

◆ KeGetExceptionFrame

#define KeGetExceptionFrame (   Thread)
Value:
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
struct _KEXCEPTION_FRAME * PKEXCEPTION_FRAME
#define KeGetTrapFrame(Thread)
Definition: ke.h:218
uint32_t ULONG_PTR
Definition: typedefs.h:65

Definition at line 235 of file ke.h.

◆ KeGetTrapFrame

#define KeGetTrapFrame (   Thread)
Value:
((PKTRAP_FRAME)((ULONG_PTR)((Thread)->InitialStack) - \
sizeof(KTRAP_FRAME)))
struct _KTRAP_FRAME * PKTRAP_FRAME

Definition at line 218 of file ke.h.

◆ KeGetTrapFrameInterruptState

#define KeGetTrapFrameInterruptState (   TrapFrame)     BooleanFlagOn((TrapFrame)->EFlags, EFLAGS_INTERRUPT_MASK)

Definition at line 243 of file ke.h.

◆ KiGetSecondLevelDCacheSize

#define KiGetSecondLevelDCacheSize ( )    ((PKIPCR)KeGetPcr())->SecondLevelCacheSize

Definition at line 233 of file ke.h.

◆ X86_CR0_EM

#define X86_CR0_EM   0x00000004 /* enable FPU emulation (disable FPU) */

Definition at line 19 of file ke.h.

◆ X86_CR0_MP

#define X86_CR0_MP   0x00000002 /* enable FPU monitoring */

Definition at line 20 of file ke.h.

◆ X86_CR0_NE

#define X86_CR0_NE   0x00000020 /* enable native FPU error reporting */

Definition at line 17 of file ke.h.

◆ X86_CR0_PE

#define X86_CR0_PE   0x00000001 /* enable Protected Mode */

Definition at line 16 of file ke.h.

◆ X86_CR0_PG

#define X86_CR0_PG   0x80000000 /* enable Paging */

Definition at line 22 of file ke.h.

◆ X86_CR0_TS

#define X86_CR0_TS   0x00000008 /* enable exception on FPU instruction for task switch */

Definition at line 18 of file ke.h.

◆ X86_CR0_WP

#define X86_CR0_WP   0x00010000 /* enable Write Protect (copy on write) */

Definition at line 21 of file ke.h.

◆ X86_CR4_OSFXSR

#define X86_CR4_OSFXSR   0x00000200 /* enable FXSAVE/FXRSTOR instructions */

Definition at line 26 of file ke.h.

◆ X86_CR4_OSXMMEXCPT

#define X86_CR4_OSXMMEXCPT   0x00000400 /* enable #XF exception */

Definition at line 27 of file ke.h.

◆ X86_CR4_PAE

#define X86_CR4_PAE   0x00000020 /* enable physical address extensions */

Definition at line 24 of file ke.h.

◆ X86_CR4_PGE

#define X86_CR4_PGE   0x00000080 /* enable global pages */

Definition at line 25 of file ke.h.

◆ X86_EFLAGS_ID

#define X86_EFLAGS_ID   0x00200000 /* CPUID detection flag */

Definition at line 14 of file ke.h.

◆ X86_EFLAGS_IF

#define X86_EFLAGS_IF   0x00000200 /* Interrupt Enable flag */

Definition at line 9 of file ke.h.

◆ X86_EFLAGS_IOPL

#define X86_EFLAGS_IOPL   0x00003000 /* I/O Privilege Level bits */

Definition at line 10 of file ke.h.

◆ X86_EFLAGS_NT

#define X86_EFLAGS_NT   0x00004000 /* Nested Task flag */

Definition at line 11 of file ke.h.

◆ X86_EFLAGS_RF

#define X86_EFLAGS_RF   0x00010000 /* Resume flag */

Definition at line 12 of file ke.h.

◆ X86_EFLAGS_TF

#define X86_EFLAGS_TF   0x00000100 /* Trap flag */

Definition at line 8 of file ke.h.

◆ X86_EFLAGS_VM

#define X86_EFLAGS_VM   0x00020000 /* Virtual Mode */

Definition at line 13 of file ke.h.

◆ X86_EXT_FEATURE_3DNOW

#define X86_EXT_FEATURE_3DNOW   0x40000000 /* 3DNOW! extension present */

Definition at line 66 of file ke.h.

◆ X86_EXT_FEATURE_SSE3

#define X86_EXT_FEATURE_SSE3   0x00000001 /* SSE3 extension present */

Definition at line 65 of file ke.h.

◆ X86_FEATURE_CMOV

#define X86_FEATURE_CMOV   0x00008000 /* "Conditional move" instruction supported */

Definition at line 40 of file ke.h.

◆ X86_FEATURE_CX16

#define X86_FEATURE_CX16   0x00002000 /* CMPXCHG16B instruction are available */

Definition at line 55 of file ke.h.

◆ X86_FEATURE_CX8

#define X86_FEATURE_CX8   0x00000100 /* CMPXCHG8B instruction present */

Definition at line 36 of file ke.h.

◆ X86_FEATURE_DBG

#define X86_FEATURE_DBG   0x00000004 /* Debugging extensions are present */

Definition at line 32 of file ke.h.

◆ X86_FEATURE_DS

#define X86_FEATURE_DS   0x00200000 /* Debug Store is present */

Definition at line 42 of file ke.h.

◆ X86_FEATURE_FMA3

#define X86_FEATURE_FMA3   0x00001000 /* Fused multiple-add supported */

Definition at line 54 of file ke.h.

◆ X86_FEATURE_FPU

#define X86_FEATURE_FPU   0x00000001 /* x87 FPU is present */

Definition at line 30 of file ke.h.

◆ X86_FEATURE_FXSR

#define X86_FEATURE_FXSR   0x01000000 /* FXSAVE/FXRSTOR instructions present */

Definition at line 44 of file ke.h.

◆ X86_FEATURE_HT

#define X86_FEATURE_HT   0x10000000 /* Hyper-Threading present */

Definition at line 47 of file ke.h.

◆ X86_FEATURE_MMX

#define X86_FEATURE_MMX   0x00800000 /* MMX extension present */

Definition at line 43 of file ke.h.

◆ X86_FEATURE_MONITOR

#define X86_FEATURE_MONITOR   0x00000008 /* SSE3 Monitor instructions supported */

Definition at line 51 of file ke.h.

◆ X86_FEATURE_MTRR

#define X86_FEATURE_MTRR   0x00001000 /* Memory type range registers are present */

Definition at line 38 of file ke.h.

◆ X86_FEATURE_NX

#define X86_FEATURE_NX   0x00100000 /* NX support present */

Definition at line 63 of file ke.h.

◆ X86_FEATURE_PAE

#define X86_FEATURE_PAE   0x00000040 /* physical address extension is present */

Definition at line 35 of file ke.h.

◆ X86_FEATURE_PAT

#define X86_FEATURE_PAT   0x00010000 /* Page Attribute Table is supported */

Definition at line 41 of file ke.h.

◆ X86_FEATURE_PCID

#define X86_FEATURE_PCID   0x00020000 /* Process Context IDentifiers are supported */

Definition at line 56 of file ke.h.

◆ X86_FEATURE_PGE

#define X86_FEATURE_PGE   0x00002000 /* Page Global Enable */

Definition at line 39 of file ke.h.

◆ X86_FEATURE_POPCNT

#define X86_FEATURE_POPCNT   0x00800000 /* POPCNT instruction is available */

Definition at line 59 of file ke.h.

◆ X86_FEATURE_PSE

#define X86_FEATURE_PSE   0x00000008 /* Page Size Extension is present */

Definition at line 33 of file ke.h.

◆ X86_FEATURE_SSE

#define X86_FEATURE_SSE   0x02000000 /* SSE extension present */

Definition at line 45 of file ke.h.

◆ X86_FEATURE_SSE2

#define X86_FEATURE_SSE2   0x04000000 /* SSE2 extension present */

Definition at line 46 of file ke.h.

◆ X86_FEATURE_SSE3

#define X86_FEATURE_SSE3   0x00000001 /* SSE3 is supported */

Definition at line 50 of file ke.h.

◆ X86_FEATURE_SSE41

#define X86_FEATURE_SSE41   0x00080000 /* SSE 4.1 is supported */

Definition at line 57 of file ke.h.

◆ X86_FEATURE_SSE42

#define X86_FEATURE_SSE42   0x00100000 /* SSE 4.2 is supported */

Definition at line 58 of file ke.h.

◆ X86_FEATURE_SSSE3

#define X86_FEATURE_SSSE3   0x00000200 /* Supplemental SSE3 are available */

Definition at line 53 of file ke.h.

◆ X86_FEATURE_SYSCALL

#define X86_FEATURE_SYSCALL   0x00000800 /* SYSCALL/SYSRET support present */

Definition at line 37 of file ke.h.

◆ X86_FEATURE_TSC

#define X86_FEATURE_TSC   0x00000010 /* time stamp counters are present */

Definition at line 34 of file ke.h.

◆ X86_FEATURE_VME

#define X86_FEATURE_VME   0x00000002 /* Virtual 8086 Extensions are present */

Definition at line 31 of file ke.h.

◆ X86_FEATURE_VMX

#define X86_FEATURE_VMX   0x00000020 /* Virtual Machine eXtensions are available */

Definition at line 52 of file ke.h.

◆ X86_FEATURE_XSAVE

#define X86_FEATURE_XSAVE   0x04000000 /* XSAVE family are available */

Definition at line 60 of file ke.h.

◆ X86_MSR_CSTAR

#define X86_MSR_CSTAR   0xC0000083

Definition at line 75 of file ke.h.

◆ X86_MSR_EFER

#define X86_MSR_EFER   0xC0000080

Definition at line 72 of file ke.h.

◆ X86_MSR_GSBASE

#define X86_MSR_GSBASE   0xC0000101

Definition at line 70 of file ke.h.

◆ X86_MSR_KERNEL_GSBASE

#define X86_MSR_KERNEL_GSBASE   0xC0000102

Definition at line 71 of file ke.h.

◆ X86_MSR_LSTAR

#define X86_MSR_LSTAR   0xC0000082

Definition at line 74 of file ke.h.

◆ X86_MSR_SFMASK

#define X86_MSR_SFMASK   0xC0000084

Definition at line 76 of file ke.h.

◆ X86_MSR_STAR

#define X86_MSR_STAR   0xC0000081

Definition at line 73 of file ke.h.

Typedef Documentation

◆ KI_INTERRUPT_DISPATCH_ENTRY

◆ KIDT_INIT

◆ PKI_INTERRUPT_DISPATCH_ENTRY

◆ PKIDT_INIT

Function Documentation

◆ HalAllocateAdapterChannel()

NTHALAPI NTSTATUS NTAPI HalAllocateAdapterChannel ( IN PADAPTER_OBJECT  AdapterObject,
IN PWAIT_CONTEXT_BLOCK  Wcb,
IN ULONG  NumberOfMapRegisters,
IN PDRIVER_CONTROL  ExecutionRoutine 
)

Definition at line 88 of file dma.c.

92{
94 while (TRUE);
95 return STATUS_SUCCESS;
96}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define TRUE
Definition: types.h:120
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by HalBuildScatterGatherList(), and IoAllocateAdapterChannel().

◆ Ke386InitThreadWithContext()

VOID Ke386InitThreadWithContext ( PKTHREAD  Thread,
PKSYSTEM_ROUTINE  SystemRoutine,
PKSTART_ROUTINE  StartRoutine,
PVOID  StartContext,
PCONTEXT  Context 
)

◆ KeAllocateGdtSelector()

ULONG KeAllocateGdtSelector ( ULONG  Desc[2])

◆ KeApplicationProcessorInitDispatcher()

VOID KeApplicationProcessorInitDispatcher ( VOID  )

◆ KeCreateApplicationProcessorIdleThread()

VOID KeCreateApplicationProcessorIdleThread ( ULONG  Id)

◆ KeDisableInterrupts()

FORCEINLINE BOOLEAN KeDisableInterrupts ( VOID  )

Definition at line 249 of file ke.h.

250{
252
253 /* Get EFLAGS and check if the interrupt bit is set */
255
256 /* Disable interrupts */
257 _disable();
258 return (Flags & EFLAGS_INTERRUPT_MASK) ? TRUE : FALSE;
259}
#define EFLAGS_INTERRUPT_MASK
#define FALSE
Definition: types.h:117
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1706
void __cdecl _disable(void)
Definition: intrin_arm.h:365
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by _ExiDisableInterruptsAndAcquireSpinlock(), _IRQL_requires_max_(), KdPollBreakIn(), KeFreezeExecution(), KeRemoveQueueDpc(), and Ki386EnableGlobalPage().

◆ KeFlushProcessTb()

FORCEINLINE VOID KeFlushProcessTb ( VOID  )

Definition at line 282 of file ke.h.

283{
284 /* Flush the TLB by resetting CR3 */
286}
__INTRIN_INLINE unsigned long __readcr3(void)
Definition: intrin_x86.h:1850
__INTRIN_INLINE void __writecr3(unsigned int Data)
Definition: intrin_x86.h:1826

Referenced by MiMapPageInHyperSpace(), MiMapPagesInZeroSpace(), MiReserveAlignedSystemPtes(), and MiUnmapLockedPagesInUserSpace().

◆ KeFreeGdtSelector()

VOID KeFreeGdtSelector ( ULONG  Entry)

◆ KeGetContextFrameRegister()

FORCEINLINE ULONG_PTR KeGetContextFrameRegister ( PCONTEXT  Context)

Definition at line 167 of file ke.h.

168{
169 return Context->Rbp;
170}
_In_ PVOID Context
Definition: storport.h:2269

Referenced by KdbpCmdBackTrace().

◆ KeGetContextPc()

FORCEINLINE ULONG_PTR KeGetContextPc ( PCONTEXT  Context)

Definition at line 132 of file ke.h.

133{
134 return Context->Rip;
135}

◆ KeGetContextReturnRegister()

FORCEINLINE ULONG_PTR KeGetContextReturnRegister ( PCONTEXT  Context)

Definition at line 146 of file ke.h.

147{
148 return Context->Rax;
149}

◆ KeGetContextStackRegister()

FORCEINLINE ULONG_PTR KeGetContextStackRegister ( PCONTEXT  Context)

Definition at line 160 of file ke.h.

161{
162 return Context->Rsp;
163}

◆ KeGetTrapFrameFrameRegister()

FORCEINLINE ULONG_PTR KeGetTrapFrameFrameRegister ( PKTRAP_FRAME  TrapFrame)

Definition at line 202 of file ke.h.

203{
204 return TrapFrame->Rbp;
205}
UINT64 Rbp
Definition: ketypes.h:477

Referenced by KdbpCmdThread().

◆ KeGetTrapFramePc()

FORCEINLINE ULONG_PTR KeGetTrapFramePc ( PKTRAP_FRAME  TrapFrame)

Definition at line 181 of file ke.h.

182{
183 return TrapFrame->Rip;
184}
UINT64 Rip
Definition: ketypes.h:484

◆ KeGetTrapFrameStackRegister()

FORCEINLINE ULONG_PTR KeGetTrapFrameStackRegister ( PKTRAP_FRAME  TrapFrame)

Definition at line 195 of file ke.h.

196{
197 return TrapFrame->Rsp;
198}
UINT64 Rsp
Definition: ketypes.h:491

Referenced by KdbpCmdThread().

◆ KeInvalidateTlbEntry()

FORCEINLINE VOID KeInvalidateTlbEntry ( IN PVOID  Address)

Definition at line 274 of file ke.h.

275{
276 /* Invalidate the TLB entry for this address */
278}
__INTRIN_INLINE void __invlpg(void *Address)
Definition: intrin_x86.h:2000
static WCHAR Address[46]
Definition: ping.c:68

Referenced by _Success_(), FreeWsleIndex(), KdpPhysMap(), KiI386PentiumLockErrataFixup(), MiDbgTranslatePhysicalAddress(), MiDbgUnTranslatePhysicalAddress(), MiProtectVirtualMemory(), MmSetDirtyBit(), MmSetPageProtect(), and TrimWsList().

◆ KeQueryInterruptHandler()

FORCEINLINE PVOID KeQueryInterruptHandler ( IN ULONG  Vector)

Definition at line 337 of file ke.h.

338{
339 UCHAR Entry;
340 PKIDTENTRY64 Idt;
341
342 /* Get the entry from the HAL */
344
345 /* Get the IDT entry */
346 Idt = &KeGetPcr()->IdtBase[Entry];
347
348 /* Return the address */
349 return (PVOID)((ULONG64)Idt->OffsetHigh << 32 |
350 (ULONG64)Idt->OffsetMiddle << 16 |
351 (ULONG64)Idt->OffsetLow);
352}
unsigned __int64 ULONG64
Definition: imports.h:198
#define HalVectorToIDTEntry
Definition: halfuncs.h:54
#define KeGetPcr()
Definition: ketypes.h:81
Entry
Definition: section.c:5216
unsigned char UCHAR
Definition: typedefs.h:53
ULONG OffsetHigh
Definition: ketypes.h:579
USHORT OffsetMiddle
Definition: ketypes.h:578
USHORT OffsetLow
Definition: ketypes.h:571

Referenced by HalpCalibrateStallExecution(), HalpInitializeTsc(), HalpSwitchToRealModeTrapHandlers(), KeConnectInterrupt(), KeDisconnectInterrupt(), and KiGetVectorDispatch().

◆ KeRegisterInterruptHandler()

FORCEINLINE VOID KeRegisterInterruptHandler ( IN ULONG  Vector,
IN PVOID  Handler 
)

Definition at line 311 of file ke.h.

313{
314 UCHAR Entry;
315 PKIDTENTRY64 Idt;
316
317 /* Get the entry from the HAL */
319
320 /* Now set the data */
321 Idt = &KeGetPcr()->IdtBase[Entry];
322 Idt->OffsetLow = (ULONG_PTR)Handler & 0xffff;
323 Idt->OffsetMiddle = ((ULONG_PTR)Handler >> 16) & 0xffff;
324 Idt->OffsetHigh = (ULONG_PTR)Handler >> 32;
326 Idt->IstIndex = 0;
327 Idt->Type = 0x0e;
328 Idt->Dpl = 0;
329 Idt->Present = 1;
330 Idt->Reserved0 = 0;
331 Idt->Reserved1 = 0;
332}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:672
#define ULONG_PTR
Definition: config.h:101
#define KGDT64_R0_CODE
Definition: ketypes.h:127
USHORT Reserved0
Definition: ketypes.h:574
USHORT IstIndex
Definition: ketypes.h:573
ULONG Reserved1
Definition: ketypes.h:580
USHORT Dpl
Definition: ketypes.h:576
USHORT Present
Definition: ketypes.h:577
USHORT Selector
Definition: ketypes.h:572
USHORT Type
Definition: ketypes.h:575

Referenced by ApicInitializeLocalApic(), HalpCalibrateStallExecution(), HalpEnableInterruptHandler(), HalpInitializePICs(), HalpInitializeTsc(), HalpRestoreTrapHandlers(), HalpSwitchToRealModeTrapHandlers(), KeConnectInterrupt(), KeDisconnectInterrupt(), and KiConnectVectorToInterrupt().

◆ KeRestoreInterrupts()

FORCEINLINE VOID KeRestoreInterrupts ( BOOLEAN  WereEnabled)

Definition at line 264 of file ke.h.

265{
266 if (WereEnabled) _enable();
267}
void __cdecl _enable(void)
Definition: intrin_arm.h:373

Referenced by _ExiReleaseSpinLockAndRestoreInterrupts(), _IRQL_requires_max_(), KdPollBreakIn(), KeRemoveQueueDpc(), KeThawExecution(), and Ki386EnableGlobalPage().

◆ KeSetContextFrameRegister()

FORCEINLINE VOID KeSetContextFrameRegister ( PCONTEXT  Context,
ULONG_PTR  Frame 
)

Definition at line 174 of file ke.h.

175{
176 Context->Rbp = Frame;
177}

Referenced by KdbpCmdBackTrace().

◆ KeSetContextPc()

FORCEINLINE VOID KeSetContextPc ( PCONTEXT  Context,
ULONG_PTR  ProgramCounter 
)

Definition at line 139 of file ke.h.

140{
141 Context->Rip = ProgramCounter;
142}

◆ KeSetContextReturnRegister()

FORCEINLINE VOID KeSetContextReturnRegister ( PCONTEXT  Context,
ULONG_PTR  ReturnValue 
)

Definition at line 153 of file ke.h.

154{
155 Context->Rax = ReturnValue;
156}
UINT32 void void ** ReturnValue
Definition: acevents.h:216

◆ KeSweepICache()

FORCEINLINE VOID KeSweepICache ( IN PVOID  BaseAddress,
IN SIZE_T  FlushSize 
)

Definition at line 290 of file ke.h.

292{
293 //
294 // Always sweep the whole cache
295 //
297 UNREFERENCED_PARAMETER(FlushSize);
298 __wbinvd();
299}
PPC_QUAL void __wbinvd(void)
Definition: intrin_ppc.h:759
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize _Pre_valid_ PVOID * BaseAddress
Definition: mmfuncs.h:408
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329

Referenced by HalpPrepareStallExecution(), KdpCopyMemoryChunks(), and NtFlushInstructionCache().

◆ Ki386InitializeLdt()

VOID Ki386InitializeLdt ( VOID  )

◆ Ki386PerfEnd()

FORCEINLINE VOID Ki386PerfEnd ( VOID  )

Definition at line 388 of file ke.h.

389{
392 DbgPrint("Boot took %I64u cycles!\n", BootCyclesEnd - BootCycles);
393 DbgPrint("Interrupts: %u System Calls: %u Context Switches: %u\n",
394 KeGetCurrentPrcb()->InterruptCount,
395 KeGetCurrentPrcb()->KeSystemCalls,
397}
#define DbgPrint
Definition: hal.h:12
PPC_QUAL unsigned long long __rdtsc(void)
Definition: intrin_ppc.h:688
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1197
#define KeGetContextSwitches(Prcb)
Definition: ke.h:226
ULONGLONG BootCyclesEnd
Definition: ke.h:157
ULONGLONG BootCycles
Definition: kiinit.c:37
uint64_t ULONGLONG
Definition: typedefs.h:67

◆ Ki386SetProcessorFeatures()

VOID Ki386SetProcessorFeatures ( VOID  )

◆ KiAlignmentFault()

VOID KiAlignmentFault ( VOID  )

◆ KiApcInterrupt()

VOID KiApcInterrupt ( VOID  )

Definition at line 229 of file trapc.c.

230{
232 KEXCEPTION_FRAME ExceptionFrame;
233 PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
234
235 DPRINT1("[APC TRAP]\n");
236 while (TRUE);
237
238 //
239 // Isolate previous mode
240 //
241 PreviousMode = KiGetPreviousMode(TrapFrame);
242
243 //
244 // FIXME-USER: Handle APC interrupt while in user-mode
245 //
247
248 //
249 // Disable interrupts
250 //
251 _disable();
252
253 //
254 // Clear APC interrupt
255 //
257
258 //
259 // Re-enable interrupts
260 //
261 _enable();
262
263 //
264 // Deliver APCs
265 //
266 KiDeliverApc(PreviousMode, &ExceptionFrame, TrapFrame);
267}
_In_ PVOID _In_ ULONG _Out_ PVOID _In_ ULONG _Inout_ PULONG _In_ KPROCESSOR_MODE PreviousMode
#define DPRINT1
Definition: precomp.h:8
#define APC_LEVEL
Definition: env_spec_w32.h:695
VOID FASTCALL HalClearSoftwareInterrupt(IN KIRQL Irql)
Definition: pic.c:282
#define KeGetCurrentThread
Definition: hal.h:55
#define ASSERT(a)
Definition: mode.c:44
#define UserMode
Definition: asm.h:39
#define KiGetPreviousMode(tf)
Definition: ke.h:180
VOID NTAPI KiDeliverApc(IN KPROCESSOR_MODE DeliveryMode, IN PKEXCEPTION_FRAME ExceptionFrame, IN PKTRAP_FRAME TrapFrame)
Definition: apc.c:302
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7

Referenced by KiInitializePcr().

◆ KiBoundFault()

VOID KiBoundFault ( VOID  )

◆ KiBreakpointTrap()

VOID KiBreakpointTrap ( VOID  )

◆ KiDebugServiceTrap()

VOID KiDebugServiceTrap ( VOID  )

◆ KiDebugTrapOrFault()

VOID KiDebugTrapOrFault ( VOID  )

◆ KiDivideErrorFault()

VOID KiDivideErrorFault ( VOID  )

◆ KiDoubleFaultAbort()

VOID KiDoubleFaultAbort ( VOID  )

◆ KiDpcInterrupt()

VOID KiDpcInterrupt ( VOID  )

◆ KiEndInterrupt()

FORCEINLINE VOID KiEndInterrupt ( IN KIRQL  Irql,
IN PKTRAP_FRAME  TrapFrame 
)

Definition at line 364 of file ke.h.

366{
367 /* Make sure this is from the clock handler */
368 ASSERT(TrapFrame->ErrorCode == 0xc10c4);
369
370 /* Disable interrupts and end the interrupt */
371 _disable();
372 HalEndSystemInterrupt(Irql, TrapFrame);
373}
_Out_ PKIRQL Irql
Definition: csq.h:179
VOID NTAPI HalEndSystemInterrupt(IN KIRQL OldIrql, IN PKTRAP_FRAME TrapFrame)
Definition: pic.c:335

◆ KiExceptionExit()

DECLSPEC_NORETURN VOID KiExceptionExit ( _In_ PKTRAP_FRAME  TrapFrame,
_In_ PKEXCEPTION_FRAME  ExceptionFrame 
)

Definition at line 720 of file ke.h.

723{
724 KiServiceExit2(TrapFrame);
725}
#define KiServiceExit2
Definition: ke.h:5

Referenced by NtContinue(), and NtRaiseException().

◆ KiFloatingErrorFault()

VOID KiFloatingErrorFault ( VOID  )

◆ KiGdtPrepareForApplicationProcessorInit()

VOID KiGdtPrepareForApplicationProcessorInit ( ULONG  Id)

◆ KiGeneralProtectionFault()

VOID KiGeneralProtectionFault ( VOID  )

◆ KiGetCacheInformation()

VOID KiGetCacheInformation ( VOID  )

Definition at line 334 of file cpu.c.

335{
336 PKIPCR Pcr = (PKIPCR)KeGetPcr();
337 ULONG CacheRequests = 0, i;
338 ULONG CurrentRegister;
339 UCHAR RegisterByte;
340 BOOLEAN FirstPass = TRUE;
341 CPU_INFO CpuInfo;
342
343 /* Set default L2 size */
344 Pcr->SecondLevelCacheSize = 0;
345
346 /* Check the Vendor ID */
347 switch (Pcr->Prcb.CpuVendor)
348 {
349 /* Handle Intel case */
350 case CPU_INTEL:
351
352 /*Check if we support CPUID 2 */
353 KiCpuId(&CpuInfo, 0);
354 if (CpuInfo.Eax >= 2)
355 {
356 /* We need to loop for the number of times CPUID will tell us to */
357 do
358 {
359 /* Do the CPUID call */
360 KiCpuId(&CpuInfo, 2);
361
362 /* Check if it was the first call */
363 if (FirstPass)
364 {
365 /*
366 * The number of times to loop is the first byte. Read
367 * it and then destroy it so we don't get confused.
368 */
369 CacheRequests = CpuInfo.Eax & 0xFF;
370 CpuInfo.Eax &= 0xFFFFFF00;
371
372 /* Don't go over this again */
373 FirstPass = FALSE;
374 }
375
376 /* Loop all 4 registers */
377 for (i = 0; i < 4; i++)
378 {
379 /* Get the current register */
380 CurrentRegister = CpuInfo.AsUINT32[i];
381
382 /*
383 * If the upper bit is set, then this register should
384 * be skipped.
385 */
386 if (CurrentRegister & 0x80000000) continue;
387
388 /* Keep looping for every byte inside this register */
389 while (CurrentRegister)
390 {
391 /* Read a byte, skip a byte. */
392 RegisterByte = (UCHAR)(CurrentRegister & 0xFF);
393 CurrentRegister >>= 8;
394 if (!RegisterByte) continue;
395
396 /*
397 * Valid values are from 0x40 (0 bytes) to 0x49
398 * (32MB), or from 0x80 to 0x89 (same size but
399 * 8-way associative.
400 */
401 if (((RegisterByte > 0x40) &&
402 (RegisterByte <= 0x49)) ||
403 ((RegisterByte > 0x80) &&
404 (RegisterByte <= 0x89)))
405 {
406 /* Mask out only the first nibble */
407 RegisterByte &= 0x0F;
408
409 /* Set the L2 Cache Size */
410 Pcr->SecondLevelCacheSize = 0x10000 <<
411 RegisterByte;
412 }
413 }
414 }
415 } while (--CacheRequests);
416 }
417 break;
418
419 case CPU_AMD:
420
421 /* Check if we support CPUID 0x80000006 */
422 KiCpuId(&CpuInfo, 0x80000000);
423 if (CpuInfo.Eax >= 6)
424 {
425 /* Get 2nd level cache and tlb size */
426 KiCpuId(&CpuInfo, 0x80000006);
427
428 /* Set the L2 Cache Size */
429 Pcr->SecondLevelCacheSize = (CpuInfo.Ecx & 0xFFFF0000) >> 6;
430 }
431 break;
432 }
433}
unsigned char BOOLEAN
Definition: actypes.h:127
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
struct _KIPCR * PKIPCR
@ CPU_INTEL
Definition: ketypes.h:100
@ CPU_AMD
Definition: ketypes.h:99
KPRCB Prcb
Definition: ketypes.h:1003
ULONG SecondLevelCacheSize
Definition: ketypes.h:995
UCHAR CpuVendor
Definition: ketypes.h:704
uint32_t ULONG
Definition: typedefs.h:59
ULONG Eax
Definition: ketypes.h:401
UINT32 AsUINT32[4]
Definition: ketypes.h:398
ULONG Ecx
Definition: ketypes.h:403

Referenced by KiInitializeKernel(), and KiSystemStartupBootStack().

◆ KiGetFeatureBits()

ULONG64 KiGetFeatureBits ( VOID  )

Evaluates the KeFeatureFlag bits for the current CPU.

Returns
The feature flags for this CPU.
See also
https://www.geoffchappell.com/studies/windows/km/ntoskrnl/structs/kprcb/featurebits.htm
Todo:
  • KF_VIRT_FIRMWARE_ENABLED 0x08000000 (see notes from Geoff Chappell)
  • KF_FPU_LEAKAGE 0x0000020000000000ULL
  • KF_CAT 0x0000100000000000ULL
  • KF_CET_SS 0x0000400000000000ULL

Definition at line 73 of file cpu.c.

74{
75 PKPRCB Prcb = KeGetCurrentPrcb();
76 ULONG Vendor;
77 ULONG64 FeatureBits = 0;
80 CPUID_EXTENDED_FUNCTION_REGS extendedFunction;
81
82 /* Get the Vendor ID */
83 Vendor = Prcb->CpuVendor;
84
85 /* Make sure we got a valid vendor ID at least. */
86 if (Vendor == CPU_UNKNOWN) return FeatureBits;
87
88 /* Get signature CPUID for the maximum function */
90
91 /* Get the CPUID Info. */
93
94 /* Set the initial APIC ID */
95 Prcb->InitialApicId = (UCHAR)VersionInfo.Ebx.Bits.InitialLocalApicId;
96
97 /* Convert all CPUID Feature bits into our format */
98 if (VersionInfo.Edx.Bits.VME) FeatureBits |= KF_CR4;
99 if (VersionInfo.Edx.Bits.PSE) FeatureBits |= KF_LARGE_PAGE | KF_CR4;
100 if (VersionInfo.Edx.Bits.TSC) FeatureBits |= KF_RDTSC;
101 if (VersionInfo.Edx.Bits.CX8) FeatureBits |= KF_CMPXCHG8B;
102 if (VersionInfo.Edx.Bits.SEP) FeatureBits |= KF_FAST_SYSCALL;
103 if (VersionInfo.Edx.Bits.MTRR) FeatureBits |= KF_MTRR;
104 if (VersionInfo.Edx.Bits.PGE) FeatureBits |= KF_GLOBAL_PAGE | KF_CR4;
105 if (VersionInfo.Edx.Bits.CMOV) FeatureBits |= KF_CMOV;
106 if (VersionInfo.Edx.Bits.PAT) FeatureBits |= KF_PAT;
107 if (VersionInfo.Edx.Bits.DS) FeatureBits |= KF_DTS;
108 if (VersionInfo.Edx.Bits.MMX) FeatureBits |= KF_MMX;
109 if (VersionInfo.Edx.Bits.FXSR) FeatureBits |= KF_FXSR;
110 if (VersionInfo.Edx.Bits.SSE) FeatureBits |= KF_XMMI;
111 if (VersionInfo.Edx.Bits.SSE2) FeatureBits |= KF_XMMI64;
112
113 if (VersionInfo.Ecx.Bits.SSE3) FeatureBits |= KF_SSE3;
114 if (VersionInfo.Ecx.Bits.SSSE3) FeatureBits |= KF_SSSE3;
115 if (VersionInfo.Ecx.Bits.CMPXCHG16B) FeatureBits |= KF_CMPXCHG16B;
116 if (VersionInfo.Ecx.Bits.SSE4_1) FeatureBits |= KF_SSE4_1;
117 if (VersionInfo.Ecx.Bits.SSE4_2) FeatureBits |= KF_SSE4_2;
118 if (VersionInfo.Ecx.Bits.XSAVE) FeatureBits |= KF_XSTATE;
119 if (VersionInfo.Ecx.Bits.RDRAND) FeatureBits |= KF_RDRAND;
120 if (VersionInfo.Ecx.Bits.AVX) FeatureBits |= KF_AVX;
121
122 /* Check if the CPU has hyper-threading */
123 if (VersionInfo.Edx.Bits.HTT)
124 {
125 /* Set the number of logical CPUs */
127 VersionInfo.Ebx.Bits.MaximumAddressableIdsForLogicalProcessors;
129 {
130 /* We're on dual-core */
132 }
133 }
134 else
135 {
136 /* We only have a single CPU */
138 }
139
140 /* Check if CPUID_THERMAL_POWER_MANAGEMENT (0x06) is supported */
142 {
143 /* Read CPUID_THERMAL_POWER_MANAGEMENT */
146
147 if (PowerInfo.Undoc.Ecx.ACNT2) FeatureBits |= KF_ACNT2;
148 }
149
150 /* Check if CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS (0x07) is supported */
152 {
153 /* Read CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS */
155 __cpuidex(ExtFlags.AsInt32,
158
159 if (ExtFlags.Ebx.Bits.SMEP) FeatureBits |= KF_SMEP;
160 if (ExtFlags.Ebx.Bits.FSGSBASE) FeatureBits |= KF_RDWRFSGSBASE;
161 if (ExtFlags.Ebx.Bits.SMAP) FeatureBits |= KF_SMAP;
162 if (ExtFlags.Ebx.Bits.AVX2) FeatureBits |= KF_AVX2;
163 if (ExtFlags.Ebx.Bits.AVX512F) FeatureBits |= KF_AVX512F;
164 }
165
166 /* Check if CPUID_EXTENDED_STATE (0x0D) is supported */
167 if (signature.MaxLeaf >= CPUID_EXTENDED_STATE)
168 {
169 /* Read CPUID_EXTENDED_STATE */
171 __cpuidex(ExtStateSub.AsInt32,
174
175 if (ExtStateSub.Eax.Bits.XSAVEOPT) FeatureBits |= KF_XSAVEOPT;
176 if (ExtStateSub.Eax.Bits.XSAVES) FeatureBits |= KF_XSAVES;
177 }
178
179 /* Check extended cpuid features */
180 __cpuid(extendedFunction.AsInt32, CPUID_EXTENDED_FUNCTION);
181 if ((extendedFunction.MaxLeaf & 0xffffff00) == 0x80000000)
182 {
183 /* Check if CPUID_EXTENDED_CPU_SIG (0x80000001) is supported */
184 if (extendedFunction.MaxLeaf >= CPUID_EXTENDED_CPU_SIG)
185 {
186 /* Read CPUID_EXTENDED_CPU_SIG */
189
190 /* Check if NX-bit is supported */
191 if (ExtSig.Intel.Edx.Bits.NX) FeatureBits |= KF_NX_BIT;
192 if (ExtSig.Intel.Edx.Bits.Page1GB) FeatureBits |= KF_HUGEPAGE;
193 if (ExtSig.Intel.Edx.Bits.RDTSCP) FeatureBits |= KF_RDTSCP;
194
195 /* AMD specific */
196 if (Vendor == CPU_AMD)
197 {
198 if (ExtSig.Amd.Edx.Bits.ThreeDNow) FeatureBits |= KF_3DNOW;
199 }
200 }
201 }
202
203 /* Vendor specific */
204 if (Vendor == CPU_INTEL)
205 {
206 FeatureBits |= KF_GENUINE_INTEL;
207
208 /* Check for models that support LBR */
209 if (VersionInfo.Eax.Bits.FamilyId == 6)
210 {
211 if ((VersionInfo.Eax.Bits.Model == 15) ||
212 (VersionInfo.Eax.Bits.Model == 22) ||
213 (VersionInfo.Eax.Bits.Model == 23) ||
214 (VersionInfo.Eax.Bits.Model == 26))
215 {
216 FeatureBits |= KF_BRANCH;
217 }
218 }
219
220 /* Check if VMX is available */
221 if (VersionInfo.Ecx.Bits.VMX)
222 {
223 /* Read PROCBASED ctls and check if secondary are allowed */
226 if (ProcBasedCtls.Bits.Allowed1.ActivateSecondaryControls)
227 {
228 /* Read secondary controls and check if EPT is allowed */
231 if (ProcBasedCtls2.Bits.Allowed1.EPT)
232 FeatureBits |= KF_SLAT;
233 }
234 }
235 }
236 else if (Vendor == CPU_AMD)
237 {
238 FeatureBits |= KF_AUTHENTICAMD;
239 FeatureBits |= KF_BRANCH;
240
241 /* Check extended cpuid features */
242 if ((extendedFunction.MaxLeaf & 0xffffff00) == 0x80000000)
243 {
244 /* Check if CPUID_AMD_SVM_FEATURES (0x8000000A) is supported */
245 if (extendedFunction.MaxLeaf >= CPUID_AMD_SVM_FEATURES)
246 {
247 /* Read CPUID_AMD_SVM_FEATURES and check if Nested Paging is available */
248 CPUID_AMD_SVM_FEATURES_REGS SvmFeatures;
250 if (SvmFeatures.Edx.Bits.NP) FeatureBits |= KF_SLAT;
251 }
252 }
253 }
254
255 /* Return the Feature Bits */
256 return FeatureBits;
257}
#define MSR_IA32_VMX_PROCBASED_CTLS
#define MSR_IA32_VMX_PROCBASED_CTLS2
#define CPUID_AMD_SVM_FEATURES
Definition: Cpuid.h:160
#define CPUID_EXTENDED_FUNCTION
Definition: Cpuid.h:3802
#define CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS
Definition: Cpuid.h:1301
#define CPUID_SIGNATURE
Definition: Cpuid.h:45
#define CPUID_VERSION_INFO
Definition: Cpuid.h:81
#define CPUID_EXTENDED_STATE
Definition: Cpuid.h:1948
#define CPUID_THERMAL_POWER_MANAGEMENT
Definition: Cpuid.h:1114
#define CPUID_EXTENDED_STATE_SUB_LEAF
Definition: Cpuid.h:2063
#define CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_SUB_LEAF_INFO
Definition: Cpuid.h:1306
#define CPUID_EXTENDED_CPU_SIG
Definition: Cpuid.h:3825
OSVERSIONINFOW VersionInfo
Definition: wkssvc.c:40
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682
PPC_QUAL unsigned long long __readmsr()
Definition: intrin_ppc.h:741
__INTRIN_INLINE void __cpuidex(int CPUInfo[4], int InfoType, int ECXValue)
Definition: intrin_x86.h:1680
if(dx< 0)
Definition: linetemp.h:194
#define KF_SSE4_2
Definition: ketypes.h:74
#define KF_SMEP
Definition: ketypes.h:31
#define KF_SSSE3
Definition: ketypes.h:72
#define KF_MTRR
Definition: ketypes.h:37
#define KF_HUGEPAGE
Definition: ketypes.h:67
#define KF_XSTATE
Definition: ketypes.h:55
#define KF_DTS
Definition: ketypes.h:40
#define KF_CMPXCHG16B
Definition: ketypes.h:52
#define KF_CR4
Definition: ketypes.h:33
#define KF_AUTHENTICAMD
Definition: ketypes.h:53
#define KF_XMMI64
Definition: ketypes.h:48
#define KF_CMOV
Definition: ketypes.h:34
#define KF_ACNT2
Definition: ketypes.h:54
#define KF_SSE4_1
Definition: ketypes.h:73
#define KF_RDWRFSGSBASE
Definition: ketypes.h:60
#define KF_CMPXCHG8B
Definition: ketypes.h:38
#define KF_RDTSC
Definition: ketypes.h:32
#define KF_FAST_SYSCALL
Definition: ketypes.h:43
#define KF_3DNOW
Definition: ketypes.h:45
#define KF_NX_BIT
Definition: ketypes.h:61
#define KF_FXSR
Definition: ketypes.h:42
#define KF_RDRAND
Definition: ketypes.h:64
@ CPU_UNKNOWN
Definition: ketypes.h:98
#define KF_XSAVES
Definition: ketypes.h:68
#define KF_LARGE_PAGE
Definition: ketypes.h:36
#define KF_BRANCH
Definition: ketypes.h:49
#define KF_AVX
Definition: ketypes.h:77
#define KF_GENUINE_INTEL
Definition: ketypes.h:56
#define KF_XMMI
Definition: ketypes.h:44
#define KF_MMX
Definition: ketypes.h:39
#define KF_XSAVEOPT
Definition: ketypes.h:47
#define KF_SSE3
Definition: ketypes.h:51
#define KF_SLAT
Definition: ketypes.h:58
#define KF_PAT
Definition: ketypes.h:41
#define KF_AVX2
Definition: ketypes.h:78
#define KF_RDTSCP
Definition: ketypes.h:66
#define KF_GLOBAL_PAGE
Definition: ketypes.h:35
#define KF_SMAP
Definition: ketypes.h:65
#define KF_AVX512F
Definition: ketypes.h:79
BOOLEAN KiSMTProcessorsPresent
Definition: cpu.c:31
UCHAR LogicalProcessorsPerPhysicalProcessor
Definition: ketypes.h:759
ULONG InitialApicId
Definition: ketypes.h:721
struct CPUID_AMD_SVM_FEATURES_EDX::@3917 Bits
CPUID_AMD_SVM_FEATURES_EDX Edx
Definition: Cpuid.h:220
struct CPUID_EXTENDED_CPU_SIG_REGS::@3915 Amd
struct CPUID_EXTENDED_CPU_SIG_REGS::@3914 Intel
struct CPUID_EXTENDED_STATE_SUB_LEAF_EAX::@4012 Bits
CPUID_EXTENDED_STATE_SUB_LEAF_EAX Eax
Definition: Cpuid.h:107
struct CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX::@4002 Bits
CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX Ebx
Definition: Cpuid.h:80
struct CPUID_THERMAL_POWER_MANAGEMENT_REGS::@3903 Undoc
struct MSR_IA32_VMX_PROCBASED_CTLS2_REGISTER::@4049 Bits
struct MSR_IA32_VMX_PROCBASED_CTLS_REGISTER::@4048 Bits

Referenced by KiInitializeCpu(), and KiVerifyCpuFeatures().

◆ KiGetLinkedTrapFrame()

FORCEINLINE PKTRAP_FRAME KiGetLinkedTrapFrame ( PKTRAP_FRAME  TrapFrame)

Definition at line 188 of file ke.h.

189{
190 return (PKTRAP_FRAME)TrapFrame->TrapFrame;
191}
UINT64 TrapFrame
Definition: ketypes.h:473

◆ KiGetTrapContext()

VOID KiGetTrapContext ( _In_ PKTRAP_FRAME  TrapFrame,
_Out_ PCONTEXT  Context 
)

Referenced by _IRQL_requires_().

◆ KiGetUserModeStackAddress()

FORCEINLINE PULONG_PTR KiGetUserModeStackAddress ( void  )

Definition at line 479 of file ke.h.

480{
481 return &PsGetCurrentThread()->Tcb.TrapFrame->Rsp;
482}
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81

Referenced by KeUserModeCallback().

◆ KiInitializeCpuFeatures()

VOID KiInitializeCpuFeatures ( VOID  )

◆ KiInitializeXStateConfiguration()

VOID NTAPI KiInitializeXStateConfiguration ( _In_ ULONG  ProcessorNumber)

Initializes the extended state configuration for the current processor.

Parameters
ProcessorNumber- Number of the current processor

Definition at line 231 of file xstate.c.

233{
234 /* Check if XSAVE is supported */
235 if ((KeFeatureBits & KF_XSTATE) == 0)
236 {
237 /* XSAVE is not supported */
238 return;
239 }
240
241 if (ProcessorNumber == 0)
242 {
243 /* Processor 0: Retrieve the global configuration */
245
246 if (SharedUserData->XState.AllFeatureSize == 0)
247 {
248 KeFeatureBits &= ~KF_XSTATE;
249 return;
250 }
251
252 KeXStateLength = SharedUserData->XState.AllFeatureSize;
253 }
254 else
255 {
256 /* Processor 1+: validate the configuration against the global one */
259 ValidateXStateConfig(&XState);
260 }
261
262 /* Enable the user mode components in XCR0 */
263 _xsetbv(0, SharedUserData->XState.EnabledFeatures);
264
265 /* Now that we have set everything up, query CPUID again to get the required
266 size based on components enabled in XCR0 */
268 __cpuidex(ExtStateMain.AsInt32,
271
272 /* CPUID 0xD, leaf 0, EBX should return the size required by all components
273 enabled in XCR0 and thus match our calculation. But VBox doesn't handle
274 this correctly and simply returns the full size of all *supported*
275 features, independent of XCR0. We check and warn. */
276 if (ExtStateMain.Ebx > SharedUserData->XState.Size)
277 {
278 DPRINT1("Processor %lu, CPUID 0xD, leaf 0, EBX returns 0x%x, but we calculated 0x%lx\n",
279 ProcessorNumber,
280 ExtStateMain.Ebx,
281 SharedUserData->XState.Size);
282 }
283
284 /* Check if we have any supervisor components enabled */
285 if (SharedUserData->XState.EnabledSupervisorFeatures != 0)
286 {
287 /* Enable the supervisor components in IA32_XSS */
288 __writemsr(MSR_IA32_XSS, SharedUserData->XState.EnabledSupervisorFeatures);
289
290 /* Get the required size for features enabled in both XCR0 and IA32_XSS */
292 __cpuidex(ExtStateSubLeaf.AsInt32,
295
296 /* Check if all components fit into what we calculated. Same VBox issue
297 here as described above. */
298 if (ExtStateSubLeaf.Ebx.XSaveAreaSize > SharedUserData->XState.AllFeatureSize)
299 {
300 DPRINT1("Processor %lu, CPUID 0xD, leaf 1, EBX returns 0x%x, but we calculated 0x%lx\n",
301 ProcessorNumber,
302 ExtStateMain.Ebx,
303 SharedUserData->XState.Size);
304
305 /* The problem is likely the VM, but to be safe, we adjust the size */
306 SharedUserData->XState.AllFeatureSize = ExtStateSubLeaf.Ebx.XSaveAreaSize;
307 }
308 }
309}
#define MSR_IA32_XSS
#define CPUID_EXTENDED_STATE_MAIN_LEAF
Definition: Cpuid.h:1983
ULONG64 KeFeatureBits
Definition: krnlinit.c:22
void __cdecl _xsetbv(unsigned int, unsigned __int64)
Definition: immintrin.h:348
PPC_QUAL void __writemsr(const unsigned long Value)
Definition: intrin_ppc.h:748
SIZE_T KeXStateLength
Definition: stubs.c:18
#define SharedUserData
struct CPUID_EXTENDED_STATE_SUB_LEAF_REGS::@3909::@3911 Ebx
static VOID KiGetXStateConfiguration(_Out_ PXSTATE_CONFIGURATION XStateConfig)
Determines the extended state configuration for the current processor.
Definition: xstate.c:43
static VOID ValidateXStateConfig(_In_ PXSTATE_CONFIGURATION XState)
Validates the provided extended state configuration against the global one.
Definition: xstate.c:197

Referenced by KiSystemStartup().

◆ KiInvalidOpcodeFault()

VOID KiInvalidOpcodeFault ( VOID  )

◆ KiInvalidTssFault()

VOID KiInvalidTssFault ( VOID  )

◆ KiIpiInterrupt()

VOID KiIpiInterrupt ( VOID  )

◆ KiMcheckAbort()

VOID KiMcheckAbort ( VOID  )

◆ KiNmiInterrupt()

VOID KiNmiInterrupt ( VOID  )

◆ KiNpxNotAvailableFault()

VOID KiNpxNotAvailableFault ( VOID  )

◆ KiNpxSegmentOverrunAbort()

VOID KiNpxSegmentOverrunAbort ( VOID  )

◆ KiOverflowTrap()

VOID KiOverflowTrap ( VOID  )

◆ KiPageFault()

VOID KiPageFault ( VOID  )

◆ KiProcessorFreezeHandler()

BOOLEAN KiProcessorFreezeHandler ( _In_ PKTRAP_FRAME  TrapFrame,
_In_ PKEXCEPTION_FRAME  ExceptionFrame 
)

Definition at line 43 of file freeze.c.

46{
47 PKPRCB CurrentPrcb = KeGetCurrentPrcb();
48
49 /* Make sure this is a freeze request */
50 if (CurrentPrcb->IpiFrozen != IPI_FROZEN_STATE_TARGET_FREEZE)
51 {
52 /* Not a freeze request, return FALSE to signal it is unhandled */
53 return FALSE;
54 }
55
56 /* We are frozen now */
58
59 /* Save the processor state */
60 KiSaveProcessorState(TrapFrame, ExceptionFrame);
61
62 /* Wait for the freeze owner to release us */
63 while (CurrentPrcb->IpiFrozen != IPI_FROZEN_STATE_THAW)
64 {
65 /* Check for Kd processor switch */
66 if (CurrentPrcb->IpiFrozen & IPI_FROZEN_FLAG_ACTIVE)
67 {
68 KCONTINUE_STATUS ContinueStatus;
69
70 /* Enter the debugger */
71 ContinueStatus = KdReportProcessorChange();
72
73 /* Set the state back to frozen */
75
76 /* If the status is ContinueSuccess, we need to release the freeze owner */
77 if (ContinueStatus == ContinueSuccess)
78 {
79 /* Release the freeze owner */
81 }
82 }
83
86 }
87
88 /* Restore the processor state */
89 KiRestoreProcessorState(TrapFrame, ExceptionFrame);
90
91 /* We are running again now */
93
94 /* Return TRUE to signal that we handled the freeze */
95 return TRUE;
96}
PKPRCB KiFreezeOwner
Definition: freeze.c:38
KCONTINUE_STATUS NTAPI KdReportProcessorChange(VOID)
Definition: kdapi.c:1806
#define IPI_FROZEN_STATE_TARGET_FREEZE
Definition: ketypes.h:330
#define IPI_FROZEN_FLAG_ACTIVE
Definition: ketypes.h:331
#define IPI_FROZEN_STATE_RUNNING
Definition: ketypes.h:326
#define IPI_FROZEN_STATE_THAW
Definition: ketypes.h:328
#define IPI_FROZEN_STATE_FROZEN
Definition: ketypes.h:327
enum _KCONTINUE_STATUS KCONTINUE_STATUS
@ ContinueSuccess
Definition: ketypes.h:469
VOID NTAPI KiSaveProcessorState(_In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame)
Definition: cpu.c:528
VOID NTAPI KiRestoreProcessorState(_Out_ PKTRAP_FRAME TrapFrame, _Out_ PKEXCEPTION_FRAME ExceptionFrame)
Definition: cpu.c:544
#define YieldProcessor
Definition: ke.h:48
FORCEINLINE VOID KeMemoryBarrier(VOID)
Definition: ke.h:58
ULONG IpiFrozen
Definition: ketypes.h:775

Referenced by KiNmiInterruptHandler().

◆ KiRaiseAssertion()

VOID KiRaiseAssertion ( VOID  )

◆ KiRundownThread()

FORCEINLINE VOID KiRundownThread ( IN PKTHREAD  Thread)

Definition at line 303 of file ke.h.

304{
305 /* Nothing to do */
306}

Referenced by KeTerminateThread().

◆ KiSegmentNotPresentFault()

VOID KiSegmentNotPresentFault ( VOID  )

◆ KiSendEOI()

FORCEINLINE VOID KiSendEOI ( VOID  )

Definition at line 356 of file ke.h.

357{
358 /* Write 0 to the apic EOI register */
359 *((volatile ULONG*)APIC_EOI_REGISTER) = 0;
360}
#define APIC_EOI_REGISTER
Definition: ke.h:87

Referenced by _Requires_lock_not_held_().

◆ KiSetProcessorType()

VOID KiSetProcessorType ( VOID  )

Definition at line 40 of file cpu.c.

41{
42 PKPRCB Prcb = KeGetCurrentPrcb();
43 USHORT Family, Model, Stepping;
44
45 /* This initializes Prcb->CpuVendor */
48
49 /* Get the family, model and stepping */
50 KiGetCpuSignature(&Family, &Model, &Stepping);
51
52 /* Save them in the PRCB */
53 Prcb->CpuID = TRUE;
54 Prcb->CpuType = (UCHAR)Family;
55 Prcb->CpuStep = ((Model << 8) | Stepping);
56}
VOID NTAPI KiGetCpuSignature(_Out_ PUSHORT Family, _Out_ PUSHORT Model, _Out_ PUSHORT Stepping)
Get the CPU signature.
Definition: cpuinfo.c:118
VOID NTAPI KiGetCpuVendorString(_Out_writes_z_(CPU_VENDOR_STR_LEN) CHAR VendorString[CPU_VENDOR_STR_LEN])
Get the CPUID information for a given CPU.
Definition: cpuinfo.c:24
CPU_VENDORS NTAPI KiIdentifyCpuVendor(_In_reads_z_(CPU_VENDOR_STR_LEN) const CHAR VendorString[CPU_VENDOR_STR_LEN])
Identify the CPU vendor by the vendor string.
Definition: cpuinfo.c:55
unsigned short USHORT
Definition: pedump.c:61
static int Family
Definition: ping.c:62
CHAR CpuType
Definition: ketypes.h:684
USHORT CpuStep
Definition: ketypes.h:689
CHAR CpuID
Definition: ketypes.h:685
UCHAR VendorString[13]
Definition: ketypes.h:901

Referenced by KiInitializeCpu(), and KiVerifyCpuFeatures().

◆ KiSetTrapContext()

VOID KiSetTrapContext ( _Out_ PKTRAP_FRAME  TrapFrame,
_In_ PCONTEXT  Context,
_In_ KPROCESSOR_MODE  RequestorMode 
)

Referenced by _IRQL_requires_().

◆ KiStackFault()

VOID KiStackFault ( VOID  )

◆ KiSwitchToBootStack()

DECLSPEC_NORETURN VOID KiSwitchToBootStack ( IN ULONG_PTR  InitialStack)

Definition at line 925 of file ke.h.

926{
928
929 /* We have to switch to a new stack before continuing kernel initialization */
930#ifdef __GNUC__
931 __asm__
932 (
933 "movl %0, %%esp\n\t"
934 "subl %1, %%esp\n\t"
935 "pushl %2\n\t"
936 "jmp _KiSystemStartupBootStack@0"
937 :
938 : "c"(InitialStack),
940 "i"(CR0_EM | CR0_TS | CR0_MP),
942 : "%esp"
943 );
944#elif defined(_MSC_VER)
945 __asm
946 {
947 mov esp, InitialStack
951 }
952#else
953#error Unknown Compiler
954#endif
955
957}
#define CODE_SEG(...)
DECLSPEC_NORETURN VOID NTAPI KiSystemStartupBootStack(VOID)
Definition: krnlinit.c:142
#define DECLSPEC_NORETURN
Definition: corecrt.h:131
#define CR0_MP
Definition: ketypes.h:140
#define CR0_EM
Definition: ketypes.h:141
#define CR0_TS
Definition: ketypes.h:142
#define NPX_FRAME_LENGTH
Definition: asm.h:247
#define KTRAP_FRAME_LENGTH
Definition: asm.h:316
#define KTRAP_FRAME_ALIGN
Definition: asm.h:317
#define UNREACHABLE
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tpush %rbx\n" "\t.seh_pushreg %rbx\n" "\tpush %rdi\n" "\t.seh_pushreg %rdi\n" "\tpush %rsi\n" "\t.seh_pushreg %rsi\n" "\tpush %r12\n" "\t.seh_pushreg %r12\n" "\tpush %r13\n" "\t.seh_pushreg %r13\n" "\tpush %r14\n" "\t.seh_pushreg %r14\n" "\tpush %r15\n" "\t.seh_pushreg %r15\n" "\tsub $40, %rsp\n" "\t.seh_stackalloc 40\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $40, %rsp\n" "\tpop %r15\n" "\tpop %r14\n" "\tpop %r13\n" "\tpop %r12\n" "\tpop %rsi\n" "\tpop %rdi\n" "\tpop %rbx\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113
#define NTAPI
Definition: typedefs.h:36

Referenced by KiSystemStartup().

◆ KiUserCallbackExit()

DECLSPEC_NORETURN VOID KiUserCallbackExit ( _In_ PKTRAP_FRAME  TrapFrame)

Referenced by KiUserModeCallout().

◆ KiUserTrap()

◆ KiXmmException()

VOID KiXmmException ( VOID  )

◆ KxQueryProcessorCycleTime()

FORCEINLINE ULONG64 KxQueryProcessorCycleTime ( VOID  )

Definition at line 209 of file ke.h.

210{
211 /* Read the time stamp counter */
212 return __rdtsc();
213}

Referenced by _IRQL_requires_max_().

◆ NtEarlyInitVdm()

VOID NtEarlyInitVdm ( VOID  )

Variable Documentation

◆ KeI386CpuStep

ULONG KeI386CpuStep
extern

Definition at line 26 of file cpu.c.

Referenced by KiInitializeKernel(), and KiInitializeKernelMachineDependent().

◆ KeI386CpuType

ULONG KeI386CpuType
extern

Definition at line 25 of file cpu.c.

Referenced by KiInitializeKernel(), and KiInitializeKernelMachineDependent().

◆ KeI386FxsrPresent

◆ KeI386NpxPresent

ULONG KeI386NpxPresent
extern

Definition at line 28 of file cpu.c.

Referenced by CmpInitializeMachineDependentConfiguration().

◆ KeI386XMMIPresent

ULONG KeI386XMMIPresent
extern

Definition at line 32 of file cpu.c.

Referenced by KiInitializeKernel().

◆ KeTickCount

◆ KeXStateLength

SIZE_T KeXStateLength
extern