1 | /** @file
|
---|
2 | * CPUM - CPU Monitor(/ Manager), Context Structures from v1.6 (saved state).
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2012 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_vmm_cpumctx_v1_6_h
|
---|
27 | #define ___VBox_vmm_cpumctx_v1_6_h
|
---|
28 |
|
---|
29 | #include <iprt/x86.h>
|
---|
30 |
|
---|
31 |
|
---|
32 | RT_C_DECLS_BEGIN
|
---|
33 |
|
---|
34 | /** @addgroup grp_cpum_ctx_v1_6 The CPUM Context Structures from v1.6
|
---|
35 | * @ingroup grp_cpum
|
---|
36 | * @{
|
---|
37 | */
|
---|
38 |
|
---|
39 | #pragma pack(1)
|
---|
40 | /** IDTR from version 1.6 */
|
---|
41 | typedef struct VBOXIDTR_VER1_6
|
---|
42 | {
|
---|
43 | /** Size of the IDT. */
|
---|
44 | uint16_t cbIdt;
|
---|
45 | /** Address of the IDT. */
|
---|
46 | uint32_t pIdt;
|
---|
47 | } VBOXIDTR_VER1_6;
|
---|
48 | #pragma pack()
|
---|
49 |
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * Selector hidden registers, for version 1.6 saved state.
|
---|
53 | */
|
---|
54 | typedef struct CPUMSELREGHID_VER1_6
|
---|
55 | {
|
---|
56 | /** Base register. */
|
---|
57 | uint32_t u32Base;
|
---|
58 | /** Limit (expanded). */
|
---|
59 | uint32_t u32Limit;
|
---|
60 | /** Flags.
|
---|
61 | * This is the high 32-bit word of the descriptor entry.
|
---|
62 | * Only the flags, dpl and type are used. */
|
---|
63 | X86DESCATTR Attr;
|
---|
64 | } CPUMSELREGHID_VER1_6;
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * CPU context, for version 1.6 saved state.
|
---|
68 | * @remarks PATM uses this, which is why it has to be here.
|
---|
69 | */
|
---|
70 | # pragma pack(1)
|
---|
71 | typedef struct CPUMCTX_VER1_6
|
---|
72 | {
|
---|
73 | /** FPU state. (16-byte alignment)
|
---|
74 | * @todo This doesn't have to be in X86FXSTATE on CPUs without fxsr - we need a type for the
|
---|
75 | * actual format or convert it (waste of time). */
|
---|
76 | X86FXSTATE fpu;
|
---|
77 |
|
---|
78 | /** CPUMCTXCORE Part.
|
---|
79 | * @{ */
|
---|
80 | union
|
---|
81 | {
|
---|
82 | uint32_t edi;
|
---|
83 | uint64_t rdi;
|
---|
84 | } CPUM_UNION_NAME(rdi);
|
---|
85 | union
|
---|
86 | {
|
---|
87 | uint32_t esi;
|
---|
88 | uint64_t rsi;
|
---|
89 | } CPUM_UNION_NAME(rsi);
|
---|
90 | union
|
---|
91 | {
|
---|
92 | uint32_t ebp;
|
---|
93 | uint64_t rbp;
|
---|
94 | } CPUM_UNION_NAME(rbp);
|
---|
95 | union
|
---|
96 | {
|
---|
97 | uint32_t eax;
|
---|
98 | uint64_t rax;
|
---|
99 | } CPUM_UNION_NAME(rax);
|
---|
100 | union
|
---|
101 | {
|
---|
102 | uint32_t ebx;
|
---|
103 | uint64_t rbx;
|
---|
104 | } CPUM_UNION_NAME(rbx);
|
---|
105 | union
|
---|
106 | {
|
---|
107 | uint32_t edx;
|
---|
108 | uint64_t rdx;
|
---|
109 | } CPUM_UNION_NAME(rdx);
|
---|
110 | union
|
---|
111 | {
|
---|
112 | uint32_t ecx;
|
---|
113 | uint64_t rcx;
|
---|
114 | } CPUM_UNION_NAME(rcx);
|
---|
115 | /** @note We rely on the exact layout, because we use lss esp, [] in the
|
---|
116 | * switcher. */
|
---|
117 | uint32_t esp;
|
---|
118 | RTSEL ss;
|
---|
119 | RTSEL ssPadding;
|
---|
120 | /* Note: no overlap with esp here. */
|
---|
121 | uint64_t rsp_notused;
|
---|
122 |
|
---|
123 | RTSEL gs;
|
---|
124 | RTSEL gsPadding;
|
---|
125 | RTSEL fs;
|
---|
126 | RTSEL fsPadding;
|
---|
127 | RTSEL es;
|
---|
128 | RTSEL esPadding;
|
---|
129 | RTSEL ds;
|
---|
130 | RTSEL dsPadding;
|
---|
131 | RTSEL cs;
|
---|
132 | RTSEL csPadding[3]; /**< 3 words to force 8 byte alignment for the remainder. */
|
---|
133 |
|
---|
134 | union
|
---|
135 | {
|
---|
136 | X86EFLAGS eflags;
|
---|
137 | X86RFLAGS rflags;
|
---|
138 | } CPUM_UNION_NAME(rflags);
|
---|
139 | union
|
---|
140 | {
|
---|
141 | uint32_t eip;
|
---|
142 | uint64_t rip;
|
---|
143 | } CPUM_UNION_NAME(rip);
|
---|
144 |
|
---|
145 | uint64_t r8;
|
---|
146 | uint64_t r9;
|
---|
147 | uint64_t r10;
|
---|
148 | uint64_t r11;
|
---|
149 | uint64_t r12;
|
---|
150 | uint64_t r13;
|
---|
151 | uint64_t r14;
|
---|
152 | uint64_t r15;
|
---|
153 |
|
---|
154 | /** Hidden selector registers.
|
---|
155 | * @{ */
|
---|
156 | CPUMSELREGHID_VER1_6 esHid;
|
---|
157 | CPUMSELREGHID_VER1_6 csHid;
|
---|
158 | CPUMSELREGHID_VER1_6 ssHid;
|
---|
159 | CPUMSELREGHID_VER1_6 dsHid;
|
---|
160 | CPUMSELREGHID_VER1_6 fsHid;
|
---|
161 | CPUMSELREGHID_VER1_6 gsHid;
|
---|
162 | /** @} */
|
---|
163 |
|
---|
164 | /** @} */
|
---|
165 |
|
---|
166 | /** Control registers.
|
---|
167 | * @{ */
|
---|
168 | uint64_t cr0;
|
---|
169 | uint64_t cr2;
|
---|
170 | uint64_t cr3;
|
---|
171 | uint64_t cr4;
|
---|
172 | uint64_t cr8;
|
---|
173 | /** @} */
|
---|
174 |
|
---|
175 | /** Debug registers.
|
---|
176 | * @{ */
|
---|
177 | uint64_t dr0;
|
---|
178 | uint64_t dr1;
|
---|
179 | uint64_t dr2;
|
---|
180 | uint64_t dr3;
|
---|
181 | uint64_t dr4; /**< @todo remove dr4 and dr5. */
|
---|
182 | uint64_t dr5;
|
---|
183 | uint64_t dr6;
|
---|
184 | uint64_t dr7;
|
---|
185 | /* DR8-15 are currently not supported */
|
---|
186 | /** @} */
|
---|
187 |
|
---|
188 | /** Global Descriptor Table register. */
|
---|
189 | VBOXGDTR_VER1_6 gdtr;
|
---|
190 | uint16_t gdtrPadding;
|
---|
191 | uint32_t gdtrPadding64;/** @todo fix this hack */
|
---|
192 | /** Interrupt Descriptor Table register. */
|
---|
193 | VBOXIDTR_VER1_6 idtr;
|
---|
194 | uint16_t idtrPadding;
|
---|
195 | uint32_t idtrPadding64;/** @todo fix this hack */
|
---|
196 | /** The task register.
|
---|
197 | * Only the guest context uses all the members. */
|
---|
198 | RTSEL ldtr;
|
---|
199 | RTSEL ldtrPadding;
|
---|
200 | /** The task register.
|
---|
201 | * Only the guest context uses all the members. */
|
---|
202 | RTSEL tr;
|
---|
203 | RTSEL trPadding;
|
---|
204 |
|
---|
205 | /** The sysenter msr registers.
|
---|
206 | * This member is not used by the hypervisor context. */
|
---|
207 | CPUMSYSENTER SysEnter;
|
---|
208 |
|
---|
209 | /** System MSRs.
|
---|
210 | * @{ */
|
---|
211 | uint64_t msrEFER;
|
---|
212 | uint64_t msrSTAR;
|
---|
213 | uint64_t msrPAT;
|
---|
214 | uint64_t msrLSTAR;
|
---|
215 | uint64_t msrCSTAR;
|
---|
216 | uint64_t msrSFMASK;
|
---|
217 | uint64_t msrFSBASE;
|
---|
218 | uint64_t msrGSBASE;
|
---|
219 | uint64_t msrKERNELGSBASE;
|
---|
220 | /** @} */
|
---|
221 |
|
---|
222 | /** Hidden selector registers.
|
---|
223 | * @{ */
|
---|
224 | CPUMSELREGHID_VER1_6 ldtrHid;
|
---|
225 | CPUMSELREGHID_VER1_6 trHid;
|
---|
226 | /** @} */
|
---|
227 |
|
---|
228 | /** padding to get 32byte aligned size. */
|
---|
229 | uint32_t padding[2];
|
---|
230 | } CPUMCTX_VER1_6;
|
---|
231 | # pragma pack()
|
---|
232 |
|
---|
233 | /** @} */
|
---|
234 |
|
---|
235 | RT_C_DECLS_END
|
---|
236 |
|
---|
237 | #endif
|
---|
238 |
|
---|