1 | /** @file
|
---|
2 | * VirtualBox - Types.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
26 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
27 | * additional information or have any questions.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef ___VBox_types_h
|
---|
31 | #define ___VBox_types_h
|
---|
32 |
|
---|
33 | #include <VBox/cdefs.h>
|
---|
34 | #include <iprt/types.h>
|
---|
35 |
|
---|
36 |
|
---|
37 | /** @defgroup grp_types Basic VBox Types
|
---|
38 | * @{
|
---|
39 | */
|
---|
40 |
|
---|
41 |
|
---|
42 | /** @defgroup grp_types_both Common Guest and Host Context Basic Types
|
---|
43 | * @ingroup grp_types
|
---|
44 | * @{
|
---|
45 | */
|
---|
46 |
|
---|
47 |
|
---|
48 | /** @defgroup grp_types_hc Host Context Basic Types
|
---|
49 | * @ingroup grp_types_both
|
---|
50 | * @{
|
---|
51 | */
|
---|
52 |
|
---|
53 | /** @deprecated
|
---|
54 | * @{ */
|
---|
55 | typedef RTHCPHYS VBOXHCPHYS;
|
---|
56 | typedef VBOXHCPHYS *PVBOXHCPHYS;
|
---|
57 | #define NILVBOXHCPHYS NIL_RTHCPHYS
|
---|
58 | typedef RTHCPTR VBOXHCPTR;
|
---|
59 | typedef VBOXHCPTR *PVBOXHCPTR;
|
---|
60 | /** @} */
|
---|
61 |
|
---|
62 | /** @} */
|
---|
63 |
|
---|
64 |
|
---|
65 | /** @defgroup grp_types_gc Guest Context Basic Types
|
---|
66 | * @ingroup grp_types_both
|
---|
67 | * @{
|
---|
68 | */
|
---|
69 |
|
---|
70 | /** @} */
|
---|
71 |
|
---|
72 |
|
---|
73 | /** Pointer to per support driver session data.
|
---|
74 | * (The data is a R0 entity and private to the the R0 SUP part. All
|
---|
75 | * other should consider this a sort of handle.) */
|
---|
76 | typedef R0PTRTYPE(struct SUPDRVSESSION *) PSUPDRVSESSION;
|
---|
77 |
|
---|
78 | /** Pointer to a VM. */
|
---|
79 | typedef struct VM *PVM;
|
---|
80 | /** Pointer to a VM - Ring-0 Ptr. */
|
---|
81 | typedef R0PTRTYPE(struct VM *) PVMR0;
|
---|
82 | /** Pointer to a VM - Ring-3 Ptr. */
|
---|
83 | typedef R3PTRTYPE(struct VM *) PVMR3;
|
---|
84 | /** Pointer to a VM - RC Ptr. */
|
---|
85 | typedef RCPTRTYPE(struct VM *) PVMRC;
|
---|
86 |
|
---|
87 | /** Pointer to a ring-0 (global) VM structure. */
|
---|
88 | typedef R0PTRTYPE(struct GVM *) PGVM;
|
---|
89 |
|
---|
90 | /** Pointer to a ring-3 (user mode) VM structure. */
|
---|
91 | typedef R3PTRTYPE(struct UVM *) PUVM;
|
---|
92 |
|
---|
93 |
|
---|
94 | /** VM State
|
---|
95 | */
|
---|
96 | typedef enum VMSTATE
|
---|
97 | {
|
---|
98 | /** The VM is being created. */
|
---|
99 | VMSTATE_CREATING = 0,
|
---|
100 | /** The VM is created. */
|
---|
101 | VMSTATE_CREATED,
|
---|
102 | /** The VM is runnning. */
|
---|
103 | VMSTATE_RUNNING,
|
---|
104 | /** The VM state is being loaded from file. */
|
---|
105 | VMSTATE_LOADING,
|
---|
106 | /** The VM is screwed because of a failed state loading. */
|
---|
107 | VMSTATE_LOAD_FAILURE,
|
---|
108 | /** The VM state is being saved to file. */
|
---|
109 | VMSTATE_SAVING,
|
---|
110 | /** The VM is suspended. */
|
---|
111 | VMSTATE_SUSPENDED,
|
---|
112 | /** The VM is being reset. */
|
---|
113 | VMSTATE_RESETTING,
|
---|
114 | /** The VM is in guru meditation over a fatal failure. */
|
---|
115 | VMSTATE_GURU_MEDITATION,
|
---|
116 | /** The VM is switched off, awaiting destruction. */
|
---|
117 | VMSTATE_OFF,
|
---|
118 | /** The VM is being destroyed. */
|
---|
119 | VMSTATE_DESTROYING,
|
---|
120 | /** Terminated. */
|
---|
121 | VMSTATE_TERMINATED,
|
---|
122 | /** hack forcing the size of the enum to 32-bits. */
|
---|
123 | VMSTATE_MAKE_32BIT_HACK = 0x7fffffff
|
---|
124 | } VMSTATE;
|
---|
125 |
|
---|
126 |
|
---|
127 | /** Pointer to a PDM Driver Base Interface. */
|
---|
128 | typedef struct PDMIBASE *PPDMIBASE;
|
---|
129 | /** Pointer to a pointer to a PDM Driver Base Interface. */
|
---|
130 | typedef PPDMIBASE *PPPDMIBASE;
|
---|
131 |
|
---|
132 | /** Pointer to a PDM Device Instance. */
|
---|
133 | typedef struct PDMDEVINS *PPDMDEVINS;
|
---|
134 | /** Pointer to a pointer to a PDM Device Instance. */
|
---|
135 | typedef PPDMDEVINS *PPPDMDEVINS;
|
---|
136 | /** R3 pointer to a PDM Device Instance. */
|
---|
137 | typedef R3PTRTYPE(PPDMDEVINS) PPDMDEVINSR3;
|
---|
138 | /** R0 pointer to a PDM Device Instance. */
|
---|
139 | typedef R0PTRTYPE(PPDMDEVINS) PPDMDEVINSR0;
|
---|
140 | /** GC pointer to a PDM Device Instance. */
|
---|
141 | typedef RCPTRTYPE(PPDMDEVINS) PPDMDEVINSGC;
|
---|
142 |
|
---|
143 | /** Pointer to a PDM USB Device Instance. */
|
---|
144 | typedef struct PDMUSBINS *PPDMUSBINS;
|
---|
145 | /** Pointer to a pointer to a PDM USB Device Instance. */
|
---|
146 | typedef PPDMUSBINS *PPPDMUSBINS;
|
---|
147 |
|
---|
148 | /** Pointer to a PDM Driver Instance. */
|
---|
149 | typedef struct PDMDRVINS *PPDMDRVINS;
|
---|
150 | /** Pointer to a pointer to a PDM Driver Instance. */
|
---|
151 | typedef PPDMDRVINS *PPPDMDRVINS;
|
---|
152 |
|
---|
153 | /** Pointer to a PDM Service Instance. */
|
---|
154 | typedef struct PDMSRVINS *PPDMSRVINS;
|
---|
155 | /** Pointer to a pointer to a PDM Service Instance. */
|
---|
156 | typedef PPDMSRVINS *PPPDMSRVINS;
|
---|
157 |
|
---|
158 | /** R3 pointer to a timer. */
|
---|
159 | typedef R3PTRTYPE(struct TMTIMER *) PTMTIMERR3;
|
---|
160 | /** Pointer to a R3 pointer to a timer. */
|
---|
161 | typedef PTMTIMERR3 *PPTMTIMERR3;
|
---|
162 |
|
---|
163 | /** R0 pointer to a timer. */
|
---|
164 | typedef R0PTRTYPE(struct TMTIMER *) PTMTIMERR0;
|
---|
165 | /** Pointer to a R3 pointer to a timer. */
|
---|
166 | typedef PTMTIMERR0 *PPTMTIMERR0;
|
---|
167 |
|
---|
168 | /** GC pointer to a timer. */
|
---|
169 | typedef RCPTRTYPE(struct TMTIMER *) PTMTIMERGC;
|
---|
170 | /** Pointer to a GC pointer to a timer. */
|
---|
171 | typedef PTMTIMERGC *PPTMTIMERGC;
|
---|
172 |
|
---|
173 | /** Pointer to a timer. */
|
---|
174 | typedef CTXALLSUFF(PTMTIMER) PTMTIMER;
|
---|
175 | /** Pointer to a pointer to a timer. */
|
---|
176 | typedef CTXALLSUFF(PPTMTIMER) PPTMTIMER;
|
---|
177 |
|
---|
178 | /** SSM Operation handle. */
|
---|
179 | typedef struct SSMHANDLE *PSSMHANDLE;
|
---|
180 |
|
---|
181 | /** Pointer to a CPUMCTX. */
|
---|
182 | typedef struct CPUMCTX *PCPUMCTX;
|
---|
183 | /** Pointer to a const CPUMCTX. */
|
---|
184 | typedef const struct CPUMCTX *PCCPUMCTX;
|
---|
185 |
|
---|
186 | /** Pointer to a CPU context core. */
|
---|
187 | typedef struct CPUMCTXCORE *PCPUMCTXCORE;
|
---|
188 | /** Pointer to a const CPU context core. */
|
---|
189 | typedef const struct CPUMCTXCORE *PCCPUMCTXCORE;
|
---|
190 |
|
---|
191 | /** Pointer to selector hidden registers. */
|
---|
192 | typedef struct CPUMSELREGHID *PCPUMSELREGHID;
|
---|
193 | /** Pointer to const selector hidden registers. */
|
---|
194 | typedef const struct CPUMSELREGHID *PCCPUMSELREGHID;
|
---|
195 |
|
---|
196 | /** @} */
|
---|
197 |
|
---|
198 |
|
---|
199 | /** @defgroup grp_types_idt Interrupt Descriptor Table Entry.
|
---|
200 | * @ingroup grp_types
|
---|
201 | * @todo This all belongs in x86.h!
|
---|
202 | * @{ */
|
---|
203 |
|
---|
204 | /** @todo VBOXIDT -> VBOXDESCIDT, skip the complex variations. We'll never use them. */
|
---|
205 |
|
---|
206 | /** IDT Entry, Task Gate view. */
|
---|
207 | #pragma pack(1) /* paranoia */
|
---|
208 | typedef struct VBOXIDTE_TASKGATE
|
---|
209 | {
|
---|
210 | /** Reserved. */
|
---|
211 | unsigned u16Reserved1 : 16;
|
---|
212 | /** Task Segment Selector. */
|
---|
213 | unsigned u16TSS : 16;
|
---|
214 | /** More reserved. */
|
---|
215 | unsigned u8Reserved2 : 8;
|
---|
216 | /** Fixed value bit 0 - Set to 1. */
|
---|
217 | unsigned u1Fixed0 : 1;
|
---|
218 | /** Busy bit. */
|
---|
219 | unsigned u1Busy : 1;
|
---|
220 | /** Fixed value bit 2 - Set to 1. */
|
---|
221 | unsigned u1Fixed1 : 1;
|
---|
222 | /** Fixed value bit 3 - Set to 0. */
|
---|
223 | unsigned u1Fixed2: 1;
|
---|
224 | /** Fixed value bit 4 - Set to 0. */
|
---|
225 | unsigned u1Fixed3 : 1;
|
---|
226 | /** Descriptor Privilege level. */
|
---|
227 | unsigned u2DPL : 2;
|
---|
228 | /** Present flag. */
|
---|
229 | unsigned u1Present : 1;
|
---|
230 | /** Reserved. */
|
---|
231 | unsigned u16Reserved3 : 16;
|
---|
232 | } VBOXIDTE_TASKGATE;
|
---|
233 | #pragma pack()
|
---|
234 | /** Pointer to IDT Entry, Task gate view. */
|
---|
235 | typedef VBOXIDTE_TASKGATE *PVBOXIDTE_TASKGATE;
|
---|
236 |
|
---|
237 |
|
---|
238 | /** IDT Entry, Intertupt gate view. */
|
---|
239 | #pragma pack(1) /* paranoia */
|
---|
240 | typedef struct VBOXIDTE_INTERRUPTGATE
|
---|
241 | {
|
---|
242 | /** Low offset word. */
|
---|
243 | unsigned u16OffsetLow : 16;
|
---|
244 | /** Segment Selector. */
|
---|
245 | unsigned u16SegSel : 16;
|
---|
246 | /** Reserved. */
|
---|
247 | unsigned u5Reserved2 : 5;
|
---|
248 | /** Fixed value bit 0 - Set to 0. */
|
---|
249 | unsigned u1Fixed0 : 1;
|
---|
250 | /** Fixed value bit 1 - Set to 0. */
|
---|
251 | unsigned u1Fixed1 : 1;
|
---|
252 | /** Fixed value bit 2 - Set to 0. */
|
---|
253 | unsigned u1Fixed2 : 1;
|
---|
254 | /** Fixed value bit 3 - Set to 0. */
|
---|
255 | unsigned u1Fixed3: 1;
|
---|
256 | /** Fixed value bit 4 - Set to 1. */
|
---|
257 | unsigned u1Fixed4 : 1;
|
---|
258 | /** Fixed value bit 5 - Set to 1. */
|
---|
259 | unsigned u1Fixed5 : 1;
|
---|
260 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
261 | unsigned u132BitGate : 1;
|
---|
262 | /** Fixed value bit 5 - Set to 0. */
|
---|
263 | unsigned u1Fixed6 : 1;
|
---|
264 | /** Descriptor Privilege level. */
|
---|
265 | unsigned u2DPL : 2;
|
---|
266 | /** Present flag. */
|
---|
267 | unsigned u1Present : 1;
|
---|
268 | /** High offset word. */
|
---|
269 | unsigned u16OffsetHigh : 16;
|
---|
270 | } VBOXIDTE_INTERRUPTGATE;
|
---|
271 | #pragma pack()
|
---|
272 | /** Pointer to IDT Entry, Interrupt gate view. */
|
---|
273 | typedef VBOXIDTE_INTERRUPTGATE *PVBOXIDTE_INTERRUPTGATE;
|
---|
274 |
|
---|
275 | /** IDT Entry, Trap Gate view. */
|
---|
276 | #pragma pack(1) /* paranoia */
|
---|
277 | typedef struct VBOXIDTE_TRAPGATE
|
---|
278 | {
|
---|
279 | /** Low offset word. */
|
---|
280 | unsigned u16OffsetLow : 16;
|
---|
281 | /** Segment Selector. */
|
---|
282 | unsigned u16SegSel : 16;
|
---|
283 | /** Reserved. */
|
---|
284 | unsigned u5Reserved2 : 5;
|
---|
285 | /** Fixed value bit 0 - Set to 0. */
|
---|
286 | unsigned u1Fixed0 : 1;
|
---|
287 | /** Fixed value bit 1 - Set to 0. */
|
---|
288 | unsigned u1Fixed1 : 1;
|
---|
289 | /** Fixed value bit 2 - Set to 0. */
|
---|
290 | unsigned u1Fixed2 : 1;
|
---|
291 | /** Fixed value bit 3 - Set to 1. */
|
---|
292 | unsigned u1Fixed3: 1;
|
---|
293 | /** Fixed value bit 4 - Set to 1. */
|
---|
294 | unsigned u1Fixed4 : 1;
|
---|
295 | /** Fixed value bit 5 - Set to 1. */
|
---|
296 | unsigned u1Fixed5 : 1;
|
---|
297 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
298 | unsigned u132BitGate : 1;
|
---|
299 | /** Fixed value bit 5 - Set to 0. */
|
---|
300 | unsigned u1Fixed6 : 1;
|
---|
301 | /** Descriptor Privilege level. */
|
---|
302 | unsigned u2DPL : 2;
|
---|
303 | /** Present flag. */
|
---|
304 | unsigned u1Present : 1;
|
---|
305 | /** High offset word. */
|
---|
306 | unsigned u16OffsetHigh : 16;
|
---|
307 | } VBOXIDTE_TRAPGATE;
|
---|
308 | #pragma pack()
|
---|
309 | /** Pointer to IDT Entry, Trap Gate view. */
|
---|
310 | typedef VBOXIDTE_TRAPGATE *PVBOXIDTE_TRAPGATE;
|
---|
311 |
|
---|
312 | /** IDT Entry Generic view. */
|
---|
313 | #pragma pack(1) /* paranoia */
|
---|
314 | typedef struct VBOXIDTE_GENERIC
|
---|
315 | {
|
---|
316 | /** Low offset word. */
|
---|
317 | unsigned u16OffsetLow : 16;
|
---|
318 | /** Segment Selector. */
|
---|
319 | unsigned u16SegSel : 16;
|
---|
320 | /** Reserved. */
|
---|
321 | unsigned u5Reserved : 5;
|
---|
322 | /** IDT Type part one (not used for task gate). */
|
---|
323 | unsigned u3Type1 : 3;
|
---|
324 | /** IDT Type part two. */
|
---|
325 | unsigned u5Type2 : 5;
|
---|
326 | /** Descriptor Privilege level. */
|
---|
327 | unsigned u2DPL : 2;
|
---|
328 | /** Present flag. */
|
---|
329 | unsigned u1Present : 1;
|
---|
330 | /** High offset word. */
|
---|
331 | unsigned u16OffsetHigh : 16;
|
---|
332 | } VBOXIDTE_GENERIC;
|
---|
333 | #pragma pack()
|
---|
334 | /** Pointer to IDT Entry Generic view. */
|
---|
335 | typedef VBOXIDTE_GENERIC *PVBOXIDTE_GENERIC;
|
---|
336 |
|
---|
337 | /** IDT Type1 value. (Reserved for task gate!) */
|
---|
338 | #define VBOX_IDTE_TYPE1 0
|
---|
339 | /** IDT Type2 value - Task gate. */
|
---|
340 | #define VBOX_IDTE_TYPE2_TASK 0x5
|
---|
341 | /** IDT Type2 value - 16 bit interrupt gate. */
|
---|
342 | #define VBOX_IDTE_TYPE2_INT_16 0x6
|
---|
343 | /** IDT Type2 value - 32 bit interrupt gate. */
|
---|
344 | #define VBOX_IDTE_TYPE2_INT_32 0xe
|
---|
345 | /** IDT Type2 value - 16 bit trap gate. */
|
---|
346 | #define VBOX_IDTE_TYPE2_TRAP_16 0x7
|
---|
347 | /** IDT Type2 value - 32 bit trap gate. */
|
---|
348 | #define VBOX_IDTE_TYPE2_TRAP_32 0xf
|
---|
349 |
|
---|
350 | /** IDT Entry. */
|
---|
351 | #pragma pack(1) /* paranoia */
|
---|
352 | typedef union VBOXIDTE
|
---|
353 | {
|
---|
354 | /** Task gate view. */
|
---|
355 | VBOXIDTE_TASKGATE Task;
|
---|
356 | /** Trap gate view. */
|
---|
357 | VBOXIDTE_TRAPGATE Trap;
|
---|
358 | /** Interrupt gate view. */
|
---|
359 | VBOXIDTE_INTERRUPTGATE Int;
|
---|
360 | /** Generic IDT view. */
|
---|
361 | VBOXIDTE_GENERIC Gen;
|
---|
362 |
|
---|
363 | /** 8 bit unsigned integer view. */
|
---|
364 | uint8_t au8[8];
|
---|
365 | /** 16 bit unsigned integer view. */
|
---|
366 | uint16_t au16[4];
|
---|
367 | /** 32 bit unsigned integer view. */
|
---|
368 | uint32_t au32[2];
|
---|
369 | /** 64 bit unsigned integer view. */
|
---|
370 | uint64_t au64;
|
---|
371 | } VBOXIDTE;
|
---|
372 | #pragma pack()
|
---|
373 | /** Pointer to IDT Entry. */
|
---|
374 | typedef VBOXIDTE *PVBOXIDTE;
|
---|
375 |
|
---|
376 | #pragma pack(1)
|
---|
377 | /** IDTR */
|
---|
378 | typedef struct VBOXIDTR
|
---|
379 | {
|
---|
380 | /** Size of the IDT. */
|
---|
381 | uint16_t cbIdt;
|
---|
382 | /** Address of the IDT. */
|
---|
383 | uint64_t pIdt;
|
---|
384 | } VBOXIDTR, *PVBOXIDTR;
|
---|
385 | #pragma pack()
|
---|
386 | /** @} */
|
---|
387 |
|
---|
388 |
|
---|
389 | /** @def VBOXIDTE_OFFSET
|
---|
390 | * Return the offset of an IDT entry.
|
---|
391 | */
|
---|
392 | #define VBOXIDTE_OFFSET(desc) \
|
---|
393 | ( ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
|
---|
394 | | ( (desc).Gen.u16OffsetLow ) )
|
---|
395 |
|
---|
396 | /** @defgroup grp_types_desc Descriptor Table Entry.
|
---|
397 | * @ingroup grp_types
|
---|
398 | * @{ */
|
---|
399 |
|
---|
400 | #pragma pack(1)
|
---|
401 | /**
|
---|
402 | * Memory descriptor.
|
---|
403 | */
|
---|
404 | typedef struct VBOXDESCGENERIC
|
---|
405 | {
|
---|
406 | /** 0-15 - Limit - Low word. */
|
---|
407 | unsigned u16LimitLow : 16;
|
---|
408 | /** 16-31 - Base address - lowe word.
|
---|
409 | * Don't try set this to 24 because MSC is doing studing things then. */
|
---|
410 | unsigned u16BaseLow : 16;
|
---|
411 | /** 32-39 - Base address - first 8 bits of high word. */
|
---|
412 | unsigned u8BaseHigh1 : 8;
|
---|
413 | /** 40-43 - Segment Type. */
|
---|
414 | unsigned u4Type : 4;
|
---|
415 | /** 44 - Descriptor Type. System(=0) or code/data selector */
|
---|
416 | unsigned u1DescType : 1;
|
---|
417 | /** 45-46 - Descriptor Privelege level. */
|
---|
418 | unsigned u2Dpl : 2;
|
---|
419 | /** 47 - Flags selector present(=1) or not. */
|
---|
420 | unsigned u1Present : 1;
|
---|
421 | /** 48-51 - Segment limit 16-19. */
|
---|
422 | unsigned u4LimitHigh : 4;
|
---|
423 | /** 52 - Available for system software. */
|
---|
424 | unsigned u1Available : 1;
|
---|
425 | /** 53 - Reserved - 0. In long mode this is the 'Long' (L) attribute bit. */
|
---|
426 | unsigned u1Reserved : 1;
|
---|
427 | /** 54 - This flags meaning depends on the segment type. Try make sense out
|
---|
428 | * of the intel manual yourself. */
|
---|
429 | unsigned u1DefBig : 1;
|
---|
430 | /** 55 - Granularity of the limit. If set 4KB granularity is used, if
|
---|
431 | * clear byte. */
|
---|
432 | unsigned u1Granularity : 1;
|
---|
433 | /** 56-63 - Base address - highest 8 bits. */
|
---|
434 | unsigned u8BaseHigh2 : 8;
|
---|
435 | } VBOXDESCGENERIC;
|
---|
436 | #pragma pack()
|
---|
437 | /** Pointer to a generic descriptor entry. */
|
---|
438 | typedef VBOXDESCGENERIC *PVBOXDESCGENERIC;
|
---|
439 |
|
---|
440 | #pragma pack(1)
|
---|
441 | /**
|
---|
442 | * Descriptor table entry.
|
---|
443 | */
|
---|
444 | typedef union VBOXDESC
|
---|
445 | {
|
---|
446 | /** Generic descriptor view. */
|
---|
447 | VBOXDESCGENERIC Gen;
|
---|
448 | /** IDT view. */
|
---|
449 | VBOXIDTE Idt;
|
---|
450 |
|
---|
451 | /** 8 bit unsigned interger view. */
|
---|
452 | uint8_t au8[8];
|
---|
453 | /** 16 bit unsigned interger view. */
|
---|
454 | uint16_t au16[4];
|
---|
455 | /** 32 bit unsigned interger view. */
|
---|
456 | uint32_t au32[2];
|
---|
457 | } VBOXDESC;
|
---|
458 | #pragma pack()
|
---|
459 | /** Pointer to descriptor table entry. */
|
---|
460 | typedef VBOXDESC *PVBOXDESC;
|
---|
461 | /** Pointer to const descriptor table entry. */
|
---|
462 | typedef VBOXDESC const *PCVBOXDESC;
|
---|
463 |
|
---|
464 |
|
---|
465 | #pragma pack(1)
|
---|
466 | /** GDTR */
|
---|
467 | typedef struct VBOXGDTR
|
---|
468 | {
|
---|
469 | /** Size of the GDT. */
|
---|
470 | uint16_t cbGdt;
|
---|
471 | /** Address of the GDT. */
|
---|
472 | uint64_t pGdt;
|
---|
473 | } VBOXGDTR;
|
---|
474 | #pragma pack()
|
---|
475 | /** Pointer to GDTR. */
|
---|
476 | typedef VBOXGDTR *PVBOXGDTR;
|
---|
477 |
|
---|
478 | /** @} */
|
---|
479 |
|
---|
480 |
|
---|
481 | /**
|
---|
482 | * Task Segment
|
---|
483 | */
|
---|
484 | #pragma pack(1)
|
---|
485 | typedef struct VBOXTSS
|
---|
486 | {
|
---|
487 | /** Back link to previous task. (static) */
|
---|
488 | RTSEL selPrev;
|
---|
489 | uint16_t padding1;
|
---|
490 | /** Ring-0 stack pointer. (static) */
|
---|
491 | uint32_t esp0;
|
---|
492 | /** Ring-0 stack segment. (static) */
|
---|
493 | RTSEL ss0;
|
---|
494 | uint16_t padding_ss0;
|
---|
495 | /** Ring-1 stack pointer. (static) */
|
---|
496 | uint32_t esp1;
|
---|
497 | /** Ring-1 stack segment. (static) */
|
---|
498 | RTSEL ss1;
|
---|
499 | uint16_t padding_ss1;
|
---|
500 | /** Ring-2 stack pointer. (static) */
|
---|
501 | uint32_t esp2;
|
---|
502 | /** Ring-2 stack segment. (static) */
|
---|
503 | RTSEL ss2;
|
---|
504 | uint16_t padding_ss2;
|
---|
505 | /** Page directory for the task. (static) */
|
---|
506 | uint32_t cr3;
|
---|
507 | /** EIP before task switch. */
|
---|
508 | uint32_t eip;
|
---|
509 | /** EFLAGS before task switch. */
|
---|
510 | uint32_t eflags;
|
---|
511 | /** EAX before task switch. */
|
---|
512 | uint32_t eax;
|
---|
513 | /** ECX before task switch. */
|
---|
514 | uint32_t ecx;
|
---|
515 | /** EDX before task switch. */
|
---|
516 | uint32_t edx;
|
---|
517 | /** EBX before task switch. */
|
---|
518 | uint32_t ebx;
|
---|
519 | /** ESP before task switch. */
|
---|
520 | uint32_t esp;
|
---|
521 | /** EBP before task switch. */
|
---|
522 | uint32_t ebp;
|
---|
523 | /** ESI before task switch. */
|
---|
524 | uint32_t esi;
|
---|
525 | /** EDI before task switch. */
|
---|
526 | uint32_t edi;
|
---|
527 | /** ES before task switch. */
|
---|
528 | RTSEL es;
|
---|
529 | uint16_t padding_es;
|
---|
530 | /** CS before task switch. */
|
---|
531 | RTSEL cs;
|
---|
532 | uint16_t padding_cs;
|
---|
533 | /** SS before task switch. */
|
---|
534 | RTSEL ss;
|
---|
535 | uint16_t padding_ss;
|
---|
536 | /** DS before task switch. */
|
---|
537 | RTSEL ds;
|
---|
538 | uint16_t padding_ds;
|
---|
539 | /** FS before task switch. */
|
---|
540 | RTSEL fs;
|
---|
541 | uint16_t padding_fs;
|
---|
542 | /** GS before task switch. */
|
---|
543 | RTSEL gs;
|
---|
544 | uint16_t padding_gs;
|
---|
545 | /** LDTR before task switch. */
|
---|
546 | RTSEL selLdt;
|
---|
547 | uint16_t padding_ldt;
|
---|
548 | /** Debug trap flag */
|
---|
549 | uint16_t fDebugTrap;
|
---|
550 | /** Offset relative to the TSS of the start of the I/O Bitmap
|
---|
551 | * and the end of the interrupt redirection bitmap. */
|
---|
552 | uint16_t offIoBitmap;
|
---|
553 | /** 32 bytes for the virtual interrupt redirection bitmap. (VME) */
|
---|
554 | uint8_t IntRedirBitmap[32];
|
---|
555 | } VBOXTSS;
|
---|
556 | #pragma pack()
|
---|
557 | /** Pointer to task segment. */
|
---|
558 | typedef VBOXTSS *PVBOXTSS;
|
---|
559 | /** Pointer to const task segment. */
|
---|
560 | typedef const VBOXTSS *PCVBOXTSS;
|
---|
561 |
|
---|
562 |
|
---|
563 | /** @} */
|
---|
564 |
|
---|
565 | #endif
|
---|