[TRANSLATION] Update Chinese translation. (#1223)
[reactos.git] / subsystems / mvdm / ntvdm / cpu / x86context.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: subsystems/mvdm/ntvdm/cpu/x86context.h
5 * PURPOSE: x86 CPU Context Frame definitions
6 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
7 *
8 * NOTE: Taken from the PSDK.
9 */
10
11 #ifndef __X86CONTEXT_H__
12 #define __X86CONTEXT_H__
13
14 #pragma once
15
16 /* Clean everything that may have been defined before */
17 #undef SIZE_OF_80387_REGISTERS
18 #undef MAXIMUM_SUPPORTED_EXTENSION
19 #undef CONTEXT_i386
20 #undef CONTEXT_i486
21 #undef CONTEXT_CONTROL
22 #undef CONTEXT_INTEGER
23 #undef CONTEXT_SEGMENTS
24 #undef CONTEXT_FLOATING_POINT
25 #undef CONTEXT_DEBUG_REGISTERS
26 #undef CONTEXT_EXTENDED_REGISTERS
27 #undef CONTEXT_FULL
28 #undef CONTEXT_ALL
29 #undef CONTEXT_DEBUGGER
30 #undef CONTEXT_XSTATE
31
32
33
34 #define SIZE_OF_80387_REGISTERS 80
35 #define MAXIMUM_SUPPORTED_EXTENSION 512
36
37 #define CONTEXT_i386 0x00010000
38 #define CONTEXT_i486 0x00010000
39
40 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L) // SS:SP, CS:IP, FLAGS, BP
41 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L) // AX, BX, CX, DX, SI, DI
42 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L) // DS, ES, FS, GS
43 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L) // 387 state
44 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L) // DB 0-3,6,7
45 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L) // CPU-specific extensions
46
47 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
48 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
49 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | \
50 CONTEXT_EXTENDED_REGISTERS)
51
52 #define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
53 #define CONTEXT_XSTATE (CONTEXT_i386 | 0x00000040L)
54
55
56 typedef struct _X87FLOATING_SAVE_AREA
57 {
58 ULONG ControlWord;
59 ULONG StatusWord;
60 ULONG TagWord;
61 ULONG ErrorOffset;
62 ULONG ErrorSelector;
63 ULONG DataOffset;
64 ULONG DataSelector;
65 UCHAR RegisterArea[SIZE_OF_80387_REGISTERS];
66 ULONG Cr0NpxState;
67 } X87FLOATING_SAVE_AREA, *PX87FLOATING_SAVE_AREA;
68
69 #include "pshpack4.h"
70 /*
71 * x86 CPU Context Frame
72 */
73 typedef struct _X86CONTEXT
74 {
75 /*
76 * The flags values within this flag control the contents of
77 * a CONTEXT record.
78 */
79 ULONG ContextFlags;
80
81 /*
82 * Section specified/returned if CONTEXT_DEBUG_REGISTERS
83 * is set in ContextFlags.
84 */
85 ULONG Dr0;
86 ULONG Dr1;
87 ULONG Dr2;
88 ULONG Dr3;
89 ULONG Dr6;
90 ULONG Dr7;
91
92 /*
93 * Section specified/returned if CONTEXT_FLOATING_POINT
94 * is set in ContextFlags.
95 */
96 X87FLOATING_SAVE_AREA FloatSave;
97
98 /*
99 * Section specified/returned if CONTEXT_SEGMENTS
100 * is set in ContextFlags.
101 */
102 ULONG SegGs;
103 ULONG SegFs;
104 ULONG SegEs;
105 ULONG SegDs;
106
107 /*
108 * Section specified/returned if CONTEXT_INTEGER
109 * is set in ContextFlags.
110 */
111 ULONG Edi;
112 ULONG Esi;
113 ULONG Ebx;
114 ULONG Edx;
115 ULONG Ecx;
116 ULONG Eax;
117
118 /*
119 * Section specified/returned if CONTEXT_CONTROL
120 * is set in ContextFlags.
121 */
122 ULONG Ebp;
123 ULONG Eip;
124 ULONG SegCs;
125 ULONG EFlags;
126 ULONG Esp;
127 ULONG SegSs;
128
129 /*
130 * Section specified/returned if CONTEXT_EXTENDED_REGISTERS
131 * is set in ContextFlags. The format and contexts are processor specific.
132 */
133 UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
134 } X86CONTEXT;
135 #include "poppack.h"
136
137 #endif /* __X86CONTEXT_H__ */