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