VirtualBox

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

Last change on this file since 23010 was 23009, checked in by vboxsync, 15 years ago

VMM: State machine adjustments. Have only received basic testing.

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