VirtualBox

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

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

TMTimerRCPtr and some types.

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