ReactOS 0.4.15-dev-6054-gbddd8b0
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_MTTR   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 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)
 
ULONG KiGetFeatureBits (VOID)
 
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 KiSetTrapContext (_Out_ PKTRAP_FRAME TrapFrame, _In_ PCONTEXT Context, _In_ KPROCESSOR_MODE RequestorMode)
 

Variables

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 122 of file ke.h.

◆ KD_BREAKPOINT_TYPE

#define KD_BREAKPOINT_TYPE   UCHAR

Definition at line 121 of file ke.h.

◆ KD_BREAKPOINT_VALUE

#define KD_BREAKPOINT_VALUE   0xCC

Definition at line 123 of file ke.h.

◆ KeArchInitThreadWithContext

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

Definition at line 436 of file ke.h.

◆ KeGetContextSwitches

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

Definition at line 216 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:208
uint32_t ULONG_PTR
Definition: typedefs.h:65

Definition at line 225 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 208 of file ke.h.

◆ KeGetTrapFrameInterruptState

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

Definition at line 233 of file ke.h.

◆ KiGetSecondLevelDCacheSize

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

Definition at line 223 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_MTTR

#define X86_FEATURE_MTTR   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: debug.h:115
#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 239 of file ke.h.

240{
242
243 /* Get EFLAGS and check if the interrupt bit is set */
245
246 /* Disable interrupts */
247 _disable();
248 return (Flags & EFLAGS_INTERRUPT_MASK) ? TRUE : FALSE;
249}
#define FALSE
Definition: types.h:117
void __cdecl _disable(void)
Definition: intrin_arm.h:365
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1674
#define EFLAGS_INTERRUPT_MASK
Definition: ketypes.h:126
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

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

◆ KeFlushProcessTb()

FORCEINLINE VOID KeFlushProcessTb ( VOID  )

Definition at line 272 of file ke.h.

273{
274 /* Flush the TLB by resetting CR3 */
276}
__INTRIN_INLINE unsigned long __readcr3(void)
Definition: intrin_x86.h:1818
__INTRIN_INLINE void __writecr3(unsigned int Data)
Definition: intrin_x86.h:1794

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

◆ KeFreeGdtSelector()

VOID KeFreeGdtSelector ( ULONG  Entry)

◆ KeGetContextFrameRegister()

FORCEINLINE ULONG_PTR KeGetContextFrameRegister ( PCONTEXT  Context)

Definition at line 165 of file ke.h.

166{
167 return Context->Rbp;
168}

Referenced by KdbpCmdBackTrace().

◆ KeGetContextPc()

FORCEINLINE ULONG_PTR KeGetContextPc ( PCONTEXT  Context)

Definition at line 130 of file ke.h.

131{
132 return Context->Rip;
133}

◆ KeGetContextReturnRegister()

FORCEINLINE ULONG_PTR KeGetContextReturnRegister ( PCONTEXT  Context)

Definition at line 144 of file ke.h.

145{
146 return Context->Rax;
147}

◆ KeGetContextStackRegister()

FORCEINLINE ULONG_PTR KeGetContextStackRegister ( PCONTEXT  Context)

Definition at line 158 of file ke.h.

159{
160 return Context->Rsp;
161}

◆ KeGetTrapFrameFrameRegister()

FORCEINLINE ULONG_PTR KeGetTrapFrameFrameRegister ( PKTRAP_FRAME  TrapFrame)

Definition at line 200 of file ke.h.

201{
202 return TrapFrame->Rbp;
203}
UINT64 Rbp
Definition: ketypes.h:377

Referenced by KdbpCmdThread().

◆ KeGetTrapFramePc()

FORCEINLINE ULONG_PTR KeGetTrapFramePc ( PKTRAP_FRAME  TrapFrame)

Definition at line 179 of file ke.h.

180{
181 return TrapFrame->Rip;
182}
UINT64 Rip
Definition: ketypes.h:384

◆ KeGetTrapFrameStackRegister()

FORCEINLINE ULONG_PTR KeGetTrapFrameStackRegister ( PKTRAP_FRAME  TrapFrame)

Definition at line 193 of file ke.h.

194{
195 return TrapFrame->Rsp;
196}
UINT64 Rsp
Definition: ketypes.h:391

Referenced by KdbpCmdThread().

◆ KeInvalidateTlbEntry()

FORCEINLINE VOID KeInvalidateTlbEntry ( IN PVOID  Address)

Definition at line 264 of file ke.h.

265{
266 /* Invalidate the TLB entry for this address */
268}
__INTRIN_INLINE void __invlpg(void *Address)
Definition: intrin_x86.h:1968
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 327 of file ke.h.

328{
329 UCHAR Entry;
330 PKIDTENTRY64 Idt;
331
332 /* Get the entry from the HAL */
334
335 /* Get the IDT entry */
336 Idt = &KeGetPcr()->IdtBase[Entry];
337
338 /* Return the address */
339 return (PVOID)((ULONG64)Idt->OffsetHigh << 32 |
340 (ULONG64)Idt->OffsetMiddle << 16 |
341 (ULONG64)Idt->OffsetLow);
342}
unsigned __int64 ULONG64
Definition: imports.h:198
#define HalVectorToIDTEntry
Definition: halfuncs.h:51
#define KeGetPcr()
Definition: ke.h:26
base of all file and directory entries
Definition: entries.h:83
ULONG OffsetHigh
Definition: ketypes.h:479
USHORT OffsetMiddle
Definition: ketypes.h:478
USHORT OffsetLow
Definition: ketypes.h:471
unsigned char UCHAR
Definition: xmlstorage.h:181

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

◆ KeRegisterInterruptHandler()

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

Definition at line 301 of file ke.h.

303{
304 UCHAR Entry;
305 PKIDTENTRY64 Idt;
306
307 /* Get the entry from the HAL */
309
310 /* Now set the data */
311 Idt = &KeGetPcr()->IdtBase[Entry];
312 Idt->OffsetLow = (ULONG_PTR)Handler & 0xffff;
313 Idt->OffsetMiddle = ((ULONG_PTR)Handler >> 16) & 0xffff;
314 Idt->OffsetHigh = (ULONG_PTR)Handler >> 32;
316 Idt->IstIndex = 0;
317 Idt->Type = 0x0e;
318 Idt->Dpl = 0;
319 Idt->Present = 1;
320 Idt->Reserved0 = 0;
321 Idt->Reserved1 = 0;
322}
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:72
USHORT Reserved0
Definition: ketypes.h:474
USHORT IstIndex
Definition: ketypes.h:473
ULONG Reserved1
Definition: ketypes.h:480
USHORT Dpl
Definition: ketypes.h:476
USHORT Present
Definition: ketypes.h:477
USHORT Selector
Definition: ketypes.h:472
USHORT Type
Definition: ketypes.h:475

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

◆ KeRestoreInterrupts()

FORCEINLINE VOID KeRestoreInterrupts ( BOOLEAN  WereEnabled)

Definition at line 254 of file ke.h.

255{
256 if (WereEnabled) _enable();
257}
void __cdecl _enable(void)
Definition: intrin_arm.h:373

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

◆ KeSetContextFrameRegister()

FORCEINLINE VOID KeSetContextFrameRegister ( PCONTEXT  Context,
ULONG_PTR  Frame 
)

Definition at line 172 of file ke.h.

173{
174 Context->Rbp = Frame;
175}

Referenced by KdbpCmdBackTrace().

◆ KeSetContextPc()

FORCEINLINE VOID KeSetContextPc ( PCONTEXT  Context,
ULONG_PTR  ProgramCounter 
)

Definition at line 137 of file ke.h.

138{
139 Context->Rip = ProgramCounter;
140}

◆ KeSetContextReturnRegister()

FORCEINLINE VOID KeSetContextReturnRegister ( PCONTEXT  Context,
ULONG_PTR  ReturnValue 
)

Definition at line 151 of file ke.h.

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

◆ KeSweepICache()

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

Definition at line 280 of file ke.h.

282{
283 //
284 // Always sweep the whole cache
285 //
287 UNREFERENCED_PARAMETER(FlushSize);
288 __wbinvd();
289}
PPC_QUAL void __wbinvd(void)
Definition: intrin_ppc.h:759
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317

Referenced by KdpCopyMemoryChunks(), and NtFlushInstructionCache().

◆ Ki386InitializeLdt()

VOID Ki386InitializeLdt ( VOID  )

◆ Ki386PerfEnd()

FORCEINLINE VOID Ki386PerfEnd ( VOID  )

Definition at line 375 of file ke.h.

376{
379 DbgPrint("Boot took %I64u cycles!\n", BootCyclesEnd - BootCycles);
380 DbgPrint("Interrupts: %u System Calls: %u Context Switches: %u\n",
381 KeGetCurrentPrcb()->InterruptCount,
382 KeGetCurrentPrcb()->KeSystemCalls,
384}
#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:1080
#define KeGetContextSwitches(Prcb)
Definition: ke.h:216
ULONGLONG BootCyclesEnd
Definition: ke.h:153
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}
#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:35
#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
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103

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 354 of file ke.h.

356{
357 /* Make sure this is from the clock handler */
358 ASSERT(TrapFrame->ErrorCode == 0xc10c4);
359 //KeLowerIrql(Irql);
360}

◆ KiFloatingErrorFault()

VOID KiFloatingErrorFault ( VOID  )

◆ KiGdtPrepareForApplicationProcessorInit()

VOID KiGdtPrepareForApplicationProcessorInit ( ULONG  Id)

◆ KiGeneralProtectionFault()

VOID KiGeneralProtectionFault ( VOID  )

◆ KiGetCacheInformation()

VOID KiGetCacheInformation ( VOID  )

Definition at line 239 of file cpu.c.

240{
241 PKIPCR Pcr = (PKIPCR)KeGetPcr();
242 ULONG Vendor;
243 ULONG CacheRequests = 0, i;
244 ULONG CurrentRegister;
245 UCHAR RegisterByte;
246 BOOLEAN FirstPass = TRUE;
247 CPU_INFO CpuInfo;
248
249 /* Set default L2 size */
250 Pcr->SecondLevelCacheSize = 0;
251
252 /* Get the Vendor ID and make sure we support CPUID */
253 Vendor = KiGetCpuVendor();
254 if (!Vendor) return;
255
256 /* Check the Vendor ID */
257 switch (Vendor)
258 {
259 /* Handle Intel case */
260 case CPU_INTEL:
261
262 /*Check if we support CPUID 2 */
263 KiCpuId(&CpuInfo, 0);
264 if (CpuInfo.Eax >= 2)
265 {
266 /* We need to loop for the number of times CPUID will tell us to */
267 do
268 {
269 /* Do the CPUID call */
270 KiCpuId(&CpuInfo, 2);
271
272 /* Check if it was the first call */
273 if (FirstPass)
274 {
275 /*
276 * The number of times to loop is the first byte. Read
277 * it and then destroy it so we don't get confused.
278 */
279 CacheRequests = CpuInfo.Eax & 0xFF;
280 CpuInfo.Eax &= 0xFFFFFF00;
281
282 /* Don't go over this again */
283 FirstPass = FALSE;
284 }
285
286 /* Loop all 4 registers */
287 for (i = 0; i < 4; i++)
288 {
289 /* Get the current register */
290 CurrentRegister = CpuInfo.AsUINT32[i];
291
292 /*
293 * If the upper bit is set, then this register should
294 * be skipped.
295 */
296 if (CurrentRegister & 0x80000000) continue;
297
298 /* Keep looping for every byte inside this register */
299 while (CurrentRegister)
300 {
301 /* Read a byte, skip a byte. */
302 RegisterByte = (UCHAR)(CurrentRegister & 0xFF);
303 CurrentRegister >>= 8;
304 if (!RegisterByte) continue;
305
306 /*
307 * Valid values are from 0x40 (0 bytes) to 0x49
308 * (32MB), or from 0x80 to 0x89 (same size but
309 * 8-way associative.
310 */
311 if (((RegisterByte > 0x40) &&
312 (RegisterByte <= 0x49)) ||
313 ((RegisterByte > 0x80) &&
314 (RegisterByte <= 0x89)))
315 {
316 /* Mask out only the first nibble */
317 RegisterByte &= 0x0F;
318
319 /* Set the L2 Cache Size */
320 Pcr->SecondLevelCacheSize = 0x10000 <<
321 RegisterByte;
322 }
323 }
324 }
325 } while (--CacheRequests);
326 }
327 break;
328
329 case CPU_AMD:
330
331 /* Check if we support CPUID 0x80000006 */
332 KiCpuId(&CpuInfo, 0x80000000);
333 if (CpuInfo.Eax >= 6)
334 {
335 /* Get 2nd level cache and tlb size */
336 KiCpuId(&CpuInfo, 0x80000006);
337
338 /* Set the L2 Cache Size */
339 Pcr->SecondLevelCacheSize = (CpuInfo.Ecx & 0xFFFF0000) >> 6;
340 }
341 break;
342 }
343}
unsigned char BOOLEAN
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:45
@ CPU_AMD
Definition: ketypes.h:44
ULONG NTAPI KiGetCpuVendor(VOID)
Definition: cpu.c:57
ULONG SecondLevelCacheSize
Definition: ketypes.h:886
uint32_t ULONG
Definition: typedefs.h:59
ULONG Eax
Definition: ketypes.h:301
UINT32 AsUINT32[4]
Definition: ketypes.h:298
ULONG Ecx
Definition: ketypes.h:303

Referenced by KiInitializeKernel(), and KiSystemStartupBootStack().

◆ KiGetFeatureBits()

ULONG KiGetFeatureBits ( VOID  )

Definition at line 150 of file cpu.c.

151{
152 PKPRCB Prcb = KeGetCurrentPrcb();
153 ULONG Vendor;
154 ULONG FeatureBits = KF_WORKING_PTE;
155 CPU_INFO CpuInfo;
156
157 /* Get the Vendor ID */
158 Vendor = Prcb->CpuVendor;
159
160 /* Make sure we got a valid vendor ID at least. */
161 if (!Vendor) return FeatureBits;
162
163 /* Get the CPUID Info. */
164 KiCpuId(&CpuInfo, 1);
165
166 /* Set the initial APIC ID */
167 Prcb->InitialApicId = (UCHAR)(CpuInfo.Ebx >> 24);
168
169 /* Convert all CPUID Feature bits into our format */
170 if (CpuInfo.Edx & X86_FEATURE_VME) FeatureBits |= KF_V86_VIS | KF_CR4;
171 if (CpuInfo.Edx & X86_FEATURE_PSE) FeatureBits |= KF_LARGE_PAGE | KF_CR4;
172 if (CpuInfo.Edx & X86_FEATURE_TSC) FeatureBits |= KF_RDTSC;
173 if (CpuInfo.Edx & X86_FEATURE_CX8) FeatureBits |= KF_CMPXCHG8B;
174 if (CpuInfo.Edx & X86_FEATURE_SYSCALL) FeatureBits |= KF_FAST_SYSCALL;
175 if (CpuInfo.Edx & X86_FEATURE_MTTR) FeatureBits |= KF_MTRR;
176 if (CpuInfo.Edx & X86_FEATURE_PGE) FeatureBits |= KF_GLOBAL_PAGE | KF_CR4;
177 if (CpuInfo.Edx & X86_FEATURE_CMOV) FeatureBits |= KF_CMOV;
178 if (CpuInfo.Edx & X86_FEATURE_PAT) FeatureBits |= KF_PAT;
179 if (CpuInfo.Edx & X86_FEATURE_DS) FeatureBits |= KF_DTS;
180 if (CpuInfo.Edx & X86_FEATURE_MMX) FeatureBits |= KF_MMX;
181 if (CpuInfo.Edx & X86_FEATURE_FXSR) FeatureBits |= KF_FXSR;
182 if (CpuInfo.Edx & X86_FEATURE_SSE) FeatureBits |= KF_XMMI;
183 if (CpuInfo.Edx & X86_FEATURE_SSE2) FeatureBits |= KF_XMMI64;
184
185 if (CpuInfo.Ecx & X86_FEATURE_SSE3) FeatureBits |= KF_SSE3;
186 //if (CpuInfo.Ecx & X86_FEATURE_MONITOR) FeatureBits |= KF_MONITOR;
187 //if (CpuInfo.Ecx & X86_FEATURE_SSSE3) FeatureBits |= KF_SSE3SUP;
188 if (CpuInfo.Ecx & X86_FEATURE_CX16) FeatureBits |= KF_CMPXCHG16B;
189 //if (CpuInfo.Ecx & X86_FEATURE_SSE41) FeatureBits |= KF_SSE41;
190 //if (CpuInfo.Ecx & X86_FEATURE_POPCNT) FeatureBits |= KF_POPCNT;
191 if (CpuInfo.Ecx & X86_FEATURE_XSAVE) FeatureBits |= KF_XSTATE;
192
193 /* Check if the CPU has hyper-threading */
194 if (CpuInfo.Edx & X86_FEATURE_HT)
195 {
196 /* Set the number of logical CPUs */
197 Prcb->LogicalProcessorsPerPhysicalProcessor = (UCHAR)(CpuInfo.Ebx >> 16);
199 {
200 /* We're on dual-core */
202 }
203 }
204 else
205 {
206 /* We only have a single CPU */
208 }
209
210 /* Check extended cpuid features */
211 KiCpuId(&CpuInfo, 0x80000000);
212 if ((CpuInfo.Eax & 0xffffff00) == 0x80000000)
213 {
214 /* Check if CPUID 0x80000001 is supported */
215 if (CpuInfo.Eax >= 0x80000001)
216 {
217 /* Check which extended features are available. */
218 KiCpuId(&CpuInfo, 0x80000001);
219
220 /* Check if NX-bit is supported */
221 if (CpuInfo.Edx & X86_FEATURE_NX) FeatureBits |= KF_NX_BIT;
222
223 /* Now handle each features for each CPU Vendor */
224 switch (Vendor)
225 {
226 case CPU_AMD:
227 if (CpuInfo.Edx & 0x80000000) FeatureBits |= KF_3DNOW;
228 break;
229 }
230 }
231 }
232
233 /* Return the Feature Bits */
234 return FeatureBits;
235}
#define KF_WORKING_PTE
Definition: ketypes.h:152
#define KF_MTRR
Definition: ketypes.h:149
#define KF_XSTATE
Definition: ketypes.h:164
#define KF_DTS
Definition: ketypes.h:160
#define KF_CMPXCHG16B
Definition: ketypes.h:163
#define KF_CR4
Definition: ketypes.h:145
#define KF_XMMI64
Definition: ketypes.h:159
#define KF_CMOV
Definition: ketypes.h:146
#define KF_CMPXCHG8B
Definition: ketypes.h:150
#define KF_RDTSC
Definition: ketypes.h:144
#define KF_FAST_SYSCALL
Definition: ketypes.h:155
#define KF_3DNOW
Definition: ketypes.h:157
#define KF_NX_BIT
Definition: ketypes.h:165
#define KF_FXSR
Definition: ketypes.h:154
#define KF_V86_VIS
Definition: ketypes.h:143
#define KF_LARGE_PAGE
Definition: ketypes.h:148
#define KF_XMMI
Definition: ketypes.h:156
#define KF_MMX
Definition: ketypes.h:151
#define KF_SSE3
Definition: ketypes.h:162
#define KF_PAT
Definition: ketypes.h:153
#define KF_GLOBAL_PAGE
Definition: ketypes.h:147
#define X86_FEATURE_TSC
Definition: ke.h:34
#define X86_FEATURE_HT
Definition: ke.h:47
#define X86_FEATURE_SSE2
Definition: ke.h:46
#define X86_FEATURE_SSE
Definition: ke.h:45
#define X86_FEATURE_PGE
Definition: ke.h:39
#define X86_FEATURE_XSAVE
Definition: ke.h:60
#define X86_FEATURE_DS
Definition: ke.h:42
#define X86_FEATURE_VME
Definition: ke.h:31
#define X86_FEATURE_MMX
Definition: ke.h:43
#define X86_FEATURE_PSE
Definition: ke.h:33
#define X86_FEATURE_SSE3
Definition: ke.h:50
#define X86_FEATURE_PAT
Definition: ke.h:41
#define X86_FEATURE_MTTR
Definition: ke.h:38
#define X86_FEATURE_CMOV
Definition: ke.h:40
#define X86_FEATURE_CX8
Definition: ke.h:36
#define X86_FEATURE_SYSCALL
Definition: ke.h:37
#define X86_FEATURE_NX
Definition: ke.h:63
#define X86_FEATURE_FXSR
Definition: ke.h:44
#define X86_FEATURE_CX16
Definition: ke.h:55
BOOLEAN KiSMTProcessorsPresent
Definition: cpu.c:28
UCHAR CpuVendor
Definition: ketypes.h:605
UCHAR LogicalProcessorsPerPhysicalProcessor
Definition: ketypes.h:706
ULONG InitialApicId
Definition: ketypes.h:622
ULONG Ebx
Definition: ketypes.h:302
ULONG Edx
Definition: ketypes.h:304

Referenced by KiInitializeCpu(), and KiVerifyCpuFeatures().

◆ KiGetLinkedTrapFrame()

FORCEINLINE PKTRAP_FRAME KiGetLinkedTrapFrame ( PKTRAP_FRAME  TrapFrame)

Definition at line 186 of file ke.h.

187{
188 return (PKTRAP_FRAME)TrapFrame->TrapFrame;
189}
UINT64 TrapFrame
Definition: ketypes.h:373

◆ KiGetUserModeStackAddress()

FORCEINLINE PULONG_PTR KiGetUserModeStackAddress ( void  )

Definition at line 465 of file ke.h.

466{
467 return &PsGetCurrentThread()->Tcb.TrapFrame->Rsp;
468}
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81

Referenced by KeUserModeCallback().

◆ KiInitializeCpuFeatures()

VOID KiInitializeCpuFeatures ( VOID  )

◆ 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  )

◆ KiRaiseAssertion()

VOID KiRaiseAssertion ( VOID  )

◆ KiRundownThread()

FORCEINLINE VOID KiRundownThread ( IN PKTHREAD  Thread)

Definition at line 293 of file ke.h.

294{
295 /* Nothing to do */
296}

Referenced by KeTerminateThread().

◆ KiSegmentNotPresentFault()

VOID KiSegmentNotPresentFault ( VOID  )

◆ KiSendEOI()

FORCEINLINE VOID KiSendEOI ( VOID  )

Definition at line 346 of file ke.h.

347{
348 /* Write 0 to the apic EOI register */
349 *((volatile ULONG*)APIC_EOI_REGISTER) = 0;
350}
#define APIC_EOI_REGISTER
Definition: ke.h:87

Referenced by _Requires_lock_not_held_().

◆ KiSetProcessorType()

VOID KiSetProcessorType ( VOID  )

Definition at line 97 of file cpu.c.

98{
99 CPU_INFO CpuInfo;
100 CPU_SIGNATURE CpuSignature;
101 BOOLEAN ExtendModel;
102 ULONG Stepping, Type, Vendor;
103
104 /* This initializes Prcb->CpuVendor */
105 Vendor = KiGetCpuVendor();
106
107 /* Do CPUID 1 now */
108 KiCpuId(&CpuInfo, 1);
109
110 /*
111 * Get the Stepping and Type. The stepping contains both the
112 * Model and the Step, while the Type contains the returned Family.
113 *
114 * For the stepping, we convert this: zzzzzzxy into this: x0y
115 */
116 CpuSignature.AsULONG = CpuInfo.Eax;
117 Stepping = CpuSignature.Model;
118 ExtendModel = (CpuSignature.Family == 15);
119#if ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) || (NTDDI_VERSION >= NTDDI_WS03SP1)
120 if (CpuSignature.Family == 6)
121 {
122 ExtendModel |= (Vendor == CPU_INTEL);
123#if (NTDDI_VERSION >= NTDDI_WIN8)
124 ExtendModel |= (Vendor == CPU_CENTAUR);
125#endif
126 }
127#endif
128 if (ExtendModel)
129 {
130 /* Add ExtendedModel to distinguish from non-extended values. */
131 Stepping |= (CpuSignature.ExtendedModel << 4);
132 }
133 Stepping = (Stepping << 8) | CpuSignature.Step;
134 Type = CpuSignature.Family;
135 if (CpuSignature.Family == 15)
136 {
137 /* Add ExtendedFamily to distinguish from non-extended values.
138 * It must not be larger than 0xF0 to avoid overflow. */
139 Type += min(CpuSignature.ExtendedFamily, 0xF0);
140 }
141
142 /* Save them in the PRCB */
143 KeGetCurrentPrcb()->CpuID = TRUE;
144 KeGetCurrentPrcb()->CpuType = (UCHAR)Type;
145 KeGetCurrentPrcb()->CpuStep = (USHORT)Stepping;
146}
Type
Definition: Type.h:7
if(dx< 0)
Definition: linetemp.h:194
#define min(a, b)
Definition: monoChain.cc:55
@ CPU_CENTAUR
Definition: ketypes.h:47
unsigned short USHORT
Definition: pedump.c:61
ULONG ExtendedFamily
Definition: cpu.c:47
ULONG Model
Definition: cpu.c:43
ULONG Family
Definition: cpu.c:44
ULONG AsULONG
Definition: cpu.c:50
ULONG Step
Definition: cpu.c:42
ULONG ExtendedModel
Definition: cpu.c:46

Referenced by KiInitializeCpu(), and KiVerifyCpuFeatures().

◆ KiSetTrapContext()

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

◆ KiStackFault()

VOID KiStackFault ( VOID  )

◆ KiSwitchToBootStack()

DECLSPEC_NORETURN VOID KiSwitchToBootStack ( IN ULONG_PTR  InitialStack)

Definition at line 827 of file ke.h.

828{
830
831 /* We have to switch to a new stack before continuing kernel initialization */
832#ifdef __GNUC__
833 __asm__
834 (
835 "movl %0, %%esp\n\t"
836 "subl %1, %%esp\n\t"
837 "pushl %2\n\t"
838 "jmp _KiSystemStartupBootStack@0"
839 :
840 : "c"(InitialStack),
842 "i"(CR0_EM | CR0_TS | CR0_MP),
844 : "%esp"
845 );
846#elif defined(_MSC_VER)
847 __asm
848 {
849 mov esp, InitialStack
853 }
854#else
855#error Unknown Compiler
856#endif
857
859}
DECLSPEC_NORETURN VOID NTAPI KiSystemStartupBootStack(VOID)
Definition: krnlinit.c:58
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
#define CR0_MP
Definition: asm.h:246
#define CR0_EM
Definition: asm.h:247
#define KTRAP_FRAME_LENGTH
Definition: asm.h:126
#define KTRAP_FRAME_ALIGN
Definition: asm.h:125
#define CR0_TS
Definition: asm.h:248
#define NPX_FRAME_LENGTH
Definition: asm.h:246
#define UNREACHABLE
#define DECLSPEC_NORETURN
Definition: ntbasedef.h:176
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tmov %rdx, %rbp\n" "\tjmp *%rax\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\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().

◆ KiUserTrap()

◆ KiXmmException()

VOID KiXmmException ( VOID  )

◆ NtEarlyInitVdm()

VOID NtEarlyInitVdm ( VOID  )

Variable Documentation

◆ KeI386CpuStep

ULONG KeI386CpuStep
extern

Definition at line 23 of file cpu.c.

Referenced by KiInitializeKernel(), and KiInitializeKernelMachineDependent().

◆ KeI386CpuType

ULONG KeI386CpuType
extern

Definition at line 22 of file cpu.c.

Referenced by KiInitializeKernel(), and KiInitializeKernelMachineDependent().

◆ KeI386FxsrPresent

◆ KeI386NpxPresent

ULONG KeI386NpxPresent
extern

Definition at line 25 of file cpu.c.

Referenced by CmpInitializeMachineDependentConfiguration().

◆ KeI386XMMIPresent

ULONG KeI386XMMIPresent
extern

Definition at line 32 of file cpu.c.

Referenced by KiInitializeKernel().

◆ KeTickCount