VirtualBox

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

Last change on this file since 58111 was 58111, checked in by vboxsync, 9 years ago

include,misc: More Doxygen grouping adjustments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 33.6 KB
Line 
1/** @file
2 * VirtualBox - Types.
3 */
4
5/*
6 * Copyright (C) 2006-2015 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_types_h
27#define ___VBox_types_h
28
29#include <VBox/cdefs.h>
30#include <iprt/types.h>
31
32
33/** @defgroup grp_types VBox Basic Types
34 * @{
35 */
36
37
38/** @defgroup grp_types_both Common Guest and Host Context Basic Types
39 * @{
40 */
41
42
43/** @defgroup grp_types_hc Host Context Basic Types
44 * @{
45 */
46
47/** @} */
48
49
50/** @defgroup grp_types_gc Guest Context Basic Types
51 * @{
52 */
53
54/** @} */
55
56
57/** Pointer to per support driver session data.
58 * (The data is a R0 entity and private to the the R0 SUP part. All
59 * other should consider this a sort of handle.) */
60typedef R0PTRTYPE(struct SUPDRVSESSION *) PSUPDRVSESSION;
61
62/** Event semaphore handle. Ring-0 / ring-3. */
63typedef R0PTRTYPE(struct SUPSEMEVENTHANDLE *) SUPSEMEVENT;
64/** Pointer to an event semaphore handle. */
65typedef SUPSEMEVENT *PSUPSEMEVENT;
66/** Nil event semaphore handle. */
67#define NIL_SUPSEMEVENT ((SUPSEMEVENT)0)
68
69/** Multiple release event semaphore handle. Ring-0 / ring-3. */
70typedef R0PTRTYPE(struct SUPSEMEVENTMULTIHANDLE *) SUPSEMEVENTMULTI;
71/** Pointer to an multiple release event semaphore handle. */
72typedef SUPSEMEVENTMULTI *PSUPSEMEVENTMULTI;
73/** Nil multiple release event semaphore handle. */
74#define NIL_SUPSEMEVENTMULTI ((SUPSEMEVENTMULTI)0)
75
76
77/** Pointer to a VM. */
78typedef struct VM *PVM;
79/** Pointer to a VM - Ring-0 Ptr. */
80typedef R0PTRTYPE(struct VM *) PVMR0;
81/** Pointer to a VM - Ring-3 Ptr. */
82typedef R3PTRTYPE(struct VM *) PVMR3;
83/** Pointer to a VM - RC Ptr. */
84typedef RCPTRTYPE(struct VM *) PVMRC;
85
86/** Pointer to a virtual CPU structure. */
87typedef struct VMCPU * PVMCPU;
88/** Pointer to a virtual CPU structure - Ring-3 Ptr. */
89typedef R3PTRTYPE(struct VMCPU *) PVMCPUR3;
90/** Pointer to a virtual CPU structure - Ring-0 Ptr. */
91typedef R0PTRTYPE(struct VMCPU *) PVMCPUR0;
92/** Pointer to a virtual CPU structure - RC Ptr. */
93typedef RCPTRTYPE(struct VMCPU *) PVMCPURC;
94
95/** Pointer to a ring-0 (global) VM structure. */
96typedef R0PTRTYPE(struct GVM *) PGVM;
97
98/** Pointer to a ring-3 (user mode) VM structure. */
99typedef R3PTRTYPE(struct UVM *) PUVM;
100
101/** Pointer to a ring-3 (user mode) VMCPU structure. */
102typedef R3PTRTYPE(struct UVMCPU *) PUVMCPU;
103
104/** Virtual CPU ID. */
105typedef uint32_t VMCPUID;
106/** Pointer to a virtual CPU ID. */
107typedef VMCPUID *PVMCPUID;
108/** @name Special CPU ID values.
109 * Most of these are for request scheduling.
110 *
111 * @{ */
112/** All virtual CPUs. */
113#define VMCPUID_ALL UINT32_C(0xfffffff2)
114/** All virtual CPUs, descending order. */
115#define VMCPUID_ALL_REVERSE UINT32_C(0xfffffff3)
116/** Any virtual CPU.
117 * Intended for scheduling a VM request or some other task. */
118#define VMCPUID_ANY UINT32_C(0xfffffff4)
119/** Any virtual CPU; always queue for future execution.
120 * Intended for scheduling a VM request or some other task. */
121#define VMCPUID_ANY_QUEUE UINT32_C(0xfffffff5)
122/** The NIL value. */
123#define NIL_VMCPUID UINT32_C(0xfffffffd)
124/** @} */
125
126/**
127 * Virtual CPU set.
128 */
129typedef struct VMCPUSET
130{
131 /** The bitmap data. */
132 uint32_t au32Bitmap[8 /*256/32*/];
133} VMCPUSET;
134/** Pointer to a Virtual CPU set. */
135typedef VMCPUSET *PVMCPUSET;
136/** Pointer to a const Virtual CPU set. */
137typedef VMCPUSET const *PCVMCPUSET;
138
139
140/**
141 * VM State
142 */
143typedef enum VMSTATE
144{
145 /** The VM is being created. */
146 VMSTATE_CREATING = 0,
147 /** The VM is created. */
148 VMSTATE_CREATED,
149 /** The VM state is being loaded from file. */
150 VMSTATE_LOADING,
151 /** The VM is being powered on */
152 VMSTATE_POWERING_ON,
153 /** The VM is being resumed. */
154 VMSTATE_RESUMING,
155 /** The VM is runnning. */
156 VMSTATE_RUNNING,
157 /** Live save: The VM is running and the state is being saved. */
158 VMSTATE_RUNNING_LS,
159 /** Fault Tolerance: The VM is running and the state is being synced. */
160 VMSTATE_RUNNING_FT,
161 /** The VM is being reset. */
162 VMSTATE_RESETTING,
163 /** Live save: The VM is being reset and immediately suspended. */
164 VMSTATE_RESETTING_LS,
165 /** The VM is being suspended. */
166 VMSTATE_SUSPENDING,
167 /** Live save: The VM is being suspended during a live save operation, either as
168 * part of the normal flow or VMR3Reset. */
169 VMSTATE_SUSPENDING_LS,
170 /** Live save: The VM is being suspended by VMR3Suspend during live save. */
171 VMSTATE_SUSPENDING_EXT_LS,
172 /** The VM is suspended. */
173 VMSTATE_SUSPENDED,
174 /** Live save: The VM has been suspended and is waiting for the live save
175 * operation to move on. */
176 VMSTATE_SUSPENDED_LS,
177 /** Live save: The VM has been suspended by VMR3Suspend during a live save. */
178 VMSTATE_SUSPENDED_EXT_LS,
179 /** The VM is suspended and its state is being saved by EMT(0). (See SSM) */
180 VMSTATE_SAVING,
181 /** The VM is being debugged. (See DBGF.) */
182 VMSTATE_DEBUGGING,
183 /** Live save: The VM is being debugged while the live phase is going on. */
184 VMSTATE_DEBUGGING_LS,
185 /** The VM is being powered off. */
186 VMSTATE_POWERING_OFF,
187 /** Live save: The VM is being powered off and the save cancelled. */
188 VMSTATE_POWERING_OFF_LS,
189 /** The VM is switched off, awaiting destruction. */
190 VMSTATE_OFF,
191 /** Live save: Waiting for cancellation and transition to VMSTATE_OFF. */
192 VMSTATE_OFF_LS,
193 /** The VM is powered off because of a fatal error. */
194 VMSTATE_FATAL_ERROR,
195 /** Live save: Waiting for cancellation and transition to FatalError. */
196 VMSTATE_FATAL_ERROR_LS,
197 /** The VM is in guru meditation over a fatal failure. */
198 VMSTATE_GURU_MEDITATION,
199 /** Live save: Waiting for cancellation and transition to GuruMeditation. */
200 VMSTATE_GURU_MEDITATION_LS,
201 /** The VM is screwed because of a failed state loading. */
202 VMSTATE_LOAD_FAILURE,
203 /** The VM is being destroyed. */
204 VMSTATE_DESTROYING,
205 /** Terminated. */
206 VMSTATE_TERMINATED,
207 /** hack forcing the size of the enum to 32-bits. */
208 VMSTATE_MAKE_32BIT_HACK = 0x7fffffff
209} VMSTATE;
210
211/** @def VBOXSTRICTRC_STRICT_ENABLED
212 * Indicates that VBOXSTRICTRC is in strict mode.
213 */
214#if defined(__cplusplus) \
215 && ARCH_BITS == 64 /* cdecl requires classes and structs as hidden params. */ \
216 && !defined(_MSC_VER) /* trouble similar to 32-bit gcc. */ \
217 && ( defined(RT_STRICT) \
218 || defined(VBOX_STRICT) \
219 || defined(DEBUG) \
220 || defined(DOXYGEN_RUNNING) )
221# define VBOXSTRICTRC_STRICT_ENABLED 1
222#endif
223
224/** We need RTERR_STRICT_RC. */
225#if defined(VBOXSTRICTRC_STRICT_ENABLED) && !defined(RTERR_STRICT_RC)
226# define RTERR_STRICT_RC 1
227#endif
228
229/**
230 * Strict VirtualBox status code.
231 *
232 * This is normally an 32-bit integer and the only purpose of the type is to
233 * highlight the special handling that is required. But in strict build it is a
234 * class that causes compilation and runtime errors for some of the incorrect
235 * handling.
236 */
237#ifdef VBOXSTRICTRC_STRICT_ENABLED
238struct VBOXSTRICTRC
239{
240protected:
241 /** The status code. */
242 int32_t m_rc;
243
244public:
245 /** Default constructor setting the status to VERR_IPE_UNINITIALIZED_STATUS. */
246 VBOXSTRICTRC()
247#ifdef VERR_IPE_UNINITIALIZED_STATUS
248 : m_rc(VERR_IPE_UNINITIALIZED_STATUS)
249#else
250 : m_rc(-233 /*VERR_IPE_UNINITIALIZED_STATUS*/)
251#endif
252 {
253 }
254
255 /** Constructor for normal integer status codes. */
256 VBOXSTRICTRC(int32_t const rc)
257 : m_rc(rc)
258 {
259 }
260
261 /** Getter that VBOXSTRICTRC_VAL can use. */
262 int32_t getValue() const { return m_rc; }
263
264 /** @name Comparison operators
265 * @{ */
266 bool operator==(int32_t rc) const { return m_rc == rc; }
267 bool operator!=(int32_t rc) const { return m_rc != rc; }
268 bool operator<=(int32_t rc) const { return m_rc <= rc; }
269 bool operator>=(int32_t rc) const { return m_rc >= rc; }
270 bool operator<(int32_t rc) const { return m_rc < rc; }
271 bool operator>(int32_t rc) const { return m_rc > rc; }
272
273 bool operator==(const VBOXSTRICTRC &rRc) const { return m_rc == rRc.m_rc; }
274 bool operator!=(const VBOXSTRICTRC &rRc) const { return m_rc != rRc.m_rc; }
275 bool operator<=(const VBOXSTRICTRC &rRc) const { return m_rc <= rRc.m_rc; }
276 bool operator>=(const VBOXSTRICTRC &rRc) const { return m_rc >= rRc.m_rc; }
277 bool operator<(const VBOXSTRICTRC &rRc) const { return m_rc < rRc.m_rc; }
278 bool operator>(const VBOXSTRICTRC &rRc) const { return m_rc > rRc.m_rc; }
279 /** @} */
280
281 /** Special automatic cast for RT_SUCCESS_NP. */
282 operator RTErrStrictType2() const { return RTErrStrictType2(m_rc); }
283
284private:
285 /** @name Constructors that will prevent some of the bad types.
286 * @{ */
287 VBOXSTRICTRC(uint8_t rc) : m_rc(-999) { NOREF(rc); }
288 VBOXSTRICTRC(uint16_t rc) : m_rc(-999) { NOREF(rc); }
289 VBOXSTRICTRC(uint32_t rc) : m_rc(-999) { NOREF(rc); }
290 VBOXSTRICTRC(uint64_t rc) : m_rc(-999) { NOREF(rc); }
291
292 VBOXSTRICTRC(int8_t rc) : m_rc(-999) { NOREF(rc); }
293 VBOXSTRICTRC(int16_t rc) : m_rc(-999) { NOREF(rc); }
294 VBOXSTRICTRC(int64_t rc) : m_rc(-999) { NOREF(rc); }
295 /** @} */
296};
297# ifdef _MSC_VER
298# pragma warning(disable:4190)
299# endif
300#else
301typedef int32_t VBOXSTRICTRC;
302#endif
303
304/** @def VBOXSTRICTRC_VAL
305 * Explicit getter.
306 * @param rcStrict The strict VirtualBox status code.
307 */
308#ifdef VBOXSTRICTRC_STRICT_ENABLED
309# define VBOXSTRICTRC_VAL(rcStrict) ( (rcStrict).getValue() )
310#else
311# define VBOXSTRICTRC_VAL(rcStrict) (rcStrict)
312#endif
313
314/** @def VBOXSTRICTRC_TODO
315 * Returns that needs dealing with.
316 * @param rcStrict The strict VirtualBox status code.
317 */
318#define VBOXSTRICTRC_TODO(rcStrict) VBOXSTRICTRC_VAL(rcStrict)
319
320
321/** Pointer to a PDM Base Interface. */
322typedef struct PDMIBASE *PPDMIBASE;
323/** Pointer to a pointer to a PDM Base Interface. */
324typedef PPDMIBASE *PPPDMIBASE;
325
326/** Pointer to a PDM Device Instance. */
327typedef struct PDMDEVINS *PPDMDEVINS;
328/** Pointer to a pointer to a PDM Device Instance. */
329typedef PPDMDEVINS *PPPDMDEVINS;
330/** R3 pointer to a PDM Device Instance. */
331typedef R3PTRTYPE(PPDMDEVINS) PPDMDEVINSR3;
332/** R0 pointer to a PDM Device Instance. */
333typedef R0PTRTYPE(PPDMDEVINS) PPDMDEVINSR0;
334/** RC pointer to a PDM Device Instance. */
335typedef RCPTRTYPE(PPDMDEVINS) PPDMDEVINSRC;
336
337/** Pointer to a PDM USB Device Instance. */
338typedef struct PDMUSBINS *PPDMUSBINS;
339/** Pointer to a pointer to a PDM USB Device Instance. */
340typedef PPDMUSBINS *PPPDMUSBINS;
341
342/** Pointer to a PDM Driver Instance. */
343typedef struct PDMDRVINS *PPDMDRVINS;
344/** Pointer to a pointer to a PDM Driver Instance. */
345typedef PPDMDRVINS *PPPDMDRVINS;
346/** R3 pointer to a PDM Driver Instance. */
347typedef R3PTRTYPE(PPDMDRVINS) PPDMDRVINSR3;
348/** R0 pointer to a PDM Driver Instance. */
349typedef R0PTRTYPE(PPDMDRVINS) PPDMDRVINSR0;
350/** RC pointer to a PDM Driver Instance. */
351typedef RCPTRTYPE(PPDMDRVINS) PPDMDRVINSRC;
352
353/** Pointer to a PDM Service Instance. */
354typedef struct PDMSRVINS *PPDMSRVINS;
355/** Pointer to a pointer to a PDM Service Instance. */
356typedef PPDMSRVINS *PPPDMSRVINS;
357
358/** Pointer to a PDM critical section. */
359typedef union PDMCRITSECT *PPDMCRITSECT;
360/** Pointer to a const PDM critical section. */
361typedef const union PDMCRITSECT *PCPDMCRITSECT;
362
363/** Pointer to a PDM read/write critical section. */
364typedef union PDMCRITSECTRW *PPDMCRITSECTRW;
365/** Pointer to a const PDM read/write critical section. */
366typedef union PDMCRITSECTRW const *PCPDMCRITSECTRW;
367
368/** R3 pointer to a timer. */
369typedef R3PTRTYPE(struct TMTIMER *) PTMTIMERR3;
370/** Pointer to a R3 pointer to a timer. */
371typedef PTMTIMERR3 *PPTMTIMERR3;
372
373/** R0 pointer to a timer. */
374typedef R0PTRTYPE(struct TMTIMER *) PTMTIMERR0;
375/** Pointer to a R3 pointer to a timer. */
376typedef PTMTIMERR0 *PPTMTIMERR0;
377
378/** RC pointer to a timer. */
379typedef RCPTRTYPE(struct TMTIMER *) PTMTIMERRC;
380/** Pointer to a RC pointer to a timer. */
381typedef PTMTIMERRC *PPTMTIMERRC;
382
383/** Pointer to a timer. */
384typedef CTX_SUFF(PTMTIMER) PTMTIMER;
385/** Pointer to a pointer to a timer. */
386typedef PTMTIMER *PPTMTIMER;
387
388/** SSM Operation handle. */
389typedef struct SSMHANDLE *PSSMHANDLE;
390/** Pointer to a const SSM stream method table. */
391typedef struct SSMSTRMOPS const *PCSSMSTRMOPS;
392
393/** Pointer to a CPUMCTX. */
394typedef struct CPUMCTX *PCPUMCTX;
395/** Pointer to a const CPUMCTX. */
396typedef const struct CPUMCTX *PCCPUMCTX;
397
398/** Pointer to a CPU context core. */
399typedef struct CPUMCTXCORE *PCPUMCTXCORE;
400/** Pointer to a const CPU context core. */
401typedef const struct CPUMCTXCORE *PCCPUMCTXCORE;
402
403/** Pointer to a selector register. */
404typedef struct CPUMSELREG *PCPUMSELREG;
405/** Pointer to a const selector register. */
406typedef const struct CPUMSELREG *PCCPUMSELREG;
407
408/** Pointer to selector hidden registers.
409 * @deprecated Replaced by PCPUMSELREG */
410typedef struct CPUMSELREG *PCPUMSELREGHID;
411/** Pointer to const selector hidden registers.
412 * @deprecated Replaced by PCCPUMSELREG */
413typedef const struct CPUMSELREG *PCCPUMSELREGHID;
414
415/** @} */
416
417
418/** @defgroup grp_types_idt Interrupt Descriptor Table Entry.
419 * @todo This all belongs in x86.h!
420 * @{ */
421
422/** @todo VBOXIDT -> VBOXDESCIDT, skip the complex variations. We'll never use them. */
423
424/** IDT Entry, Task Gate view. */
425#pragma pack(1) /* paranoia */
426typedef struct VBOXIDTE_TASKGATE
427{
428 /** Reserved. */
429 unsigned u16Reserved1 : 16;
430 /** Task Segment Selector. */
431 unsigned u16TSS : 16;
432 /** More reserved. */
433 unsigned u8Reserved2 : 8;
434 /** Fixed value bit 0 - Set to 1. */
435 unsigned u1Fixed0 : 1;
436 /** Busy bit. */
437 unsigned u1Busy : 1;
438 /** Fixed value bit 2 - Set to 1. */
439 unsigned u1Fixed1 : 1;
440 /** Fixed value bit 3 - Set to 0. */
441 unsigned u1Fixed2 : 1;
442 /** Fixed value bit 4 - Set to 0. */
443 unsigned u1Fixed3 : 1;
444 /** Descriptor Privilege level. */
445 unsigned u2DPL : 2;
446 /** Present flag. */
447 unsigned u1Present : 1;
448 /** Reserved. */
449 unsigned u16Reserved3 : 16;
450} VBOXIDTE_TASKGATE;
451#pragma pack()
452/** Pointer to IDT Entry, Task gate view. */
453typedef VBOXIDTE_TASKGATE *PVBOXIDTE_TASKGATE;
454
455
456/** IDT Entry, Intertupt gate view. */
457#pragma pack(1) /* paranoia */
458typedef struct VBOXIDTE_INTERRUPTGATE
459{
460 /** Low offset word. */
461 unsigned u16OffsetLow : 16;
462 /** Segment Selector. */
463 unsigned u16SegSel : 16;
464 /** Reserved. */
465 unsigned u5Reserved2 : 5;
466 /** Fixed value bit 0 - Set to 0. */
467 unsigned u1Fixed0 : 1;
468 /** Fixed value bit 1 - Set to 0. */
469 unsigned u1Fixed1 : 1;
470 /** Fixed value bit 2 - Set to 0. */
471 unsigned u1Fixed2 : 1;
472 /** Fixed value bit 3 - Set to 0. */
473 unsigned u1Fixed3 : 1;
474 /** Fixed value bit 4 - Set to 1. */
475 unsigned u1Fixed4 : 1;
476 /** Fixed value bit 5 - Set to 1. */
477 unsigned u1Fixed5 : 1;
478 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
479 unsigned u132BitGate : 1;
480 /** Fixed value bit 5 - Set to 0. */
481 unsigned u1Fixed6 : 1;
482 /** Descriptor Privilege level. */
483 unsigned u2DPL : 2;
484 /** Present flag. */
485 unsigned u1Present : 1;
486 /** High offset word. */
487 unsigned u16OffsetHigh : 16;
488} VBOXIDTE_INTERRUPTGATE;
489#pragma pack()
490/** Pointer to IDT Entry, Interrupt gate view. */
491typedef VBOXIDTE_INTERRUPTGATE *PVBOXIDTE_INTERRUPTGATE;
492
493/** IDT Entry, Trap Gate view. */
494#pragma pack(1) /* paranoia */
495typedef struct VBOXIDTE_TRAPGATE
496{
497 /** Low offset word. */
498 unsigned u16OffsetLow : 16;
499 /** Segment Selector. */
500 unsigned u16SegSel : 16;
501 /** Reserved. */
502 unsigned u5Reserved2 : 5;
503 /** Fixed value bit 0 - Set to 0. */
504 unsigned u1Fixed0 : 1;
505 /** Fixed value bit 1 - Set to 0. */
506 unsigned u1Fixed1 : 1;
507 /** Fixed value bit 2 - Set to 0. */
508 unsigned u1Fixed2 : 1;
509 /** Fixed value bit 3 - Set to 1. */
510 unsigned u1Fixed3 : 1;
511 /** Fixed value bit 4 - Set to 1. */
512 unsigned u1Fixed4 : 1;
513 /** Fixed value bit 5 - Set to 1. */
514 unsigned u1Fixed5 : 1;
515 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
516 unsigned u132BitGate : 1;
517 /** Fixed value bit 5 - Set to 0. */
518 unsigned u1Fixed6 : 1;
519 /** Descriptor Privilege level. */
520 unsigned u2DPL : 2;
521 /** Present flag. */
522 unsigned u1Present : 1;
523 /** High offset word. */
524 unsigned u16OffsetHigh : 16;
525} VBOXIDTE_TRAPGATE;
526#pragma pack()
527/** Pointer to IDT Entry, Trap Gate view. */
528typedef VBOXIDTE_TRAPGATE *PVBOXIDTE_TRAPGATE;
529
530/** IDT Entry Generic view. */
531#pragma pack(1) /* paranoia */
532typedef struct VBOXIDTE_GENERIC
533{
534 /** Low offset word. */
535 unsigned u16OffsetLow : 16;
536 /** Segment Selector. */
537 unsigned u16SegSel : 16;
538 /** Reserved. */
539 unsigned u5Reserved : 5;
540 /** IDT Type part one (not used for task gate). */
541 unsigned u3Type1 : 3;
542 /** IDT Type part two. */
543 unsigned u5Type2 : 5;
544 /** Descriptor Privilege level. */
545 unsigned u2DPL : 2;
546 /** Present flag. */
547 unsigned u1Present : 1;
548 /** High offset word. */
549 unsigned u16OffsetHigh : 16;
550} VBOXIDTE_GENERIC;
551#pragma pack()
552/** Pointer to IDT Entry Generic view. */
553typedef VBOXIDTE_GENERIC *PVBOXIDTE_GENERIC;
554
555/** IDT Type1 value. (Reserved for task gate!) */
556#define VBOX_IDTE_TYPE1 0
557/** IDT Type2 value - Task gate. */
558#define VBOX_IDTE_TYPE2_TASK 0x5
559/** IDT Type2 value - 16 bit interrupt gate. */
560#define VBOX_IDTE_TYPE2_INT_16 0x6
561/** IDT Type2 value - 32 bit interrupt gate. */
562#define VBOX_IDTE_TYPE2_INT_32 0xe
563/** IDT Type2 value - 16 bit trap gate. */
564#define VBOX_IDTE_TYPE2_TRAP_16 0x7
565/** IDT Type2 value - 32 bit trap gate. */
566#define VBOX_IDTE_TYPE2_TRAP_32 0xf
567
568/** IDT Entry. */
569#pragma pack(1) /* paranoia */
570typedef union VBOXIDTE
571{
572 /** Task gate view. */
573 VBOXIDTE_TASKGATE Task;
574 /** Trap gate view. */
575 VBOXIDTE_TRAPGATE Trap;
576 /** Interrupt gate view. */
577 VBOXIDTE_INTERRUPTGATE Int;
578 /** Generic IDT view. */
579 VBOXIDTE_GENERIC Gen;
580
581 /** 8 bit unsigned integer view. */
582 uint8_t au8[8];
583 /** 16 bit unsigned integer view. */
584 uint16_t au16[4];
585 /** 32 bit unsigned integer view. */
586 uint32_t au32[2];
587 /** 64 bit unsigned integer view. */
588 uint64_t au64;
589} VBOXIDTE;
590#pragma pack()
591/** Pointer to IDT Entry. */
592typedef VBOXIDTE *PVBOXIDTE;
593/** Pointer to IDT Entry. */
594typedef VBOXIDTE const *PCVBOXIDTE;
595
596/** IDT Entry, 64-bit mode, Intertupt gate view. */
597#pragma pack(1) /* paranoia */
598typedef struct VBOXIDTE64_INTERRUPTGATE
599{
600 /** Low offset word. */
601 unsigned u16OffsetLow : 16;
602 /** Segment Selector. */
603 unsigned u16SegSel : 16;
604 /** Interrupt Stack Table Index. */
605 unsigned u3Ist : 3;
606 /** Fixed value bit 0 - Set to 0. */
607 unsigned u1Fixed0 : 1;
608 /** Fixed value bit 1 - Set to 0. */
609 unsigned u1Fixed1 : 1;
610 /** Fixed value bit 2 - Set to 0. */
611 unsigned u1Fixed2 : 1;
612 /** Fixed value bit 3 - Set to 0. */
613 unsigned u1Fixed3 : 1;
614 /** Fixed value bit 4 - Set to 0. */
615 unsigned u1Fixed4 : 1;
616 /** Fixed value bit 5 - Set to 0. */
617 unsigned u1Fixed5 : 1;
618 /** Fixed value bit 6 - Set to 1. */
619 unsigned u1Fixed6 : 1;
620 /** Fixed value bit 7 - Set to 1. */
621 unsigned u1Fixed7 : 1;
622 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
623 unsigned u132BitGate : 1;
624 /** Fixed value bit 5 - Set to 0. */
625 unsigned u1Fixed8 : 1;
626 /** Descriptor Privilege level. */
627 unsigned u2DPL : 2;
628 /** Present flag. */
629 unsigned u1Present : 1;
630 /** High offset word. */
631 unsigned u16OffsetHigh : 16;
632 /** Offset bits 32..63. */
633 unsigned u32OffsetHigh64;
634 /** Reserved. */
635 unsigned u32Reserved;
636} VBOXIDTE64_INTERRUPTGATE;
637#pragma pack()
638/** Pointer to IDT Entry, 64-bit mode, Interrupt gate view. */
639typedef VBOXIDTE64_INTERRUPTGATE *PVBOXIDTE64_INTERRUPTGATE;
640
641/** IDT Entry, 64-bit mode, Trap gate view. */
642#pragma pack(1) /* paranoia */
643typedef struct VBOXIDTE64_TRAPGATE
644{
645 /** Low offset word. */
646 unsigned u16OffsetLow : 16;
647 /** Segment Selector. */
648 unsigned u16SegSel : 16;
649 /** Interrupt Stack Table Index. */
650 unsigned u3Ist : 3;
651 /** Fixed value bit 0 - Set to 0. */
652 unsigned u1Fixed0 : 1;
653 /** Fixed value bit 1 - Set to 0. */
654 unsigned u1Fixed1 : 1;
655 /** Fixed value bit 2 - Set to 0. */
656 unsigned u1Fixed2 : 1;
657 /** Fixed value bit 3 - Set to 0. */
658 unsigned u1Fixed3 : 1;
659 /** Fixed value bit 4 - Set to 0. */
660 unsigned u1Fixed4 : 1;
661 /** Fixed value bit 5 - Set to 1. */
662 unsigned u1Fixed5 : 1;
663 /** Fixed value bit 6 - Set to 1. */
664 unsigned u1Fixed6 : 1;
665 /** Fixed value bit 7 - Set to 1. */
666 unsigned u1Fixed7 : 1;
667 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
668 unsigned u132BitGate : 1;
669 /** Fixed value bit 5 - Set to 0. */
670 unsigned u1Fixed8 : 1;
671 /** Descriptor Privilege level. */
672 unsigned u2DPL : 2;
673 /** Present flag. */
674 unsigned u1Present : 1;
675 /** High offset word. */
676 unsigned u16OffsetHigh : 16;
677 /** Offset bits 32..63. */
678 unsigned u32OffsetHigh64;
679 /** Reserved. */
680 unsigned u32Reserved;
681} VBOXIDTE64_TRAPGATE;
682#pragma pack()
683/** Pointer to IDT Entry, 64-bit mode, Trap gate view. */
684typedef VBOXIDTE64_TRAPGATE *PVBOXIDTE64_TRAPGATE;
685
686/** IDT Entry, 64-bit mode, Generic view. */
687#pragma pack(1) /* paranoia */
688typedef struct VBOXIDTE64_GENERIC
689{
690 /** Low offset word. */
691 unsigned u16OffsetLow : 16;
692 /** Segment Selector. */
693 unsigned u16SegSel : 16;
694 /** Reserved. */
695 unsigned u3Ist : 3;
696 /** Fixed value bit 0 - Set to 0. */
697 unsigned u1Fixed0 : 1;
698 /** Fixed value bit 1 - Set to 0. */
699 unsigned u1Fixed1 : 1;
700 /** IDT Type part one (not used for task gate). */
701 unsigned u3Type1 : 3;
702 /** IDT Type part two. */
703 unsigned u5Type2 : 5;
704 /** Descriptor Privilege level. */
705 unsigned u2DPL : 2;
706 /** Present flag. */
707 unsigned u1Present : 1;
708 /** High offset word. */
709 unsigned u16OffsetHigh : 16;
710 /** Offset bits 32..63. */
711 unsigned u32OffsetHigh64;
712 /** Reserved. */
713 unsigned u32Reserved;
714} VBOXIDTE64_GENERIC;
715#pragma pack()
716/** Pointer to IDT Entry, 64-bit mode, Generic view. */
717typedef VBOXIDTE64_GENERIC *PVBOXIDTE64_GENERIC;
718
719/** IDT Entry, 64-bit mode. */
720#pragma pack(1) /* paranoia */
721typedef union VBOXIDTE64
722{
723 /** Trap gate view. */
724 VBOXIDTE64_TRAPGATE Trap;
725 /** Interrupt gate view. */
726 VBOXIDTE64_INTERRUPTGATE Int;
727 /** Generic IDT view. */
728 VBOXIDTE64_GENERIC Gen;
729
730 /** 8 bit unsigned integer view. */
731 uint8_t au8[16];
732 /** 16 bit unsigned integer view. */
733 uint16_t au16[8];
734 /** 32 bit unsigned integer view. */
735 uint32_t au32[4];
736 /** 64 bit unsigned integer view. */
737 uint64_t au64[2];
738} VBOXIDTE64;
739#pragma pack()
740/** Pointer to IDT Entry. */
741typedef VBOXIDTE64 *PVBOXIDTE64;
742/** Pointer to IDT Entry. */
743typedef VBOXIDTE64 const *PCVBOXIDTE64;
744
745#pragma pack(1)
746/** IDTR */
747typedef struct VBOXIDTR
748{
749 /** Size of the IDT. */
750 uint16_t cbIdt;
751 /** Address of the IDT. */
752 uint64_t pIdt;
753} VBOXIDTR, *PVBOXIDTR;
754#pragma pack()
755
756/** @} */
757
758
759/** @def VBOXIDTE_OFFSET
760 * Return the offset of an IDT entry.
761 */
762#define VBOXIDTE_OFFSET(desc) \
763 ( ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
764 | ( (desc).Gen.u16OffsetLow ) )
765
766/** @def VBOXIDTE64_OFFSET
767 * Return the offset of an IDT entry.
768 */
769#define VBOXIDTE64_OFFSET(desc) \
770 ( ((uint64_t)((desc).Gen.u32OffsetHigh64) << 32) \
771 | ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
772 | ( (desc).Gen.u16OffsetLow ) )
773
774#pragma pack(1)
775/** GDTR */
776typedef struct VBOXGDTR
777{
778 /** Size of the GDT. */
779 uint16_t cbGdt;
780 /** Address of the GDT. */
781 uint64_t pGdt;
782} VBOXGDTR;
783#pragma pack()
784/** Pointer to GDTR. */
785typedef VBOXGDTR *PVBOXGDTR;
786
787/** @} */
788
789
790/**
791 * 32-bit Task Segment used in raw mode.
792 * @todo Move this to SELM! Use X86TSS32 instead.
793 */
794#pragma pack(1)
795typedef struct VBOXTSS
796{
797 /** 0x00 - Back link to previous task. (static) */
798 RTSEL selPrev;
799 uint16_t padding1;
800 /** 0x04 - Ring-0 stack pointer. (static) */
801 uint32_t esp0;
802 /** 0x08 - Ring-0 stack segment. (static) */
803 RTSEL ss0;
804 uint16_t padding_ss0;
805 /** 0x0c - Ring-1 stack pointer. (static) */
806 uint32_t esp1;
807 /** 0x10 - Ring-1 stack segment. (static) */
808 RTSEL ss1;
809 uint16_t padding_ss1;
810 /** 0x14 - Ring-2 stack pointer. (static) */
811 uint32_t esp2;
812 /** 0x18 - Ring-2 stack segment. (static) */
813 RTSEL ss2;
814 uint16_t padding_ss2;
815 /** 0x1c - Page directory for the task. (static) */
816 uint32_t cr3;
817 /** 0x20 - EIP before task switch. */
818 uint32_t eip;
819 /** 0x24 - EFLAGS before task switch. */
820 uint32_t eflags;
821 /** 0x28 - EAX before task switch. */
822 uint32_t eax;
823 /** 0x2c - ECX before task switch. */
824 uint32_t ecx;
825 /** 0x30 - EDX before task switch. */
826 uint32_t edx;
827 /** 0x34 - EBX before task switch. */
828 uint32_t ebx;
829 /** 0x38 - ESP before task switch. */
830 uint32_t esp;
831 /** 0x3c - EBP before task switch. */
832 uint32_t ebp;
833 /** 0x40 - ESI before task switch. */
834 uint32_t esi;
835 /** 0x44 - EDI before task switch. */
836 uint32_t edi;
837 /** 0x48 - ES before task switch. */
838 RTSEL es;
839 uint16_t padding_es;
840 /** 0x4c - CS before task switch. */
841 RTSEL cs;
842 uint16_t padding_cs;
843 /** 0x50 - SS before task switch. */
844 RTSEL ss;
845 uint16_t padding_ss;
846 /** 0x54 - DS before task switch. */
847 RTSEL ds;
848 uint16_t padding_ds;
849 /** 0x58 - FS before task switch. */
850 RTSEL fs;
851 uint16_t padding_fs;
852 /** 0x5c - GS before task switch. */
853 RTSEL gs;
854 uint16_t padding_gs;
855 /** 0x60 - LDTR before task switch. */
856 RTSEL selLdt;
857 uint16_t padding_ldt;
858 /** 0x64 - Debug trap flag */
859 uint16_t fDebugTrap;
860 /** 0x66 - Offset relative to the TSS of the start of the I/O Bitmap
861 * and the end of the interrupt redirection bitmap. */
862 uint16_t offIoBitmap;
863 /** 0x68 - 32 bytes for the virtual interrupt redirection bitmap. (VME) */
864 uint8_t IntRedirBitmap[32];
865} VBOXTSS;
866#pragma pack()
867/** Pointer to task segment. */
868typedef VBOXTSS *PVBOXTSS;
869/** Pointer to const task segment. */
870typedef const VBOXTSS *PCVBOXTSS;
871
872
873/** Pointer to a callback method table provided by the VM API user. */
874typedef struct VMM2USERMETHODS const *PCVMM2USERMETHODS;
875
876
877/**
878 * Data transport buffer (scatter/gather)
879 */
880typedef struct PDMDATASEG
881{
882 /** Length of buffer in entry. */
883 size_t cbSeg;
884 /** Pointer to the start of the buffer. */
885 void *pvSeg;
886} PDMDATASEG;
887/** Pointer to a data transport segment. */
888typedef PDMDATASEG *PPDMDATASEG;
889/** Pointer to a const data transport segment. */
890typedef PDMDATASEG const *PCPDMDATASEG;
891
892
893/**
894 * Forms of generic segment offloading.
895 */
896typedef enum PDMNETWORKGSOTYPE
897{
898 /** Invalid zero value. */
899 PDMNETWORKGSOTYPE_INVALID = 0,
900 /** TCP/IPv4 - no CWR/ECE encoding. */
901 PDMNETWORKGSOTYPE_IPV4_TCP,
902 /** TCP/IPv6 - no CWR/ECE encoding. */
903 PDMNETWORKGSOTYPE_IPV6_TCP,
904 /** UDP/IPv4. */
905 PDMNETWORKGSOTYPE_IPV4_UDP,
906 /** UDP/IPv6. */
907 PDMNETWORKGSOTYPE_IPV6_UDP,
908 /** TCP/IPv6 over IPv4 tunneling - no CWR/ECE encoding.
909 * The header offsets and sizes relates to IPv4 and TCP, the IPv6 header is
910 * figured out as needed.
911 * @todo Needs checking against facts, this is just an outline of the idea. */
912 PDMNETWORKGSOTYPE_IPV4_IPV6_TCP,
913 /** UDP/IPv6 over IPv4 tunneling.
914 * The header offsets and sizes relates to IPv4 and UDP, the IPv6 header is
915 * figured out as needed.
916 * @todo Needs checking against facts, this is just an outline of the idea. */
917 PDMNETWORKGSOTYPE_IPV4_IPV6_UDP,
918 /** The end of valid GSO types. */
919 PDMNETWORKGSOTYPE_END
920} PDMNETWORKGSOTYPE;
921
922
923/**
924 * Generic segment offloading context.
925 *
926 * We generally follow the E1000 specs wrt to which header fields we change.
927 * However the GSO type implies where the checksum fields are and that they are
928 * always updated from scratch (no half done pseudo checksums).
929 *
930 * @remarks This is part of the internal network GSO packets. Take great care
931 * when making changes. The size is expected to be exactly 8 bytes.
932 */
933typedef struct PDMNETWORKGSO
934{
935 /** The type of segmentation offloading we're performing (PDMNETWORKGSOTYPE). */
936 uint8_t u8Type;
937 /** The total header size. */
938 uint8_t cbHdrsTotal;
939 /** The max segment size (MSS) to apply. */
940 uint16_t cbMaxSeg;
941
942 /** Offset of the first header (IPv4 / IPv6). 0 if not not needed. */
943 uint8_t offHdr1;
944 /** Offset of the second header (TCP / UDP). 0 if not not needed. */
945 uint8_t offHdr2;
946 /** The header size used for segmentation (equal to offHdr2 in UFO). */
947 uint8_t cbHdrsSeg;
948 /** Unused. */
949 uint8_t u8Unused;
950} PDMNETWORKGSO;
951/** Pointer to a GSO context. */
952typedef PDMNETWORKGSO *PPDMNETWORKGSO;
953/** Pointer to a const GSO context. */
954typedef PDMNETWORKGSO const *PCPDMNETWORKGSO;
955
956
957/**
958 * The current ROM page protection.
959 *
960 * @remarks This is part of the saved state.
961 */
962typedef enum PGMROMPROT
963{
964 /** The customary invalid value. */
965 PGMROMPROT_INVALID = 0,
966 /** Read from the virgin ROM page, ignore writes.
967 * Map the virgin page, use write access handler to ignore writes. */
968 PGMROMPROT_READ_ROM_WRITE_IGNORE,
969 /** Read from the virgin ROM page, write to the shadow RAM.
970 * Map the virgin page, use write access handler to change the shadow RAM. */
971 PGMROMPROT_READ_ROM_WRITE_RAM,
972 /** Read from the shadow ROM page, ignore writes.
973 * Map the shadow page read-only, use write access handler to ignore writes. */
974 PGMROMPROT_READ_RAM_WRITE_IGNORE,
975 /** Read from the shadow ROM page, ignore writes.
976 * Map the shadow page read-write, disabled write access handler. */
977 PGMROMPROT_READ_RAM_WRITE_RAM,
978 /** The end of valid values. */
979 PGMROMPROT_END,
980 /** The usual 32-bit type size hack. */
981 PGMROMPROT_32BIT_HACK = 0x7fffffff
982} PGMROMPROT;
983
984
985/**
986 * Page mapping lock.
987 */
988typedef struct PGMPAGEMAPLOCK
989{
990#if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
991 /** The locked page. */
992 void *pvPage;
993 /** Pointer to the CPU that made the mapping.
994 * In ring-0 and raw-mode context we don't intend to ever allow long term
995 * locking and this is a way of making sure we're still on the same CPU. */
996 PVMCPU pVCpu;
997#else
998 /** Pointer to the PGMPAGE and lock type.
999 * bit-0 abuse: set=write, clear=read. */
1000 uintptr_t uPageAndType;
1001/** Read lock type value. */
1002# define PGMPAGEMAPLOCK_TYPE_READ ((uintptr_t)0)
1003/** Write lock type value. */
1004# define PGMPAGEMAPLOCK_TYPE_WRITE ((uintptr_t)1)
1005/** Lock type mask. */
1006# define PGMPAGEMAPLOCK_TYPE_MASK ((uintptr_t)1)
1007 /** Pointer to the PGMCHUNKR3MAP. */
1008 void *pvMap;
1009#endif
1010} PGMPAGEMAPLOCK;
1011/** Pointer to a page mapping lock. */
1012typedef PGMPAGEMAPLOCK *PPGMPAGEMAPLOCK;
1013
1014
1015/** Pointer to a info helper callback structure. */
1016typedef struct DBGFINFOHLP *PDBGFINFOHLP;
1017/** Pointer to a const info helper callback structure. */
1018typedef const struct DBGFINFOHLP *PCDBGFINFOHLP;
1019
1020/** Pointer to a const register descriptor. */
1021typedef struct DBGFREGDESC const *PCDBGFREGDESC;
1022
1023
1024/** Configuration manager tree node - A key. */
1025typedef struct CFGMNODE *PCFGMNODE;
1026
1027/** Configuration manager tree leaf - A value. */
1028typedef struct CFGMLEAF *PCFGMLEAF;
1029
1030
1031/**
1032 * CPU modes.
1033 */
1034typedef enum CPUMMODE
1035{
1036 /** The usual invalid zero entry. */
1037 CPUMMODE_INVALID = 0,
1038 /** Real mode. */
1039 CPUMMODE_REAL,
1040 /** Protected mode (32-bit). */
1041 CPUMMODE_PROTECTED,
1042 /** Long mode (64-bit). */
1043 CPUMMODE_LONG
1044} CPUMMODE;
1045
1046
1047/**
1048 * CPU mode flags (DISSTATE::mode).
1049 */
1050typedef enum DISCPUMODE
1051{
1052 DISCPUMODE_INVALID = 0,
1053 DISCPUMODE_16BIT,
1054 DISCPUMODE_32BIT,
1055 DISCPUMODE_64BIT,
1056 /** hack forcing the size of the enum to 32-bits. */
1057 DISCPUMODE_MAKE_32BIT_HACK = 0x7fffffff
1058} DISCPUMODE;
1059
1060/** Pointer to the disassembler state. */
1061typedef struct DISSTATE *PDISSTATE;
1062/** Pointer to a const disassembler state. */
1063typedef struct DISSTATE const *PCDISSTATE;
1064
1065/** @deprecated PDISSTATE and change pCpu and pDisState to pDis. */
1066typedef PDISSTATE PDISCPUSTATE;
1067/** @deprecated PCDISSTATE and change pCpu and pDisState to pDis. */
1068typedef PCDISSTATE PCDISCPUSTATE;
1069
1070
1071/** @} */
1072
1073#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