VirtualBox

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

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

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