19#ifndef _I386_KETYPES_H
20#define _I386_KETYPES_H
30#define KF_V86_VIS 0x00000001
31#define KF_RDTSC 0x00000002
32#define KF_CR4 0x00000004
33#define KF_CMOV 0x00000008
34#define KF_GLOBAL_PAGE 0x00000010
35#define KF_LARGE_PAGE 0x00000020
36#define KF_MTRR 0x00000040
37#define KF_CMPXCHG8B 0x00000080
38#define KF_MMX 0x00000100
39#define KF_WORKING_PTE 0x00000200
40#define KF_PAT 0x00000400
41#define KF_FXSR 0x00000800
42#define KF_FAST_SYSCALL 0x00001000
43#define KF_XMMI 0x00002000
44#define KF_3DNOW 0x00004000
45#define KF_AMDK6MTRR 0x00008000
46#define KF_XSAVEOPT 0x00008000
47#define KF_XMMI64 0x00010000
48#define KF_DTS 0x00020000
49#define KF_CLFLUSH 0x00040000
50#define KF_SSE3 0x00080000
51#define KF_AUTHENTICAMD 0x00100000
52#define KF_ACNT2 0x00200000
53#define KF_XSTATE 0x00400000
54#define KF_GENUINE_INTEL 0x00800000
55#define KF_SMEP 0x01000000
56#define KF_RDRAND 0x02000000
57#define KF_SLAT 0x04000000
58#define KF_08000000 0x08000000
59#define KF_NX_BIT 0x20000000
60#define KF_NX_DISABLED 0x40000000
61#define KF_NX_ENABLED 0x80000000
62#define KF_RDTSCP 0x0000000100000000ULL
63#define KF_CLFLUSHOPT 0x0000000200000000ULL
64#define KF_HDC 0x0000000400000000ULL
65#define KF_FPU_LEAKAGE 0x0000001000000000ULL
66#define KF_SSSE3 0x0000004000000000ULL
67#define KF_SSE4_1 0x0000008000000000ULL
68#define KF_SSE4_2 0x0000010000000000ULL
70#define KF_FPU_LEAKAGE_BIT 36
75#define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS))
76#define PCR ((KPCR *)K0IPCR)
77#if defined(CONFIG_SMP) || defined(NT_BUILD)
79#define KeGetPcr() ((KPCR *)__readfsdword(FIELD_OFFSET(KPCR, SelfPcr)))
103#define MACHINE_TYPE_ISA 0x0000
104#define MACHINE_TYPE_EISA 0x0001
105#define MACHINE_TYPE_MCA 0x0002
110#define I386_TASK_GATE 0x5
112#define I386_ACTIVE_TSS 0xB
113#define I386_CALL_GATE 0xC
114#define I386_INTERRUPT_GATE 0xE
115#define I386_TRAP_GATE 0xF
120#define RPL_MASK 0x0003
121#define MODE_MASK 0x0001
122#define KGDT_NULL 0x00
123#define KGDT_R0_CODE 0x08
124#define KGDT_R0_DATA 0x10
125#define KGDT_R3_CODE 0x18
126#define KGDT_R3_DATA 0x20
128#define KGDT_R0_PCR 0x30
129#define KGDT_R3_TEB 0x38
130#define KGDT_VDM_TILE 0x40
132#define KGDT_DF_TSS 0x50
133#define KGDT_NMI_TSS 0x58
138#define KGDT_NUMBER 10
151#define CR4_FXSR 0x200
152#define CR4_XMMEXCPT 0x400
157#define EFLAGS_CF 0x01L
158#define EFLAGS_ZF 0x40L
159#define EFLAGS_TF 0x100L
160#define EFLAGS_INTERRUPT_MASK 0x200L
161#define EFLAGS_DF 0x400L
162#define EFLAGS_IOPL 0x3000L
163#define EFLAGS_NESTED_TASK 0x4000L
164#define EFLAGS_RF 0x10000
165#define EFLAGS_V86_MASK 0x20000
166#define EFLAGS_ALIGN_CHECK 0x40000
167#define EFLAGS_VIF 0x80000
168#define EFLAGS_VIP 0x100000
169#define EFLAGS_ID 0x200000
170#define EFLAGS_USER_SANITIZE 0x3F4DD7
171#define EFLAG_SIGN 0x8000
172#define EFLAG_ZERO 0x4000
177#define FSW_INVALID_OPERATION 0x1
178#define FSW_DENORMAL 0x2
179#define FSW_ZERO_DIVIDE 0x4
180#define FSW_OVERFLOW 0x8
181#define FSW_UNDERFLOW 0x10
182#define FSW_PRECISION 0x20
183#define FSW_STACK_FAULT 0x40
188#define MSR_AMD_ACCESS 0x9C5A203A
189#define MSR_IA32_MISC_ENABLE 0x01A0
190#define MSR_EFER 0xC0000080
195#define MSR_NXE 0x0800
196#define XHF_NOEXECUTE 0x100000
197#define MSR_XD_ENABLE_MASK 0xFFFFFFFB
205#define IPI_PACKET_READY 8
206#define IPI_SYNCH_REQUEST 16
211#define PRCB_MINOR_VERSION 1
212#define PRCB_MAJOR_VERSION 1
213#define PRCB_BUILD_DEBUG 1
214#define PRCB_BUILD_UNIPROCESSOR 2
219#define INITIAL_STALL_COUNT 100
220#define MM_HAL_VA_START 0xFFC00000
221#define MM_HAL_VA_END 0xFFFFFFFF
222#define APIC_BASE 0xFFFE0000
228#define IOPM_SIZE 8192
229#define IOPM_FULL_SIZE 8196
230#define IO_ACCESS_MAP_NONE 0
231#define IOPM_DIRECTION_MAP_SIZE 32
232#define IOPM_OFFSET FIELD_OFFSET(KTSS, IoMaps[0].IoMap)
233#define KiComputeIopmOffset(MapNumber) \
234 (MapNumber == IO_ACCESS_MAP_NONE) ? \
235 (USHORT)(sizeof(KTSS)) : \
236 (USHORT)(FIELD_OFFSET(KTSS, IoMaps[MapNumber-1].IoMap))
245#define SIZE_OF_FX_REGISTERS 128
250#define KSEG0_BASE 0x80000000
256#define SYNCH_LEVEL DISPATCH_LEVEL
258#if (NTDDI_VERSION < NTDDI_WS03)
259#define SYNCH_LEVEL (IPI_LEVEL - 1)
261#define SYNCH_LEVEL (IPI_LEVEL - 2)
268#define DOUBLE_FAULT_STACK_SIZE 0x3000
273#define NUMBER_POOL_LOOKASIDE_LISTS 32
352#ifndef _LDT_ENTRY_DEFINED
353#define _LDT_ENTRY_DEFINED
453#ifndef NTOS_MODE_USER
560#if (NTDDI_VERSION >= NTDDI_LONGHORN)
578#if (NTDDI_VERSION >= NTDDI_WS03)
580#if (NTDDI_VERSION >= NTDDI_LONGHORN)
592#if (NTDDI_VERSION >= NTDDI_WS03)
594#if (NTDDI_VERSION >= NTDDI_LONGHORN)
600 ULONG ThreadStartCount[2];
608#if (NTDDI_VERSION < NTDDI_LONGHORN)
612#if (NTDDI_VERSION < NTDDI_LONGHORN)
615 ULONG KeFirstLevelTbFills;
616 ULONG KeFloatingEmulationCount;
618 ULONG KeSecondLevelTbFills;
627#if (NTDDI_VERSION >= NTDDI_LONGHORN)
659 ULONG SpareCounter1[8];
696#if (NTDDI_VERSION >= NTDDI_LONGHORN)
706#if (NTDDI_VERSION >= NTDDI_LONGHORN)
722#if (NTDDI_VERSION >= NTDDI_LONGHORN)
748#if (NTDDI_VERSION >= NTDDI_LONGHORN)
755 ULONG SpareFields0[1];
767#if (NTDDI_VERSION >= NTDDI_LONGHORN)
PPC_QUAL unsigned long __readfsdword(const unsigned long Offset)
struct _KSPECIAL_REGISTERS * PKSPECIAL_REGISTERS
struct _KIDT_ACCESS KIDT_ACCESS
struct _KTRAP_FRAME KTRAP_FRAME
struct _KDESCRIPTOR * PKDESCRIPTOR
struct _KPROCESSOR_STATE * PKPROCESSOR_STATE
KEXCEPTION_FRAME KCALLOUT_FRAME
struct _KEXCEPTION_FRAME * PKEXCEPTION_FRAME
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
struct _KiIoAccessMap KIIO_ACCESS_MAP
struct _KDESCRIPTOR KDESCRIPTOR
KEXCEPTION_FRAME * PKCALLOUT_FRAME
struct _KTRAP_FRAME * PKTRAP_FRAME
struct _KSPECIAL_REGISTERS KSPECIAL_REGISTERS
union _CPU_INFO * PCPU_INFO
struct _KIDT_ACCESS * PKIDT_ACCESS
struct _KPROCESSOR_STATE KPROCESSOR_STATE
struct _KGDTENTRY KGDTENTRY
struct _KIDTENTRY * PKIDTENTRY
UCHAR KIO_ACCESS_MAP[IOPM_SIZE]
#define NUMBER_POOL_LOOKASIDE_LISTS
struct _FX_SAVE_AREA * PFX_SAVE_AREA
struct _FXSAVE_FORMAT * PFXSAVE_FORMAT
enum _WOW64_SERVICE_TYPES * PWOW64_SERVICE_TYPES
struct _KIDTENTRY KIDTENTRY
enum _WOW64_SERVICE_TYPES WOW64_SERVICE_TYPES
enum _VDM_INDEX VDM_INDEX
struct _FXSAVE_FORMAT FXSAVE_FORMAT
struct _FX_SAVE_AREA FX_SAVE_AREA
struct _LDT_ENTRY * LPLDT_ENTRY
struct _FNSAVE_FORMAT * PFNSAVE_FORMAT
KIO_ACCESS_MAP * PKIO_ACCESS_MAP
struct _FNSAVE_FORMAT FNSAVE_FORMAT
#define IOPM_DIRECTION_MAP_SIZE
struct _KGDTENTRY * PKGDTENTRY
enum _VDM_INDEX * PVDM_INDEX
@ Service4ArgSpSpNSpNSpReloadState
@ Service4ArgSpNSpNSpNSpReloadState
@ ServiceCpupTdReadWriteFile
@ ServiceCpupTdWaitForMultipleObjects
@ Service3ArgSpNSpNSpReloadState
@ Service2ArgNSpNSpReloadState
@ Service4ArgNSpNSpNSpNSp
@ ServiceCpupTdQuerySystemTime
@ ServiceCpupTdGetCurrentProcessorNumber
@ ServiceCpupTdRemoveIoCompletion
@ ServiceCpupTdWaitForMultipleObjects32
@ ServiceCpupTdDeviceIoControlFile
#define SIZE_OF_FX_REGISTERS
struct _LDT_ENTRY * PLDT_ENTRY
union _FX_SAVE_AREA::@2463 U
struct _KGDTENTRY::@2456::@2457 Bytes
struct _KGDTENTRY::@2456::@2458 Bits
union _KGDTENTRY::@2456 HighWord
ULONG SecondLevelCacheSize
UCHAR SecondLevelCacheAssociativity
PVOID PerfGlobalGroupMask
ULONG KernelReserved2[17]
struct _EXCEPTION_REGISTRATION_RECORD * Used_ExceptionList
volatile ULONG IoWriteOperationCount
ULONG CcCopyReadNoWaitMiss
ULONG CcLostDelayedWrites
volatile BOOLEAN QuantumEnd
KSPIN_LOCK_QUEUE LockQueue[LockQueueMaximumLock]
PROCESSOR_POWER_STATE PowerState
struct _KTHREAD * IdleThread
volatile UCHAR DpcThreadActive
volatile UCHAR DpcInterruptRequested
GENERAL_LOOKASIDE_POOL PPPagedLookasideList[NUMBER_POOL_LOOKASIDE_LISTS]
struct _KPRCB * MultiThreadSetMaster
volatile LARGE_INTEGER IsrTime
volatile ULONG IoReadOperationCount
volatile LONG MmDemandZeroCount
volatile LONG MmPageReadIoCount
volatile UCHAR DpcRoutineActive
volatile PKIPI_WORKER WorkerRoutine
LONG ThreadWatchdogPeriod
volatile UCHAR IdleSchedule
volatile ULONG ReverseStall
PVOID ChainedInterruptList
ULONG CcPinReadNoWaitMiss
volatile ULONG IoOtherOperationCount
volatile LONG MmMappedWriteIoCount
volatile LONG MmCacheIoCount
ULONG CachedResidentAvailable
volatile LONG MmTransitionCount
ULONG CcPinMappedDataCount
ULONG CcMdlReadNoWaitMiss
volatile LONG MmCopyOnWriteCount
volatile ULONG PacketBarrier
ULONG MaximumDpcQueueDepth
volatile PVOID CurrentPacket[3]
volatile LONG MmCacheReadCount
UCHAR LogicalProcessorsPerPhysicalProcessor
LARGE_INTEGER HyperCallPagePhysical
GENERAL_LOOKASIDE_POOL PPNPagedLookasideList[NUMBER_POOL_LOOKASIDE_LISTS]
PP_LOOKASIDE_LIST PPLookasideList[16]
ULONG CcMapDataNoWaitMiss
ULONG KeExceptionDispatchCount
ULONG CcFastMdlReadNoWait
volatile LONG MmDirtyPagesWriteCount
struct _KTHREAD * CurrentThread
LARGE_INTEGER IoReadTransferCount
struct _KTHREAD * NextThread
volatile UCHAR DpcThreadRequested
struct _KTHREAD * NpxThread
ULONG CcFastReadResourceMiss
LARGE_INTEGER IoOtherTransferCount
volatile LONG MmMappedPagesWriteCount
ULONG MultiThreadProcessorSet
volatile LONG MmPageFaultCount
volatile LONG MmDirtyWriteIoCount
UINT64 CacheProcessorMask[5]
struct _KNODE * ParentNode
volatile LONG MmPageReadCount
volatile ULONG TimerRequest
UCHAR LogicalProcessorsPerCore
LARGE_INTEGER UpdateSignature
KPROCESSOR_STATE ProcessorState
volatile LONG MmCacheTransitionCount
LIST_ENTRY DispatcherReadyListHead[32]
ULONG CcFastMdlReadNotPossible
volatile struct _KPRCB * SignalDone
LARGE_INTEGER SpareField1
LARGE_INTEGER HyperCallPageVirtual
LARGE_INTEGER IoWriteTransferCount
volatile ULONG RequestSummary
ULONG CcLazyWriteHotSpots
ULONG KeAlignmentFixupCount
ULONG CcFastReadNotPossible
SINGLE_LIST_ENTRY DeferredReadyListHead
ULONG CcFastMdlReadResourceMiss
ULONG PackageProcessorSet
SLIST_HEADER InterruptObjectPool
KSPECIAL_REGISTERS SpecialRegisters
ULONG PreviousPreviousMode
struct _EXCEPTION_REGISTRATION_RECORD FAR * ExceptionList
UCHAR IntDirectionMap[IOPM_DIRECTION_MAP_SIZE]
KIIO_ACCESS_MAP IoMaps[IOPM_COUNT]
struct _LDT_ENTRY::@357::@359 Bits
struct _LDT_ENTRY::@357::@358 Bytes
union _LDT_ENTRY::@357 HighWord
#define FIELD_OFFSET(t, f)
_Reserved_ PVOID Reserved
VOID(NTAPI * PKIPI_WORKER)(IN OUT PKIPI_CONTEXT PacketContext, IN PVOID Parameter1 OPTIONAL, IN PVOID Parameter2 OPTIONAL, IN PVOID Parameter3 OPTIONAL)