- Removed unneeded crap
[AROS.git] / arch / all-mingw32 / exec / winapi.h
blobda905da806db5eaa95c0ade30431f4af96f0cd20
1 #ifndef _WINAPI_H
2 #define _WINAPI_H
4 #define UCHAR UBYTE
5 #define USHORT UWORD
6 #define DWORD IPTR
8 /* This was taken from Mingw32's w32api/winnt.h */
9 #ifdef __i386__
10 #define SIZE_OF_80387_REGISTERS 80
11 #define CONTEXT_i386 0x10000
12 #define CONTEXT_i486 0x10000
13 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
14 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
15 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
16 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
17 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
18 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
19 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
20 #define MAXIMUM_SUPPORTED_EXTENSION 512
21 typedef struct _FLOATING_SAVE_AREA {
22 DWORD ControlWord;
23 DWORD StatusWord;
24 DWORD TagWord;
25 DWORD ErrorOffset;
26 DWORD ErrorSelector;
27 DWORD DataOffset;
28 DWORD DataSelector;
29 BYTE RegisterArea[80];
30 DWORD Cr0NpxState;
31 } FLOATING_SAVE_AREA;
32 typedef struct _CONTEXT {
33 DWORD ContextFlags;
34 DWORD Dr0;
35 DWORD Dr1;
36 DWORD Dr2;
37 DWORD Dr3;
38 DWORD Dr6;
39 DWORD Dr7;
40 FLOATING_SAVE_AREA FloatSave;
41 DWORD SegGs;
42 DWORD SegFs;
43 DWORD SegEs;
44 DWORD SegDs;
45 DWORD Edi;
46 DWORD Esi;
47 DWORD Ebx;
48 DWORD Edx;
49 DWORD Ecx;
50 DWORD Eax;
51 DWORD Ebp;
52 DWORD Eip;
53 DWORD SegCs;
54 DWORD EFlags;
55 DWORD Esp;
56 DWORD SegSs;
57 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
58 } CONTEXT;
59 #elif defined(_PPC_)
60 #define CONTEXT_CONTROL 1L
61 #define CONTEXT_FLOATING_POINT 2L
62 #define CONTEXT_INTEGER 4L
63 #define CONTEXT_DEBUG_REGISTERS 8L
64 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
65 typedef struct {
66 double Fpr0;
67 double Fpr1;
68 double Fpr2;
69 double Fpr3;
70 double Fpr4;
71 double Fpr5;
72 double Fpr6;
73 double Fpr7;
74 double Fpr8;
75 double Fpr9;
76 double Fpr10;
77 double Fpr11;
78 double Fpr12;
79 double Fpr13;
80 double Fpr14;
81 double Fpr15;
82 double Fpr16;
83 double Fpr17;
84 double Fpr18;
85 double Fpr19;
86 double Fpr20;
87 double Fpr21;
88 double Fpr22;
89 double Fpr23;
90 double Fpr24;
91 double Fpr25;
92 double Fpr26;
93 double Fpr27;
94 double Fpr28;
95 double Fpr29;
96 double Fpr30;
97 double Fpr31;
98 double Fpscr;
99 DWORD Gpr0;
100 DWORD Gpr1;
101 DWORD Gpr2;
102 DWORD Gpr3;
103 DWORD Gpr4;
104 DWORD Gpr5;
105 DWORD Gpr6;
106 DWORD Gpr7;
107 DWORD Gpr8;
108 DWORD Gpr9;
109 DWORD Gpr10;
110 DWORD Gpr11;
111 DWORD Gpr12;
112 DWORD Gpr13;
113 DWORD Gpr14;
114 DWORD Gpr15;
115 DWORD Gpr16;
116 DWORD Gpr17;
117 DWORD Gpr18;
118 DWORD Gpr19;
119 DWORD Gpr20;
120 DWORD Gpr21;
121 DWORD Gpr22;
122 DWORD Gpr23;
123 DWORD Gpr24;
124 DWORD Gpr25;
125 DWORD Gpr26;
126 DWORD Gpr27;
127 DWORD Gpr28;
128 DWORD Gpr29;
129 DWORD Gpr30;
130 DWORD Gpr31;
131 DWORD Cr;
132 DWORD Xer;
133 DWORD Msr;
134 DWORD Iar;
135 DWORD Lr;
136 DWORD Ctr;
137 DWORD ContextFlags;
138 DWORD Fill[3];
139 DWORD Dr0;
140 DWORD Dr1;
141 DWORD Dr2;
142 DWORD Dr3;
143 DWORD Dr4;
144 DWORD Dr5;
145 DWORD Dr6;
146 DWORD Dr7;
147 } CONTEXT;
148 #elif defined(_ALPHA_)
149 #define CONTEXT_ALPHA 0x20000
150 #define CONTEXT_CONTROL (CONTEXT_ALPHA|1L)
151 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L)
152 #define CONTEXT_INTEGER (CONTEXT_ALPHA|4L)
153 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
154 typedef struct _CONTEXT {
155 ULONGLONG FltF0;
156 ULONGLONG FltF1;
157 ULONGLONG FltF2;
158 ULONGLONG FltF3;
159 ULONGLONG FltF4;
160 ULONGLONG FltF5;
161 ULONGLONG FltF6;
162 ULONGLONG FltF7;
163 ULONGLONG FltF8;
164 ULONGLONG FltF9;
165 ULONGLONG FltF10;
166 ULONGLONG FltF11;
167 ULONGLONG FltF12;
168 ULONGLONG FltF13;
169 ULONGLONG FltF14;
170 ULONGLONG FltF15;
171 ULONGLONG FltF16;
172 ULONGLONG FltF17;
173 ULONGLONG FltF18;
174 ULONGLONG FltF19;
175 ULONGLONG FltF20;
176 ULONGLONG FltF21;
177 ULONGLONG FltF22;
178 ULONGLONG FltF23;
179 ULONGLONG FltF24;
180 ULONGLONG FltF25;
181 ULONGLONG FltF26;
182 ULONGLONG FltF27;
183 ULONGLONG FltF28;
184 ULONGLONG FltF29;
185 ULONGLONG FltF30;
186 ULONGLONG FltF31;
187 ULONGLONG IntV0;
188 ULONGLONG IntT0;
189 ULONGLONG IntT1;
190 ULONGLONG IntT2;
191 ULONGLONG IntT3;
192 ULONGLONG IntT4;
193 ULONGLONG IntT5;
194 ULONGLONG IntT6;
195 ULONGLONG IntT7;
196 ULONGLONG IntS0;
197 ULONGLONG IntS1;
198 ULONGLONG IntS2;
199 ULONGLONG IntS3;
200 ULONGLONG IntS4;
201 ULONGLONG IntS5;
202 ULONGLONG IntFp;
203 ULONGLONG IntA0;
204 ULONGLONG IntA1;
205 ULONGLONG IntA2;
206 ULONGLONG IntA3;
207 ULONGLONG IntA4;
208 ULONGLONG IntA5;
209 ULONGLONG IntT8;
210 ULONGLONG IntT9;
211 ULONGLONG IntT10;
212 ULONGLONG IntT11;
213 ULONGLONG IntRa;
214 ULONGLONG IntT12;
215 ULONGLONG IntAt;
216 ULONGLONG IntGp;
217 ULONGLONG IntSp;
218 ULONGLONG IntZero;
219 ULONGLONG Fpcr;
220 ULONGLONG SoftFpcr;
221 ULONGLONG Fir;
222 DWORD Psr;
223 DWORD ContextFlags;
224 DWORD Fill[4];
225 } CONTEXT;
226 #elif defined(SHx)
228 /* These are the debug or break registers on the SH3 */
229 typedef struct _DEBUG_REGISTERS {
230 ULONG BarA;
231 UCHAR BasrA;
232 UCHAR BamrA;
233 USHORT BbrA;
234 ULONG BarB;
235 UCHAR BasrB;
236 UCHAR BamrB;
237 USHORT BbrB;
238 ULONG BdrB;
239 ULONG BdmrB;
240 USHORT Brcr;
241 USHORT Align;
242 } DEBUG_REGISTERS, *PDEBUG_REGISTERS;
244 /* The following flags control the contents of the CONTEXT structure. */
246 #define CONTEXT_SH3 0x00000040
247 #define CONTEXT_SH4 0x000000c0 /* CONTEXT_SH3 | 0x80 - must contain the SH3 bits */
249 #ifdef SH3
250 #define CONTEXT_CONTROL (CONTEXT_SH3 | 0x00000001L)
251 #define CONTEXT_INTEGER (CONTEXT_SH3 | 0x00000002L)
252 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH3 | 0x00000008L)
253 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS)
254 #else /* SH4 */
255 #define CONTEXT_CONTROL (CONTEXT_SH4 | 0x00000001L)
256 #define CONTEXT_INTEGER (CONTEXT_SH4 | 0x00000002L)
257 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH4 | 0x00000008L)
258 #define CONTEXT_FLOATING_POINT (CONTEXT_SH4 | 0x00000004L)
259 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT)
260 #endif
262 /* Context Frame */
264 /* This frame is used to store a limited processor context into the */
265 /* Thread structure for CPUs which have no floating point support. */
267 typedef struct _CONTEXT {
268 /* The flags values within this flag control the contents of */
269 /* a CONTEXT record. */
271 /* If the context record is used as an input parameter, then */
272 /* for each portion of the context record controlled by a flag */
273 /* whose value is set, it is assumed that that portion of the */
274 /* context record contains valid context. If the context record */
275 /* is being used to modify a thread's context, then only that */
276 /* portion of the threads context will be modified. */
278 /* If the context record is used as an IN OUT parameter to capture */
279 /* the context of a thread, then only those portions of the thread's */
280 /* context corresponding to set flags will be returned. */
282 /* The context record is never used as an OUT only parameter. */
285 ULONG ContextFlags;
287 /* This section is specified/returned if the ContextFlags word contains */
288 /* the flag CONTEXT_INTEGER. */
290 /* N.B. The registers RA and R15 are defined in this section, but are */
291 /* considered part of the control context rather than part of the integer */
292 /* context. */
294 ULONG PR;
295 ULONG MACH;
296 ULONG MACL;
297 ULONG GBR;
298 ULONG R0;
299 ULONG R1;
300 ULONG R2;
301 ULONG R3;
302 ULONG R4;
303 ULONG R5;
304 ULONG R6;
305 ULONG R7;
306 ULONG R8;
307 ULONG R9;
308 ULONG R10;
309 ULONG R11;
310 ULONG R12;
311 ULONG R13;
312 ULONG R14;
313 ULONG R15;
315 /* This section is specified/returned if the ContextFlags word contains */
316 /* the flag CONTEXT_CONTROL. */
318 /* N.B. The registers r15 and ra are defined in the integer section, */
319 /* but are considered part of the control context rather than part of */
320 /* the integer context. */
322 ULONG Fir;
323 ULONG Psr;
325 #if !defined(SH3e) && !defined(SH4)
326 ULONG OldStuff[2];
327 DEBUG_REGISTERS DebugRegisters;
328 #else
329 ULONG Fpscr;
330 ULONG Fpul;
331 ULONG FRegs[16];
332 #if defined(SH4)
333 ULONG xFRegs[16];
334 #endif
335 #endif
336 } CONTEXT;
338 #elif defined(MIPS)
340 /* The following flags control the contents of the CONTEXT structure. */
342 #define CONTEXT_R4000 0x00010000 /* r4000 context */
344 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001L)
345 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002L)
346 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004L)
348 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
350 /* Context Frame */
352 /* N.B. This frame must be exactly a multiple of 16 bytes in length. */
354 /* This frame has a several purposes: 1) it is used as an argument to */
355 /* NtContinue, 2) it is used to constuct a call frame for APC delivery, */
356 /* 3) it is used to construct a call frame for exception dispatching */
357 /* in user mode, and 4) it is used in the user level thread creation */
358 /* routines. */
360 /* The layout of the record conforms to a standard call frame. */
363 typedef struct _CONTEXT {
365 /* This section is always present and is used as an argument build */
366 /* area. */
368 DWORD Argument[4];
370 /* This section is specified/returned if the ContextFlags word contains */
371 /* the flag CONTEXT_FLOATING_POINT. */
373 DWORD FltF0;
374 DWORD FltF1;
375 DWORD FltF2;
376 DWORD FltF3;
377 DWORD FltF4;
378 DWORD FltF5;
379 DWORD FltF6;
380 DWORD FltF7;
381 DWORD FltF8;
382 DWORD FltF9;
383 DWORD FltF10;
384 DWORD FltF11;
385 DWORD FltF12;
386 DWORD FltF13;
387 DWORD FltF14;
388 DWORD FltF15;
389 DWORD FltF16;
390 DWORD FltF17;
391 DWORD FltF18;
392 DWORD FltF19;
393 DWORD FltF20;
394 DWORD FltF21;
395 DWORD FltF22;
396 DWORD FltF23;
397 DWORD FltF24;
398 DWORD FltF25;
399 DWORD FltF26;
400 DWORD FltF27;
401 DWORD FltF28;
402 DWORD FltF29;
403 DWORD FltF30;
404 DWORD FltF31;
406 /* This section is specified/returned if the ContextFlags word contains */
407 /* the flag CONTEXT_INTEGER. */
409 /* N.B. The registers gp, sp, and ra are defined in this section, but are */
410 /* considered part of the control context rather than part of the integer */
411 /* context. */
413 /* N.B. Register zero is not stored in the frame. */
415 DWORD IntZero;
416 DWORD IntAt;
417 DWORD IntV0;
418 DWORD IntV1;
419 DWORD IntA0;
420 DWORD IntA1;
421 DWORD IntA2;
422 DWORD IntA3;
423 DWORD IntT0;
424 DWORD IntT1;
425 DWORD IntT2;
426 DWORD IntT3;
427 DWORD IntT4;
428 DWORD IntT5;
429 DWORD IntT6;
430 DWORD IntT7;
431 DWORD IntS0;
432 DWORD IntS1;
433 DWORD IntS2;
434 DWORD IntS3;
435 DWORD IntS4;
436 DWORD IntS5;
437 DWORD IntS6;
438 DWORD IntS7;
439 DWORD IntT8;
440 DWORD IntT9;
441 DWORD IntK0;
442 DWORD IntK1;
443 DWORD IntGp;
444 DWORD IntSp;
445 DWORD IntS8;
446 DWORD IntRa;
447 DWORD IntLo;
448 DWORD IntHi;
450 /* This section is specified/returned if the ContextFlags word contains */
451 /* the flag CONTEXT_FLOATING_POINT. */
453 DWORD Fsr;
455 /* This section is specified/returned if the ContextFlags word contains */
456 /* the flag CONTEXT_CONTROL. */
458 /* N.B. The registers gp, sp, and ra are defined in the integer section, */
459 /* but are considered part of the control context rather than part of */
460 /* the integer context. */
462 DWORD Fir;
463 DWORD Psr;
465 /* The flags values within this flag control the contents of */
466 /* a CONTEXT record. */
468 /* If the context record is used as an input parameter, then */
469 /* for each portion of the context record controlled by a flag */
470 /* whose value is set, it is assumed that that portion of the */
471 /* context record contains valid context. If the context record */
472 /* is being used to modify a thread's context, then only that */
473 /* portion of the threads context will be modified. */
475 /* If the context record is used as an IN OUT parameter to capture */
476 /* the context of a thread, then only those portions of the thread's */
477 /* context corresponding to set flags will be returned. */
479 /* The context record is never used as an OUT only parameter. */
481 DWORD ContextFlags;
483 DWORD Fill[2];
485 } CONTEXT;
486 #elif defined(ARM)
488 /* The following flags control the contents of the CONTEXT structure. */
490 #define CONTEXT_ARM 0x0000040
491 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
492 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
494 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
496 typedef struct _CONTEXT {
497 /* The flags values within this flag control the contents of
498 a CONTEXT record.
500 If the context record is used as an input parameter, then
501 for each portion of the context record controlled by a flag
502 whose value is set, it is assumed that that portion of the
503 context record contains valid context. If the context record
504 is being used to modify a thread's context, then only that
505 portion of the threads context will be modified.
507 If the context record is used as an IN OUT parameter to capture
508 the context of a thread, then only those portions of the thread's
509 context corresponding to set flags will be returned.
511 The context record is never used as an OUT only parameter. */
513 ULONG ContextFlags;
515 /* This section is specified/returned if the ContextFlags word contains
516 the flag CONTEXT_INTEGER. */
517 ULONG R0;
518 ULONG R1;
519 ULONG R2;
520 ULONG R3;
521 ULONG R4;
522 ULONG R5;
523 ULONG R6;
524 ULONG R7;
525 ULONG R8;
526 ULONG R9;
527 ULONG R10;
528 ULONG R11;
529 ULONG R12;
531 ULONG Sp;
532 ULONG Lr;
533 ULONG Pc;
534 ULONG Psr;
535 } CONTEXT;
537 #else
538 #error "undefined processor type"
539 #endif
541 #endif