Some powerpc adaptations of i386 headers. Initial work, not tested yet.
[reactos.git] / reactos / include / ndk / powerpc / ketypes.h
1 /*++ NDK Version: 0095
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 ketypes.h (PPC)
8
9 Abstract:
10
11 PowerPC Type definitions for the Kernel services.
12
13 Author:
14
15 Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
16
17 --*/
18
19 #ifndef _POWERPC_KETYPES_H
20 #define _POWERPC_KETYPES_H
21
22 //
23 // Dependencies
24 //
25
26 //
27 // IPI Types
28 //
29 #define IPI_APC 1
30 #define IPI_DPC 2
31 #define IPI_FREEZE 3
32 #define IPI_PACKET_READY 4
33 #define IPI_SYNCH_REQUEST 10
34
35 //
36 // Trap Frame Definition
37 //
38 typedef struct _KTRAP_FRAME
39 {
40 ULONG R[32];
41 ULONG SRR0, SRR1;
42 ULONG LR, CTR;
43 } KTRAP_FRAME, *PKTRAP_FRAME;
44
45 //
46 // Page Table Entry Definition
47 //
48 // I'll use the same table format
49 //
50 typedef struct _SOFTWARE_PTE_PPC
51 {
52 ULONG Valid : 1;
53 ULONG Write : 1;
54 ULONG Owner : 1;
55 ULONG WriteThrough : 1;
56 ULONG CacheDisable : 1;
57 ULONG Accessed : 1;
58 ULONG Dirty : 1;
59 ULONG LargePage : 1;
60 ULONG Global : 1;
61 ULONG CopyOnWrite : 1;
62 ULONG Prototype : 1;
63 ULONG reserved : 1;
64 ULONG PageFrameNumber : 20;
65 } SOFTWARE_PTE_X86, *PSOFTWARE_PTE_PPC;
66
67 typedef struct _DESCRIPTOR
68 {
69 USHORT Pad;
70 USHORT Limit;
71 ULONG Base;
72 } KDESCRIPTOR, *PKDESCRIPTOR;
73
74 //
75 // Special Registers Structure (outside of CONTEXT)
76 //
77 typedef struct _KSPECIAL_REGISTERS
78 {
79 ULONG MSR, SDR0, SDR1;
80 ULONG BATU[4], BATL[4];
81 ULONG SR[8];
82 } KSPECIAL_REGISTERS, *PKSPECIAL_REGISTERS;
83
84 //
85 // Processor State Data
86 //
87 #pragma pack(push,4)
88 typedef struct _KPROCESSOR_STATE
89 {
90 PCONTEXT ContextFrame;
91 KSPECIAL_REGISTERS SpecialRegisters;
92 } KPROCESSOR_STATE;
93
94 //
95 // Processor Region Control Block
96 //
97 typedef struct _KPRCB
98 {
99 USHORT MinorVersion;
100 USHORT MajorVersion;
101 struct _KTHREAD *CurrentThread;
102 struct _KTHREAD *NextThread;
103 struct _KTHREAD *IdleThread;
104 UCHAR Number;
105 UCHAR Reserved;
106 USHORT BuildType;
107 KAFFINITY SetMember;
108 UCHAR CpuType;
109 UCHAR CpuID;
110 USHORT CpuStep;
111 KPROCESSOR_STATE ProcessorState;
112 ULONG KernelReserved[16];
113 ULONG HalReserved[16];
114 UCHAR PrcbPad0[92];
115 PVOID LockQueue[33]; // Used for Queued Spinlocks
116 struct _KTHREAD *NpxThread;
117 ULONG InterruptCount;
118 ULONG KernelTime;
119 ULONG UserTime;
120 ULONG DpcTime;
121 ULONG DebugDpcTime;
122 ULONG InterruptTime;
123 ULONG AdjustDpcThreshold;
124 ULONG PageColor;
125 UCHAR SkipTick;
126 UCHAR DebuggerSavedIRQL;
127 UCHAR Spare1[6];
128 struct _KNODE *ParentNode;
129 ULONG MultiThreadProcessorSet;
130 struct _KPRCB *MultiThreadSetMaster;
131 ULONG ThreadStartCount[2];
132 ULONG CcFastReadNoWait;
133 ULONG CcFastReadWait;
134 ULONG CcFastReadNotPossible;
135 ULONG CcCopyReadNoWait;
136 ULONG CcCopyReadWait;
137 ULONG CcCopyReadNoWaitMiss;
138 ULONG KeAlignmentFixupCount;
139 ULONG KeContextSwitches;
140 ULONG KeDcacheFlushCount;
141 ULONG KeExceptionDispatchCount;
142 ULONG KeFirstLevelTbFills;
143 ULONG KeFloatingEmulationCount;
144 ULONG KeIcacheFlushCount;
145 ULONG KeSecondLevelTbFills;
146 ULONG KeSystemCalls;
147 ULONG IoReadOperationCount;
148 ULONG IoWriteOperationCount;
149 ULONG IoOtherOperationCount;
150 LARGE_INTEGER IoReadTransferCount;
151 LARGE_INTEGER IoWriteTransferCount;
152 LARGE_INTEGER IoOtherTransferCount;
153 ULONG SpareCounter1[8];
154 PP_LOOKASIDE_LIST PPLookasideList[16];
155 PP_LOOKASIDE_LIST PPNPagedLookasideList[32];
156 PP_LOOKASIDE_LIST PPPagedLookasideList[32];
157 ULONG PacketBarrier;
158 ULONG ReverseStall;
159 PVOID IpiFrame;
160 UCHAR PrcbPad2[52];
161 PVOID CurrentPacket[3];
162 ULONG TargetSet;
163 ULONG_PTR WorkerRoutine;
164 ULONG IpiFrozen;
165 UCHAR PrcbPad3[40];
166 ULONG RequestSummary;
167 struct _KPRCB *SignalDone;
168 UCHAR PrcbPad4[56];
169 struct _KDPC_DATA DpcData[2];
170 PVOID DpcStack;
171 ULONG MaximumDpcQueueDepth;
172 ULONG DpcRequestRate;
173 ULONG MinimumDpcRate;
174 UCHAR DpcInterruptRequested;
175 UCHAR DpcThreadRequested;
176 UCHAR DpcRoutineActive;
177 UCHAR DpcThreadActive;
178 ULONG PrcbLock;
179 ULONG DpcLastCount;
180 ULONG TimerHand;
181 ULONG TimerRequest;
182 PVOID DpcThread;
183 struct _KEVENT *DpcEvent;
184 UCHAR ThreadDpcEnable;
185 BOOLEAN QuantumEnd;
186 UCHAR PrcbPad50;
187 UCHAR IdleSchedule;
188 ULONG DpcSetEventRequest;
189 UCHAR PrcbPad5[18];
190 LONG TickOffset;
191 struct _KDPC* CallDpc;
192 ULONG PrcbPad7[8];
193 LIST_ENTRY WaitListHead;
194 ULONG ReadySummary;
195 ULONG SelectNextLast;
196 LIST_ENTRY DispatcherReadyListHead[32];
197 SINGLE_LIST_ENTRY DeferredReadyListHead;
198 ULONG PrcbPad72[11];
199 PVOID ChainedInterruptList;
200 LONG LookasideIrpFloat;
201 LONG MmPageFaultCount;
202 LONG MmCopyOnWriteCount;
203 LONG MmTransitionCount;
204 LONG MmCacheTransitionCount;
205 LONG MmDemandZeroCount;
206 LONG MmPageReadCount;
207 LONG MmPageReadIoCount;
208 LONG MmCacheReadCount;
209 LONG MmCacheIoCount;
210 LONG MmDirtyPagesWriteCount;
211 LONG MmDirtyWriteIoCount;
212 LONG MmMappedPagesWriteCount;
213 LONG MmMappedWriteIoCount;
214 ULONG SpareFields0[1];
215 CHAR VendorString[13];
216 UCHAR InitialApicId;
217 UCHAR LogicalProcessorsPerPhysicalProcessor;
218 ULONG MHz;
219 ULONG FeatureBits;
220 LARGE_INTEGER UpdateSignature;
221 LARGE_INTEGER IsrTime;
222 LARGE_INTEGER SpareField1;
223 FX_SAVE_AREA NpxSaveArea;
224 PROCESSOR_POWER_STATE PowerState;
225 } KPRCB, *PKPRCB;
226
227 //
228 // Processor Control Region
229 //
230 typedef struct _KIPCR
231 {
232 union
233 {
234 NT_TIB NtTib;
235 struct
236 {
237 struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList;
238 PVOID Used_StackBase;
239 PVOID PerfGlobalGroupMask;
240 PVOID TssCopy;
241 ULONG ContextSwitches;
242 KAFFINITY SetMemberCopy;
243 PVOID Used_Self;
244 };
245 };
246 struct _KPCR *Self; /* 1C */
247 struct _KPRCB *Prcb; /* 20 */
248 KIRQL Irql; /* 24 */
249 ULONG IRR; /* 28 */
250 ULONG IrrActive; /* 2C */
251 ULONG IDR; /* 30 */
252 PVOID KdVersionBlock; /* 34 */
253 struct _KTSS *TSS; /* 40 */
254 USHORT MajorVersion; /* 44 */
255 USHORT MinorVersion; /* 46 */
256 KAFFINITY SetMember; /* 48 */
257 ULONG StallScaleFactor; /* 4C */
258 UCHAR SparedUnused; /* 50 */
259 UCHAR Number; /* 51 */
260 UCHAR Reserved; /* 52 */
261 UCHAR L2CacheAssociativity; /* 53 */
262 ULONG VdmAlert; /* 54 */
263 ULONG KernelReserved[14]; /* 58 */
264 ULONG L2CacheSize; /* 90 */
265 ULONG HalReserved[16]; /* 94 */
266 ULONG InterruptMode; /* D4 */
267 UCHAR KernelReserved2[0x48]; /* D8 */
268 KPRCB PrcbData; /* 120 */
269 } KIPCR, *PKIPCR;
270 #pragma pack(pop)
271
272 //
273 // TSS Definition
274 //
275 typedef struct _KiIoAccessMap
276 {
277 UCHAR DirectionMap[32];
278 UCHAR IoMap[8196];
279 } KIIO_ACCESS_MAP;
280
281 #include <pshpack1.h>
282 typedef struct _KTSS
283 {
284 USHORT Backlink;
285 USHORT Reserved0;
286
287 KTRAP_FRAME Registers;
288
289 KIIO_ACCESS_MAP IoMaps[1];
290 UCHAR IntDirectionMap[32];
291 } KTSS, *PKTSS;
292 #include <poppack.h>
293
294 //
295 // PowerPC Exception Frame
296 //
297 typedef struct _KEXCEPTION_FRAME {
298
299 } KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
300
301 #endif