VirtualBox

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

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

VMM,DevPCI,VBox/types.h: Added a VBOXSTRICTRC type for indicating strict VBox stuatus codes. Some expirmentation with making it a class in strict builds to get some help from the compiler with making sure the return code is treated correctly.

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