[SDK][NDK] Add two missing documented GDT selector names.
[reactos.git] / sdk / include / ndk / i386 / ketypes.h
1 /*++ NDK Version: 0098
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 ketypes.h (X86)
8
9 Abstract:
10
11 i386 Type definitions for the Kernel services.
12
13 Author:
14
15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16
17 --*/
18
19 #ifndef _I386_KETYPES_H
20 #define _I386_KETYPES_H
21
22 //
23 // Dependencies
24 //
25
26 //
27 // KPCR Access for non-IA64 builds
28 //
29 #define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS))
30 #define PCR ((KPCR *)K0IPCR)
31 #if defined(CONFIG_SMP) || defined(NT_BUILD)
32 #undef KeGetPcr
33 #define KeGetPcr() ((KPCR *)__readfsdword(FIELD_OFFSET(KPCR, SelfPcr)))
34 #endif
35
36 //
37 // CPU Vendors
38 //
39 typedef enum
40 {
41 CPU_NONE = 0,
42 CPU_INTEL = 1,
43 CPU_AMD = 2,
44 CPU_CYRIX = 3,
45 CPU_TRANSMETA = 4,
46 CPU_VIA = 5,
47 CPU_CENTAUR = CPU_VIA,
48 CPU_RISE = 6,
49 CPU_UNKNOWN = 7
50 } CPU_VENDORS;
51
52 //
53 // Machine Types
54 //
55 #define MACHINE_TYPE_ISA 0x0000
56 #define MACHINE_TYPE_EISA 0x0001
57 #define MACHINE_TYPE_MCA 0x0002
58
59 //
60 // X86 80386 Segment Types
61 //
62 #define I386_TASK_GATE 0x5
63 #define I386_TSS 0x9
64 #define I386_ACTIVE_TSS 0xB
65 #define I386_CALL_GATE 0xC
66 #define I386_INTERRUPT_GATE 0xE
67 #define I386_TRAP_GATE 0xF
68
69 //
70 // Selector Names
71 //
72 #define RPL_MASK 0x0003
73 #define MODE_MASK 0x0001
74 #define KGDT_NULL 0x00
75 #define KGDT_R0_CODE 0x08
76 #define KGDT_R0_DATA 0x10
77 #define KGDT_R3_CODE 0x18
78 #define KGDT_R3_DATA 0x20
79 #define KGDT_TSS 0x28
80 #define KGDT_R0_PCR 0x30
81 #define KGDT_R3_TEB 0x38
82 #define KGDT_VDM_TILE 0x40
83 #define KGDT_LDT 0x48
84 #define KGDT_DF_TSS 0x50
85 #define KGDT_NMI_TSS 0x58
86
87 //
88 // Define the number of GDTs that can be queried by user mode
89 //
90 #define KGDT_NUMBER 10
91
92 //
93 // CR4
94 //
95 #define CR4_VME 0x1
96 #define CR4_PVI 0x2
97 #define CR4_TSD 0x4
98 #define CR4_DE 0x8
99 #define CR4_PSE 0x10
100 #define CR4_PAE 0x20
101 #define CR4_MCE 0x40
102 #define CR4_PGE 0x80
103 #define CR4_FXSR 0x200
104 #define CR4_XMMEXCPT 0x400
105
106 //
107 // EFlags
108 //
109 #define EFLAGS_CF 0x01L
110 #define EFLAGS_ZF 0x40L
111 #define EFLAGS_TF 0x100L
112 #define EFLAGS_INTERRUPT_MASK 0x200L
113 #define EFLAGS_DF 0x400L
114 #define EFLAGS_IOPL 0x3000L
115 #define EFLAGS_NESTED_TASK 0x4000L
116 #define EFLAGS_RF 0x10000
117 #define EFLAGS_V86_MASK 0x20000
118 #define EFLAGS_ALIGN_CHECK 0x40000
119 #define EFLAGS_VIF 0x80000
120 #define EFLAGS_VIP 0x100000
121 #define EFLAGS_ID 0x200000
122 #define EFLAGS_USER_SANITIZE 0x3F4DD7
123 #define EFLAG_SIGN 0x8000
124 #define EFLAG_ZERO 0x4000
125
126 //
127 // Legacy floating status word bit masks.
128 //
129 #define FSW_INVALID_OPERATION 0x1
130 #define FSW_DENORMAL 0x2
131 #define FSW_ZERO_DIVIDE 0x4
132 #define FSW_OVERFLOW 0x8
133 #define FSW_UNDERFLOW 0x10
134 #define FSW_PRECISION 0x20
135 #define FSW_STACK_FAULT 0x40
136
137 //
138 // Machine Specific Registers
139 //
140 #define MSR_AMD_ACCESS 0x9C5A203A
141 #define MSR_IA32_MISC_ENABLE 0x01A0
142 #define MSR_EFER 0xC0000080
143
144 //
145 // MSR internal Values
146 //
147 #define MSR_NXE 0x0800
148 #define XHF_NOEXECUTE 0x100000
149 #define MSR_XD_ENABLE_MASK 0xFFFFFFFB
150
151 //
152 // IPI Types
153 //
154 #define IPI_APC 1
155 #define IPI_DPC 2
156 #define IPI_FREEZE 4
157 #define IPI_PACKET_READY 8
158 #define IPI_SYNCH_REQUEST 16
159
160 //
161 // PRCB Flags
162 //
163 #define PRCB_MAJOR_VERSION 1
164 #define PRCB_BUILD_DEBUG 1
165 #define PRCB_BUILD_UNIPROCESSOR 2
166
167 //
168 // HAL Variables
169 //
170 #define INITIAL_STALL_COUNT 100
171 #define MM_HAL_VA_START 0xFFC00000
172 #define MM_HAL_VA_END 0xFFFFFFFF
173 #define APIC_BASE 0xFFFE0000
174
175 //
176 // IOPM Definitions
177 //
178 #define IOPM_COUNT 1
179 #define IOPM_SIZE 8192
180 #define IOPM_FULL_SIZE 8196
181 #define IO_ACCESS_MAP_NONE 0
182 #define IOPM_DIRECTION_MAP_SIZE 32
183 #define IOPM_OFFSET FIELD_OFFSET(KTSS, IoMaps[0].IoMap)
184 #define KiComputeIopmOffset(MapNumber) \
185 (MapNumber == IO_ACCESS_MAP_NONE) ? \
186 (USHORT)(sizeof(KTSS)) : \
187 (USHORT)(FIELD_OFFSET(KTSS, IoMaps[MapNumber-1].IoMap))
188
189 typedef UCHAR KIO_ACCESS_MAP[IOPM_SIZE];
190
191 typedef KIO_ACCESS_MAP *PKIO_ACCESS_MAP;
192
193 //
194 // Size of the XMM register save area in the FXSAVE format
195 //
196 #define SIZE_OF_FX_REGISTERS 128
197
198 //
199 // Static Kernel-Mode Address start (use MM_KSEG0_BASE for actual)
200 //
201 #define KSEG0_BASE 0x80000000
202
203 //
204 // Synchronization-level IRQL
205 //
206 #ifndef CONFIG_SMP
207 #define SYNCH_LEVEL DISPATCH_LEVEL
208 #else
209 #if (NTDDI_VERSION < NTDDI_WS03)
210 #define SYNCH_LEVEL (IPI_LEVEL - 1)
211 #else
212 #define SYNCH_LEVEL (IPI_LEVEL - 2)
213 #endif
214 #endif
215
216 //
217 // Number of pool lookaside lists per pool in the PRCB
218 //
219 #define NUMBER_POOL_LOOKASIDE_LISTS 32
220
221 //
222 // Structure for CPUID
223 //
224 typedef union _CPU_INFO
225 {
226 UINT32 AsUINT32[4];
227 struct
228 {
229 ULONG Eax;
230 ULONG Ebx;
231 ULONG Ecx;
232 ULONG Edx;
233 };
234 } CPU_INFO, *PCPU_INFO;
235
236 //
237 // Trap Frame Definition
238 //
239 typedef struct _KTRAP_FRAME
240 {
241 ULONG DbgEbp;
242 ULONG DbgEip;
243 ULONG DbgArgMark;
244 ULONG DbgArgPointer;
245 ULONG TempSegCs;
246 ULONG TempEsp;
247 ULONG Dr0;
248 ULONG Dr1;
249 ULONG Dr2;
250 ULONG Dr3;
251 ULONG Dr6;
252 ULONG Dr7;
253 ULONG SegGs;
254 ULONG SegEs;
255 ULONG SegDs;
256 ULONG Edx;
257 ULONG Ecx;
258 ULONG Eax;
259 ULONG PreviousPreviousMode;
260 struct _EXCEPTION_REGISTRATION_RECORD FAR *ExceptionList;
261 ULONG SegFs;
262 ULONG Edi;
263 ULONG Esi;
264 ULONG Ebx;
265 ULONG Ebp;
266 ULONG ErrCode;
267 ULONG Eip;
268 ULONG SegCs;
269 ULONG EFlags;
270 ULONG HardwareEsp;
271 ULONG HardwareSegSs;
272 ULONG V86Es;
273 ULONG V86Ds;
274 ULONG V86Fs;
275 ULONG V86Gs;
276 } KTRAP_FRAME, *PKTRAP_FRAME;
277
278 //
279 // Defines the Callback Stack Layout for User Mode Callbacks
280 //
281 typedef struct _KCALLOUT_FRAME
282 {
283 ULONG InitialStack;
284 ULONG TrapFrame;
285 ULONG CallbackStack;
286 ULONG Edi;
287 ULONG Esi;
288 ULONG Ebx;
289 ULONG Ebp;
290 ULONG ReturnAddress;
291 ULONG Result;
292 ULONG ResultLength;
293 } KCALLOUT_FRAME, *PKCALLOUT_FRAME;
294
295 //
296 // LDT Entry Definition
297 //
298 #ifndef _LDT_ENTRY_DEFINED
299 #define _LDT_ENTRY_DEFINED
300 typedef struct _LDT_ENTRY
301 {
302 USHORT LimitLow;
303 USHORT BaseLow;
304 union
305 {
306 struct
307 {
308 UCHAR BaseMid;
309 UCHAR Flags1;
310 UCHAR Flags2;
311 UCHAR BaseHi;
312 } Bytes;
313 struct
314 {
315 ULONG BaseMid:8;
316 ULONG Type:5;
317 ULONG Dpl:2;
318 ULONG Pres:1;
319 ULONG LimitHi:4;
320 ULONG Sys:1;
321 ULONG Reserved_0:1;
322 ULONG Default_Big:1;
323 ULONG Granularity:1;
324 ULONG BaseHi:8;
325 } Bits;
326 } HighWord;
327 } LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY;
328 #endif
329
330 //
331 // GDT Entry Definition
332 //
333 typedef struct _KGDTENTRY
334 {
335 USHORT LimitLow;
336 USHORT BaseLow;
337 union
338 {
339 struct
340 {
341 UCHAR BaseMid;
342 UCHAR Flags1;
343 UCHAR Flags2;
344 UCHAR BaseHi;
345 } Bytes;
346 struct
347 {
348 ULONG BaseMid:8;
349 ULONG Type:5;
350 ULONG Dpl:2;
351 ULONG Pres:1;
352 ULONG LimitHi:4;
353 ULONG Sys:1;
354 ULONG Reserved_0:1;
355 ULONG Default_Big:1;
356 ULONG Granularity:1;
357 ULONG BaseHi:8;
358 } Bits;
359 } HighWord;
360 } KGDTENTRY, *PKGDTENTRY;
361
362 //
363 // IDT Entry Access Definition
364 //
365 typedef struct _KIDT_ACCESS
366 {
367 union
368 {
369 struct
370 {
371 UCHAR Reserved;
372 UCHAR SegmentType:4;
373 UCHAR SystemSegmentFlag:1;
374 UCHAR Dpl:2;
375 UCHAR Present:1;
376 };
377 USHORT Value;
378 };
379 } KIDT_ACCESS, *PKIDT_ACCESS;
380
381 //
382 // IDT Entry Definition
383 //
384 typedef struct _KIDTENTRY
385 {
386 USHORT Offset;
387 USHORT Selector;
388 USHORT Access;
389 USHORT ExtendedOffset;
390 } KIDTENTRY, *PKIDTENTRY;
391
392 typedef struct _DESCRIPTOR
393 {
394 USHORT Pad;
395 USHORT Limit;
396 ULONG Base;
397 } KDESCRIPTOR, *PKDESCRIPTOR;
398
399 #ifndef NTOS_MODE_USER
400 //
401 // Macro to get current KPRCB
402 //
403 FORCEINLINE
404 struct _KPRCB *
405 KeGetCurrentPrcb(VOID)
406 {
407 return (struct _KPRCB *)(ULONG_PTR)__readfsdword(FIELD_OFFSET(KPCR, Prcb));
408 }
409
410 //
411 // FN/FX (FPU) Save Area Structures
412 //
413 typedef struct _FNSAVE_FORMAT
414 {
415 ULONG ControlWord;
416 ULONG StatusWord;
417 ULONG TagWord;
418 ULONG ErrorOffset;
419 ULONG ErrorSelector;
420 ULONG DataOffset;
421 ULONG DataSelector;
422 UCHAR RegisterArea[80];
423 } FNSAVE_FORMAT, *PFNSAVE_FORMAT;
424
425 typedef struct _FXSAVE_FORMAT
426 {
427 USHORT ControlWord;
428 USHORT StatusWord;
429 USHORT TagWord;
430 USHORT ErrorOpcode;
431 ULONG ErrorOffset;
432 ULONG ErrorSelector;
433 ULONG DataOffset;
434 ULONG DataSelector;
435 ULONG MXCsr;
436 ULONG MXCsrMask;
437 UCHAR RegisterArea[SIZE_OF_FX_REGISTERS];
438 UCHAR Reserved3[128];
439 UCHAR Reserved4[224];
440 UCHAR Align16Byte[8];
441 } FXSAVE_FORMAT, *PFXSAVE_FORMAT;
442
443 typedef struct _FX_SAVE_AREA
444 {
445 union
446 {
447 FNSAVE_FORMAT FnArea;
448 FXSAVE_FORMAT FxArea;
449 } U;
450 ULONG NpxSavedCpu;
451 ULONG Cr0NpxState;
452 } FX_SAVE_AREA, *PFX_SAVE_AREA;
453
454 //
455 // Special Registers Structure (outside of CONTEXT)
456 //
457 typedef struct _KSPECIAL_REGISTERS
458 {
459 ULONG Cr0;
460 ULONG Cr2;
461 ULONG Cr3;
462 ULONG Cr4;
463 ULONG KernelDr0;
464 ULONG KernelDr1;
465 ULONG KernelDr2;
466 ULONG KernelDr3;
467 ULONG KernelDr6;
468 ULONG KernelDr7;
469 KDESCRIPTOR Gdtr;
470 KDESCRIPTOR Idtr;
471 USHORT Tr;
472 USHORT Ldtr;
473 ULONG Reserved[6];
474 } KSPECIAL_REGISTERS, *PKSPECIAL_REGISTERS;
475
476 //
477 // Processor State Data
478 //
479 typedef struct _KPROCESSOR_STATE
480 {
481 CONTEXT ContextFrame;
482 KSPECIAL_REGISTERS SpecialRegisters;
483 } KPROCESSOR_STATE, *PKPROCESSOR_STATE;
484
485 //
486 // Processor Region Control Block
487 //
488 #pragma pack(push,4)
489 typedef struct _KPRCB
490 {
491 USHORT MinorVersion;
492 USHORT MajorVersion;
493 struct _KTHREAD *CurrentThread;
494 struct _KTHREAD *NextThread;
495 struct _KTHREAD *IdleThread;
496 UCHAR Number;
497 UCHAR Reserved;
498 USHORT BuildType;
499 KAFFINITY SetMember;
500 UCHAR CpuType;
501 UCHAR CpuID;
502 USHORT CpuStep;
503 KPROCESSOR_STATE ProcessorState;
504 ULONG KernelReserved[16];
505 ULONG HalReserved[16];
506 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
507 ULONG CFlushSize;
508 UCHAR PrcbPad0[88];
509 #else
510 UCHAR PrcbPad0[92];
511 #endif
512 KSPIN_LOCK_QUEUE LockQueue[LockQueueMaximumLock];
513 struct _KTHREAD *NpxThread;
514 ULONG InterruptCount;
515 ULONG KernelTime;
516 ULONG UserTime;
517 ULONG DpcTime;
518 ULONG DebugDpcTime;
519 ULONG InterruptTime;
520 ULONG AdjustDpcThreshold;
521 ULONG PageColor;
522 UCHAR SkipTick;
523 UCHAR DebuggerSavedIRQL;
524 #if (NTDDI_VERSION >= NTDDI_WS03)
525 UCHAR NodeColor;
526 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
527 UCHAR PollSlot;
528 #else
529 UCHAR Spare1;
530 #endif
531 ULONG NodeShiftedColor;
532 #else
533 UCHAR Spare1[6];
534 #endif
535 struct _KNODE *ParentNode;
536 ULONG MultiThreadProcessorSet;
537 struct _KPRCB *MultiThreadSetMaster;
538 #if (NTDDI_VERSION >= NTDDI_WS03)
539 ULONG SecondaryColorMask;
540 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
541 ULONG DpcTimeLimit;
542 #else
543 LONG Sleeping;
544 #endif
545 #else
546 ULONG ThreadStartCount[2];
547 #endif
548 ULONG CcFastReadNoWait;
549 ULONG CcFastReadWait;
550 ULONG CcFastReadNotPossible;
551 ULONG CcCopyReadNoWait;
552 ULONG CcCopyReadWait;
553 ULONG CcCopyReadNoWaitMiss;
554 #if (NTDDI_VERSION < NTDDI_LONGHORN)
555 ULONG KeAlignmentFixupCount;
556 #endif
557 ULONG SpareCounter0;
558 #if (NTDDI_VERSION < NTDDI_LONGHORN)
559 ULONG KeDcacheFlushCount;
560 ULONG KeExceptionDispatchCount;
561 ULONG KeFirstLevelTbFills;
562 ULONG KeFloatingEmulationCount;
563 ULONG KeIcacheFlushCount;
564 ULONG KeSecondLevelTbFills;
565 ULONG KeSystemCalls;
566 #endif
567 volatile ULONG IoReadOperationCount;
568 volatile ULONG IoWriteOperationCount;
569 volatile ULONG IoOtherOperationCount;
570 LARGE_INTEGER IoReadTransferCount;
571 LARGE_INTEGER IoWriteTransferCount;
572 LARGE_INTEGER IoOtherTransferCount;
573 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
574 ULONG CcFastMdlReadNoWait;
575 ULONG CcFastMdlReadWait;
576 ULONG CcFastMdlReadNotPossible;
577 ULONG CcMapDataNoWait;
578 ULONG CcMapDataWait;
579 ULONG CcPinMappedDataCount;
580 ULONG CcPinReadNoWait;
581 ULONG CcPinReadWait;
582 ULONG CcMdlReadNoWait;
583 ULONG CcMdlReadWait;
584 ULONG CcLazyWriteHotSpots;
585 ULONG CcLazyWriteIos;
586 ULONG CcLazyWritePages;
587 ULONG CcDataFlushes;
588 ULONG CcDataPages;
589 ULONG CcLostDelayedWrites;
590 ULONG CcFastReadResourceMiss;
591 ULONG CcCopyReadWaitMiss;
592 ULONG CcFastMdlReadResourceMiss;
593 ULONG CcMapDataNoWaitMiss;
594 ULONG CcMapDataWaitMiss;
595 ULONG CcPinReadNoWaitMiss;
596 ULONG CcPinReadWaitMiss;
597 ULONG CcMdlReadNoWaitMiss;
598 ULONG CcMdlReadWaitMiss;
599 ULONG CcReadAheadIos;
600 ULONG KeAlignmentFixupCount;
601 ULONG KeExceptionDispatchCount;
602 ULONG KeSystemCalls;
603 ULONG PrcbPad1[3];
604 #else
605 ULONG SpareCounter1[8];
606 #endif
607 PP_LOOKASIDE_LIST PPLookasideList[16];
608 PP_LOOKASIDE_LIST PPNPagedLookasideList[NUMBER_POOL_LOOKASIDE_LISTS];
609 PP_LOOKASIDE_LIST PPPagedLookasideList[NUMBER_POOL_LOOKASIDE_LISTS];
610 volatile ULONG PacketBarrier;
611 volatile ULONG ReverseStall;
612 PVOID IpiFrame;
613 UCHAR PrcbPad2[52];
614 volatile PVOID CurrentPacket[3];
615 volatile ULONG TargetSet;
616 volatile PKIPI_WORKER WorkerRoutine;
617 volatile ULONG IpiFrozen;
618 UCHAR PrcbPad3[40];
619 volatile ULONG RequestSummary;
620 volatile struct _KPRCB *SignalDone;
621 UCHAR PrcbPad4[56];
622 struct _KDPC_DATA DpcData[2];
623 PVOID DpcStack;
624 ULONG MaximumDpcQueueDepth;
625 ULONG DpcRequestRate;
626 ULONG MinimumDpcRate;
627 volatile UCHAR DpcInterruptRequested;
628 volatile UCHAR DpcThreadRequested;
629 volatile UCHAR DpcRoutineActive;
630 volatile UCHAR DpcThreadActive;
631 ULONG PrcbLock;
632 ULONG DpcLastCount;
633 volatile ULONG TimerHand;
634 volatile ULONG TimerRequest;
635 PVOID DpcThread;
636 KEVENT DpcEvent;
637 UCHAR ThreadDpcEnable;
638 volatile BOOLEAN QuantumEnd;
639 UCHAR PrcbPad50;
640 volatile UCHAR IdleSchedule;
641 LONG DpcSetEventRequest;
642 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
643 LONG Sleeping;
644 ULONG PeriodicCount;
645 ULONG PeriodicBias;
646 UCHAR PrcbPad5[6];
647 #else
648 UCHAR PrcbPad5[18];
649 #endif
650 LONG TickOffset;
651 KDPC CallDpc;
652 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
653 LONG ClockKeepAlive;
654 UCHAR ClockCheckSlot;
655 UCHAR ClockPollCycle;
656 UCHAR PrcbPad6[2];
657 LONG DpcWatchdogPeriod;
658 LONG DpcWatchDogCount;
659 LONG ThreadWatchdogPeriod;
660 LONG ThreadWatchDogCount;
661 ULONG PrcbPad70[2];
662 #else
663 ULONG PrcbPad7[8];
664 #endif
665 LIST_ENTRY WaitListHead;
666 ULONG ReadySummary;
667 ULONG QueueIndex;
668 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
669 SINGLE_LIST_ENTRY DeferredReadyListHead;
670 ULONGLONG StartCycles;
671 ULONGLONG CycleTime;
672 ULONGLONG PrcbPad71[3];
673 LIST_ENTRY DispatcherReadyListHead[32];
674 #else
675 LIST_ENTRY DispatcherReadyListHead[32];
676 SINGLE_LIST_ENTRY DeferredReadyListHead;
677 ULONG PrcbPad72[11];
678 #endif
679 PVOID ChainedInterruptList;
680 LONG LookasideIrpFloat;
681 volatile LONG MmPageFaultCount;
682 volatile LONG MmCopyOnWriteCount;
683 volatile LONG MmTransitionCount;
684 volatile LONG MmCacheTransitionCount;
685 volatile LONG MmDemandZeroCount;
686 volatile LONG MmPageReadCount;
687 volatile LONG MmPageReadIoCount;
688 volatile LONG MmCacheReadCount;
689 volatile LONG MmCacheIoCount;
690 volatile LONG MmDirtyPagesWriteCount;
691 volatile LONG MmDirtyWriteIoCount;
692 volatile LONG MmMappedPagesWriteCount;
693 volatile LONG MmMappedWriteIoCount;
694 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
695 ULONG CachedCommit;
696 ULONG CachedResidentAvailable;
697 PVOID HyperPte;
698 UCHAR CpuVendor;
699 UCHAR PrcbPad9[3];
700 #else
701 ULONG SpareFields0[1];
702 #endif
703 CHAR VendorString[13];
704 UCHAR InitialApicId;
705 UCHAR LogicalProcessorsPerPhysicalProcessor;
706 ULONG MHz;
707 ULONG FeatureBits;
708 LARGE_INTEGER UpdateSignature;
709 volatile LARGE_INTEGER IsrTime;
710 LARGE_INTEGER SpareField1;
711 FX_SAVE_AREA NpxSaveArea;
712 PROCESSOR_POWER_STATE PowerState;
713 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
714 KDPC DpcWatchdogDoc;
715 KTIMER DpcWatchdogTimer;
716 PVOID WheaInfo;
717 PVOID EtwSupport;
718 SLIST_HEADER InterruptObjectPool;
719 LARGE_INTEGER HyperCallPagePhysical;
720 LARGE_INTEGER HyperCallPageVirtual;
721 PVOID RateControl;
722 CACHE_DESCRIPTOR Cache[5];
723 ULONG CacheCount;
724 ULONG CacheProcessorMask[5];
725 UCHAR LogicalProcessorsPerCore;
726 UCHAR PrcbPad8[3];
727 ULONG PackageProcessorSet;
728 ULONG CoreProcessorSet;
729 #endif
730 } KPRCB, *PKPRCB;
731
732 //
733 // Processor Control Region
734 //
735 typedef struct _KIPCR
736 {
737 union
738 {
739 NT_TIB NtTib;
740 struct
741 {
742 struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList;
743 PVOID Used_StackBase;
744 PVOID PerfGlobalGroupMask;
745 PVOID TssCopy;
746 ULONG ContextSwitches;
747 KAFFINITY SetMemberCopy;
748 PVOID Used_Self;
749 };
750 };
751 struct _KPCR *SelfPcr;
752 struct _KPRCB *Prcb;
753 KIRQL Irql;
754 ULONG IRR;
755 ULONG IrrActive;
756 ULONG IDR;
757 PVOID KdVersionBlock;
758 PKIDTENTRY IDT;
759 PKGDTENTRY GDT;
760 struct _KTSS *TSS;
761 USHORT MajorVersion;
762 USHORT MinorVersion;
763 KAFFINITY SetMember;
764 ULONG StallScaleFactor;
765 UCHAR SpareUnused;
766 UCHAR Number;
767 UCHAR Spare0;
768 UCHAR SecondLevelCacheAssociativity;
769 ULONG VdmAlert;
770 ULONG KernelReserved[14];
771 ULONG SecondLevelCacheSize;
772 ULONG HalReserved[16];
773 ULONG InterruptMode;
774 UCHAR Spare1;
775 ULONG KernelReserved2[17];
776 KPRCB PrcbData;
777 } KIPCR, *PKIPCR;
778 #pragma pack(pop)
779
780 //
781 // TSS Definition
782 //
783 typedef struct _KiIoAccessMap
784 {
785 UCHAR DirectionMap[IOPM_DIRECTION_MAP_SIZE];
786 UCHAR IoMap[IOPM_FULL_SIZE];
787 } KIIO_ACCESS_MAP;
788
789 typedef struct _KTSS
790 {
791 USHORT Backlink;
792 USHORT Reserved0;
793 ULONG Esp0;
794 USHORT Ss0;
795 USHORT Reserved1;
796 ULONG NotUsed1[4];
797 ULONG CR3;
798 ULONG Eip;
799 ULONG EFlags;
800 ULONG Eax;
801 ULONG Ecx;
802 ULONG Edx;
803 ULONG Ebx;
804 ULONG Esp;
805 ULONG Ebp;
806 ULONG Esi;
807 ULONG Edi;
808 USHORT Es;
809 USHORT Reserved2;
810 USHORT Cs;
811 USHORT Reserved3;
812 USHORT Ss;
813 USHORT Reserved4;
814 USHORT Ds;
815 USHORT Reserved5;
816 USHORT Fs;
817 USHORT Reserved6;
818 USHORT Gs;
819 USHORT Reserved7;
820 USHORT LDT;
821 USHORT Reserved8;
822 USHORT Flags;
823 USHORT IoMapBase;
824 KIIO_ACCESS_MAP IoMaps[IOPM_COUNT];
825 UCHAR IntDirectionMap[IOPM_DIRECTION_MAP_SIZE];
826 } KTSS, *PKTSS;
827
828 //
829 // i386 CPUs don't have exception frames
830 //
831 typedef struct _KEXCEPTION_FRAME KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
832
833 #endif /* NTOS_MODE_USER */
834
835 typedef enum _WOW64_SERVICE_TYPES
836 {
837 ServiceNoTurbo = 0x0000,
838 Service0Arg = 0x0001,
839 Service0ArgReloadState = 0x0002,
840 Service1ArgSp = 0x0003,
841 Service1ArgNSp = 0x0004,
842 Service2ArgNSpNSp = 0x0005,
843 Service2ArgNSpNSpReloadState = 0x0006,
844 Service2ArgSpNSp = 0x0007,
845 Service2ArgSpSp = 0x0008,
846 Service2ArgNSpSp = 0x0009,
847 Service3ArgNSpNSpNSp = 0x000A,
848 Service3ArgSpSpSp = 0x000B,
849 Service3ArgSpNSpNSp = 0x000C,
850 Service3ArgSpNSpNSpReloadState = 0x000D,
851 Service3ArgSpSpNSp = 0x000E,
852 Service3ArgNSpSpNSp = 0x000F,
853 Service3ArgSpNSpSp = 0x0010,
854 Service4ArgNSpNSpNSpNSp = 0x0011,
855 Service4ArgSpSpNSpNSp = 0x0012,
856 Service4ArgSpSpNSpNSpReloadState = 0x0013,
857 Service4ArgSpNSpNSpNSp = 0x0014,
858 Service4ArgSpNSpNSpNSpReloadState = 0x0015,
859 Service4ArgNSpSpNSpNSp = 0x0016,
860 Service4ArgSpSpSpNSp = 0x0017,
861 ServiceCpupTdQuerySystemTime = 0x0018,
862 ServiceCpupTdGetCurrentProcessorNumber = 0x0019,
863 ServiceCpupTdReadWriteFile = 0x001A,
864 ServiceCpupTdDeviceIoControlFile = 0x001B,
865 ServiceCpupTdRemoveIoCompletion = 0x001C,
866 ServiceCpupTdWaitForMultipleObjects = 0x001D,
867 ServiceCpupTdWaitForMultipleObjects32 = 0x001E,
868 Wow64ServiceTypesCount // = 0x001F
869 } WOW64_SERVICE_TYPES, *PWOW64_SERVICE_TYPES;
870
871 typedef enum _VDM_INDEX
872 {
873 VDM_INDEX_Invalid = 0,
874 VDM_INDEX_0F,
875 VDM_INDEX_ESPrefix,
876 VDM_INDEX_CSPrefix,
877 VDM_INDEX_SSPrefix,
878 VDM_INDEX_DSPrefix,
879 VDM_INDEX_FSPrefix,
880 VDM_INDEX_GSPrefix,
881 VDM_INDEX_OPER32Prefix,
882 VDM_INDEX_ADDR32Prefix,
883 VDM_INDEX_INSB,
884 VDM_INDEX_INSW,
885 VDM_INDEX_OUTSB,
886 VDM_INDEX_OUTSW,
887 VDM_INDEX_PUSHF,
888 VDM_INDEX_POPF,
889 VDM_INDEX_INTnn,
890 VDM_INDEX_INTO,
891 VDM_INDEX_IRET,
892 VDM_INDEX_NPX,
893 VDM_INDEX_INBimm,
894 VDM_INDEX_INWimm,
895 VDM_INDEX_OUTBimm,
896 VDM_INDEX_OUTWimm,
897 VDM_INDEX_INB,
898 VDM_INDEX_INW,
899 VDM_INDEX_OUTB,
900 VDM_INDEX_OUTW,
901 VDM_INDEX_LOCKPrefix,
902 VDM_INDEX_REPNEPrefix,
903 VDM_INDEX_REPPrefix,
904 VDM_INDEX_CLI,
905 VDM_INDEX_STI,
906 VDM_INDEX_HLT,
907 MAX_VDM_INDEX
908 } VDM_INDEX, *PVDM_INDEX;
909
910 #endif /* _I386_KETYPES_H */