VirtualBox

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

Last change on this file since 23002 was 22975, checked in by vboxsync, 15 years ago

VMM: State coding in progress - bed time commit.

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