VirtualBox

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

Last change on this file since 22966 was 22961, checked in by vboxsync, 16 years ago

VMM: state updates (almost there).

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