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