dc7b3b228297cb470f4417e1898320e158eceb53
[reactos.git] / reactos / include / ndk / asm.h
1 /*++ NDK Version: 0095
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 asm.h
8
9 Abstract:
10
11 ASM Offsets for dealing with de-referencing structures in registers.
12 C-compatible version of the file ks386.inc present in the newest WDK.
13
14 Author:
15
16 Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
17
18 --*/
19
20 #ifndef _ASM_H
21 #define _ASM_H
22
23 //
24 // PCR Access
25 //
26 #ifdef __ASM__
27 #ifdef CONFIG_SMP
28 #define PCR fs:
29 #else
30 #define PCR ds:[0xFFDFF000]
31 #endif
32 #endif
33
34 //
35 // CPU Modes
36 //
37 #define KernelMode 0x0
38 #define UserMode 0x1
39
40 //
41 // CPU Types
42 //
43 #define CPU_INTEL 0x1
44 #define CPU_AMD 0x2
45
46 //
47 // Selector Names
48 //
49 #ifdef __ASM__
50 #define RPL_MASK 0x0003
51 #define MODE_MASK 0x0001
52 #define KGDT_R0_CODE (0x8)
53 #define KGDT_R0_DATA (0x10)
54 #define KGDT_R3_CODE (0x18)
55 #define KGDT_R3_DATA (0x20)
56 #define KGDT_TSS (0x28)
57 #define KGDT_R0_PCR (0x30)
58 #define KGDT_R3_TEB (0x38)
59 #define KGDT_LDT (0x48)
60 #define KGDT_DF_TSS (0x50)
61 #define KGDT_NMI_TSS (0x58)
62 #endif
63
64 //
65 // KV86M_REGISTERS Offsets
66 //
67 #define KV86M_REGISTERS_EBP 0x0
68 #define KV86M_REGISTERS_EDI 0x4
69 #define KV86M_REGISTERS_ESI 0x8
70 #define KV86M_REGISTERS_EDX 0xC
71 #define KV86M_REGISTERS_ECX 0x10
72 #define KV86M_REGISTERS_EBX 0x14
73 #define KV86M_REGISTERS_EAX 0x18
74 #define KV86M_REGISTERS_DS 0x1C
75 #define KV86M_REGISTERS_ES 0x20
76 #define KV86M_REGISTERS_FS 0x24
77 #define KV86M_REGISTERS_GS 0x28
78 #define KV86M_REGISTERS_EIP 0x2C
79 #define KV86M_REGISTERS_CS 0x30
80 #define KV86M_REGISTERS_EFLAGS 0x34
81 #define KV86M_REGISTERS_ESP 0x38
82 #define KV86M_REGISTERS_SS 0x3C
83 #define TF_SAVED_EXCEPTION_STACK 0x8C
84 #define TF_REGS 0x90
85 #define TF_ORIG_EBP 0x94
86
87 //
88 // TSS Offsets
89 //
90 #define KTSS_ESP0 0x4
91 #define KTSS_CR3 0x1C
92 #define KTSS_EFLAGS 0x24
93 #define KTSS_IOMAPBASE 0x66
94 #define KTSS_IO_MAPS 0x68
95
96 //
97 // KTHREAD Offsets
98 //
99 #define KTHREAD_DEBUG_ACTIVE 0x03
100 #define KTHREAD_INITIAL_STACK 0x18
101 #define KTHREAD_STACK_LIMIT 0x1C
102 #define KTHREAD_TEB 0x74
103 #define KTHREAD_KERNEL_STACK 0x20
104 #define KTHREAD_ALERTED 0x5E
105 #define KTHREAD_APCSTATE_PROCESS 0x28 + 0x10
106 #define KTHREAD_PENDING_USER_APC 0x28 + 0x16
107 #define KTHREAD_PENDING_KERNEL_APC 0x28 + 0x15
108 #define KTHREAD_CONTEXT_SWITCHES 0x48
109 #define KTHREAD_STATE_ 0x4C
110 #define KTHREAD_NPX_STATE 0x4D
111 #define KTHREAD_WAIT_IRQL 0x4E
112 #define KTHREAD_NEXT_PROCESSOR 0x40
113 #define KTHREAD_WAIT_REASON 0x5A
114 #define KTHREAD_PRIORITY 0x5B
115 #define KTHREAD_SWAP_BUSY 0x5D
116 #define KTHREAD_SERVICE_TABLE 0x118
117 #define KTHREAD_PREVIOUS_MODE 0xD7
118 #define KTHREAD_COMBINED_APC_DISABLE 0x70
119 #define KTHREAD_SPECIAL_APC_DISABLE 0x72
120 #define KTHREAD_LARGE_STACK 0x107
121 #define KTHREAD_TRAP_FRAME 0x110
122 #define KTHREAD_CALLBACK_STACK 0x114
123 #define KTHREAD_APC_STATE_INDEX 0x11C
124 #define KTHREAD_STACK_BASE 0x158
125 #define KTHREAD_QUANTUM 0x15D
126 #define KTHREAD_KERNEL_TIME 0x160
127 #define KTHREAD_USER_TIME 0x18C
128
129 //
130 // KPROCESS Offsets
131 //
132 #define KPROCESS_DIRECTORY_TABLE_BASE 0x18
133 #define KPROCESS_LDT_DESCRIPTOR0 0x20
134 #define KPROCESS_LDT_DESCRIPTOR1 0x24
135 #define KPROCESS_INT21_DESCRIPTOR0 0x28
136 #define KPROCESS_INT21_DESCRIPTOR1 0x2C
137 #define KPROCESS_IOPM_OFFSET 0x30
138 #define KPROCESS_ACTIVE_PROCESSORS 0x34
139 #define EPROCESS_VDM_OBJECTS 0x144
140
141 //
142 // KTIMER_TABLE Offsets
143 //
144 #ifdef __ASM__
145 #define KTIMER_TABLE_ENTRY 0x00
146 #define KTIMER_TABLE_TIME 0x08
147 #define TIMER_ENTRY_SIZE 0x10
148 #define TIMER_TABLE_SIZE 0x200
149 #endif
150
151 //
152 // KPRCB Offsets
153 //
154 #define KPRCB_DR0 0x2F8
155 #define KPRCB_DR1 0x2FC
156 #define KPRCB_DR2 0x300
157 #define KPRCB_DR3 0x304
158 #define KPRCB_DR6 0x308
159 #define KPRCB_DR7 0x30C
160 #define KPRCB_TIMER_HAND 0x964
161 #define KPRCB_TIMER_REQUEST 0x968
162
163 //
164 // KPCR Offsets
165 //
166 #define KPCR_EXCEPTION_LIST 0x0
167 #define KPCR_INITIAL_STACK 0x4
168 #define KPCR_STACK_LIMIT 0x8
169 #define KPCR_PERF_GLOBAL_GROUP_MASK 0x8
170 #define KPCR_CONTEXT_SWITCHES 0x10
171 #define KPCR_SET_MEMBER_COPY 0x14
172 #define KPCR_TEB 0x18
173 #define KPCR_SELF 0x1C
174 #define KPCR_PRCB 0x20
175 #define KPCR_IRQL 0x24
176 #define KPCR_IRR 0x28
177 #define KPCR_IRR_ACTIVE 0x2C
178 #define KPCR_IDR 0x30
179 #define KPCR_KD_VERSION_BLOCK 0x34
180 #define KPCR_IDT 0x38
181 #define KPCR_GDT 0x3C
182 #define KPCR_TSS 0x40
183 #define KPCR_STALL_SCALE_FACTOR 0x4C
184 #define KPCR_SET_MEMBER 0x48
185 #define KPCR_NUMBER 0x51
186 #define KPCR_VDM_ALERT 0x54
187 #define KPCR_PRCB_DATA 0x120
188 #define KPCR_CURRENT_THREAD 0x124
189 #define KPCR_PRCB_NEXT_THREAD 0x128
190 #define KPCR_PRCB_IDLE_THREAD 0x12C
191 #define KPCR_PROCESSOR_NUMBER 0x130
192 #define KPCR_PRCB_SET_MEMBER 0x134
193 #define KPCR_PRCB_CPU_TYPE 0x138
194 #define KPCR_PRCB_PRCB_LOCK 0xA7C
195 #define KPCR_NPX_THREAD 0x640
196 #define KPCR_DR6 0x428
197 #define KPCR_DR7 0x42C
198 #define KPCR_PRCB_INTERRUPT_COUNT 0x644
199 #define KPCR_PRCB_KERNEL_TIME 0x648
200 #define KPCR_PRCB_USER_TIME 0x64C
201 #define KPCR_PRCB_DPC_TIME 0x650
202 #define KPCR_PRCB_DEBUG_DPC_TIME 0x654
203 #define KPCR_PRCB_INTERRUPT_TIME 0x658
204 #define KPCR_PRCB_ADJUST_DPC_THRESHOLD 0x65C
205 #define KPCR_PRCB_SKIP_TICK 0x664
206 #define KPCR_SYSTEM_CALLS 0x6B8
207 #define KPCR_PRCB_DPC_QUEUE_DEPTH 0xA4C
208 #define KPCR_PRCB_DPC_COUNT 0xA50
209 #define KPCR_PRCB_DPC_STACK 0xA68
210 #define KPCR_PRCB_MAXIMUM_DPC_QUEUE_DEPTH 0xA6C
211 #define KPCR_PRCB_DPC_REQUEST_RATE 0xA70
212 #define KPCR_PRCB_DPC_INTERRUPT_REQUESTED 0xA78
213 #define KPCR_PRCB_DPC_ROUTINE_ACTIVE 0xA7A
214 #define KPCR_PRCB_DPC_LAST_COUNT 0xA80
215 #define KPCR_PRCB_TIMER_REQUEST 0xA88
216 #define KPCR_PRCB_QUANTUM_END 0xAA1
217 #define KPCR_PRCB_DEFERRED_READY_LIST_HEAD 0xC10
218 #define KPCR_PRCB_POWER_STATE_IDLE_FUNCTION 0xEC0
219
220 //
221 // KINTERRUPT Offsets
222 //
223 #define KINTERRUPT_SERVICE_ROUTINE 0x0C
224 #define KINTERRUPT_SERVICE_CONTEXT 0x10
225 #define KINTERRUPT_TICK_COUNT 0x18
226 #define KINTERRUPT_ACTUAL_LOCK 0x1C
227 #define KINTERRUPT_IRQL 0x20
228 #define KINTERRUPT_VECTOR 0x24
229 #define KINTERRUPT_SYNCHRONIZE_IRQL 0x29
230 #define KINTERRUPT_DISPATCH_COUNT 0x38
231
232 //
233 // KGDTENTRY Offsets
234 //
235 #define KGDT_BASE_LOW 0x2
236 #define KGDT_BASE_MID 0x4
237 #define KGDT_BASE_HI 0x7
238 #define KGDT_LIMIT_HI 0x6
239 #define KGDT_LIMIT_LOW 0x0
240
241 //
242 // FPU Save Area Offsets
243 //
244 #define FP_CONTROL_WORD 0x0
245 #define FP_STATUS_WORD 0x4
246 #define FP_TAG_WORD 0x8
247 #define FP_ERROR_OFFSET 0xC
248 #define FP_ERROR_SELECTOR 0x10
249 #define FP_DATA_OFFSET 0x14
250 #define FP_DATA_SELECTOR 0x18
251 #define FN_CR0_NPX_STATE 0x20C
252 #define SIZEOF_FX_SAVE_AREA 528
253 #define NPX_FRAME_LENGTH 0x210
254
255 //
256 // FX Save Area Offsets
257 //
258 #define FX_CONTROL_WORD 0x0
259 #define FX_STATUS_WORD 0x2
260 #define FX_TAG_WORD 0x4
261 #define FX_ERROR_OPCODE 0x6
262 #define FX_ERROR_OFFSET 0x8
263 #define FX_ERROR_SELECTOR 0xC
264 #define FX_DATA_OFFSET 0x10
265 #define FX_DATA_SELECTOR 0x14
266 #define FX_MXCSR 0x18
267
268 //
269 // NPX States
270 //
271 #define NPX_STATE_NOT_LOADED 0xA
272 #define NPX_STATE_LOADED 0x0
273
274 //
275 // Trap Frame Offsets
276 //
277 #define KTRAP_FRAME_DEBUGEBP 0x0
278 #define KTRAP_FRAME_DEBUGEIP 0x4
279 #define KTRAP_FRAME_DEBUGARGMARK 0x8
280 #define KTRAP_FRAME_DEBUGPOINTER 0xC
281 #define KTRAP_FRAME_TEMPCS 0x10
282 #define KTRAP_FRAME_TEMPESP 0x14
283 #define KTRAP_FRAME_DR0 0x18
284 #define KTRAP_FRAME_DR1 0x1C
285 #define KTRAP_FRAME_DR2 0x20
286 #define KTRAP_FRAME_DR3 0x24
287 #define KTRAP_FRAME_DR6 0x28
288 #define KTRAP_FRAME_DR7 0x2C
289 #define KTRAP_FRAME_GS 0x30
290 #define KTRAP_FRAME_RESERVED1 0x32
291 #define KTRAP_FRAME_ES 0x34
292 #define KTRAP_FRAME_RESERVED2 0x36
293 #define KTRAP_FRAME_DS 0x38
294 #define KTRAP_FRAME_RESERVED3 0x3A
295 #define KTRAP_FRAME_EDX 0x3C
296 #define KTRAP_FRAME_ECX 0x40
297 #define KTRAP_FRAME_EAX 0x44
298 #define KTRAP_FRAME_PREVIOUS_MODE 0x48
299 #define KTRAP_FRAME_EXCEPTION_LIST 0x4C
300 #define KTRAP_FRAME_FS 0x50
301 #define KTRAP_FRAME_RESERVED4 0x52
302 #define KTRAP_FRAME_EDI 0x54
303 #define KTRAP_FRAME_ESI 0x58
304 #define KTRAP_FRAME_EBX 0x5C
305 #define KTRAP_FRAME_EBP 0x60
306 #define KTRAP_FRAME_ERROR_CODE 0x64
307 #define KTRAP_FRAME_EIP 0x68
308 #define KTRAP_FRAME_CS 0x6C
309 #define KTRAP_FRAME_EFLAGS 0x70
310 #define KTRAP_FRAME_ESP 0x74
311 #define KTRAP_FRAME_SS 0x78
312 #define KTRAP_FRAME_RESERVED5 0x7A
313 #define KTRAP_FRAME_V86_ES 0x7C
314 #define KTRAP_FRAME_RESERVED6 0x7E
315 #define KTRAP_FRAME_V86_DS 0x80
316 #define KTRAP_FRAME_RESERVED7 0x82
317 #define KTRAP_FRAME_V86_FS 0x84
318 #define KTRAP_FRAME_RESERVED8 0x86
319 #define KTRAP_FRAME_V86_GS 0x88
320 #define KTRAP_FRAME_RESERVED9 0x8A
321 #define KTRAP_FRAME_SIZE 0x8C
322 #define KTRAP_FRAME_LENGTH 0x8C
323 #define KTRAP_FRAME_ALIGN 0x04
324 #define FRAME_EDITED 0xFFF8
325
326 //
327 // KUSER_SHARED_DATA Offsets
328 //
329 #ifdef __ASM__
330 #define USER_SHARED_DATA 0xFFDF0000
331 #endif
332 #define USER_SHARED_DATA_INTERRUPT_TIME 0x8
333 #define USER_SHARED_DATA_SYSTEM_TIME 0x14
334 #define USER_SHARED_DATA_TICK_COUNT 0x320
335
336 //
337 // KUSER_SHARED_DATA Offsets (this stuff is trash)
338 //
339 #define KERNEL_USER_SHARED_DATA 0x7FFE0000
340 #define KUSER_SHARED_PROCESSOR_FEATURES KERNEL_USER_SHARED_DATA + 0x274
341 #define KUSER_SHARED_SYSCALL KERNEL_USER_SHARED_DATA + 0x300
342 #define KUSER_SHARED_SYSCALL_RET KERNEL_USER_SHARED_DATA + 0x304
343 #define PROCESSOR_FEATURE_FXSR KUSER_SHARED_PROCESSOR_FEATURES + 0x4
344
345 //
346 // CONTEXT Offsets
347 //
348 #define CONTEXT_FLAGS 0x0
349 #define CONTEXT_DR6 0x14
350 #define CONTEXT_FLOAT_SAVE 0x1C
351 #define CONTEXT_SEGGS 0x8C
352 #define CONTEXT_SEGFS 0x90
353 #define CONTEXT_SEGES 0x94
354 #define CONTEXT_SEGDS 0x98
355 #define CONTEXT_EDI 0x9C
356 #define CONTEXT_ESI 0xA0
357 #define CONTEXT_EBX 0xA4
358 #define CONTEXT_EDX 0xA8
359 #define CONTEXT_ECX 0xAC
360 #define CONTEXT_EAX 0xB0
361 #define CONTEXT_EBP 0xB4
362 #define CONTEXT_EIP 0xB8
363 #define CONTEXT_SEGCS 0xBC
364 #define CONTEXT_EFLAGS 0xC0
365 #define CONTEXT_ESP 0xC4
366 #define CONTEXT_SEGSS 0xC8
367 #define CONTEXT_FLOAT_SAVE_CONTROL_WORD CONTEXT_FLOAT_SAVE + FP_CONTROL_WORD
368 #define CONTEXT_FLOAT_SAVE_STATUS_WORD CONTEXT_FLOAT_SAVE + FP_STATUS_WORD
369 #define CONTEXT_FLOAT_SAVE_TAG_WORD CONTEXT_FLOAT_SAVE + FP_TAG_WORD
370 #define CONTEXT_ALIGNED_SIZE 0x2CC
371
372 //
373 // EXCEPTION_RECORD Offsets
374 //
375 #define EXCEPTION_RECORD_EXCEPTION_CODE 0x0
376 #define EXCEPTION_RECORD_EXCEPTION_FLAGS 0x4
377 #define EXCEPTION_RECORD_EXCEPTION_RECORD 0x8
378 #define EXCEPTION_RECORD_EXCEPTION_ADDRESS 0xC
379 #define EXCEPTION_RECORD_NUMBER_PARAMETERS 0x10
380 #define SIZEOF_EXCEPTION_RECORD 0x14
381 #define EXCEPTION_RECORD_LENGTH 0x50
382
383 //
384 // Exception types
385 //
386 #ifdef __ASM__
387 #define EXCEPTION_NONCONTINUABLE 0x0001
388 #define EXCEPTION_UNWINDING 0x0002
389 #define EXCEPTION_EXIT_UNWIND 0x0004
390 #define EXCEPTION_STACK_INVALID 0x0008
391 #define EXCEPTION_NESTED_CALL 0x00010
392 #define EXCEPTION_TARGET_UNWIND 0x00020
393 #define EXCEPTION_COLLIDED_UNWIND 0x00040
394 #define EXCEPTION_UNWIND 0x00066
395 #define EXCEPTION_EXECUTE_HANDLER 0x00001
396 #define EXCEPTION_CONTINUE_SEARCH 0x00000
397 #define EXCEPTION_CONTINUE_EXECUTION 0xFFFFFFFF
398 #define EXCEPTION_CHAIN_END 0xFFFFFFFF
399 #endif
400
401 //
402 // TEB Offsets
403 //
404 #define TEB_EXCEPTION_LIST 0x0
405 #define TEB_STACK_BASE 0x4
406 #define TEB_STACK_LIMIT 0x8
407 #define TEB_FIBER_DATA 0x10
408 #define TEB_PEB 0x30
409 #define TEB_EXCEPTION_CODE 0x1A4
410 #define TEB_ACTIVATION_CONTEXT_STACK_POINTER 0x1A8
411 #define TEB_DEALLOCATION_STACK 0xE0C
412 #define TEB_GDI_BATCH_COUNT 0xF70
413 #define TEB_GUARANTEED_STACK_BYTES 0xF78
414 #define TEB_FLS_DATA 0xFB4
415
416 //
417 // PEB Offsets
418 //
419 #define PEB_KERNEL_CALLBACK_TABLE 0x2C
420
421 //
422 // FIBER Offsets
423 //
424 #define FIBER_PARAMETER 0x0
425 #define FIBER_EXCEPTION_LIST 0x4
426 #define FIBER_STACK_BASE 0x8
427 #define FIBER_STACK_LIMIT 0xC
428 #define FIBER_DEALLOCATION_STACK 0x10
429 #define FIBER_CONTEXT 0x14
430 #define FIBER_GUARANTEED_STACK_BYTES 0x2E0
431 #define FIBER_FLS_DATA 0x2E4
432 #define FIBER_ACTIVATION_CONTEXT_STACK 0x2E8
433 #define FIBER_CONTEXT_FLAGS FIBER_CONTEXT + CONTEXT_FLAGS
434 #define FIBER_CONTEXT_EAX FIBER_CONTEXT + CONTEXT_EAX
435 #define FIBER_CONTEXT_EBX FIBER_CONTEXT + CONTEXT_EBX
436 #define FIBER_CONTEXT_ECX FIBER_CONTEXT + CONTEXT_ECX
437 #define FIBER_CONTEXT_EDX FIBER_CONTEXT + CONTEXT_EDX
438 #define FIBER_CONTEXT_ESI FIBER_CONTEXT + CONTEXT_ESI
439 #define FIBER_CONTEXT_EDI FIBER_CONTEXT + CONTEXT_EDI
440 #define FIBER_CONTEXT_EBP FIBER_CONTEXT + CONTEXT_EBP
441 #define FIBER_CONTEXT_ESP FIBER_CONTEXT + CONTEXT_ESP
442 #define FIBER_CONTEXT_DR6 FIBER_CONTEXT + CONTEXT_DR6
443 #define FIBER_CONTEXT_FLOAT_SAVE_STATUS_WORD FIBER_CONTEXT + CONTEXT_FLOAT_SAVE_STATUS_WORD
444 #define FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD FIBER_CONTEXT + CONTEXT_FLOAT_SAVE_CONTROL_WORD
445 #define FIBER_CONTEXT_FLOAT_SAVE_TAG_WORD FIBER_CONTEXT + CONTEXT_FLOAT_SAVE_TAG_WORD
446
447 //
448 // EFLAGS
449 //
450 #ifdef __ASM__
451 #define EFLAGS_TF 0x100
452 #define EFLAGS_INTERRUPT_MASK 0x200
453 #define EFLAGS_IOPL 0x3000
454 #define EFLAGS_NESTED_TASK 0x4000
455 #define EFLAGS_V86_MASK 0x20000
456 #define EFLAGS_ALIGN_CHECK 0x40000
457 #define EFLAGS_VIF 0x80000
458 #define EFLAGS_VIP 0x100000
459 #define EFLAG_SIGN 0x8000
460 #define EFLAG_ZERO 0x4000
461 #define EFLAG_SELECT (EFLAG_SIGN + EFLAG_ZERO)
462 #endif
463 #define EFLAGS_USER_SANITIZE 0x3F4DD7
464
465 //
466 // CR0
467 //
468 #define CR0_PE 0x1
469 #define CR0_MP 0x2
470 #define CR0_EM 0x4
471 #define CR0_TS 0x8
472 #define CR0_ET 0x10
473 #define CR0_NE 0x20
474 #define CR0_WP 0x10000
475 #define CR0_AM 0x40000
476 #define CR0_NW 0x20000000
477 #define CR0_CD 0x40000000
478 #define CR0_PG 0x80000000
479
480 //
481 // CR4
482 //
483 #ifdef __ASM__
484 #define CR4_VME 0x1
485 #define CR4_PVI 0x2
486 #define CR4_TSD 0x4
487 #define CR4_DE 0x8
488 #define CR4_PSE 0x10
489 #define CR4_PAE 0x20
490 #define CR4_MCE 0x40
491 #define CR4_PGE 0x80
492 #define CR4_FXSR 0x200
493 #define CR4_XMMEXCPT 0x400
494 #endif
495
496 //
497 // DR6 and 7 Masks
498 //
499 #define DR6_LEGAL 0xE00F
500 #define DR7_LEGAL 0xFFFF0155
501 #define DR7_ACTIVE 0x55
502 #define DR7_OVERRIDE_V 0x04
503 #define DR7_RESERVED_MASK 0xDC00
504 #define DR7_OVERRIDE_MASK 0xF0000
505
506 //
507 // Usermode callout frame definitions
508 //
509 #define CBSTACK_STACK 0x0
510 #define CBSTACK_TRAP_FRAME 0x4
511 #define CBSTACK_CALLBACK_STACK 0x8
512 #define CBSTACK_EBP 0x18
513 #define CBSTACK_RESULT 0x20
514 #define CBSTACK_RESULT_LENGTH 0x24
515
516 //
517 // NTSTATUS and Bugcheck Codes
518 //
519 #ifdef __ASM__
520 #define STATUS_ACCESS_VIOLATION 0xC0000005
521 #define STATUS_IN_PAGE_ERROR 0xC0000006
522 #define STATUS_GUARD_PAGE_VIOLATION 0x80000001
523 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
524 #define STATUS_STACK_OVERFLOW 0xC00000FD
525 #define KI_EXCEPTION_ACCESS_VIOLATION 0x10000004
526 #define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C
527 #define STATUS_NO_CALLBACK_ACTIVE 0xC0000258
528 #define STATUS_CALLBACK_POP_STACK 0xC0000423
529 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
530 #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
531 #define STATUS_INVALID_LOCK_SEQUENCE 0xC000001E
532 #define STATUS_BREAKPOINT 0x80000003
533 #define STATUS_SINGLE_STEP 0x80000004
534 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
535 #define STATUS_INTEGER_OVERFLOW 0xC0000095
536 #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
537 #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
538 #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
539 #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
540 #define STATUS_FLOAT_OVERFLOW 0xC0000091
541 #define STATUS_FLOAT_STACK_CHECK 0xC0000092
542 #define STATUS_FLOAT_UNDERFLOW 0xC0000093
543 #define STATUS_FLOAT_MULTIPLE_FAULTS 0xC00002B4
544 #define STATUS_FLOAT_MULTIPLE_TRAPS 0xC00002B5
545 #define APC_INDEX_MISMATCH 0x01
546 #define IRQL_NOT_GREATER_OR_EQUAL 0x09
547 #define IRQL_NOT_LESS_OR_EQUAL 0x0A
548 #define TRAP_CAUSE_UNKNOWN 0x12
549 #define KMODE_EXCEPTION_NOT_HANDLED 0x13
550 #define IRQL_GT_ZERO_AT_SYSTEM_SERVICE 0x4A
551 #define UNEXPECTED_KERNEL_MODE_TRAP 0x7F
552 #define ATTEMPTED_SWITCH_FROM_DPC 0xB8
553 #define HARDWARE_INTERRUPT_STORM 0xF2
554
555 //
556 // IRQL Levels
557 //
558 #define PASSIVE_LEVEL 0x0
559 #define APC_LEVEL 0x1
560 #define DISPATCH_LEVEL 0x2
561 #define CLOCK2_LEVEL 0x1C
562 #define HIGH_LEVEL 0x1F
563
564 //
565 // Quantum Decrements
566 //
567 #define CLOCK_QUANTUM_DECREMENT 0x3
568 #endif
569
570 //
571 // System Call Table definitions
572 //
573 #define NUMBER_SERVICE_TABLES 0x0002
574 #define SERVICE_NUMBER_MASK 0x0FFF
575 #define SERVICE_TABLE_SHIFT 0x0008
576 #define SERVICE_TABLE_MASK 0x0010
577 #define SERVICE_TABLE_TEST 0x0010
578 #define SERVICE_DESCRIPTOR_BASE 0x0000
579 #define SERVICE_DESCRIPTOR_COUNT 0x0004
580 #define SERVICE_DESCRIPTOR_LIMIT 0x0008
581 #define SERVICE_DESCRIPTOR_NUMBER 0x000C
582 #define SERVICE_DESCRIPTOR_LENGTH 0x0010
583
584 //
585 // VDM State Pointer
586 //
587 #define FIXED_NTVDMSTATE_LINEAR_PC_AT 0x714
588
589 //
590 // Machine types
591 //
592 #ifdef __ASM__
593 #define MACHINE_TYPE_ISA 0x0000
594 #define MACHINE_TYPE_EISA 0x0001
595 #define MACHINE_TYPE_MCA 0x0002
596
597 //
598 // Kernel Feature Bits
599 //
600 #define KF_RDTSC 0x00000002
601
602 //
603 // Kernel Stack Size
604 //
605 #define KERNEL_STACK_SIZE 0x3000
606 #endif
607
608 //
609 // Generic Definitions
610 //
611 #define PRIMARY_VECTOR_BASE 0x30 // FIXME: HACK
612 #define MAXIMUM_IDTVECTOR 0xFF
613 #endif // !_ASM_H
614
615
616
617
618