ReactOS  0.4.10-dev-244-gb941574
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 KeGetContextPc(Context)   ((Context)->Rip)
 
#define KeSetContextPc(Context, ProgramCounter)   ((Context)->Rip = (ProgramCounter))
 
#define KeGetTrapFramePc(TrapFrame)   ((TrapFrame)->Rip)
 
#define KiGetLinkedTrapFrame(x)   (PKTRAP_FRAME)((x)->TrapFrame)
 
#define KeGetContextReturnRegister(Context)   ((Context)->Rax)
 
#define KeSetContextReturnRegister(Context, ReturnValue)   ((Context)->Rax = (ReturnValue))
 
#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 Ki386PerfEnd()
 
#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_ENTRY
PKI_INTERRUPT_DISPATCH_ENTRY
 

Functions

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)
 
VOID FORCEINLINE KiSendEOI (VOID)
 
VOID FORCEINLINE KiEndInterrupt (IN KIRQL Irql, IN PKTRAP_FRAME TrapFrame)
 
BOOLEAN FORCEINLINE KiUserTrap (IN PKTRAP_FRAME TrapFrame)
 
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)
 

Variables

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

Macro Definition Documentation

#define AMD64_TSS   9

Definition at line 81 of file ke.h.

Referenced by KiInitializeTss().

#define APIC_EOI_REGISTER   0xFFFFFFFFFFFE00B0ULL

Definition at line 83 of file ke.h.

Referenced by KiSendEOI().

#define EFER_FFXSR   0x4000

Definition at line 79 of file ke.h.

#define EFER_LMA   0x0400

Definition at line 76 of file ke.h.

#define EFER_LME   0x0100

Definition at line 75 of file ke.h.

#define EFER_NXE   0x0800

Definition at line 77 of file ke.h.

#define EFER_SCE   0x0001

Definition at line 74 of file ke.h.

#define EFER_SVME   0x1000

Definition at line 78 of file ke.h.

#define FRAME_EDITED   0xFFF8
#define KD_BREAKPOINT_TYPE   UCHAR

Definition at line 117 of file ke.h.

Referenced by handle_gdb_c(), KdpAddBreakpoint(), and KdSetOwedBreakpoints().

#define KD_BREAKPOINT_VALUE   0xCC

Definition at line 119 of file ke.h.

Referenced by handle_gdb_c().

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

Definition at line 363 of file ke.h.

#define KeGetContextPc (   Context)    ((Context)->Rip)

Definition at line 124 of file ke.h.

Referenced by KdpEnterDebuggerException(), KdpSetCommonState(), KdpStub(), KdpTrap(), and PspCreateThread().

#define KeGetContextReturnRegister (   Context)    ((Context)->Rax)

Definition at line 136 of file ke.h.

Referenced by PspCreateThread().

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

Definition at line 153 of file ke.h.

Referenced by QSI_DEF().

#define KeGetExceptionFrame (   Thread)
Value:
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
uint32_t ULONG_PTR
Definition: typedefs.h:63
struct _KEXCEPTION_FRAME * PKEXCEPTION_FRAME
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define KeGetTrapFrame(Thread)
Definition: ke.h:145

Definition at line 162 of file ke.h.

Referenced by PspUserThreadStartup().

#define KeGetTrapFrame (   Thread)
Value:
(PKTRAP_FRAME)((ULONG_PTR)((Thread)->InitialStack) - \
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
uint32_t ULONG_PTR
Definition: typedefs.h:63
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
struct _KTRAP_FRAME * PKTRAP_FRAME

Definition at line 145 of file ke.h.

Referenced by Ke386SetIOPL(), KiSwapContextExit(), KiTrap0EHandler(), PspGetOrSetContextKernelRoutine(), PspUserThreadStartup(), and RtlWalkFrameChain().

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

Definition at line 170 of file ke.h.

Referenced by KdpQueryPerformanceCounter().

#define KeGetTrapFramePc (   TrapFrame)    ((TrapFrame)->Rip)

Definition at line 130 of file ke.h.

Referenced by KeBugCheckWithTf(), and KiParseProfileList().

#define KeSetContextPc (   Context,
  ProgramCounter 
)    ((Context)->Rip = (ProgramCounter))

Definition at line 127 of file ke.h.

Referenced by KdpEnterDebuggerException(), KdpStub(), and KdpTrap().

#define KeSetContextReturnRegister (   Context,
  ReturnValue 
)    ((Context)->Rax = (ReturnValue))

Definition at line 139 of file ke.h.

Referenced by KdpEnterDebuggerException(), and KdpTrap().

#define Ki386PerfEnd ( )

Definition at line 311 of file ke.h.

#define KiGetLinkedTrapFrame (   x)    (PKTRAP_FRAME)((x)->TrapFrame)

Definition at line 133 of file ke.h.

Referenced by KiSystemService(), NtContinue(), and NtRaiseException().

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

Definition at line 160 of file ke.h.

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

Definition at line 15 of file ke.h.

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

Definition at line 16 of file ke.h.

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

Definition at line 13 of file ke.h.

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

Definition at line 12 of file ke.h.

#define X86_CR0_PG   0x80000000 /* enable Paging */

Definition at line 18 of file ke.h.

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

Definition at line 14 of file ke.h.

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

Definition at line 17 of file ke.h.

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

Definition at line 22 of file ke.h.

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

Definition at line 23 of file ke.h.

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

Definition at line 20 of file ke.h.

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

Definition at line 21 of file ke.h.

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

Definition at line 10 of file ke.h.

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

Definition at line 5 of file ke.h.

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

Definition at line 6 of file ke.h.

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

Definition at line 7 of file ke.h.

#define X86_EFLAGS_RF   0x00010000 /* Resume flag */

Definition at line 8 of file ke.h.

#define X86_EFLAGS_TF   0x00000100 /* Trap flag */

Definition at line 4 of file ke.h.

#define X86_EFLAGS_VM   0x00020000 /* Virtual Mode */

Definition at line 9 of file ke.h.

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

Definition at line 62 of file ke.h.

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

Definition at line 61 of file ke.h.

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

Definition at line 36 of file ke.h.

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

Definition at line 51 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 32 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 28 of file ke.h.

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

Definition at line 38 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 50 of file ke.h.

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

Definition at line 26 of file ke.h.

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

Definition at line 40 of file ke.h.

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

Definition at line 43 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 39 of file ke.h.

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

Definition at line 47 of file ke.h.

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

Definition at line 34 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 59 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 31 of file ke.h.

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

Definition at line 37 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 52 of file ke.h.

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

Definition at line 35 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 55 of file ke.h.

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

Definition at line 29 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 41 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 42 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 46 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 53 of file ke.h.

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

Definition at line 54 of file ke.h.

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

Definition at line 49 of file ke.h.

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

Definition at line 33 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 30 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 27 of file ke.h.

Referenced by KiGetFeatureBits().

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

Definition at line 48 of file ke.h.

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

Definition at line 56 of file ke.h.

Referenced by KiGetFeatureBits().

#define X86_MSR_CSTAR   0xC0000083

Definition at line 71 of file ke.h.

Referenced by KiRestoreProcessorControlState(), and KiSaveProcessorControlState().

#define X86_MSR_EFER   0xC0000080

Definition at line 68 of file ke.h.

#define X86_MSR_GSBASE   0xC0000101

Definition at line 66 of file ke.h.

Referenced by KiRestoreProcessorControlState(), and KiSaveProcessorControlState().

#define X86_MSR_KERNEL_GSBASE   0xC0000102

Definition at line 67 of file ke.h.

Referenced by KiRestoreProcessorControlState(), and KiSaveProcessorControlState().

#define X86_MSR_LSTAR   0xC0000082

Definition at line 70 of file ke.h.

Referenced by KiRestoreProcessorControlState(), and KiSaveProcessorControlState().

#define X86_MSR_SFMASK   0xC0000084

Definition at line 72 of file ke.h.

Referenced by KiRestoreProcessorControlState(), and KiSaveProcessorControlState().

#define X86_MSR_STAR   0xC0000081

Definition at line 69 of file ke.h.

Referenced by KiRestoreProcessorControlState(), and KiSaveProcessorControlState().

Typedef Documentation

Function Documentation

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.

Referenced by HalGetScatterGatherList(), and IoAllocateAdapterChannel().

92 {
94  while (TRUE);
95  return STATUS_SUCCESS;
96 }
#define TRUE
Definition: types.h:120
return STATUS_SUCCESS
Definition: btrfs.c:2690
#define UNIMPLEMENTED
Definition: debug.h:114
VOID Ke386InitThreadWithContext ( PKTHREAD  Thread,
PKSYSTEM_ROUTINE  SystemRoutine,
PKSTART_ROUTINE  StartRoutine,
PVOID  StartContext,
PCONTEXT  Context 
)
ULONG KeAllocateGdtSelector ( ULONG  Desc[2])
VOID KeApplicationProcessorInitDispatcher ( VOID  )
VOID KeCreateApplicationProcessorIdleThread ( ULONG  Id)
FORCEINLINE BOOLEAN KeDisableInterrupts ( VOID  )

Definition at line 176 of file ke.h.

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

177 {
179 
180  /* Get EFLAGS and check if the interrupt bit is set */
181  Flags = __readeflags();
182 
183  /* Disable interrupts */
184  _disable();
185  return (Flags & EFLAGS_INTERRUPT_MASK) ? TRUE : FALSE;
186 }
#define TRUE
Definition: types.h:120
uint32_t ULONG_PTR
Definition: typedefs.h:63
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1560
#define FALSE
Definition: types.h:117
void __cdecl _disable(void)
Definition: intrin_arm.h:365
#define EFLAGS_INTERRUPT_MASK
Definition: ketypes.h:126
FORCEINLINE VOID KeFlushProcessTb ( VOID  )

Definition at line 209 of file ke.h.

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

210 {
211  /* Flush the TLB by resetting CR3 */
213 }
__INTRIN_INLINE unsigned long __readcr3(void)
Definition: intrin_x86.h:1711
__INTRIN_INLINE void __writecr3(unsigned int Data)
Definition: intrin_x86.h:1680
VOID KeFreeGdtSelector ( ULONG  Entry)
FORCEINLINE VOID KeInvalidateTlbEntry ( IN PVOID  Address)

Definition at line 201 of file ke.h.

Referenced by KdpPhysMap(), MiDbgTranslatePhysicalAddress(), MiDbgUnTranslatePhysicalAddress(), MiFlushTlb(), MiProtectVirtualMemory(), and MmCreateVirtualMappingUnsafe().

202 {
203  /* Invalidate the TLB entry for this address */
204  __invlpg(Address);
205 }
PVOID ULONG Address
Definition: oprghdlr.h:14
__INTRIN_INLINE void __invlpg(void *Address)
Definition: intrin_x86.h:1870
FORCEINLINE PVOID KeQueryInterruptHandler ( IN ULONG  Vector)

Definition at line 268 of file ke.h.

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

269 {
270  UCHAR Entry;
271  PKIDTENTRY64 Idt;
272 
273  /* Get the entry from the HAL */
274  Entry = HalVectorToIDTEntry(Vector);
275 
276  /* Get the IDT entry */
277  Idt = &KeGetPcr()->IdtBase[Entry];
278 
279  /* Return the address */
280  return (PVOID)((ULONG64)Idt->OffsetHigh << 32 |
281  (ULONG64)Idt->OffsetMiddle << 16 |
282  (ULONG64)Idt->OffsetLow);
283 }
DWORD *typedef PVOID
Definition: winlogon.h:52
struct _Entry Entry
Definition: kefuncs.h:640
union _KIDTENTRY64 * IdtBase
Definition: ke.h:296
USHORT OffsetLow
Definition: ketypes.h:466
USHORT OffsetMiddle
Definition: ketypes.h:473
unsigned __int64 ULONG64
Definition: imports.h:198
unsigned char UCHAR
Definition: xmlstorage.h:181
FORCEINLINE PKPCR KeGetPcr(VOID)
Definition: ke.h:318
ULONG OffsetHigh
Definition: ketypes.h:474
#define HalVectorToIDTEntry
Definition: halfuncs.h:50
FORCEINLINE VOID KeRegisterInterruptHandler ( IN ULONG  Vector,
IN PVOID  Handler 
)

Definition at line 242 of file ke.h.

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

244 {
245  UCHAR Entry;
246  PKIDTENTRY64 Idt;
247 
248  /* Get the entry from the HAL */
249  Entry = HalVectorToIDTEntry(Vector);
250 
251  /* Now set the data */
252  Idt = &KeGetPcr()->IdtBase[Entry];
253  Idt->OffsetLow = (ULONG_PTR)Handler & 0xffff;
254  Idt->OffsetMiddle = ((ULONG_PTR)Handler >> 16) & 0xffff;
255  Idt->OffsetHigh = (ULONG_PTR)Handler >> 32;
256  Idt->Selector = KGDT64_R0_CODE;
257  Idt->IstIndex = 0;
258  Idt->Type = 0x0e;
259  Idt->Dpl = 0;
260  Idt->Present = 1;
261  Idt->Reserved0 = 0;
262  Idt->Reserved1 = 0;
263 }
struct _Entry Entry
Definition: kefuncs.h:640
union _KIDTENTRY64 * IdtBase
Definition: ke.h:296
USHORT Selector
Definition: ketypes.h:467
USHORT OffsetLow
Definition: ketypes.h:466
USHORT Reserved0
Definition: ketypes.h:469
USHORT Type
Definition: ketypes.h:470
USHORT Present
Definition: ketypes.h:472
USHORT OffsetMiddle
Definition: ketypes.h:473
#define KGDT64_R0_CODE
Definition: ketypes.h:72
USHORT IstIndex
Definition: ketypes.h:468
unsigned char UCHAR
Definition: xmlstorage.h:181
USHORT Dpl
Definition: ketypes.h:471
ULONG Reserved1
Definition: ketypes.h:475
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical 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:658
FORCEINLINE PKPCR KeGetPcr(VOID)
Definition: ke.h:318
#define ULONG_PTR
Definition: config.h:101
ULONG OffsetHigh
Definition: ketypes.h:474
#define HalVectorToIDTEntry
Definition: halfuncs.h:50
FORCEINLINE VOID KeRestoreInterrupts ( BOOLEAN  WereEnabled)

Definition at line 191 of file ke.h.

Referenced by _ExiReleaseSpinLockAndRestoreInterrupts(), and Ki386EnableGlobalPage().

192 {
193  if (WereEnabled) _enable();
194 }
void __cdecl _enable(void)
Definition: intrin_arm.h:373
FORCEINLINE VOID KeSweepICache ( IN PVOID  BaseAddress,
IN SIZE_T  FlushSize 
)

Definition at line 217 of file ke.h.

Referenced by KdpCopyMemoryChunks(), and NtFlushInstructionCache().

219 {
220  //
221  // Always sweep the whole cache
222  //
224  UNREFERENCED_PARAMETER(FlushSize);
225  __wbinvd();
226 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
PPC_QUAL void __wbinvd(void)
Definition: intrin_ppc.h:759
VOID Ki386InitializeLdt ( VOID  )
VOID Ki386SetProcessorFeatures ( VOID  )
VOID KiAlignmentFault ( VOID  )
VOID KiApcInterrupt ( VOID  )

Definition at line 228 of file trapc.c.

Referenced by KiInitializePcr().

229 {
231  KEXCEPTION_FRAME ExceptionFrame;
232  PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
233 
234  DPRINT1("[APC TRAP]\n");
235  while (TRUE);
236 
237  //
238  // Isolate previous mode
239  //
240  PreviousMode = KiGetPreviousMode(TrapFrame);
241 
242  //
243  // FIXME-USER: Handle APC interrupt while in user-mode
244  //
245  if (PreviousMode == UserMode) ASSERT(FALSE);
246 
247  //
248  // Disable interrupts
249  //
250  _disable();
251 
252  //
253  // Clear APC interrupt
254  //
256 
257  //
258  // Re-enable interrupts
259  //
260  _enable();
261 
262  //
263  // Deliver APCs
264  //
265  KiDeliverApc(PreviousMode, &ExceptionFrame, TrapFrame);
266 }
#define TRUE
Definition: types.h:120
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
void __cdecl _enable(void)
Definition: intrin_arm.h:373
#define FALSE
Definition: types.h:117
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define KiGetPreviousMode(tf)
Definition: ke.h:180
#define DPRINT1
Definition: precomp.h:8
VOID FASTCALL HalClearSoftwareInterrupt(IN KIRQL Irql)
Definition: pic.c:282
void __cdecl _disable(void)
Definition: intrin_arm.h:365
#define KeGetCurrentThread
Definition: hal.h:44
VOID NTAPI KiDeliverApc(IN KPROCESSOR_MODE DeliveryMode, IN PKEXCEPTION_FRAME ExceptionFrame, IN PKTRAP_FRAME TrapFrame)
Definition: apc.c:302
#define APC_LEVEL
Definition: env_spec_w32.h:695
VOID KiBoundFault ( VOID  )
VOID KiBreakpointTrap ( VOID  )
VOID KiDebugServiceTrap ( VOID  )
VOID KiDebugTrapOrFault ( VOID  )
VOID KiDivideErrorFault ( VOID  )
VOID KiDoubleFaultAbort ( VOID  )
VOID KiDpcInterrupt ( VOID  )
VOID FORCEINLINE KiEndInterrupt ( IN KIRQL  Irql,
IN PKTRAP_FRAME  TrapFrame 
)

Definition at line 295 of file ke.h.

297 {
298  /* Make sure this is from the clock handler */
299  ASSERT(TrapFrame->ErrorCode == 0xc10c4);
300  //KeLowerIrql(Irql);
301 }
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
VOID KiFloatingErrorFault ( VOID  )
VOID KiGdtPrepareForApplicationProcessorInit ( ULONG  Id)
VOID KiGeneralProtectionFault ( VOID  )
VOID KiGetCacheInformation ( VOID  )

Definition at line 214 of file cpu.c.

Referenced by KiSystemStartupBootStack().

215 {
216  PKIPCR Pcr = (PKIPCR)KeGetPcr();
217  ULONG Vendor;
218  ULONG CacheRequests = 0, i;
219  ULONG CurrentRegister;
220  UCHAR RegisterByte;
221  BOOLEAN FirstPass = TRUE;
222  CPU_INFO CpuInfo;
223 
224  /* Set default L2 size */
225  Pcr->SecondLevelCacheSize = 0;
226 
227  /* Get the Vendor ID and make sure we support CPUID */
228  Vendor = KiGetCpuVendor();
229  if (!Vendor) return;
230 
231  /* Check the Vendor ID */
232  switch (Vendor)
233  {
234  /* Handle Intel case */
235  case CPU_INTEL:
236 
237  /*Check if we support CPUID 2 */
238  KiCpuId(&CpuInfo, 0);
239  if (CpuInfo.Eax >= 2)
240  {
241  /* We need to loop for the number of times CPUID will tell us to */
242  do
243  {
244  /* Do the CPUID call */
245  KiCpuId(&CpuInfo, 2);
246 
247  /* Check if it was the first call */
248  if (FirstPass)
249  {
250  /*
251  * The number of times to loop is the first byte. Read
252  * it and then destroy it so we don't get confused.
253  */
254  CacheRequests = CpuInfo.Eax & 0xFF;
255  CpuInfo.Eax &= 0xFFFFFF00;
256 
257  /* Don't go over this again */
258  FirstPass = FALSE;
259  }
260 
261  /* Loop all 4 registers */
262  for (i = 0; i < 4; i++)
263  {
264  /* Get the current register */
265  CurrentRegister = CpuInfo.AsUINT32[i];
266 
267  /*
268  * If the upper bit is set, then this register should
269  * be skipped.
270  */
271  if (CurrentRegister & 0x80000000) continue;
272 
273  /* Keep looping for every byte inside this register */
274  while (CurrentRegister)
275  {
276  /* Read a byte, skip a byte. */
277  RegisterByte = (UCHAR)(CurrentRegister & 0xFF);
278  CurrentRegister >>= 8;
279  if (!RegisterByte) continue;
280 
281  /*
282  * Valid values are from 0x40 (0 bytes) to 0x49
283  * (32MB), or from 0x80 to 0x89 (same size but
284  * 8-way associative.
285  */
286  if (((RegisterByte > 0x40) &&
287  (RegisterByte <= 0x49)) ||
288  ((RegisterByte > 0x80) &&
289  (RegisterByte <= 0x89)))
290  {
291  /* Mask out only the first nibble */
292  RegisterByte &= 0x0F;
293 
294  /* Set the L2 Cache Size */
295  Pcr->SecondLevelCacheSize = 0x10000 <<
296  RegisterByte;
297  }
298  }
299  }
300  } while (--CacheRequests);
301  }
302  break;
303 
304  case CPU_AMD:
305 
306  /* Check if we support CPUID 0x80000006 */
307  KiCpuId(&CpuInfo, 0x80000000);
308  if (CpuInfo.Eax >= 6)
309  {
310  /* Get 2nd level cache and tlb size */
311  KiCpuId(&CpuInfo, 0x80000006);
312 
313  /* Set the L2 Cache Size */
314  Pcr->SecondLevelCacheSize = (CpuInfo.Ecx & 0xFFFF0000) >> 6;
315  }
316  break;
317  }
318 }
#define TRUE
Definition: types.h:120
struct _KIPCR * PKIPCR
#define KeGetPcr()
Definition: ke.h:25
ULONG NTAPI KiGetCpuVendor(VOID)
Definition: cpu.c:85
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
ULONG SecondLevelCacheSize
Definition: ketypes.h:881
ULONG Eax
Definition: ketypes.h:296
unsigned char BOOLEAN
ULONG Ecx
Definition: ketypes.h:298
unsigned char UCHAR
Definition: xmlstorage.h:181
UINT32 AsUINT32[4]
Definition: ketypes.h:293
unsigned int ULONG
Definition: retypes.h:1
ULONG KiGetFeatureBits ( VOID  )

Definition at line 125 of file cpu.c.

126 {
127  PKPRCB Prcb = KeGetCurrentPrcb();
128  ULONG Vendor;
129  ULONG FeatureBits = KF_WORKING_PTE;
130  CPU_INFO CpuInfo;
131 
132  /* Get the Vendor ID */
133  Vendor = KiGetCpuVendor();
134 
135  /* Make sure we got a valid vendor ID at least. */
136  if (!Vendor) return FeatureBits;
137 
138  /* Get the CPUID Info. */
139  KiCpuId(&CpuInfo, 1);
140 
141  /* Set the initial APIC ID */
142  Prcb->InitialApicId = (UCHAR)(CpuInfo.Ebx >> 24);
143 
144  /* Convert all CPUID Feature bits into our format */
145  if (CpuInfo.Edx & X86_FEATURE_VME) FeatureBits |= KF_V86_VIS | KF_CR4;
146  if (CpuInfo.Edx & X86_FEATURE_PSE) FeatureBits |= KF_LARGE_PAGE | KF_CR4;
147  if (CpuInfo.Edx & X86_FEATURE_TSC) FeatureBits |= KF_RDTSC;
148  if (CpuInfo.Edx & X86_FEATURE_CX8) FeatureBits |= KF_CMPXCHG8B;
149  if (CpuInfo.Edx & X86_FEATURE_SYSCALL) FeatureBits |= KF_FAST_SYSCALL;
150  if (CpuInfo.Edx & X86_FEATURE_MTTR) FeatureBits |= KF_MTRR;
151  if (CpuInfo.Edx & X86_FEATURE_PGE) FeatureBits |= KF_GLOBAL_PAGE | KF_CR4;
152  if (CpuInfo.Edx & X86_FEATURE_CMOV) FeatureBits |= KF_CMOV;
153  if (CpuInfo.Edx & X86_FEATURE_PAT) FeatureBits |= KF_PAT;
154  if (CpuInfo.Edx & X86_FEATURE_DS) FeatureBits |= KF_DTS;
155  if (CpuInfo.Edx & X86_FEATURE_MMX) FeatureBits |= KF_MMX;
156  if (CpuInfo.Edx & X86_FEATURE_FXSR) FeatureBits |= KF_FXSR;
157  if (CpuInfo.Edx & X86_FEATURE_SSE) FeatureBits |= KF_XMMI;
158  if (CpuInfo.Edx & X86_FEATURE_SSE2) FeatureBits |= KF_XMMI64;
159 
160  if (CpuInfo.Ecx & X86_FEATURE_SSE3) FeatureBits |= KF_SSE3;
161  //if (CpuInfo.Ecx & X86_FEATURE_MONITOR) FeatureBits |= KF_MONITOR;
162  //if (CpuInfo.Ecx & X86_FEATURE_SSSE3) FeatureBits |= KF_SSE3SUP;
163  if (CpuInfo.Ecx & X86_FEATURE_CX16) FeatureBits |= KF_CMPXCHG16B;
164  //if (CpuInfo.Ecx & X86_FEATURE_SSE41) FeatureBits |= KF_SSE41;
165  //if (CpuInfo.Ecx & X86_FEATURE_POPCNT) FeatureBits |= KF_POPCNT;
166  if (CpuInfo.Ecx & X86_FEATURE_XSAVE) FeatureBits |= KF_XSTATE;
167 
168  /* Check if the CPU has hyper-threading */
169  if (CpuInfo.Edx & X86_FEATURE_HT)
170  {
171  /* Set the number of logical CPUs */
172  Prcb->LogicalProcessorsPerPhysicalProcessor = (UCHAR)(CpuInfo.Ebx >> 16);
174  {
175  /* We're on dual-core */
177  }
178  }
179  else
180  {
181  /* We only have a single CPU */
183  }
184 
185  /* Check extended cpuid features */
186  KiCpuId(&CpuInfo, 0x80000000);
187  if ((CpuInfo.Eax & 0xffffff00) == 0x80000000)
188  {
189  /* Check if CPUID 0x80000001 is supported */
190  if (CpuInfo.Eax >= 0x80000001)
191  {
192  /* Check which extended features are available. */
193  KiCpuId(&CpuInfo, 0x80000001);
194 
195  /* Check if NX-bit is supported */
196  if (CpuInfo.Edx & X86_FEATURE_NX) FeatureBits |= KF_NX_BIT;
197 
198  /* Now handle each features for each CPU Vendor */
199  switch (Vendor)
200  {
201  case CPU_AMD:
202  if (CpuInfo.Edx & 0x80000000) FeatureBits |= KF_3DNOW;
203  break;
204  }
205  }
206  }
207 
208  /* Return the Feature Bits */
209  return FeatureBits;
210 }
#define X86_FEATURE_PGE
Definition: ke.h:35
#define X86_FEATURE_SYSCALL
Definition: ke.h:33
#define TRUE
Definition: types.h:120
#define X86_FEATURE_VME
Definition: ke.h:27
UCHAR LogicalProcessorsPerPhysicalProcessor
Definition: ketypes.h:703
#define KF_CMPXCHG8B
Definition: ketypes.h:150
#define X86_FEATURE_SSE2
Definition: ke.h:42
#define X86_FEATURE_HT
Definition: ke.h:43
#define KF_RDTSC
Definition: ketypes.h:144
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1054
#define KF_MMX
Definition: ketypes.h:151
#define KF_NX_BIT
Definition: ketypes.h:165
#define X86_FEATURE_XSAVE
Definition: ke.h:56
ULONG NTAPI KiGetCpuVendor(VOID)
Definition: cpu.c:85
#define KF_LARGE_PAGE
Definition: ketypes.h:148
#define KF_PAT
Definition: ketypes.h:153
#define KF_XMMI
Definition: ketypes.h:156
#define X86_FEATURE_CX16
Definition: ke.h:51
#define X86_FEATURE_PSE
Definition: ke.h:29
ULONG Eax
Definition: ketypes.h:296
#define X86_FEATURE_PAT
Definition: ke.h:37
#define X86_FEATURE_CMOV
#define KF_CR4
Definition: ketypes.h:145
ULONG Ebx
Definition: ketypes.h:297
#define KF_MTRR
Definition: ketypes.h:149
ULONG Ecx
Definition: ketypes.h:298
#define X86_FEATURE_NX
Definition: ke.h:59
#define KF_WORKING_PTE
Definition: ketypes.h:152
#define KF_FAST_SYSCALL
Definition: ketypes.h:155
#define KF_V86_VIS
Definition: ketypes.h:143
#define KF_FXSR
Definition: ketypes.h:154
#define KF_3DNOW
Definition: ketypes.h:157
#define X86_FEATURE_MTTR
Definition: ke.h:34
unsigned char UCHAR
Definition: xmlstorage.h:181
#define KF_XMMI64
Definition: ketypes.h:159
#define KF_CMPXCHG16B
Definition: ketypes.h:163
#define X86_FEATURE_SSE
Definition: ke.h:41
#define X86_FEATURE_CX8
Definition: ke.h:32
#define KF_SSE3
Definition: ketypes.h:162
#define X86_FEATURE_FXSR
#define X86_FEATURE_MMX
unsigned int ULONG
Definition: retypes.h:1
#define KF_DTS
Definition: ketypes.h:160
#define X86_FEATURE_TSC
Definition: ke.h:30
#define KF_XSTATE
Definition: ketypes.h:164
#define X86_FEATURE_DS
Definition: ke.h:38
#define KF_GLOBAL_PAGE
Definition: ketypes.h:147
ULONG Edx
Definition: ketypes.h:299
BOOLEAN KiSMTProcessorsPresent
Definition: cpu.c:34
#define KF_CMOV
Definition: ketypes.h:146
#define X86_FEATURE_SSE3
Definition: ke.h:46
ULONG InitialApicId
Definition: ketypes.h:617
VOID KiInitializeCpuFeatures ( VOID  )
VOID KiInvalidOpcodeFault ( VOID  )
VOID KiInvalidTssFault ( VOID  )
VOID KiIpiInterrupt ( VOID  )
VOID KiMcheckAbort ( VOID  )
VOID KiNmiInterrupt ( VOID  )
VOID KiNpxNotAvailableFault ( VOID  )
VOID KiNpxSegmentOverrunAbort ( VOID  )
VOID KiOverflowTrap ( VOID  )
VOID KiPageFault ( VOID  )
VOID KiRaiseAssertion ( VOID  )
FORCEINLINE VOID KiRundownThread ( IN PKTHREAD  Thread)

Definition at line 230 of file ke.h.

Referenced by KeTerminateThread().

231 {
232 #ifndef CONFIG_SMP
233  DbgPrint("KiRundownThread is unimplemented\n");
234 #else
235  /* Nothing to do */
236 #endif
237 }
#define DbgPrint
Definition: loader.c:25
VOID KiSegmentNotPresentFault ( VOID  )
VOID FORCEINLINE KiSendEOI ( VOID  )

Definition at line 287 of file ke.h.

Referenced by KiDpcInterruptHandler().

288 {
289  /* Write 0 to the apic EOI register */
290  *((volatile ULONG*)APIC_EOI_REGISTER) = 0;
291 }
#define APIC_EOI_REGISTER
Definition: ke.h:83
unsigned int ULONG
Definition: retypes.h:1
VOID KiSetProcessorType ( VOID  )

Definition at line 55 of file cpu.c.

56 {
57  CPU_INFO CpuInfo;
58  ULONG Stepping, Type;
59 
60  /* Do CPUID 1 now */
61  KiCpuId(&CpuInfo, 1);
62 
63  /*
64  * Get the Stepping and Type. The stepping contains both the
65  * Model and the Step, while the Type contains the returned Type.
66  * We ignore the family.
67  *
68  * For the stepping, we convert this: zzzzzzxy into this: x0y
69  */
70  Stepping = CpuInfo.Eax & 0xF0;
71  Stepping <<= 4;
72  Stepping += (CpuInfo.Eax & 0xFF);
73  Stepping &= 0xF0F;
74  Type = CpuInfo.Eax & 0xF00;
75  Type >>= 8;
76 
77  /* Save them in the PRCB */
78  KeGetCurrentPrcb()->CpuID = TRUE;
79  KeGetCurrentPrcb()->CpuType = (UCHAR)Type;
80  KeGetCurrentPrcb()->CpuStep = (USHORT)Stepping;
81 }
#define TRUE
Definition: types.h:120
Type
Definition: Type.h:6
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1054
ULONG Eax
Definition: ketypes.h:296
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
VOID KiStackFault ( VOID  )
VOID KiSwitchToBootStack ( IN ULONG_PTR  InitialStack)

Definition at line 796 of file ke.h.

Referenced by KiSystemStartup().

797 {
799 
800  /* We have to switch to a new stack before continuing kernel initialization */
801 #ifdef __GNUC__
802  __asm__
803  (
804  "movl %0, %%esp\n\t"
805  "subl %1, %%esp\n\t"
806  "pushl %2\n\t"
807  "jmp _KiSystemStartupBootStack@0"
808  :
809  : "c"(InitialStack),
811  "i"(CR0_EM | CR0_TS | CR0_MP),
813  : "%esp"
814  );
815 #elif defined(_MSC_VER)
816  __asm
817  {
818  mov esp, InitialStack
820  push (CR0_EM | CR0_TS | CR0_MP)
822  }
823 #else
824 #error Unknown Compiler
825 #endif
826 }
#define CR0_MP
Definition: asm.h:246
#define NPX_FRAME_LENGTH
Definition: asm.h:244
#define CR0_TS
Definition: asm.h:248
#define KTRAP_FRAME_LENGTH
Definition: asm.h:126
#define KTRAP_FRAME_ALIGN
Definition: asm.h:125
__asm__("\t.globl GetPhys\n""GetPhys:\t\n""mflr 0\n\t""stwu 0,-16(1)\n\t""mfmsr 5\n\t""andi. 6,5,0xffef\n\t""mtmsr 6\n\t""isync\n\t""sync\n\t""lwz 3,0(3)\n\t""mtmsr 5\n\t""isync\n\t""sync\n\t""lwz 0,0(1)\n\t""addi 1,1,16\n\t""mtlr 0\n\t""blr")
VOID NTAPI INIT_FUNCTION KiSystemStartupBootStack(VOID)
Definition: krnlinit.c:57
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
static void push(stack_node_t *op)
Definition: rpn.c:87
#define CR0_EM
Definition: asm.h:247
jmp_buf jmp
Definition: mach.c:36
VOID KiXmmException ( VOID  )
VOID NtEarlyInitVdm ( VOID  )

Variable Documentation

ULONG KeI386CpuStep

Definition at line 29 of file cpu.c.

Referenced by KiInitializeKernel(), and KiInitializeKernelMachineDependent().

ULONG KeI386CpuType

Definition at line 28 of file cpu.c.

Referenced by KiInitializeKernel(), and KiInitializeKernelMachineDependent().

ULONG KeI386XMMIPresent