This commit was generated by cvs2svn to compensate for changes in r10,
[reactos.git] / reactos / include / ddk / ketypes.h
1 /* KERNEL TYPES **************************************************************/
2
3 #ifndef __INCLUDE_DDK_KETYPES_H
4 #define __INCLUDE_DDK_KETYPES_H
5
6 typedef LONG KPRIORITY;
7
8 typedef VOID (*PKBUGCHECK_CALLBACK_ROUTINE)(PVOID Buffer, ULONG Length);
9 typedef BOOLEAN (*PKSYNCHRONIZE_ROUTINE)(PVOID SynchronizeContext);
10
11 struct _KAPC;
12
13 typedef VOID (*PKNORMAL_ROUTINE)(PVOID NormalContext,
14 PVOID SystemArgument1,
15 PVOID SystemArgument2);
16 typedef VOID (*PKKERNEL_ROUTINE)(struct _KAPC* Apc,
17 PKNORMAL_ROUTINE* NormalRoutine,
18 PVOID* NormalContext,
19 PVOID* SystemArgument1,
20 PVOID* SystemArgument2);
21
22 typedef VOID (*PKRUNDOWN_ROUTINE)(struct _KAPC* Apc);
23
24 typedef struct
25 /*
26 * PURPOSE: Object describing the wait a thread is currently performing
27 */
28 {
29 LIST_ENTRY WaitListEntry;
30 struct _KTHREAD* Thread;
31 PVOID Object;
32 struct _KWAIT_BLOCK* NextWaitBlock;
33 USHORT WaitKey;
34 USHORT WaitType;
35 } KWAIT_BLOCK, *PKWAIT_BLOCK;
36
37
38
39 typedef struct _ETHREAD
40 /*
41 * PURPOSE: Describes a thread of execution
42 */
43 {
44 CSHORT Type;
45 CSHORT Size;
46
47 /*
48 * PURPOSE: Head of the queue of apcs
49 */
50 LIST_ENTRY apc_queue_head;
51
52 /*
53 * PURPOSE: Entry in the linked list of threads
54 */
55 LIST_ENTRY Entry;
56
57 /*
58 * PURPOSE: Current state of the thread
59 */
60 ULONG State;
61
62 /*
63 * PURPOSE: Priority modifier of the thread
64 */
65 ULONG Priority;
66
67 /*
68 * PURPOSE: Pointer to our process
69 */
70 struct _EPROCESS* Process;
71
72 /*
73 * PURPOSE: Handle of our process
74 */
75 HANDLE ProcessHandle;
76
77 /*
78 * PURPOSE: Thread affinity mask
79 */
80 ULONG AffinityMask;
81
82 /*
83 * PURPOSE: Saved thread context
84 */
85 hal_thread_state context;
86
87 } KTHREAD, *PKTHREAD, *PETHREAD;
88
89 typedef struct _DISPATCHER_HEADER
90 {
91 UCHAR Type;
92 UCHAR Absolute;
93 UCHAR Size;
94 UCHAR Inserted;
95 LONG SignalState;
96 LIST_ENTRY WaitListHead;
97 } DISPATCHER_HEADER;
98
99 typedef struct _KAPC
100 {
101 CSHORT Type;
102 CSHORT Size;
103 ULONG Spare0;
104 struct _KTHREAD* Thread;
105 LIST_ENTRY ApcListEntry;
106 PKKERNEL_ROUTINE KernelRoutine;
107 PKRUNDOWN_ROUTINE RundownRoutine;
108 PKNORMAL_ROUTINE NormalRoutine;
109 PVOID NormalContext;
110 PVOID SystemArgument1;
111 PVOID SystemArgument2;
112 CCHAR ApcStateIndex;
113 KPROCESSOR_MODE ApcMode;
114 BOOLEAN Inserted;
115 } KAPC, *PKAPC;
116
117 typedef struct
118 {
119 LIST_ENTRY Entry;
120 PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine;
121 PVOID Buffer;
122 ULONG Length;
123 PUCHAR Component;
124 ULONG Checksum;
125 UCHAR State;
126 } KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
127
128 typedef struct
129 {
130 DISPATCHER_HEADER Header;
131 LIST_ENTRY MutantListEntry;
132 struct _KTHREAD* OwnerThread;
133 BOOLEAN Abandoned;
134 UCHAR ApcDisable;
135 } KMUTEX, *PKMUTEX;
136
137 typedef struct
138 {
139 DISPATCHER_HEADER Header;
140 LONG Limit;
141 } KSEMAPHORE, *PKSEMAPHORE;
142
143 typedef struct _KEVENT
144 /*
145 * PURPOSE: Describes an event
146 */
147 {
148 /*
149 * PURPOSE: So we can use the general wait routine
150 */
151 DISPATCHER_HEADER Header;
152 } KEVENT, *PKEVENT;
153
154
155 typedef struct _KSPIN_LOCK
156 {
157 KIRQL irql;
158 } KSPIN_LOCK, *PKSPIN_LOCK;
159
160 typedef VOID (*PDRIVER_ADD_DEVICE)(VOID);
161
162 struct _KDPC;
163
164 /*
165 * PURPOSE: Defines a delayed procedure call routine
166 * NOTE:
167 * Dpc = The associated DPC object
168 * DeferredContext = Driver defined context for the DPC
169 * SystemArgument[1-2] = Undocumented.
170 *
171 */
172 typedef VOID (*PKDEFERRED_ROUTINE)(struct _KDPC* Dpc, PVOID DeferredContext,
173 PVOID SystemArgument1, PVOID SystemArgument2);
174
175 typedef struct _KDPC
176 /*
177 * PURPOSE: Defines a delayed procedure call object
178 */
179 {
180 /*
181 * PURPOSE: Magic value to check this is the current object type
182 */
183 SHORT Type;
184
185 /*
186 * PURPOSE: Target processor or zero if untargetted
187 */
188 UCHAR Number;
189
190 /*
191 * PURPOSE: Indication of desired latency before exection
192 */
193 UCHAR Importance;
194
195 LIST_ENTRY DpcListEntry;
196 PKDEFERRED_ROUTINE DeferredRoutine;
197 PVOID DeferredContext;
198 PVOID SystemArgument1;
199 PVOID SystemArgument2;
200
201 /*
202 * PURPOSE: If non-zero then already in queue
203 */
204 PULONG Lock;
205
206 } KDPC, *PKDPC;
207
208
209 typedef struct _KDEVICE_QUEUE
210 {
211 LIST_ENTRY ListHead;
212 BOOLEAN Busy;
213 KSPIN_LOCK Lock;
214 } KDEVICE_QUEUE, *PKDEVICE_QUEUE;
215
216 typedef struct _KDEVICE_QUEUE_ENTRY
217 {
218 LIST_ENTRY Entry;
219 ULONG Key;
220 } KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY;
221
222 typedef struct _WAIT_CONTEXT_BLOCK
223 {
224 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
225
226
227 typedef struct _KTIMER
228 {
229 /*
230 * Pointers to maintain the linked list of activated timers
231 */
232 LIST_ENTRY entry;
233
234 /*
235 * Absolute expiration time in system time units
236 */
237 unsigned long long expire_time;
238
239 /*
240 * Optional dpc associated with the timer
241 */
242 PKDPC dpc;
243
244 /*
245 * True if the timer is signaled
246 */
247 BOOLEAN signaled;
248
249 /*
250 * True if the timer is in the system timer queue
251 */
252 BOOLEAN running;
253
254 /*
255 * Type of the timer either Notification or Synchronization
256 */
257 TIMER_TYPE type;
258
259 /*
260 * Period of the timer in milliseconds (zero if once-only)
261 */
262 ULONG period;
263
264 } KTIMER, *PKTIMER;
265
266 struct _KINTERRUPT;
267
268 typedef BOOLEAN (*PKSERVICE_ROUTINE)(struct _KINTERRUPT* Interrupt,
269 PVOID ServiceContext);
270
271 typedef struct _KINTERRUPT
272 {
273 ULONG Vector;
274 KAFFINITY ProcessorEnableMask;
275 PKSPIN_LOCK IrqLock;
276 BOOLEAN Shareable;
277 BOOLEAN FloatingSave;
278 PKSERVICE_ROUTINE ServiceRoutine;
279 PVOID ServiceContext;
280 LIST_ENTRY Entry;
281 KIRQL SynchLevel;
282 } KINTERRUPT, *PKINTERRUPT;
283
284 #endif /* __INCLUDE_DDK_KETYPES_H */