1#ifndef __NTOSKRNL_INCLUDE_INTERNAL_AMD64_KE_H
2#define __NTOSKRNL_INCLUDE_INTERNAL_AMD64_KE_H
8#define X86_EFLAGS_TF 0x00000100
9#define X86_EFLAGS_IF 0x00000200
10#define X86_EFLAGS_IOPL 0x00003000
11#define X86_EFLAGS_NT 0x00004000
12#define X86_EFLAGS_RF 0x00010000
13#define X86_EFLAGS_VM 0x00020000
14#define X86_EFLAGS_ID 0x00200000
16#define X86_CR0_PE 0x00000001
17#define X86_CR0_NE 0x00000020
18#define X86_CR0_TS 0x00000008
19#define X86_CR0_EM 0x00000004
20#define X86_CR0_MP 0x00000002
21#define X86_CR0_WP 0x00010000
22#define X86_CR0_PG 0x80000000
24#define X86_CR4_PAE 0x00000020
25#define X86_CR4_PGE 0x00000080
26#define X86_CR4_OSFXSR 0x00000200
27#define X86_CR4_OSXMMEXCPT 0x00000400
30#define X86_FEATURE_FPU 0x00000001
31#define X86_FEATURE_VME 0x00000002
32#define X86_FEATURE_DBG 0x00000004
33#define X86_FEATURE_PSE 0x00000008
34#define X86_FEATURE_TSC 0x00000010
35#define X86_FEATURE_PAE 0x00000040
36#define X86_FEATURE_CX8 0x00000100
37#define X86_FEATURE_SYSCALL 0x00000800
38#define X86_FEATURE_MTTR 0x00001000
39#define X86_FEATURE_PGE 0x00002000
40#define X86_FEATURE_CMOV 0x00008000
41#define X86_FEATURE_PAT 0x00010000
42#define X86_FEATURE_DS 0x00200000
43#define X86_FEATURE_MMX 0x00800000
44#define X86_FEATURE_FXSR 0x01000000
45#define X86_FEATURE_SSE 0x02000000
46#define X86_FEATURE_SSE2 0x04000000
47#define X86_FEATURE_HT 0x10000000
50#define X86_FEATURE_SSE3 0x00000001
51#define X86_FEATURE_MONITOR 0x00000008
52#define X86_FEATURE_VMX 0x00000020
53#define X86_FEATURE_SSSE3 0x00000200
54#define X86_FEATURE_FMA3 0x00001000
55#define X86_FEATURE_CX16 0x00002000
56#define X86_FEATURE_PCID 0x00020000
57#define X86_FEATURE_SSE41 0x00080000
58#define X86_FEATURE_SSE42 0x00100000
59#define X86_FEATURE_POPCNT 0x00800000
60#define X86_FEATURE_XSAVE 0x04000000
63#define X86_FEATURE_NX 0x00100000
65#define X86_EXT_FEATURE_SSE3 0x00000001
66#define X86_EXT_FEATURE_3DNOW 0x40000000
68#define FRAME_EDITED 0xFFF8
70#define X86_MSR_GSBASE 0xC0000101
71#define X86_MSR_KERNEL_GSBASE 0xC0000102
72#define X86_MSR_EFER 0xC0000080
73#define X86_MSR_STAR 0xC0000081
74#define X86_MSR_LSTAR 0xC0000082
75#define X86_MSR_CSTAR 0xC0000083
76#define X86_MSR_SFMASK 0xC0000084
78#define EFER_SCE 0x0001
79#define EFER_LME 0x0100
80#define EFER_LMA 0x0400
81#define EFER_NXE 0x0800
82#define EFER_SVME 0x1000
83#define EFER_FFXSR 0x4000
87#define APIC_EOI_REGISTER 0xFFFFFFFFFFFE00B0ULL
121#define KD_BREAKPOINT_TYPE UCHAR
122#define KD_BREAKPOINT_SIZE sizeof(UCHAR)
123#define KD_BREAKPOINT_VALUE 0xCC
181 return TrapFrame->
Rip;
195 return TrapFrame->
Rsp;
202 return TrapFrame->
Rbp;
208#define KeGetTrapFrame(Thread) \
209 ((PKTRAP_FRAME)((ULONG_PTR)((Thread)->InitialStack) - \
210 sizeof(KTRAP_FRAME)))
216#define KeGetContextSwitches(Prcb) \
217 (Prcb->KeContextSwitches)
223#define KiGetSecondLevelDCacheSize() ((PKIPCR)KeGetPcr())->SecondLevelCacheSize
225#define KeGetExceptionFrame(Thread) \
226 (PKEXCEPTION_FRAME)((ULONG_PTR)KeGetTrapFrame(Thread) - \
227 sizeof(KEXCEPTION_FRAME))
233#define KeGetTrapFrameInterruptState(TrapFrame) \
234 BooleanFlagOn((TrapFrame)->EFlags, EFLAGS_INTERRUPT_MASK)
358 ASSERT(TrapFrame->ErrorCode == 0xc10c4);
380 DbgPrint(
"Interrupts: %u System Calls: %u Context Switches: %u\n",
437#define KeArchInitThreadWithContext(Thread,SystemRoutine,StartRoutine,StartContext,Context) \
438 Ke386InitThreadWithContext(Thread,SystemRoutine,StartRoutine,StartContext,Context)
#define EFLAGS_INTERRUPT_MASK
UINT32 void void ** ReturnValue
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
#define PsGetCurrentThread()
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
void __cdecl _disable(void)
void __cdecl _enable(void)
PPC_QUAL void __wbinvd(void)
PPC_QUAL unsigned long long __rdtsc(void)
__INTRIN_INLINE unsigned long __readcr3(void)
__INTRIN_INLINE uintptr_t __readeflags(void)
__INTRIN_INLINE void __invlpg(void *Address)
__INTRIN_INLINE void __writecr3(unsigned int Data)
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
#define HalVectorToIDTEntry
VOID(NTAPI * PKSYSTEM_ROUTINE)(PKSTART_ROUTINE StartRoutine, PVOID StartContext)
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
#define DECLSPEC_NORETURN
#define UNREFERENCED_PARAMETER(P)
VOID KiSetTrapContext(_Out_ PKTRAP_FRAME TrapFrame, _In_ PCONTEXT Context, _In_ KPROCESSOR_MODE RequestorMode)
DECLSPEC_NORETURN VOID KiUserCallbackExit(_In_ PKTRAP_FRAME TrapFrame)
FORCEINLINE ULONG_PTR KeGetTrapFrameFrameRegister(PKTRAP_FRAME TrapFrame)
VOID KiInitializeCpuFeatures(VOID)
VOID KiDebugServiceTrap(VOID)
DECLSPEC_NORETURN VOID KiSwitchToBootStack(IN ULONG_PTR InitialStack)
#define KeGetContextSwitches(Prcb)
VOID KiOverflowTrap(VOID)
FORCEINLINE ULONG_PTR KeGetContextFrameRegister(PCONTEXT Context)
ULONG KeAllocateGdtSelector(ULONG Desc[2])
VOID KiGeneralProtectionFault(VOID)
VOID Ki386SetProcessorFeatures(VOID)
FORCEINLINE VOID KeInvalidateTlbEntry(IN PVOID Address)
FORCEINLINE VOID KeFlushProcessTb(VOID)
FORCEINLINE VOID KeSetContextFrameRegister(PCONTEXT Context, ULONG_PTR Frame)
DECLSPEC_NORETURN VOID KiExceptionExit(_In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame)
FORCEINLINE ULONG_PTR KeGetTrapFrameStackRegister(PKTRAP_FRAME TrapFrame)
VOID KiGetCacheInformation(VOID)
FORCEINLINE BOOLEAN KeDisableInterrupts(VOID)
VOID KiInvalidOpcodeFault(VOID)
struct _KIDT_INIT KIDT_INIT
struct _KI_INTERRUPT_DISPATCH_ENTRY * PKI_INTERRUPT_DISPATCH_ENTRY
ULONG64 KiGetFeatureBits(VOID)
Evaluates the KeFeatureFlag bits for the current CPU.
VOID KiXmmException(VOID)
VOID Ke386InitThreadWithContext(PKTHREAD Thread, PKSYSTEM_ROUTINE SystemRoutine, PKSTART_ROUTINE StartRoutine, PVOID StartContext, PCONTEXT Context)
#define APIC_EOI_REGISTER
struct _KIDT_INIT * PKIDT_INIT
VOID KiNpxSegmentOverrunAbort(VOID)
FORCEINLINE VOID KiSendEOI(VOID)
VOID KiInvalidTssFault(VOID)
NTHALAPI NTSTATUS NTAPI HalAllocateAdapterChannel(IN PADAPTER_OBJECT AdapterObject, IN PWAIT_CONTEXT_BLOCK Wcb, IN ULONG NumberOfMapRegisters, IN PDRIVER_CONTROL ExecutionRoutine)
VOID KiDebugTrapOrFault(VOID)
struct _KI_INTERRUPT_DISPATCH_ENTRY KI_INTERRUPT_DISPATCH_ENTRY
VOID KiDivideErrorFault(VOID)
VOID KiAlignmentFault(VOID)
VOID KiApcInterrupt(VOID)
VOID KiGdtPrepareForApplicationProcessorInit(ULONG Id)
VOID KeApplicationProcessorInitDispatcher(VOID)
VOID KiSegmentNotPresentFault(VOID)
VOID KiIpiInterrupt(VOID)
BOOLEAN KiProcessorFreezeHandler(_In_ PKTRAP_FRAME TrapFrame, _In_ PKEXCEPTION_FRAME ExceptionFrame)
FORCEINLINE PVOID KeQueryInterruptHandler(IN ULONG Vector)
VOID KiBreakpointTrap(VOID)
VOID KeFreeGdtSelector(ULONG Entry)
FORCEINLINE VOID KeRestoreInterrupts(BOOLEAN WereEnabled)
VOID NtEarlyInitVdm(VOID)
VOID KiSetProcessorType(VOID)
VOID KiDoubleFaultAbort(VOID)
VOID KiNpxNotAvailableFault(VOID)
FORCEINLINE VOID KiRundownThread(IN PKTHREAD Thread)
NTKERNELAPI volatile KSYSTEM_TIME KeTickCount
VOID KiRaiseAssertion(VOID)
FORCEINLINE BOOLEAN KiUserTrap(IN PKTRAP_FRAME TrapFrame)
VOID KiDpcInterrupt(VOID)
VOID KeCreateApplicationProcessorIdleThread(ULONG Id)
VOID KiFloatingErrorFault(VOID)
FORCEINLINE VOID KeSweepICache(IN PVOID BaseAddress, IN SIZE_T FlushSize)
VOID Ki386InitializeLdt(VOID)
FORCEINLINE VOID KeRegisterInterruptHandler(IN ULONG Vector, IN PVOID Handler)
FORCEINLINE PULONG_PTR KiGetUserModeStackAddress(void)
VOID KiNmiInterrupt(VOID)
FORCEINLINE ULONG_PTR KeGetContextStackRegister(PCONTEXT Context)
#define KeSetContextReturnRegister(Context, ReturnValue)
#define KiGetLinkedTrapFrame(x)
#define KeSetContextPc(Context, ProgramCounter)
#define KeGetContextPc(Context)
#define KeGetContextReturnRegister(Context)
#define KeGetTrapFramePc(TrapFrame)
#define KiEndInterrupt(x, y)
VOID NTAPI KiThreadStartup(VOID)
base of all file and directory entries
_Must_inspect_result_ _In_ ULONG Flags
_Out_ PULONG NumberOfMapRegisters
_In_ PDEVICE_OBJECT _In_ ULONG _In_ PDRIVER_CONTROL ExecutionRoutine
DRIVER_CONTROL * PDRIVER_CONTROL
KSTART_ROUTINE * PKSTART_ROUTINE
_In_ ULONG _In_opt_ POBJECT_ATTRIBUTES _In_opt_ HANDLE _Out_opt_ PCLIENT_ID _In_ PKSTART_ROUTINE StartRoutine