VirtualBox

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

Last change on this file since 23329 was 23146, checked in by vboxsync, 15 years ago

VMM: State reworking.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.1 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 virtual CPU structure. */
79typedef struct VMCPU * PVMCPU;
80/** Pointer to a virtual CPU structure - Ring-3 Ptr. */
81typedef R3PTRTYPE(struct VMCPU *) PVMCPUR3;
82/** Pointer to a virtual CPU structure - Ring-0 Ptr. */
83typedef R0PTRTYPE(struct VMCPU *) PVMCPUR0;
84/** Pointer to a virtual CPU structure - RC Ptr. */
85typedef RCPTRTYPE(struct VMCPU *) PVMCPURC;
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/** Pointer to a ring-3 (user mode) VMCPU structure. */
94typedef R3PTRTYPE(struct UVMCPU *) PUVMCPU;
95
96/** Virtual CPU ID. */
97typedef uint32_t VMCPUID;
98/** Pointer to a virtual CPU ID. */
99typedef VMCPUID *PVMCPUID;
100/** @name Special CPU ID values.
101 * Most of these are for request scheduling.
102 *
103 * @{ */
104/** All virtual CPUs. */
105#define VMCPUID_ALL UINT32_C(0xfffffff2)
106/** All virtual CPUs, descending order. */
107#define VMCPUID_ALL_REVERSE UINT32_C(0xfffffff3)
108/** Any virtual CPU.
109 * Intended for scheduling a VM request or some other task. */
110#define VMCPUID_ANY UINT32_C(0xfffffff4)
111/** Any virtual CPU; always queue for future execution.
112 * Intended for scheduling a VM request or some other task. */
113#define VMCPUID_ANY_QUEUE UINT32_C(0xfffffff5)
114/** The NIL value. */
115#define NIL_VMCPUID UINT32_C(0xfffffffd)
116/** @} */
117
118/**
119 * Virtual CPU set.
120 */
121typedef struct VMCPUSET
122{
123 /** The bitmap data. */
124 uint32_t au32Bitmap[256/32];
125} VMCPUSET;
126/** Pointer to a Virtual CPU set. */
127typedef VMCPUSET *PVMCPUSET;
128/** Pointer to a const Virtual CPU set. */
129typedef VMCPUSET const *PCVMCPUSET;
130
131/** Tests if a valid CPU ID is present in the set.. */
132#define VMCPUSET_IS_PRESENT(pSet, idCpu) ASMBitTest( &(pSet)->au32Bitmap, (idCpu))
133/** Adds a CPU to the set. */
134#define VMCPUSET_ADD(pSet, idCpu) ASMBitSet( &(pSet)->au32Bitmap, (idCpu))
135/** Deletes a CPU from the set. */
136#define VMCPUSET_DEL(pSet, idCpu) ASMBitClear(&(pSet)->au32Bitmap, (idCpu))
137/** Empties the set. */
138#define VMCPUSET_EMPTY(pSet, idCpu) memset(&(pSet)->au32Bitmap, '\0', sizeof((pSet)->au32Bitmap))
139/** Filles the set. */
140#define VMCPUSET_FILL(pSet, idCpu) memset(&(pSet)->au32Bitmap, 0xff, sizeof((pSet)->au32Bitmap))
141/** Filles the set. */
142#define VMCPUSET_IS_EQUAL(pSet1, pSet2) (memcmp(&(pSet1)->au32Bitmap, &(pSet2)->au32Bitmap, sizeof((pSet1)->au32Bitmap)) == 0)
143
144
145/**
146 * VM State
147 */
148typedef enum VMSTATE
149{
150 /** The VM is being created. */
151 VMSTATE_CREATING = 0,
152 /** The VM is created. */
153 VMSTATE_CREATED,
154 /** The VM state is being loaded from file. */
155 VMSTATE_LOADING,
156 /** The VM is being powered on */
157 VMSTATE_POWERING_ON,
158 /** The VM is being resumed. */
159 VMSTATE_RESUMING,
160 /** The VM is runnning. */
161 VMSTATE_RUNNING,
162 /** Live save: The VM is running and the state is being saved. */
163 VMSTATE_RUNNING_LS,
164 /** The VM is being reset. */
165 VMSTATE_RESETTING,
166 /** Live save: The VM is being reset and immediately suspended. */
167 VMSTATE_RESETTING_LS,
168 /** The VM is being suspended. */
169 VMSTATE_SUSPENDING,
170 /** Live save: The VM is being suspended during a live save operation, either as
171 * part of the normal flow or VMR3Reset. */
172 VMSTATE_SUSPENDING_LS,
173 /** Live save: The VM is being suspended by VMR3Suspend during live save. */
174 VMSTATE_SUSPENDING_EXT_LS,
175 /** The VM is suspended. */
176 VMSTATE_SUSPENDED,
177 /** Live save: The VM has been suspended and is waiting for the live save
178 * operation to move on. */
179 VMSTATE_SUSPENDED_LS,
180 /** Live save: The VM has been suspended by VMR3Suspend during a live save. */
181 VMSTATE_SUSPENDED_EXT_LS,
182 /** The VM is suspended and its state is being saved by EMT(0). (See SSM) */
183 VMSTATE_SAVING,
184 /** The VM is being debugged. (See DBGF.) */
185 VMSTATE_DEBUGGING,
186 /** Live save: The VM is being debugged while the live phase is going on. */
187 VMSTATE_DEBUGGING_LS,
188 /** The VM is being powered off. */
189 VMSTATE_POWERING_OFF,
190 /** Live save: The VM is being powered off and the save cancelled. */
191 VMSTATE_POWERING_OFF_LS,
192 /** The VM is switched off, awaiting destruction. */
193 VMSTATE_OFF,
194 /** Live save: Waiting for cancellation and transition to VMSTATE_OFF. */
195 VMSTATE_OFF_LS,
196 /** The VM is powered off because of a fatal error. */
197 VMSTATE_FATAL_ERROR,
198 /** Live save: Waiting for cancellation and transition to FatalError. */
199 VMSTATE_FATAL_ERROR_LS,
200 /** The VM is in guru meditation over a fatal failure. */
201 VMSTATE_GURU_MEDITATION,
202 /** Live save: Waiting for cancellation and transition to GuruMeditation. */
203 VMSTATE_GURU_MEDITATION_LS,
204 /** The VM is screwed because of a failed state loading. */
205 VMSTATE_LOAD_FAILURE,
206 /** The VM is being destroyed. */
207 VMSTATE_DESTROYING,
208 /** Terminated. */
209 VMSTATE_TERMINATED,
210 /** hack forcing the size of the enum to 32-bits. */
211 VMSTATE_MAKE_32BIT_HACK = 0x7fffffff
212} VMSTATE;
213
214/** @def VBOXSTRICTRC_STRICT_ENABLED
215 * Indicates that VBOXSTRICTRC is in strict mode.
216 */
217#if defined(__cplusplus) \
218 && ARCH_BITS == 64 /* cdecl requires classes and structs as hidden params. */ \
219 && !defined(_MSC_VER) /* trouble similar to 32-bit gcc. */ \
220 && ( defined(RT_STRICT) \
221 || defined(VBOX_STRICT) \
222 || defined(DEBUG) \
223 || defined(DOXYGEN_RUNNING) )
224# define VBOXSTRICTRC_STRICT_ENABLED 1
225# ifdef _MSC_VER
226# pragma warning(disable:4190)
227# endif
228#endif
229
230/** We need RTERR_STRICT_RC. */
231#if defined(VBOXSTRICTRC_STRICT_ENABLED) && !defined(RTERR_STRICT_RC)
232# define RTERR_STRICT_RC 1
233#endif
234
235/**
236 * Strict VirtualBox status code.
237 *
238 * This is normally an 32-bit integer and the only purpose of the type is to
239 * highlight the special handling that is required. But in strict build it is a
240 * class that causes compilation and runtime errors for some of the incorrect
241 * handling.
242 */
243#ifdef VBOXSTRICTRC_STRICT_ENABLED
244struct VBOXSTRICTRC
245{
246protected:
247 /** The status code. */
248 int32_t m_rc;
249
250public:
251 /** Default constructor setting the status to VERR_IPE_UNINITIALIZED_STATUS. */
252 VBOXSTRICTRC()
253#ifdef VERR_IPE_UNINITIALIZED_STATUS
254 : m_rc(VERR_IPE_UNINITIALIZED_STATUS)
255#else
256 : m_rc(-233 /*VERR_IPE_UNINITIALIZED_STATUS*/)
257#endif
258 {
259 }
260
261 /** Constructor for normal integer status codes. */
262 VBOXSTRICTRC(int32_t const rc)
263 : m_rc(rc)
264 {
265 }
266
267 /** Getter that VBOXSTRICTRC_VAL can use. */
268 int32_t getValue() const { return m_rc; }
269
270 /** @name Comparison operators
271 * @{ */
272 bool operator==(int32_t rc) const { return m_rc == rc; }
273 bool operator!=(int32_t rc) const { return m_rc != rc; }
274 bool operator<=(int32_t rc) const { return m_rc <= rc; }
275 bool operator>=(int32_t rc) const { return m_rc >= rc; }
276 bool operator<(int32_t rc) const { return m_rc < rc; }
277 bool operator>(int32_t rc) const { return m_rc > rc; }
278 /** @} */
279
280 /** Special automatic cast for RT_SUCCESS_NP. */
281 operator RTErrStrictType2() const { return RTErrStrictType2(m_rc); }
282
283private:
284 /** @name Constructors that will prevent some of the bad types.
285 * @{ */
286 VBOXSTRICTRC(uint8_t rc) : m_rc(-999) { NOREF(rc); }
287 VBOXSTRICTRC(uint16_t rc) : m_rc(-999) { NOREF(rc); }
288 VBOXSTRICTRC(uint32_t rc) : m_rc(-999) { NOREF(rc); }
289 VBOXSTRICTRC(uint64_t rc) : m_rc(-999) { NOREF(rc); }
290
291 VBOXSTRICTRC(int8_t rc) : m_rc(-999) { NOREF(rc); }
292 VBOXSTRICTRC(int16_t rc) : m_rc(-999) { NOREF(rc); }
293 VBOXSTRICTRC(int64_t rc) : m_rc(-999) { NOREF(rc); }
294 /** @} */
295};
296#else
297typedef int32_t VBOXSTRICTRC;
298#endif
299
300/** @def VBOXSTRICTRC_VAL
301 * Explicit getter.
302 * @param rcStrict The strict VirtualBox status code.
303 */
304#ifdef VBOXSTRICTRC_STRICT_ENABLED
305# define VBOXSTRICTRC_VAL(rcStrict) ( (rcStrict).getValue() )
306#else
307# define VBOXSTRICTRC_VAL(rcStrict) (rcStrict)
308#endif
309
310/** @def VBOXSTRICTRC_TODO
311 * Returns that needs dealing with.
312 * @param rcStrict The strict VirtualBox status code.
313 */
314#define VBOXSTRICTRC_TODO(rcStrict) VBOXSTRICTRC_VAL(rcStrict)
315
316
317/** Pointer to a PDM Driver Base Interface. */
318typedef struct PDMIBASE *PPDMIBASE;
319/** Pointer to a pointer to a PDM Driver Base Interface. */
320typedef PPDMIBASE *PPPDMIBASE;
321
322/** Pointer to a PDM Device Instance. */
323typedef struct PDMDEVINS *PPDMDEVINS;
324/** Pointer to a pointer to a PDM Device Instance. */
325typedef PPDMDEVINS *PPPDMDEVINS;
326/** R3 pointer to a PDM Device Instance. */
327typedef R3PTRTYPE(PPDMDEVINS) PPDMDEVINSR3;
328/** R0 pointer to a PDM Device Instance. */
329typedef R0PTRTYPE(PPDMDEVINS) PPDMDEVINSR0;
330/** RC pointer to a PDM Device Instance. */
331typedef RCPTRTYPE(PPDMDEVINS) PPDMDEVINSRC;
332
333/** Pointer to a PDM USB Device Instance. */
334typedef struct PDMUSBINS *PPDMUSBINS;
335/** Pointer to a pointer to a PDM USB Device Instance. */
336typedef PPDMUSBINS *PPPDMUSBINS;
337
338/** Pointer to a PDM Driver Instance. */
339typedef struct PDMDRVINS *PPDMDRVINS;
340/** Pointer to a pointer to a PDM Driver Instance. */
341typedef PPDMDRVINS *PPPDMDRVINS;
342
343/** Pointer to a PDM Service Instance. */
344typedef struct PDMSRVINS *PPDMSRVINS;
345/** Pointer to a pointer to a PDM Service Instance. */
346typedef PPDMSRVINS *PPPDMSRVINS;
347
348/** Pointer to a PDM critical section. */
349typedef union PDMCRITSECT *PPDMCRITSECT;
350/** Pointer to a const PDM critical section. */
351typedef const union PDMCRITSECT *PCPDMCRITSECT;
352
353/** R3 pointer to a timer. */
354typedef R3PTRTYPE(struct TMTIMER *) PTMTIMERR3;
355/** Pointer to a R3 pointer to a timer. */
356typedef PTMTIMERR3 *PPTMTIMERR3;
357
358/** R0 pointer to a timer. */
359typedef R0PTRTYPE(struct TMTIMER *) PTMTIMERR0;
360/** Pointer to a R3 pointer to a timer. */
361typedef PTMTIMERR0 *PPTMTIMERR0;
362
363/** RC pointer to a timer. */
364typedef RCPTRTYPE(struct TMTIMER *) PTMTIMERRC;
365/** Pointer to a RC pointer to a timer. */
366typedef PTMTIMERRC *PPTMTIMERRC;
367
368/** Pointer to a timer. */
369typedef CTX_SUFF(PTMTIMER) PTMTIMER;
370/** Pointer to a pointer to a timer. */
371typedef PTMTIMER *PPTMTIMER;
372
373/** SSM Operation handle. */
374typedef struct SSMHANDLE *PSSMHANDLE;
375
376/** Pointer to a CPUMCTX. */
377typedef struct CPUMCTX *PCPUMCTX;
378/** Pointer to a const CPUMCTX. */
379typedef const struct CPUMCTX *PCCPUMCTX;
380
381/** Pointer to a CPU context core. */
382typedef struct CPUMCTXCORE *PCPUMCTXCORE;
383/** Pointer to a const CPU context core. */
384typedef const struct CPUMCTXCORE *PCCPUMCTXCORE;
385
386/** Pointer to selector hidden registers. */
387typedef struct CPUMSELREGHID *PCPUMSELREGHID;
388/** Pointer to const selector hidden registers. */
389typedef const struct CPUMSELREGHID *PCCPUMSELREGHID;
390
391/** @} */
392
393
394/** @defgroup grp_types_idt Interrupt Descriptor Table Entry.
395 * @ingroup grp_types
396 * @todo This all belongs in x86.h!
397 * @{ */
398
399/** @todo VBOXIDT -> VBOXDESCIDT, skip the complex variations. We'll never use them. */
400
401/** IDT Entry, Task Gate view. */
402#pragma pack(1) /* paranoia */
403typedef struct VBOXIDTE_TASKGATE
404{
405 /** Reserved. */
406 unsigned u16Reserved1 : 16;
407 /** Task Segment Selector. */
408 unsigned u16TSS : 16;
409 /** More reserved. */
410 unsigned u8Reserved2 : 8;
411 /** Fixed value bit 0 - Set to 1. */
412 unsigned u1Fixed0 : 1;
413 /** Busy bit. */
414 unsigned u1Busy : 1;
415 /** Fixed value bit 2 - Set to 1. */
416 unsigned u1Fixed1 : 1;
417 /** Fixed value bit 3 - Set to 0. */
418 unsigned u1Fixed2: 1;
419 /** Fixed value bit 4 - Set to 0. */
420 unsigned u1Fixed3 : 1;
421 /** Descriptor Privilege level. */
422 unsigned u2DPL : 2;
423 /** Present flag. */
424 unsigned u1Present : 1;
425 /** Reserved. */
426 unsigned u16Reserved3 : 16;
427} VBOXIDTE_TASKGATE;
428#pragma pack()
429/** Pointer to IDT Entry, Task gate view. */
430typedef VBOXIDTE_TASKGATE *PVBOXIDTE_TASKGATE;
431
432
433/** IDT Entry, Intertupt gate view. */
434#pragma pack(1) /* paranoia */
435typedef struct VBOXIDTE_INTERRUPTGATE
436{
437 /** Low offset word. */
438 unsigned u16OffsetLow : 16;
439 /** Segment Selector. */
440 unsigned u16SegSel : 16;
441 /** Reserved. */
442 unsigned u5Reserved2 : 5;
443 /** Fixed value bit 0 - Set to 0. */
444 unsigned u1Fixed0 : 1;
445 /** Fixed value bit 1 - Set to 0. */
446 unsigned u1Fixed1 : 1;
447 /** Fixed value bit 2 - Set to 0. */
448 unsigned u1Fixed2 : 1;
449 /** Fixed value bit 3 - Set to 0. */
450 unsigned u1Fixed3: 1;
451 /** Fixed value bit 4 - Set to 1. */
452 unsigned u1Fixed4 : 1;
453 /** Fixed value bit 5 - Set to 1. */
454 unsigned u1Fixed5 : 1;
455 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
456 unsigned u132BitGate : 1;
457 /** Fixed value bit 5 - Set to 0. */
458 unsigned u1Fixed6 : 1;
459 /** Descriptor Privilege level. */
460 unsigned u2DPL : 2;
461 /** Present flag. */
462 unsigned u1Present : 1;
463 /** High offset word. */
464 unsigned u16OffsetHigh : 16;
465} VBOXIDTE_INTERRUPTGATE;
466#pragma pack()
467/** Pointer to IDT Entry, Interrupt gate view. */
468typedef VBOXIDTE_INTERRUPTGATE *PVBOXIDTE_INTERRUPTGATE;
469
470/** IDT Entry, Trap Gate view. */
471#pragma pack(1) /* paranoia */
472typedef struct VBOXIDTE_TRAPGATE
473{
474 /** Low offset word. */
475 unsigned u16OffsetLow : 16;
476 /** Segment Selector. */
477 unsigned u16SegSel : 16;
478 /** Reserved. */
479 unsigned u5Reserved2 : 5;
480 /** Fixed value bit 0 - Set to 0. */
481 unsigned u1Fixed0 : 1;
482 /** Fixed value bit 1 - Set to 0. */
483 unsigned u1Fixed1 : 1;
484 /** Fixed value bit 2 - Set to 0. */
485 unsigned u1Fixed2 : 1;
486 /** Fixed value bit 3 - Set to 1. */
487 unsigned u1Fixed3: 1;
488 /** Fixed value bit 4 - Set to 1. */
489 unsigned u1Fixed4 : 1;
490 /** Fixed value bit 5 - Set to 1. */
491 unsigned u1Fixed5 : 1;
492 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
493 unsigned u132BitGate : 1;
494 /** Fixed value bit 5 - Set to 0. */
495 unsigned u1Fixed6 : 1;
496 /** Descriptor Privilege level. */
497 unsigned u2DPL : 2;
498 /** Present flag. */
499 unsigned u1Present : 1;
500 /** High offset word. */
501 unsigned u16OffsetHigh : 16;
502} VBOXIDTE_TRAPGATE;
503#pragma pack()
504/** Pointer to IDT Entry, Trap Gate view. */
505typedef VBOXIDTE_TRAPGATE *PVBOXIDTE_TRAPGATE;
506
507/** IDT Entry Generic view. */
508#pragma pack(1) /* paranoia */
509typedef struct VBOXIDTE_GENERIC
510{
511 /** Low offset word. */
512 unsigned u16OffsetLow : 16;
513 /** Segment Selector. */
514 unsigned u16SegSel : 16;
515 /** Reserved. */
516 unsigned u5Reserved : 5;
517 /** IDT Type part one (not used for task gate). */
518 unsigned u3Type1 : 3;
519 /** IDT Type part two. */
520 unsigned u5Type2 : 5;
521 /** Descriptor Privilege level. */
522 unsigned u2DPL : 2;
523 /** Present flag. */
524 unsigned u1Present : 1;
525 /** High offset word. */
526 unsigned u16OffsetHigh : 16;
527} VBOXIDTE_GENERIC;
528#pragma pack()
529/** Pointer to IDT Entry Generic view. */
530typedef VBOXIDTE_GENERIC *PVBOXIDTE_GENERIC;
531
532/** IDT Type1 value. (Reserved for task gate!) */
533#define VBOX_IDTE_TYPE1 0
534/** IDT Type2 value - Task gate. */
535#define VBOX_IDTE_TYPE2_TASK 0x5
536/** IDT Type2 value - 16 bit interrupt gate. */
537#define VBOX_IDTE_TYPE2_INT_16 0x6
538/** IDT Type2 value - 32 bit interrupt gate. */
539#define VBOX_IDTE_TYPE2_INT_32 0xe
540/** IDT Type2 value - 16 bit trap gate. */
541#define VBOX_IDTE_TYPE2_TRAP_16 0x7
542/** IDT Type2 value - 32 bit trap gate. */
543#define VBOX_IDTE_TYPE2_TRAP_32 0xf
544
545/** IDT Entry. */
546#pragma pack(1) /* paranoia */
547typedef union VBOXIDTE
548{
549 /** Task gate view. */
550 VBOXIDTE_TASKGATE Task;
551 /** Trap gate view. */
552 VBOXIDTE_TRAPGATE Trap;
553 /** Interrupt gate view. */
554 VBOXIDTE_INTERRUPTGATE Int;
555 /** Generic IDT view. */
556 VBOXIDTE_GENERIC Gen;
557
558 /** 8 bit unsigned integer view. */
559 uint8_t au8[8];
560 /** 16 bit unsigned integer view. */
561 uint16_t au16[4];
562 /** 32 bit unsigned integer view. */
563 uint32_t au32[2];
564 /** 64 bit unsigned integer view. */
565 uint64_t au64;
566} VBOXIDTE;
567#pragma pack()
568/** Pointer to IDT Entry. */
569typedef VBOXIDTE *PVBOXIDTE;
570/** Pointer to IDT Entry. */
571typedef VBOXIDTE const *PCVBOXIDTE;
572
573#pragma pack(1)
574/** IDTR */
575typedef struct VBOXIDTR
576{
577 /** Size of the IDT. */
578 uint16_t cbIdt;
579 /** Address of the IDT. */
580 uint64_t pIdt;
581} VBOXIDTR, *PVBOXIDTR;
582#pragma pack()
583
584#pragma pack(1)
585/** IDTR from version 1.6 */
586typedef struct VBOXIDTR_VER1_6
587{
588 /** Size of the IDT. */
589 uint16_t cbIdt;
590 /** Address of the IDT. */
591 uint32_t pIdt;
592} VBOXIDTR_VER1_6, *PVBOXIDTR_VER1_6;
593#pragma pack()
594
595/** @} */
596
597
598/** @def VBOXIDTE_OFFSET
599 * Return the offset of an IDT entry.
600 */
601#define VBOXIDTE_OFFSET(desc) \
602 ( ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
603 | ( (desc).Gen.u16OffsetLow ) )
604
605#pragma pack(1)
606/** GDTR */
607typedef struct VBOXGDTR
608{
609 /** Size of the GDT. */
610 uint16_t cbGdt;
611 /** Address of the GDT. */
612 uint64_t pGdt;
613} VBOXGDTR;
614#pragma pack()
615/** Pointer to GDTR. */
616typedef VBOXGDTR *PVBOXGDTR;
617
618#pragma pack(1)
619/** GDTR from version 1.6 */
620typedef struct VBOXGDTR_VER1_6
621{
622 /** Size of the GDT. */
623 uint16_t cbGdt;
624 /** Address of the GDT. */
625 uint32_t pGdt;
626} VBOXGDTR_VER1_6;
627#pragma pack()
628
629/** @} */
630
631
632/**
633 * 32-bit Task Segment used in raw mode.
634 * @todo Move this to SELM! Use X86TSS32 instead.
635 */
636#pragma pack(1)
637typedef struct VBOXTSS
638{
639 /** 0x00 - Back link to previous task. (static) */
640 RTSEL selPrev;
641 uint16_t padding1;
642 /** 0x04 - Ring-0 stack pointer. (static) */
643 uint32_t esp0;
644 /** 0x08 - Ring-0 stack segment. (static) */
645 RTSEL ss0;
646 uint16_t padding_ss0;
647 /** 0x0c - Ring-1 stack pointer. (static) */
648 uint32_t esp1;
649 /** 0x10 - Ring-1 stack segment. (static) */
650 RTSEL ss1;
651 uint16_t padding_ss1;
652 /** 0x14 - Ring-2 stack pointer. (static) */
653 uint32_t esp2;
654 /** 0x18 - Ring-2 stack segment. (static) */
655 RTSEL ss2;
656 uint16_t padding_ss2;
657 /** 0x1c - Page directory for the task. (static) */
658 uint32_t cr3;
659 /** 0x20 - EIP before task switch. */
660 uint32_t eip;
661 /** 0x24 - EFLAGS before task switch. */
662 uint32_t eflags;
663 /** 0x28 - EAX before task switch. */
664 uint32_t eax;
665 /** 0x2c - ECX before task switch. */
666 uint32_t ecx;
667 /** 0x30 - EDX before task switch. */
668 uint32_t edx;
669 /** 0x34 - EBX before task switch. */
670 uint32_t ebx;
671 /** 0x38 - ESP before task switch. */
672 uint32_t esp;
673 /** 0x3c - EBP before task switch. */
674 uint32_t ebp;
675 /** 0x40 - ESI before task switch. */
676 uint32_t esi;
677 /** 0x44 - EDI before task switch. */
678 uint32_t edi;
679 /** 0x48 - ES before task switch. */
680 RTSEL es;
681 uint16_t padding_es;
682 /** 0x4c - CS before task switch. */
683 RTSEL cs;
684 uint16_t padding_cs;
685 /** 0x50 - SS before task switch. */
686 RTSEL ss;
687 uint16_t padding_ss;
688 /** 0x54 - DS before task switch. */
689 RTSEL ds;
690 uint16_t padding_ds;
691 /** 0x58 - FS before task switch. */
692 RTSEL fs;
693 uint16_t padding_fs;
694 /** 0x5c - GS before task switch. */
695 RTSEL gs;
696 uint16_t padding_gs;
697 /** 0x60 - LDTR before task switch. */
698 RTSEL selLdt;
699 uint16_t padding_ldt;
700 /** 0x64 - Debug trap flag */
701 uint16_t fDebugTrap;
702 /** 0x66 - Offset relative to the TSS of the start of the I/O Bitmap
703 * and the end of the interrupt redirection bitmap. */
704 uint16_t offIoBitmap;
705 /** 0x68 - 32 bytes for the virtual interrupt redirection bitmap. (VME) */
706 uint8_t IntRedirBitmap[32];
707} VBOXTSS;
708#pragma pack()
709/** Pointer to task segment. */
710typedef VBOXTSS *PVBOXTSS;
711/** Pointer to const task segment. */
712typedef const VBOXTSS *PCVBOXTSS;
713
714
715/**
716 * Data transport buffer (scatter/gather)
717 */
718typedef struct PDMDATASEG
719{
720 /** Length of buffer in entry. */
721 size_t cbSeg;
722 /** Pointer to the start of the buffer. */
723 void *pvSeg;
724} PDMDATASEG;
725/** Pointer to a data transport segment. */
726typedef PDMDATASEG *PPDMDATASEG;
727/** Pointer to a const data transport segment. */
728typedef PDMDATASEG const *PCPDMDATASEG;
729
730
731/**
732 * The current ROM page protection.
733 *
734 * @remarks This is part of the saved state.
735 */
736typedef enum PGMROMPROT
737{
738 /** The customary invalid value. */
739 PGMROMPROT_INVALID = 0,
740 /** Read from the virgin ROM page, ignore writes.
741 * Map the virgin page, use write access handler to ignore writes. */
742 PGMROMPROT_READ_ROM_WRITE_IGNORE,
743 /** Read from the virgin ROM page, write to the shadow RAM.
744 * Map the virgin page, use write access handler change the RAM. */
745 PGMROMPROT_READ_ROM_WRITE_RAM,
746 /** Read from the shadow ROM page, ignore writes.
747 * Map the shadow page read-only, use write access handler to ignore writes. */
748 PGMROMPROT_READ_RAM_WRITE_IGNORE,
749 /** Read from the shadow ROM page, ignore writes.
750 * Map the shadow page read-write, disabled write access handler. */
751 PGMROMPROT_READ_RAM_WRITE_RAM,
752 /** The end of valid values. */
753 PGMROMPROT_END,
754 /** The usual 32-bit type size hack. */
755 PGMROMPROT_32BIT_HACK = 0x7fffffff
756} PGMROMPROT;
757
758
759/**
760 * Page mapping lock.
761 *
762 * @remarks This doesn't work in structures shared between
763 * ring-3, ring-0 and/or GC.
764 */
765typedef struct PGMPAGEMAPLOCK
766{
767 /** @todo see PGMPhysIsPageMappingLockValid for possibly incorrect assumptions */
768#if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
769 /** Just a dummy for the time being. */
770 uint32_t u32Dummy;
771#else
772 /** Pointer to the PGMPAGE. */
773 void *pvPage;
774 /** Pointer to the PGMCHUNKR3MAP. */
775 void *pvMap;
776#endif
777} PGMPAGEMAPLOCK;
778/** Pointer to a page mapping lock. */
779typedef PGMPAGEMAPLOCK *PPGMPAGEMAPLOCK;
780
781
782/** Configuration manager tree node - A key. */
783typedef struct CFGMNODE *PCFGMNODE;
784
785/** Configuration manager tree leaf - A value. */
786typedef struct CFGMLEAF *PCFGMLEAF;
787
788
789/** @} */
790
791#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