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