VirtualBox

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

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

VMR3Save: Code done. (Had to add VMSTATE_RESET_LS to deal with reset.)

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

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