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