VirtualBox

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

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

VBox/types.h: Enable VBOXSTRICTRC on windows again.

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