20#ifndef _AMD64_KETYPES_H
21#define _AMD64_KETYPES_H
31#define KF_SMEP 0x00000001
32#define KF_RDTSC 0x00000002
33#define KF_CR4 0x00000004
34#define KF_CMOV 0x00000008
35#define KF_GLOBAL_PAGE 0x00000010
36#define KF_LARGE_PAGE 0x00000020
37#define KF_MTRR 0x00000040
38#define KF_CMPXCHG8B 0x00000080
39#define KF_MMX 0x00000100
40#define KF_DTS 0x00000200
41#define KF_PAT 0x00000400
42#define KF_FXSR 0x00000800
43#define KF_FAST_SYSCALL 0x00001000
44#define KF_XMMI 0x00002000
45#define KF_3DNOW 0x00004000
46#define KF_AMDK6MTRR 0x00008000
47#define KF_XSAVEOPT 0x00008000
48#define KF_XMMI64 0x00010000
49#define KF_BRANCH 0x00020000
50#define KF_00040000 0x00040000
51#define KF_SSE3 0x00080000
52#define KF_CMPXCHG16B 0x00100000
53#define KF_AUTHENTICAMD 0x00200000
54#define KF_ACNT2 0x00400000
55#define KF_XSTATE 0x00800000
56#define KF_GENUINE_INTEL 0x01000000
57#define KF_02000000 0x02000000
58#define KF_SLAT 0x04000000
59#define KF_VIRT_FIRMWARE_ENABLED 0x08000000
60#define KF_RDWRFSGSBASE 0x10000000
61#define KF_NX_BIT 0x20000000
62#define KF_NX_DISABLED 0x40000000
63#define KF_NX_ENABLED 0x80000000
64#define KF_RDRAND 0x0000000100000000ULL
65#define KF_SMAP 0x0000000200000000ULL
66#define KF_RDTSCP 0x0000000400000000ULL
67#define KF_HUGEPAGE 0x0000002000000000ULL
68#define KF_XSAVES 0x0000004000000000ULL
69#define KF_FPU_LEAKAGE 0x0000020000000000ULL
70#define KF_CAT 0x0000100000000000ULL
71#define KF_CET_SS 0x0000400000000000ULL
72#define KF_SSSE3 0x0000800000000000ULL
73#define KF_SSE4_1 0x0001000000000000ULL
74#define KF_SSE4_2 0x0002000000000000ULL
76#define KF_XSAVEOPT_BIT 15
77#define KF_XSTATE_BIT 23
78#define KF_RDWRFSGSBASE_BIT 28
79#define KF_XSAVES_BIT 38
80#define KF_FPU_LEAKAGE_BIT 41
86#define DOUBLE_FAULT_STACK_SIZE 0x2000
102#define MACHINE_TYPE_ISA 0x0000
103#define MACHINE_TYPE_EISA 0x0001
104#define MACHINE_TYPE_MCA 0x0002
109#define I386_TASK_GATE 0x5
111#define I386_ACTIVE_TSS 0xB
112#define I386_CALL_GATE 0xC
113#define I386_INTERRUPT_GATE 0xE
114#define I386_TRAP_GATE 0xF
119#define RPL_MASK 0x0003
120#define MODE_MASK 0x0001
121#define KGDT64_NULL 0x0000
122#define KGDT64_R0_CODE 0x0010
123#define KGDT64_R0_DATA 0x0018
124#define KGDT64_R3_CMCODE 0x0020
125#define KGDT64_R3_DATA 0x0028
126#define KGDT64_R3_CODE 0x0030
127#define KGDT64_SYS_TSS 0x0040
128#define KGDT64_R3_CMTEB 0x0050
129#define KGDT64_R0_LDT 0x0060
134#define CR0_PE 0x00000001
135#define CR0_MP 0x00000002
136#define CR0_EM 0x00000004
137#define CR0_TS 0x00000008
138#define CR0_ET 0x00000010
139#define CR0_NE 0x00000020
140#define CR0_WP 0x00010000
141#define CR0_AM 0x00040000
142#define CR0_NW 0x20000000
143#define CR0_CD 0x40000000
144#define CR0_PG 0x80000000
157#define CR4_FXSR 0x200
158#define CR4_XMMEXCPT 0x400
159#define CR4_CHANNELS 0x800
160#define CR4_XSAVE 0x40000
165#define DR7_LEGAL 0xFFFF0355
166#define DR7_ACTIVE 0x00000355
167#define DR7_TRACE_BRANCH 0x00000200
168#define DR7_LAST_BRANCH 0x00000100
173#define DEBUG_ACTIVE_DR7 0x0001
174#define DEBUG_ACTIVE_INSTRUMENTED 0x0002
175#define DEBUG_ACTIVE_DBG_INSTRUMENTED 0x0003
176#define DEBUG_ACTIVE_MINIMAL_THREAD 0x0004
177#define DEBUG_ACTIVE_PRIMARY_THREAD 0x0080
178#define DEBUG_ACTIVE_PRIMARY_THREAD_BIT 0x0007
179#define DEBUG_ACTIVE_PRIMARY_THREAD_LOCK_BIT 0x001F
180#define DEBUG_ACTIVE_SCHEDULED_THREAD 0x0040
181#define DEBUG_ACTIVE_SCHEDULED_THREAD_BIT 0x0006
182#define DEBUG_ACTIVE_SCHEDULED_THREAD_LOCK_BIT 0x001E
183#define DEBUG_ACTIVE_SCHEDULED_THREAD_LOCK 0x40000000
188#define EFLAGS_CF 0x01L
189#define EFLAGS_ZF 0x40L
190#define EFLAGS_TF 0x100L
191#define EFLAGS_INTERRUPT_MASK 0x200L
192#define EFLAGS_DF 0x400L
193#define EFLAGS_IOPL 0x3000L
194#define EFLAGS_NESTED_TASK 0x4000L
196#define EFLAGS_RF 0x10000
197#define EFLAGS_V86_MASK 0x20000
198#define EFLAGS_ALIGN_CHECK 0x40000
199#define EFLAGS_VIF 0x80000
200#define EFLAGS_VIP 0x100000
201#define EFLAGS_ID 0x200000
202#define EFLAGS_USER_SANITIZE 0x3F4DD7
203#define EFLAG_SIGN 0x8000
204#define EFLAG_ZERO 0x4000
205#define EFLAGS_TF_MASK 0x0100
206#define EFLAGS_TF_SHIFT 0x0008
207#define EFLAGS_ID_MASK 0x200000
208#define EFLAGS_IF_MASK 0x0200
209#define EFLAGS_IF_SHIFT 0x0009
214#define XSW_INVALID_OPERATION 0x0001
215#define XSW_DENORMAL 0x0002
216#define XSW_ZERO_DIVIDE 0x0004
217#define XSW_OVERFLOW 0x0008
218#define XSW_UNDERFLOW 0x0010
219#define XSW_PRECISION 0x0020
220#define XCW_INVALID_OPERATION 0x0080
221#define XCW_DENORMAL 0x0100
222#define XCW_ZERO_DIVIDE 0x0200
223#define XCW_OVERFLOW 0x0400
224#define XCW_UNDERFLOW 0x0800
225#define XCW_PRECISION 0x1000
226#define XCW_ROUND_CONTROL 0x6000
227#define XCW_FLUSH_ZERO 0x8000
228#define XSW_ERROR_MASK 0x003F
229#define XSW_ERROR_SHIFT 7
234#define FSW_INVALID_OPERATION 0x0001
235#define FSW_DENORMAL 0x0002
236#define FSW_ZERO_DIVIDE 0x0004
237#define FSW_OVERFLOW 0x0008
238#define FSW_UNDERFLOW 0x0010
239#define FSW_PRECISION 0x0020
240#define FSW_STACK_FAULT 0x0040
241#define FSW_ERROR_SUMMARY 0x0080
242#define FSW_CONDITION_CODE_0 0x0100
243#define FSW_CONDITION_CODE_1 0x0200
244#define FSW_CONDITION_CODE_2 0x0400
245#define FSW_CONDITION_CODE_3 0x4000
246#define FSW_ERROR_MASK 0x003F
251#define MSR_EFER 0xC0000080
252#define MSR_STAR 0xC0000081
253#define MSR_LSTAR 0xC0000082
254#define MSR_CSTAR 0xC0000083
255#define MSR_SYSCALL_MASK 0xC0000084
256#define MSR_FS_BASE 0xC0000100
257#define MSR_GS_BASE 0xC0000101
258#define MSR_GS_SWAP 0xC0000102
259#define MSR_MCG_STATUS 0x017A
260#define MSR_AMD_ACCESS 0x9C5A203A
261#define MSR_IA32_MISC_ENABLE 0x000001A0
262#define MSR_LAST_BRANCH_FROM 0x01DB
263#define MSR_LAST_BRANCH_TO 0x01DC
264#define MSR_LAST_EXCEPTION_FROM 0x01DD
265#define MSR_LAST_EXCEPTION_TO 0x01DE
280#define MSR_SCE 0x0001
281#define MSR_LME 0x0100
282#define MSR_LMA 0x0400
283#define MSR_NXE 0x0800
284#define MSR_PAT 0x0277
285#define MSR_DEBUG_CTL 0x01D9
290#define MSR_XD_ENABLE_MASK 0xFFFFFFFB
295#define MSR_DEBUG_CTL_LBR 0x0001
296#define MSR_DEBUG_CTL_BTF 0x0002
304#define IPI_PACKET_READY 8
305#define IPI_SYNCH_REQUEST 16
315#define IPI_FROZEN_STATE_RUNNING 0
316#define IPI_FROZEN_STATE_FROZEN 2
317#define IPI_FROZEN_STATE_THAW 3
318#define IPI_FROZEN_STATE_OWNER 4
319#define IPI_FROZEN_STATE_TARGET_FREEZE 5
320#define IPI_FROZEN_FLAG_ACTIVE 0x20
325#define PRCB_MINOR_VERSION 1
326#define PRCB_MAJOR_VERSION 1
327#define PRCB_BUILD_DEBUG 1
328#define PRCB_BUILD_UNIPROCESSOR 2
333#define KEXCEPTION_ACTIVE_INTERRUPT_FRAME 0x0000
334#define KEXCEPTION_ACTIVE_EXCEPTION_FRAME 0x0001
335#define KEXCEPTION_ACTIVE_SERVICE_FRAME 0x0002
340#define PRIMARY_VECTOR_BASE 0x30
341#define MAXIMUM_IDTVECTOR 0xFF
342#define INITIAL_STALL_COUNT 100
343#define MM_HAL_VA_START 0xFFFFFFFFFFC00000ULL
344#define MM_HAL_VA_END 0xFFFFFFFFFFFFFFFFULL
345#define APIC_BASE 0xFFFFFFFFFFFE0000ULL
350#define IO_ACCESS_MAP_NONE 0
351#define IOPM_OFFSET FIELD_OFFSET(KTSS, IoMaps[0].IoMap)
352#define KiComputeIopmOffset(MapNumber) \
353 (MapNumber == IO_ACCESS_MAP_NONE) ? \
354 (USHORT)(sizeof(KTSS)) : \
355 (USHORT)(FIELD_OFFSET(KTSS, IoMaps[MapNumber-1].IoMap))
360#define KSEG0_BASE 0xfffff80000000000ULL
362#define NMI_STACK_SIZE 0x2000
363#define ISR_STACK_SIZE 0x6000
366#define MAX_SYSCALL_PARAM_SIZE (16 * 8)
372#define SYNCH_LEVEL DISPATCH_LEVEL
374#define SYNCH_LEVEL (IPI_LEVEL - 2)
380#define NUMBER_POOL_LOOKASIDE_LISTS 32
489#ifndef _LDT_ENTRY_DEFINED
490#define _LDT_ENTRY_DEFINED
531#define KGDTENTRY KGDTENTRY64
532#define PKGDTENTRY PKGDTENTRY64
573#define KIDTENTRY KIDTENTRY64
574#define PKIDTENTRY PKIDTENTRY64
583#ifndef NTOS_MODE_USER
628#if (NTDDI_VERSION < NTDDI_LONGHORN)
629#define GENERAL_LOOKASIDE_POOL PP_LOOKASIDE_LIST
651#if (NTDDI_VERSION >= NTDDI_LONGHORN)
662#if (NTDDI_VERSION >= NTDDI_LONGHORN)
675#if (NTDDI_VERSION >= NTDDI_LONGHORN)
694#if (NTDDI_VERSION >= NTDDI_LONGHORN)
702#if (NTDDI_VERSION >= NTDDI_LONGHORN)
709#if (NTDDI_VERSION >= NTDDI_LONGHORN)
725#if (NTDDI_VERSION < NTDDI_LONGHORN)
731#if (NTDDI_VERSION < NTDDI_LONGHORN)
739#if (NTDDI_VERSION >= NTDDI_LONGHORN)
759#if (NTDDI_VERSION < NTDDI_LONGHORN)
771#if (NTDDI_VERSION >= NTDDI_LONGHORN)
793#if (NTDDI_VERSION >= NTDDI_LONGHORN)
800#if (NTDDI_VERSION >= NTDDI_LONGHORN)
804#if (NTDDI_VERSION >= NTDDI_LONGHORN)
816#if (NTDDI_VERSION >= NTDDI_LONGHORN)
821#if (NTDDI_VERSION >= NTDDI_LONGHORN)
834#if (NTDDI_VERSION >= NTDDI_LONGHORN)
847#if (NTDDI_VERSION >= NTDDI_LONGHORN)
856#if (NTDDI_VERSION >= NTDDI_LONGHORN)
929 ULONG KeFirstLevelTbFills;
930 ULONG KeFloatingEmulationCount;
932 ULONG KeSecondLevelTbFills;
942 ULONG FeatureBitsHigh;
1016#define PKTSS PKTSS64
1028#if (NTDDI_VERSION >= NTDDI_WIN8)
1044#if (NTDDI_VERSION < NTDDI_WIN8)
1049#if (NTDDI_VERSION >= NTDDI_WIN8)
1155#define PROCESSOR_START_FLAG_FORCE_ENABLE_NX 0x0001
unsigned long long UINT64
EXCEPTION_ROUTINE * PEXCEPTION_ROUTINE
struct _KSPECIAL_REGISTERS * PKSPECIAL_REGISTERS
struct _KIDT_ACCESS KIDT_ACCESS
struct _KTRAP_FRAME KTRAP_FRAME
struct _KREQUEST_PACKET * PKREQUEST_PACKET
struct _KDESCRIPTOR * PKDESCRIPTOR
struct _KPROCESSOR_STATE * PKPROCESSOR_STATE
union _KGDTENTRY64 * PKGDTENTRY64
struct _KREQUEST_PACKET KREQUEST_PACKET
struct _KUSER_EXCEPTION_STACK * PKUSER_EXCEPTION_STACK
struct _KSTART_FRAME KSTART_FRAME
struct _REQUEST_MAILBOX * PREQUEST_MAILBOX
struct _KPROCESSOR_START_BLOCK * PKPROCESSOR_START_BLOCK
struct _KSWITCH_FRAME KSWITCH_FRAME
struct _DISPATCHER_CONTEXT * PDISPATCHER_CONTEXT
struct _REQUEST_MAILBOX REQUEST_MAILBOX
KEXCEPTION_FRAME KCALLOUT_FRAME
struct _KUSER_EXCEPTION_STACK KUSER_EXCEPTION_STACK
struct _KEXCEPTION_FRAME * PKEXCEPTION_FRAME
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
struct _UAPC_FRAME UAPC_FRAME
struct _DISPATCHER_CONTEXT DISPATCHER_CONTEXT
struct _KiIoAccessMap KIIO_ACCESS_MAP
struct _KDESCRIPTOR KDESCRIPTOR
struct _MACHINE_FRAME MACHINE_FRAME
struct _KSWITCH_FRAME * PKSWITCH_FRAME
struct _UCALLOUT_FRAME * PUCALLOUT_FRAME
KEXCEPTION_FRAME * PKCALLOUT_FRAME
union _KIDTENTRY64 * PKIDTENTRY64
union _KGDTENTRY64 KGDTENTRY64
union _KIDTENTRY64 KIDTENTRY64
struct _UAPC_FRAME * PUAPC_FRAME
struct _MACHINE_FRAME * PMACHINE_FRAME
struct _KSTART_FRAME * PKSTART_FRAME
struct _KEXCEPTION_FRAME KEXCEPTION_FRAME
struct _KTRAP_FRAME * PKTRAP_FRAME
struct _KPROCESSOR_START_BLOCK KPROCESSOR_START_BLOCK
struct _KSPECIAL_REGISTERS KSPECIAL_REGISTERS
union _CPU_INFO * PCPU_INFO
struct _KIDT_ACCESS * PKIDT_ACCESS
struct _KPROCESSOR_STATE KPROCESSOR_STATE
struct _UCALLOUT_FRAME UCALLOUT_FRAME
#define NUMBER_POOL_LOOKASIDE_LISTS
struct _RUNTIME_FUNCTION * FunctionEntry
struct _UNWIND_HISTORY_TABLE * HistoryTable
PEXCEPTION_ROUTINE LanguageHandler
ULONG SecondLevelCacheSize
UCHAR SecondLevelCacheAssociativity
struct _KPRCB * CurrentPrcb
union _KGDTENTRY64 * GdtBase
PKSPIN_LOCK_QUEUE LockArray
union _KIDTENTRY64 * IdtBase
UCHAR CoresPerPhysicalProcessor
ULONG CcCopyReadNoWaitMiss
ULONG CcLostDelayedWrites
KSPIN_LOCK_QUEUE LockQueue[LockQueueMaximumLock]
PROCESSOR_POWER_STATE PowerState
struct _KTHREAD * IdleThread
GENERAL_LOOKASIDE_POOL PPPagedLookasideList[NUMBER_POOL_LOOKASIDE_LISTS]
struct _KPRCB * MultiThreadSetMaster
LONG MaximumDpcQueueDepth
ULONG CcPinReadNoWaitMiss
ULONG CachedResidentAvailable
ULONG CcPinMappedDataCount
ULONG CcMdlReadNoWaitMiss
UCHAR LogicalProcessorsPerPhysicalProcessor
GENERAL_LOOKASIDE_POOL PPNPagedLookasideList[NUMBER_POOL_LOOKASIDE_LISTS]
PP_LOOKASIDE_LIST PPLookasideList[16]
ULONG CcMapDataNoWaitMiss
LONG MmMappedWriteIoCount
ULONG KeExceptionDispatchCount
ULONG CcFastMdlReadNoWait
struct _KTHREAD * CurrentThread
LARGE_INTEGER IoReadTransferCount
struct _KTHREAD * NextThread
REQUEST_MAILBOX RequestMailbox[64]
LONG MmMappedPagesWriteCount
LONG MmCacheTransitionCount
ULONG CcFastReadResourceMiss
LARGE_INTEGER IoOtherTransferCount
LONG IoReadOperationCount
SLIST_HEADER HypercallPageList
UINT64 PackageProcessorSet
UINT64 CacheProcessorMask[5]
LONG IoWriteOperationCount
LONG IoOtherOperationCount
PVOID HypercallPageVirtual
struct _KNODE * ParentNode
UCHAR DpcInterruptRequested
UCHAR LogicalProcessorsPerCore
LARGE_INTEGER UpdateSignature
UINT64 MultiThreadProcessorSet
KPROCESSOR_STATE ProcessorState
LONG MmDirtyPagesWriteCount
LIST_ENTRY DispatcherReadyListHead[32]
ULONG CcFastMdlReadNotPossible
LARGE_INTEGER IoWriteTransferCount
ULONG CcLazyWriteHotSpots
ULONG KeAlignmentFixupCount
ULONG CcFastReadNotPossible
SINGLE_LIST_ENTRY DeferredReadyListHead
ULONG CcFastMdlReadResourceMiss
SLIST_HEADER InterruptObjectPool
KPROCESSOR_STATE ProcessorState
UCHAR LmIdentityTarget[6]
struct _KPROCESSOR_START_BLOCK * SelfMap
KSPECIAL_REGISTERS SpecialRegisters
ULONG64 LastExceptionToRip
ULONG64 LastBranchFromRip
ULONG64 LastExceptionFromRip
UINT64 LastExceptionFromRip
UINT64 LastExceptionToRip
MACHINE_FRAME MachineFrame
EXCEPTION_RECORD ExceptionRecord
KREQUEST_PACKET RequestPacket
MACHINE_FRAME MachineFrame
MACHINE_FRAME MachineFrame
#define FIELD_OFFSET(t, f)
struct _KGDTENTRY64::@2322::@2324::@2327 Bits
struct _KGDTENTRY64::@2322::@2324::@2326 Bytes