VirtualBox

source: vbox/trunk/include/VBox/types.h@ 11305

Last change on this file since 11305 was 11305, checked in by vboxsync, 16 years ago

VBox/types.h: Retired unused types VBOXHCPHYS, PVBOXHCPHYS, NILVBOXHCPHYS, VBOXHCPTR and PVBOXHCPTR.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 14.2 KB
Line 
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/** @} */
54
55
56/** @defgroup grp_types_gc Guest Context Basic Types
57 * @ingroup grp_types_both
58 * @{
59 */
60
61/** @} */
62
63
64/** Pointer to per support driver session data.
65 * (The data is a R0 entity and private to the the R0 SUP part. All
66 * other should consider this a sort of handle.) */
67typedef R0PTRTYPE(struct SUPDRVSESSION *) PSUPDRVSESSION;
68
69/** Pointer to a VM. */
70typedef struct VM *PVM;
71/** Pointer to a VM - Ring-0 Ptr. */
72typedef R0PTRTYPE(struct VM *) PVMR0;
73/** Pointer to a VM - Ring-3 Ptr. */
74typedef R3PTRTYPE(struct VM *) PVMR3;
75/** Pointer to a VM - RC Ptr. */
76typedef RCPTRTYPE(struct VM *) PVMRC;
77
78/** Pointer to a ring-0 (global) VM structure. */
79typedef R0PTRTYPE(struct GVM *) PGVM;
80
81/** Pointer to a ring-3 (user mode) VM structure. */
82typedef R3PTRTYPE(struct UVM *) PUVM;
83
84
85/** VM State
86 */
87typedef enum VMSTATE
88{
89 /** The VM is being created. */
90 VMSTATE_CREATING = 0,
91 /** The VM is created. */
92 VMSTATE_CREATED,
93 /** The VM is runnning. */
94 VMSTATE_RUNNING,
95 /** The VM state is being loaded from file. */
96 VMSTATE_LOADING,
97 /** The VM is screwed because of a failed state loading. */
98 VMSTATE_LOAD_FAILURE,
99 /** The VM state is being saved to file. */
100 VMSTATE_SAVING,
101 /** The VM is suspended. */
102 VMSTATE_SUSPENDED,
103 /** The VM is being reset. */
104 VMSTATE_RESETTING,
105 /** The VM is in guru meditation over a fatal failure. */
106 VMSTATE_GURU_MEDITATION,
107 /** The VM is switched off, awaiting destruction. */
108 VMSTATE_OFF,
109 /** The VM is being destroyed. */
110 VMSTATE_DESTROYING,
111 /** Terminated. */
112 VMSTATE_TERMINATED,
113 /** hack forcing the size of the enum to 32-bits. */
114 VMSTATE_MAKE_32BIT_HACK = 0x7fffffff
115} VMSTATE;
116
117
118/** Pointer to a PDM Driver Base Interface. */
119typedef struct PDMIBASE *PPDMIBASE;
120/** Pointer to a pointer to a PDM Driver Base Interface. */
121typedef PPDMIBASE *PPPDMIBASE;
122
123/** Pointer to a PDM Device Instance. */
124typedef struct PDMDEVINS *PPDMDEVINS;
125/** Pointer to a pointer to a PDM Device Instance. */
126typedef PPDMDEVINS *PPPDMDEVINS;
127/** R3 pointer to a PDM Device Instance. */
128typedef R3PTRTYPE(PPDMDEVINS) PPDMDEVINSR3;
129/** R0 pointer to a PDM Device Instance. */
130typedef R0PTRTYPE(PPDMDEVINS) PPDMDEVINSR0;
131/** RC pointer to a PDM Device Instance. */
132typedef RCPTRTYPE(PPDMDEVINS) PPDMDEVINSRC;
133
134/** Pointer to a PDM USB Device Instance. */
135typedef struct PDMUSBINS *PPDMUSBINS;
136/** Pointer to a pointer to a PDM USB Device Instance. */
137typedef PPDMUSBINS *PPPDMUSBINS;
138
139/** Pointer to a PDM Driver Instance. */
140typedef struct PDMDRVINS *PPDMDRVINS;
141/** Pointer to a pointer to a PDM Driver Instance. */
142typedef PPDMDRVINS *PPPDMDRVINS;
143
144/** Pointer to a PDM Service Instance. */
145typedef struct PDMSRVINS *PPDMSRVINS;
146/** Pointer to a pointer to a PDM Service Instance. */
147typedef PPDMSRVINS *PPPDMSRVINS;
148
149/** R3 pointer to a timer. */
150typedef R3PTRTYPE(struct TMTIMER *) PTMTIMERR3;
151/** Pointer to a R3 pointer to a timer. */
152typedef PTMTIMERR3 *PPTMTIMERR3;
153
154/** R0 pointer to a timer. */
155typedef R0PTRTYPE(struct TMTIMER *) PTMTIMERR0;
156/** Pointer to a R3 pointer to a timer. */
157typedef PTMTIMERR0 *PPTMTIMERR0;
158
159/** RC pointer to a timer. */
160typedef RCPTRTYPE(struct TMTIMER *) PTMTIMERRC;
161/** Pointer to a RC pointer to a timer. */
162typedef PTMTIMERRC *PPTMTIMERRC;
163
164/** Pointer to a timer. */
165typedef CTXALLSUFF(PTMTIMER) PTMTIMER;
166/** Pointer to a pointer to a timer. */
167typedef PTMTIMER *PPTMTIMER;
168
169/** SSM Operation handle. */
170typedef struct SSMHANDLE *PSSMHANDLE;
171
172/** Pointer to a CPUMCTX. */
173typedef struct CPUMCTX *PCPUMCTX;
174/** Pointer to a const CPUMCTX. */
175typedef const struct CPUMCTX *PCCPUMCTX;
176
177/** Pointer to a CPU context core. */
178typedef struct CPUMCTXCORE *PCPUMCTXCORE;
179/** Pointer to a const CPU context core. */
180typedef const struct CPUMCTXCORE *PCCPUMCTXCORE;
181
182/** Pointer to selector hidden registers. */
183typedef struct CPUMSELREGHID *PCPUMSELREGHID;
184/** Pointer to const selector hidden registers. */
185typedef const struct CPUMSELREGHID *PCCPUMSELREGHID;
186
187/** @} */
188
189
190/** @defgroup grp_types_idt Interrupt Descriptor Table Entry.
191 * @ingroup grp_types
192 * @todo This all belongs in x86.h!
193 * @{ */
194
195/** @todo VBOXIDT -> VBOXDESCIDT, skip the complex variations. We'll never use them. */
196
197/** IDT Entry, Task Gate view. */
198#pragma pack(1) /* paranoia */
199typedef struct VBOXIDTE_TASKGATE
200{
201 /** Reserved. */
202 unsigned u16Reserved1 : 16;
203 /** Task Segment Selector. */
204 unsigned u16TSS : 16;
205 /** More reserved. */
206 unsigned u8Reserved2 : 8;
207 /** Fixed value bit 0 - Set to 1. */
208 unsigned u1Fixed0 : 1;
209 /** Busy bit. */
210 unsigned u1Busy : 1;
211 /** Fixed value bit 2 - Set to 1. */
212 unsigned u1Fixed1 : 1;
213 /** Fixed value bit 3 - Set to 0. */
214 unsigned u1Fixed2: 1;
215 /** Fixed value bit 4 - Set to 0. */
216 unsigned u1Fixed3 : 1;
217 /** Descriptor Privilege level. */
218 unsigned u2DPL : 2;
219 /** Present flag. */
220 unsigned u1Present : 1;
221 /** Reserved. */
222 unsigned u16Reserved3 : 16;
223} VBOXIDTE_TASKGATE;
224#pragma pack()
225/** Pointer to IDT Entry, Task gate view. */
226typedef VBOXIDTE_TASKGATE *PVBOXIDTE_TASKGATE;
227
228
229/** IDT Entry, Intertupt gate view. */
230#pragma pack(1) /* paranoia */
231typedef struct VBOXIDTE_INTERRUPTGATE
232{
233 /** Low offset word. */
234 unsigned u16OffsetLow : 16;
235 /** Segment Selector. */
236 unsigned u16SegSel : 16;
237 /** Reserved. */
238 unsigned u5Reserved2 : 5;
239 /** Fixed value bit 0 - Set to 0. */
240 unsigned u1Fixed0 : 1;
241 /** Fixed value bit 1 - Set to 0. */
242 unsigned u1Fixed1 : 1;
243 /** Fixed value bit 2 - Set to 0. */
244 unsigned u1Fixed2 : 1;
245 /** Fixed value bit 3 - Set to 0. */
246 unsigned u1Fixed3: 1;
247 /** Fixed value bit 4 - Set to 1. */
248 unsigned u1Fixed4 : 1;
249 /** Fixed value bit 5 - Set to 1. */
250 unsigned u1Fixed5 : 1;
251 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
252 unsigned u132BitGate : 1;
253 /** Fixed value bit 5 - Set to 0. */
254 unsigned u1Fixed6 : 1;
255 /** Descriptor Privilege level. */
256 unsigned u2DPL : 2;
257 /** Present flag. */
258 unsigned u1Present : 1;
259 /** High offset word. */
260 unsigned u16OffsetHigh : 16;
261} VBOXIDTE_INTERRUPTGATE;
262#pragma pack()
263/** Pointer to IDT Entry, Interrupt gate view. */
264typedef VBOXIDTE_INTERRUPTGATE *PVBOXIDTE_INTERRUPTGATE;
265
266/** IDT Entry, Trap Gate view. */
267#pragma pack(1) /* paranoia */
268typedef struct VBOXIDTE_TRAPGATE
269{
270 /** Low offset word. */
271 unsigned u16OffsetLow : 16;
272 /** Segment Selector. */
273 unsigned u16SegSel : 16;
274 /** Reserved. */
275 unsigned u5Reserved2 : 5;
276 /** Fixed value bit 0 - Set to 0. */
277 unsigned u1Fixed0 : 1;
278 /** Fixed value bit 1 - Set to 0. */
279 unsigned u1Fixed1 : 1;
280 /** Fixed value bit 2 - Set to 0. */
281 unsigned u1Fixed2 : 1;
282 /** Fixed value bit 3 - Set to 1. */
283 unsigned u1Fixed3: 1;
284 /** Fixed value bit 4 - Set to 1. */
285 unsigned u1Fixed4 : 1;
286 /** Fixed value bit 5 - Set to 1. */
287 unsigned u1Fixed5 : 1;
288 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
289 unsigned u132BitGate : 1;
290 /** Fixed value bit 5 - Set to 0. */
291 unsigned u1Fixed6 : 1;
292 /** Descriptor Privilege level. */
293 unsigned u2DPL : 2;
294 /** Present flag. */
295 unsigned u1Present : 1;
296 /** High offset word. */
297 unsigned u16OffsetHigh : 16;
298} VBOXIDTE_TRAPGATE;
299#pragma pack()
300/** Pointer to IDT Entry, Trap Gate view. */
301typedef VBOXIDTE_TRAPGATE *PVBOXIDTE_TRAPGATE;
302
303/** IDT Entry Generic view. */
304#pragma pack(1) /* paranoia */
305typedef struct VBOXIDTE_GENERIC
306{
307 /** Low offset word. */
308 unsigned u16OffsetLow : 16;
309 /** Segment Selector. */
310 unsigned u16SegSel : 16;
311 /** Reserved. */
312 unsigned u5Reserved : 5;
313 /** IDT Type part one (not used for task gate). */
314 unsigned u3Type1 : 3;
315 /** IDT Type part two. */
316 unsigned u5Type2 : 5;
317 /** Descriptor Privilege level. */
318 unsigned u2DPL : 2;
319 /** Present flag. */
320 unsigned u1Present : 1;
321 /** High offset word. */
322 unsigned u16OffsetHigh : 16;
323} VBOXIDTE_GENERIC;
324#pragma pack()
325/** Pointer to IDT Entry Generic view. */
326typedef VBOXIDTE_GENERIC *PVBOXIDTE_GENERIC;
327
328/** IDT Type1 value. (Reserved for task gate!) */
329#define VBOX_IDTE_TYPE1 0
330/** IDT Type2 value - Task gate. */
331#define VBOX_IDTE_TYPE2_TASK 0x5
332/** IDT Type2 value - 16 bit interrupt gate. */
333#define VBOX_IDTE_TYPE2_INT_16 0x6
334/** IDT Type2 value - 32 bit interrupt gate. */
335#define VBOX_IDTE_TYPE2_INT_32 0xe
336/** IDT Type2 value - 16 bit trap gate. */
337#define VBOX_IDTE_TYPE2_TRAP_16 0x7
338/** IDT Type2 value - 32 bit trap gate. */
339#define VBOX_IDTE_TYPE2_TRAP_32 0xf
340
341/** IDT Entry. */
342#pragma pack(1) /* paranoia */
343typedef union VBOXIDTE
344{
345 /** Task gate view. */
346 VBOXIDTE_TASKGATE Task;
347 /** Trap gate view. */
348 VBOXIDTE_TRAPGATE Trap;
349 /** Interrupt gate view. */
350 VBOXIDTE_INTERRUPTGATE Int;
351 /** Generic IDT view. */
352 VBOXIDTE_GENERIC Gen;
353
354 /** 8 bit unsigned integer view. */
355 uint8_t au8[8];
356 /** 16 bit unsigned integer view. */
357 uint16_t au16[4];
358 /** 32 bit unsigned integer view. */
359 uint32_t au32[2];
360 /** 64 bit unsigned integer view. */
361 uint64_t au64;
362} VBOXIDTE;
363#pragma pack()
364/** Pointer to IDT Entry. */
365typedef VBOXIDTE *PVBOXIDTE;
366
367#pragma pack(1)
368/** IDTR */
369typedef struct VBOXIDTR
370{
371 /** Size of the IDT. */
372 uint16_t cbIdt;
373 /** Address of the IDT. */
374 uint64_t pIdt;
375} VBOXIDTR, *PVBOXIDTR;
376#pragma pack()
377/** @} */
378
379
380/** @def VBOXIDTE_OFFSET
381 * Return the offset of an IDT entry.
382 */
383#define VBOXIDTE_OFFSET(desc) \
384 ( ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
385 | ( (desc).Gen.u16OffsetLow ) )
386
387#pragma pack(1)
388/** GDTR */
389typedef struct VBOXGDTR
390{
391 /** Size of the GDT. */
392 uint16_t cbGdt;
393 /** Address of the GDT. */
394 uint64_t pGdt;
395} VBOXGDTR;
396#pragma pack()
397/** Pointer to GDTR. */
398typedef VBOXGDTR *PVBOXGDTR;
399
400/** @} */
401
402
403/**
404 * Task Segment
405 */
406#pragma pack(1)
407typedef struct VBOXTSS
408{
409 /** Back link to previous task. (static) */
410 RTSEL selPrev;
411 uint16_t padding1;
412 /** Ring-0 stack pointer. (static) */
413 uint32_t esp0;
414 /** Ring-0 stack segment. (static) */
415 RTSEL ss0;
416 uint16_t padding_ss0;
417 /** Ring-1 stack pointer. (static) */
418 uint32_t esp1;
419 /** Ring-1 stack segment. (static) */
420 RTSEL ss1;
421 uint16_t padding_ss1;
422 /** Ring-2 stack pointer. (static) */
423 uint32_t esp2;
424 /** Ring-2 stack segment. (static) */
425 RTSEL ss2;
426 uint16_t padding_ss2;
427 /** Page directory for the task. (static) */
428 uint32_t cr3;
429 /** EIP before task switch. */
430 uint32_t eip;
431 /** EFLAGS before task switch. */
432 uint32_t eflags;
433 /** EAX before task switch. */
434 uint32_t eax;
435 /** ECX before task switch. */
436 uint32_t ecx;
437 /** EDX before task switch. */
438 uint32_t edx;
439 /** EBX before task switch. */
440 uint32_t ebx;
441 /** ESP before task switch. */
442 uint32_t esp;
443 /** EBP before task switch. */
444 uint32_t ebp;
445 /** ESI before task switch. */
446 uint32_t esi;
447 /** EDI before task switch. */
448 uint32_t edi;
449 /** ES before task switch. */
450 RTSEL es;
451 uint16_t padding_es;
452 /** CS before task switch. */
453 RTSEL cs;
454 uint16_t padding_cs;
455 /** SS before task switch. */
456 RTSEL ss;
457 uint16_t padding_ss;
458 /** DS before task switch. */
459 RTSEL ds;
460 uint16_t padding_ds;
461 /** FS before task switch. */
462 RTSEL fs;
463 uint16_t padding_fs;
464 /** GS before task switch. */
465 RTSEL gs;
466 uint16_t padding_gs;
467 /** LDTR before task switch. */
468 RTSEL selLdt;
469 uint16_t padding_ldt;
470 /** Debug trap flag */
471 uint16_t fDebugTrap;
472 /** Offset relative to the TSS of the start of the I/O Bitmap
473 * and the end of the interrupt redirection bitmap. */
474 uint16_t offIoBitmap;
475 /** 32 bytes for the virtual interrupt redirection bitmap. (VME) */
476 uint8_t IntRedirBitmap[32];
477} VBOXTSS;
478#pragma pack()
479/** Pointer to task segment. */
480typedef VBOXTSS *PVBOXTSS;
481/** Pointer to const task segment. */
482typedef const VBOXTSS *PCVBOXTSS;
483
484
485/**
486 * Data transport buffer (scatter/gather)
487 */
488typedef struct PDMDATASEG
489{
490 /** Length of buffer in entry. */
491 size_t cbSeg;
492 /** Pointer to the start of the buffer. */
493 void *pvSeg;
494} PDMDATASEG;
495/** Pointer to a data transport segment. */
496typedef PDMDATASEG *PPDMDATASEG;
497/** Pointer to a const data transport segment. */
498typedef PDMDATASEG const *PCPDMDATASEG;
499
500/** @} */
501
502#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette