VirtualBox

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

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

VBox/types.h: Don't use the VBOXSTRICTRC class with MSC as it floods us with warnings.

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