6 * Copyright (C) 2006-2016 Oracle Corporation
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.
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.
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.
26 #ifndef ___VBox_types_h
27 #define ___VBox_types_h
29 #include <VBox/cdefs.h>
30 #include <iprt/types.h>
33 /** @defgroup grp_types VBox Basic Types
38 /** @defgroup grp_types_both Common Guest and Host Context Basic Types
43 /** @defgroup grp_types_hc Host Context Basic Types
50 /** @defgroup grp_types_gc Guest Context Basic Types
57 /** Pointer to per support driver session data.
58 * (The data is a R0 entity and private to the the R0 SUP part. All
59 * other should consider this a sort of handle.) */
60 typedef R0PTRTYPE(struct SUPDRVSESSION
*) PSUPDRVSESSION
;
62 /** Event semaphore handle. Ring-0 / ring-3. */
63 typedef R0PTRTYPE(struct SUPSEMEVENTHANDLE
*) SUPSEMEVENT
;
64 /** Pointer to an event semaphore handle. */
65 typedef SUPSEMEVENT
*PSUPSEMEVENT
;
66 /** Nil event semaphore handle. */
67 #define NIL_SUPSEMEVENT ((SUPSEMEVENT)0)
69 /** Multiple release event semaphore handle. Ring-0 / ring-3. */
70 typedef R0PTRTYPE(struct SUPSEMEVENTMULTIHANDLE
*) SUPSEMEVENTMULTI
;
71 /** Pointer to an multiple release event semaphore handle. */
72 typedef SUPSEMEVENTMULTI
*PSUPSEMEVENTMULTI
;
73 /** Nil multiple release event semaphore handle. */
74 #define NIL_SUPSEMEVENTMULTI ((SUPSEMEVENTMULTI)0)
77 /** Pointer to a VM. */
78 typedef struct VM
*PVM
;
79 /** Pointer to a VM - Ring-0 Ptr. */
80 typedef R0PTRTYPE(struct VM
*) PVMR0
;
81 /** Pointer to a VM - Ring-3 Ptr. */
82 typedef R3PTRTYPE(struct VM
*) PVMR3
;
83 /** Pointer to a VM - RC Ptr. */
84 typedef RCPTRTYPE(struct VM
*) PVMRC
;
86 /** Pointer to a virtual CPU structure. */
87 typedef struct VMCPU
* PVMCPU
;
88 /** Pointer to a const virtual CPU structure. */
89 typedef const struct VMCPU
* PCVMCPU
;
90 /** Pointer to a virtual CPU structure - Ring-3 Ptr. */
91 typedef R3PTRTYPE(struct VMCPU
*) PVMCPUR3
;
92 /** Pointer to a virtual CPU structure - Ring-0 Ptr. */
93 typedef R0PTRTYPE(struct VMCPU
*) PVMCPUR0
;
94 /** Pointer to a virtual CPU structure - RC Ptr. */
95 typedef RCPTRTYPE(struct VMCPU
*) PVMCPURC
;
97 /** Pointer to a ring-0 (global) VM structure. */
98 typedef R0PTRTYPE(struct GVM
*) PGVM
;
100 /** Pointer to a ring-3 (user mode) VM structure. */
101 typedef R3PTRTYPE(struct UVM
*) PUVM
;
103 /** Pointer to a ring-3 (user mode) VMCPU structure. */
104 typedef R3PTRTYPE(struct UVMCPU
*) PUVMCPU
;
106 /** Virtual CPU ID. */
107 typedef uint32_t VMCPUID
;
108 /** Pointer to a virtual CPU ID. */
109 typedef VMCPUID
*PVMCPUID
;
110 /** @name Special CPU ID values.
111 * Most of these are for request scheduling.
114 /** All virtual CPUs. */
115 #define VMCPUID_ALL UINT32_C(0xfffffff2)
116 /** All virtual CPUs, descending order. */
117 #define VMCPUID_ALL_REVERSE UINT32_C(0xfffffff3)
119 * Intended for scheduling a VM request or some other task. */
120 #define VMCPUID_ANY UINT32_C(0xfffffff4)
121 /** Any virtual CPU; always queue for future execution.
122 * Intended for scheduling a VM request or some other task. */
123 #define VMCPUID_ANY_QUEUE UINT32_C(0xfffffff5)
124 /** The NIL value. */
125 #define NIL_VMCPUID UINT32_C(0xfffffffd)
131 typedef struct VMCPUSET
133 /** The bitmap data. */
134 uint32_t au32Bitmap
[8 /*256/32*/];
136 /** Pointer to a Virtual CPU set. */
137 typedef VMCPUSET
*PVMCPUSET
;
138 /** Pointer to a const Virtual CPU set. */
139 typedef VMCPUSET
const *PCVMCPUSET
;
147 /** The VM is being created. */
148 VMSTATE_CREATING
= 0,
149 /** The VM is created. */
151 /** The VM state is being loaded from file. */
153 /** The VM is being powered on */
155 /** The VM is being resumed. */
157 /** The VM is runnning. */
159 /** Live save: The VM is running and the state is being saved. */
161 /** Fault Tolerance: The VM is running and the state is being synced. */
163 /** The VM is being reset. */
165 /** Live save: The VM is being reset and immediately suspended. */
166 VMSTATE_RESETTING_LS
,
167 /** The VM is being soft/warm reset. */
168 VMSTATE_SOFT_RESETTING
,
169 /** Live save: The VM is being soft/warm reset (not suspended afterwards). */
170 VMSTATE_SOFT_RESETTING_LS
,
171 /** The VM is being suspended. */
173 /** Live save: The VM is being suspended during a live save operation, either as
174 * part of the normal flow or VMR3Reset. */
175 VMSTATE_SUSPENDING_LS
,
176 /** Live save: The VM is being suspended by VMR3Suspend during live save. */
177 VMSTATE_SUSPENDING_EXT_LS
,
178 /** The VM is suspended. */
180 /** Live save: The VM has been suspended and is waiting for the live save
181 * operation to move on. */
182 VMSTATE_SUSPENDED_LS
,
183 /** Live save: The VM has been suspended by VMR3Suspend during a live save. */
184 VMSTATE_SUSPENDED_EXT_LS
,
185 /** The VM is suspended and its state is being saved by EMT(0). (See SSM) */
187 /** The VM is being debugged. (See DBGF.) */
189 /** Live save: The VM is being debugged while the live phase is going on. */
190 VMSTATE_DEBUGGING_LS
,
191 /** The VM is being powered off. */
192 VMSTATE_POWERING_OFF
,
193 /** Live save: The VM is being powered off and the save cancelled. */
194 VMSTATE_POWERING_OFF_LS
,
195 /** The VM is switched off, awaiting destruction. */
197 /** Live save: Waiting for cancellation and transition to VMSTATE_OFF. */
199 /** The VM is powered off because of a fatal error. */
201 /** Live save: Waiting for cancellation and transition to FatalError. */
202 VMSTATE_FATAL_ERROR_LS
,
203 /** The VM is in guru meditation over a fatal failure. */
204 VMSTATE_GURU_MEDITATION
,
205 /** Live save: Waiting for cancellation and transition to GuruMeditation. */
206 VMSTATE_GURU_MEDITATION_LS
,
207 /** The VM is screwed because of a failed state loading. */
208 VMSTATE_LOAD_FAILURE
,
209 /** The VM is being destroyed. */
213 /** hack forcing the size of the enum to 32-bits. */
214 VMSTATE_MAKE_32BIT_HACK
= 0x7fffffff
217 /** @def VBOXSTRICTRC_STRICT_ENABLED
218 * Indicates that VBOXSTRICTRC is in strict mode.
220 #if defined(__cplusplus) \
221 && ARCH_BITS == 64 /* cdecl requires classes and structs as hidden params. */ \
222 && !defined(_MSC_VER) /* trouble similar to 32-bit gcc. */ \
223 && ( defined(RT_STRICT) \
224 || defined(VBOX_STRICT) \
226 || defined(DOXYGEN_RUNNING) )
227 # define VBOXSTRICTRC_STRICT_ENABLED 1
230 /** We need RTERR_STRICT_RC. */
231 #if defined(VBOXSTRICTRC_STRICT_ENABLED) && !defined(RTERR_STRICT_RC)
232 # define RTERR_STRICT_RC 1
236 * Strict VirtualBox status code.
238 * This is normally an 32-bit integer and the only purpose of the type is to
239 * highlight the special handling that is required. But in strict build it is a
240 * class that causes compilation and runtime errors for some of the incorrect
243 #ifdef VBOXSTRICTRC_STRICT_ENABLED
247 /** The status code. */
251 /** Default constructor setting the status to VERR_IPE_UNINITIALIZED_STATUS. */
253 #ifdef VERR_IPE_UNINITIALIZED_STATUS
254 : m_rc(VERR_IPE_UNINITIALIZED_STATUS
)
256 : m_rc(-233 /*VERR_IPE_UNINITIALIZED_STATUS*/)
261 /** Constructor for normal integer status codes. */
262 VBOXSTRICTRC(int32_t const rc
)
267 /** Getter that VBOXSTRICTRC_VAL can use. */
268 int32_t getValue() const { return m_rc
; }
270 /** @name Comparison operators
272 bool operator==(int32_t rc
) const { return m_rc
== rc
; }
273 bool operator!=(int32_t rc
) const { return m_rc
!= rc
; }
274 bool operator<=(int32_t rc
) const { return m_rc
<= rc
; }
275 bool operator>=(int32_t rc
) const { return m_rc
>= rc
; }
276 bool operator<(int32_t rc
) const { return m_rc
< rc
; }
277 bool operator>(int32_t rc
) const { return m_rc
> rc
; }
279 bool operator==(const VBOXSTRICTRC
&rRc
) const { return m_rc
== rRc
.m_rc
; }
280 bool operator!=(const VBOXSTRICTRC
&rRc
) const { return m_rc
!= rRc
.m_rc
; }
281 bool operator<=(const VBOXSTRICTRC
&rRc
) const { return m_rc
<= rRc
.m_rc
; }
282 bool operator>=(const VBOXSTRICTRC
&rRc
) const { return m_rc
>= rRc
.m_rc
; }
283 bool operator<(const VBOXSTRICTRC
&rRc
) const { return m_rc
< rRc
.m_rc
; }
284 bool operator>(const VBOXSTRICTRC
&rRc
) const { return m_rc
> rRc
.m_rc
; }
287 /** Special automatic cast for RT_SUCCESS_NP. */
288 operator RTErrStrictType2() const { return RTErrStrictType2(m_rc
); }
291 /** @name Constructors that will prevent some of the bad types.
293 VBOXSTRICTRC(uint8_t rc
) : m_rc(-999) { NOREF(rc
); }
294 VBOXSTRICTRC(uint16_t rc
) : m_rc(-999) { NOREF(rc
); }
295 VBOXSTRICTRC(uint32_t rc
) : m_rc(-999) { NOREF(rc
); }
296 VBOXSTRICTRC(uint64_t rc
) : m_rc(-999) { NOREF(rc
); }
298 VBOXSTRICTRC(int8_t rc
) : m_rc(-999) { NOREF(rc
); }
299 VBOXSTRICTRC(int16_t rc
) : m_rc(-999) { NOREF(rc
); }
300 VBOXSTRICTRC(int64_t rc
) : m_rc(-999) { NOREF(rc
); }
304 # pragma warning(disable:4190)
307 typedef int32_t VBOXSTRICTRC
;
310 /** @def VBOXSTRICTRC_VAL
312 * @param rcStrict The strict VirtualBox status code.
314 #ifdef VBOXSTRICTRC_STRICT_ENABLED
315 # define VBOXSTRICTRC_VAL(rcStrict) ( (rcStrict).getValue() )
317 # define VBOXSTRICTRC_VAL(rcStrict) (rcStrict)
320 /** @def VBOXSTRICTRC_TODO
321 * Returns that needs dealing with.
322 * @param rcStrict The strict VirtualBox status code.
324 #define VBOXSTRICTRC_TODO(rcStrict) VBOXSTRICTRC_VAL(rcStrict)
327 /** Pointer to a PDM Base Interface. */
328 typedef struct PDMIBASE
*PPDMIBASE
;
329 /** Pointer to a pointer to a PDM Base Interface. */
330 typedef PPDMIBASE
*PPPDMIBASE
;
332 /** Pointer to a PDM Device Instance. */
333 typedef struct PDMDEVINS
*PPDMDEVINS
;
334 /** Pointer to a pointer to a PDM Device Instance. */
335 typedef PPDMDEVINS
*PPPDMDEVINS
;
336 /** R3 pointer to a PDM Device Instance. */
337 typedef R3PTRTYPE(PPDMDEVINS
) PPDMDEVINSR3
;
338 /** R0 pointer to a PDM Device Instance. */
339 typedef R0PTRTYPE(PPDMDEVINS
) PPDMDEVINSR0
;
340 /** RC pointer to a PDM Device Instance. */
341 typedef RCPTRTYPE(PPDMDEVINS
) PPDMDEVINSRC
;
343 /** Pointer to a PDM USB Device Instance. */
344 typedef struct PDMUSBINS
*PPDMUSBINS
;
345 /** Pointer to a pointer to a PDM USB Device Instance. */
346 typedef PPDMUSBINS
*PPPDMUSBINS
;
348 /** Pointer to a PDM Driver Instance. */
349 typedef struct PDMDRVINS
*PPDMDRVINS
;
350 /** Pointer to a pointer to a PDM Driver Instance. */
351 typedef PPDMDRVINS
*PPPDMDRVINS
;
352 /** R3 pointer to a PDM Driver Instance. */
353 typedef R3PTRTYPE(PPDMDRVINS
) PPDMDRVINSR3
;
354 /** R0 pointer to a PDM Driver Instance. */
355 typedef R0PTRTYPE(PPDMDRVINS
) PPDMDRVINSR0
;
356 /** RC pointer to a PDM Driver Instance. */
357 typedef RCPTRTYPE(PPDMDRVINS
) PPDMDRVINSRC
;
359 /** Pointer to a PDM Service Instance. */
360 typedef struct PDMSRVINS
*PPDMSRVINS
;
361 /** Pointer to a pointer to a PDM Service Instance. */
362 typedef PPDMSRVINS
*PPPDMSRVINS
;
364 /** Pointer to a PDM critical section. */
365 typedef union PDMCRITSECT
*PPDMCRITSECT
;
366 /** Pointer to a const PDM critical section. */
367 typedef const union PDMCRITSECT
*PCPDMCRITSECT
;
369 /** Pointer to a PDM read/write critical section. */
370 typedef union PDMCRITSECTRW
*PPDMCRITSECTRW
;
371 /** Pointer to a const PDM read/write critical section. */
372 typedef union PDMCRITSECTRW
const *PCPDMCRITSECTRW
;
374 /** R3 pointer to a timer. */
375 typedef R3PTRTYPE(struct TMTIMER
*) PTMTIMERR3
;
376 /** Pointer to a R3 pointer to a timer. */
377 typedef PTMTIMERR3
*PPTMTIMERR3
;
379 /** R0 pointer to a timer. */
380 typedef R0PTRTYPE(struct TMTIMER
*) PTMTIMERR0
;
381 /** Pointer to a R3 pointer to a timer. */
382 typedef PTMTIMERR0
*PPTMTIMERR0
;
384 /** RC pointer to a timer. */
385 typedef RCPTRTYPE(struct TMTIMER
*) PTMTIMERRC
;
386 /** Pointer to a RC pointer to a timer. */
387 typedef PTMTIMERRC
*PPTMTIMERRC
;
389 /** Pointer to a timer. */
390 typedef CTX_SUFF(PTMTIMER
) PTMTIMER
;
391 /** Pointer to a pointer to a timer. */
392 typedef PTMTIMER
*PPTMTIMER
;
394 /** SSM Operation handle. */
395 typedef struct SSMHANDLE
*PSSMHANDLE
;
396 /** Pointer to a const SSM stream method table. */
397 typedef struct SSMSTRMOPS
const *PCSSMSTRMOPS
;
399 /** Pointer to a CPUMCTX. */
400 typedef struct CPUMCTX
*PCPUMCTX
;
401 /** Pointer to a const CPUMCTX. */
402 typedef const struct CPUMCTX
*PCCPUMCTX
;
404 /** Pointer to a CPU context core. */
405 typedef struct CPUMCTXCORE
*PCPUMCTXCORE
;
406 /** Pointer to a const CPU context core. */
407 typedef const struct CPUMCTXCORE
*PCCPUMCTXCORE
;
409 /** Pointer to a selector register. */
410 typedef struct CPUMSELREG
*PCPUMSELREG
;
411 /** Pointer to a const selector register. */
412 typedef const struct CPUMSELREG
*PCCPUMSELREG
;
414 /** Pointer to selector hidden registers.
415 * @deprecated Replaced by PCPUMSELREG */
416 typedef struct CPUMSELREG
*PCPUMSELREGHID
;
417 /** Pointer to const selector hidden registers.
418 * @deprecated Replaced by PCCPUMSELREG */
419 typedef const struct CPUMSELREG
*PCCPUMSELREGHID
;
424 /** @defgroup grp_types_idt Interrupt Descriptor Table Entry.
425 * @todo This all belongs in x86.h!
428 /** @todo VBOXIDT -> VBOXDESCIDT, skip the complex variations. We'll never use them. */
430 /** IDT Entry, Task Gate view. */
431 #pragma pack(1) /* paranoia */
432 typedef struct VBOXIDTE_TASKGATE
435 unsigned u16Reserved1
: 16;
436 /** Task Segment Selector. */
437 unsigned u16TSS
: 16;
438 /** More reserved. */
439 unsigned u8Reserved2
: 8;
440 /** Fixed value bit 0 - Set to 1. */
441 unsigned u1Fixed0
: 1;
444 /** Fixed value bit 2 - Set to 1. */
445 unsigned u1Fixed1
: 1;
446 /** Fixed value bit 3 - Set to 0. */
447 unsigned u1Fixed2
: 1;
448 /** Fixed value bit 4 - Set to 0. */
449 unsigned u1Fixed3
: 1;
450 /** Descriptor Privilege level. */
453 unsigned u1Present
: 1;
455 unsigned u16Reserved3
: 16;
458 /** Pointer to IDT Entry, Task gate view. */
459 typedef VBOXIDTE_TASKGATE
*PVBOXIDTE_TASKGATE
;
462 /** IDT Entry, Intertupt gate view. */
463 #pragma pack(1) /* paranoia */
464 typedef struct VBOXIDTE_INTERRUPTGATE
466 /** Low offset word. */
467 unsigned u16OffsetLow
: 16;
468 /** Segment Selector. */
469 unsigned u16SegSel
: 16;
471 unsigned u5Reserved2
: 5;
472 /** Fixed value bit 0 - Set to 0. */
473 unsigned u1Fixed0
: 1;
474 /** Fixed value bit 1 - Set to 0. */
475 unsigned u1Fixed1
: 1;
476 /** Fixed value bit 2 - Set to 0. */
477 unsigned u1Fixed2
: 1;
478 /** Fixed value bit 3 - Set to 0. */
479 unsigned u1Fixed3
: 1;
480 /** Fixed value bit 4 - Set to 1. */
481 unsigned u1Fixed4
: 1;
482 /** Fixed value bit 5 - Set to 1. */
483 unsigned u1Fixed5
: 1;
484 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
485 unsigned u132BitGate
: 1;
486 /** Fixed value bit 5 - Set to 0. */
487 unsigned u1Fixed6
: 1;
488 /** Descriptor Privilege level. */
491 unsigned u1Present
: 1;
492 /** High offset word. */
493 unsigned u16OffsetHigh
: 16;
494 } VBOXIDTE_INTERRUPTGATE
;
496 /** Pointer to IDT Entry, Interrupt gate view. */
497 typedef VBOXIDTE_INTERRUPTGATE
*PVBOXIDTE_INTERRUPTGATE
;
499 /** IDT Entry, Trap Gate view. */
500 #pragma pack(1) /* paranoia */
501 typedef struct VBOXIDTE_TRAPGATE
503 /** Low offset word. */
504 unsigned u16OffsetLow
: 16;
505 /** Segment Selector. */
506 unsigned u16SegSel
: 16;
508 unsigned u5Reserved2
: 5;
509 /** Fixed value bit 0 - Set to 0. */
510 unsigned u1Fixed0
: 1;
511 /** Fixed value bit 1 - Set to 0. */
512 unsigned u1Fixed1
: 1;
513 /** Fixed value bit 2 - Set to 0. */
514 unsigned u1Fixed2
: 1;
515 /** Fixed value bit 3 - Set to 1. */
516 unsigned u1Fixed3
: 1;
517 /** Fixed value bit 4 - Set to 1. */
518 unsigned u1Fixed4
: 1;
519 /** Fixed value bit 5 - Set to 1. */
520 unsigned u1Fixed5
: 1;
521 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
522 unsigned u132BitGate
: 1;
523 /** Fixed value bit 5 - Set to 0. */
524 unsigned u1Fixed6
: 1;
525 /** Descriptor Privilege level. */
528 unsigned u1Present
: 1;
529 /** High offset word. */
530 unsigned u16OffsetHigh
: 16;
533 /** Pointer to IDT Entry, Trap Gate view. */
534 typedef VBOXIDTE_TRAPGATE
*PVBOXIDTE_TRAPGATE
;
536 /** IDT Entry Generic view. */
537 #pragma pack(1) /* paranoia */
538 typedef struct VBOXIDTE_GENERIC
540 /** Low offset word. */
541 unsigned u16OffsetLow
: 16;
542 /** Segment Selector. */
543 unsigned u16SegSel
: 16;
545 unsigned u5Reserved
: 5;
546 /** IDT Type part one (not used for task gate). */
547 unsigned u3Type1
: 3;
548 /** IDT Type part two. */
549 unsigned u5Type2
: 5;
550 /** Descriptor Privilege level. */
553 unsigned u1Present
: 1;
554 /** High offset word. */
555 unsigned u16OffsetHigh
: 16;
558 /** Pointer to IDT Entry Generic view. */
559 typedef VBOXIDTE_GENERIC
*PVBOXIDTE_GENERIC
;
561 /** IDT Type1 value. (Reserved for task gate!) */
562 #define VBOX_IDTE_TYPE1 0
563 /** IDT Type2 value - Task gate. */
564 #define VBOX_IDTE_TYPE2_TASK 0x5
565 /** IDT Type2 value - 16 bit interrupt gate. */
566 #define VBOX_IDTE_TYPE2_INT_16 0x6
567 /** IDT Type2 value - 32 bit interrupt gate. */
568 #define VBOX_IDTE_TYPE2_INT_32 0xe
569 /** IDT Type2 value - 16 bit trap gate. */
570 #define VBOX_IDTE_TYPE2_TRAP_16 0x7
571 /** IDT Type2 value - 32 bit trap gate. */
572 #define VBOX_IDTE_TYPE2_TRAP_32 0xf
575 #pragma pack(1) /* paranoia */
576 typedef union VBOXIDTE
578 /** Task gate view. */
579 VBOXIDTE_TASKGATE Task
;
580 /** Trap gate view. */
581 VBOXIDTE_TRAPGATE Trap
;
582 /** Interrupt gate view. */
583 VBOXIDTE_INTERRUPTGATE Int
;
584 /** Generic IDT view. */
585 VBOXIDTE_GENERIC Gen
;
587 /** 8 bit unsigned integer view. */
589 /** 16 bit unsigned integer view. */
591 /** 32 bit unsigned integer view. */
593 /** 64 bit unsigned integer view. */
597 /** Pointer to IDT Entry. */
598 typedef VBOXIDTE
*PVBOXIDTE
;
599 /** Pointer to IDT Entry. */
600 typedef VBOXIDTE
const *PCVBOXIDTE
;
602 /** IDT Entry, 64-bit mode, Intertupt gate view. */
603 #pragma pack(1) /* paranoia */
604 typedef struct VBOXIDTE64_INTERRUPTGATE
606 /** Low offset word. */
607 unsigned u16OffsetLow
: 16;
608 /** Segment Selector. */
609 unsigned u16SegSel
: 16;
610 /** Interrupt Stack Table Index. */
612 /** Fixed value bit 0 - Set to 0. */
613 unsigned u1Fixed0
: 1;
614 /** Fixed value bit 1 - Set to 0. */
615 unsigned u1Fixed1
: 1;
616 /** Fixed value bit 2 - Set to 0. */
617 unsigned u1Fixed2
: 1;
618 /** Fixed value bit 3 - Set to 0. */
619 unsigned u1Fixed3
: 1;
620 /** Fixed value bit 4 - Set to 0. */
621 unsigned u1Fixed4
: 1;
622 /** Fixed value bit 5 - Set to 0. */
623 unsigned u1Fixed5
: 1;
624 /** Fixed value bit 6 - Set to 1. */
625 unsigned u1Fixed6
: 1;
626 /** Fixed value bit 7 - Set to 1. */
627 unsigned u1Fixed7
: 1;
628 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
629 unsigned u132BitGate
: 1;
630 /** Fixed value bit 5 - Set to 0. */
631 unsigned u1Fixed8
: 1;
632 /** Descriptor Privilege level. */
635 unsigned u1Present
: 1;
636 /** High offset word. */
637 unsigned u16OffsetHigh
: 16;
638 /** Offset bits 32..63. */
639 unsigned u32OffsetHigh64
;
641 unsigned u32Reserved
;
642 } VBOXIDTE64_INTERRUPTGATE
;
644 /** Pointer to IDT Entry, 64-bit mode, Interrupt gate view. */
645 typedef VBOXIDTE64_INTERRUPTGATE
*PVBOXIDTE64_INTERRUPTGATE
;
647 /** IDT Entry, 64-bit mode, Trap gate view. */
648 #pragma pack(1) /* paranoia */
649 typedef struct VBOXIDTE64_TRAPGATE
651 /** Low offset word. */
652 unsigned u16OffsetLow
: 16;
653 /** Segment Selector. */
654 unsigned u16SegSel
: 16;
655 /** Interrupt Stack Table Index. */
657 /** Fixed value bit 0 - Set to 0. */
658 unsigned u1Fixed0
: 1;
659 /** Fixed value bit 1 - Set to 0. */
660 unsigned u1Fixed1
: 1;
661 /** Fixed value bit 2 - Set to 0. */
662 unsigned u1Fixed2
: 1;
663 /** Fixed value bit 3 - Set to 0. */
664 unsigned u1Fixed3
: 1;
665 /** Fixed value bit 4 - Set to 0. */
666 unsigned u1Fixed4
: 1;
667 /** Fixed value bit 5 - Set to 1. */
668 unsigned u1Fixed5
: 1;
669 /** Fixed value bit 6 - Set to 1. */
670 unsigned u1Fixed6
: 1;
671 /** Fixed value bit 7 - Set to 1. */
672 unsigned u1Fixed7
: 1;
673 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
674 unsigned u132BitGate
: 1;
675 /** Fixed value bit 5 - Set to 0. */
676 unsigned u1Fixed8
: 1;
677 /** Descriptor Privilege level. */
680 unsigned u1Present
: 1;
681 /** High offset word. */
682 unsigned u16OffsetHigh
: 16;
683 /** Offset bits 32..63. */
684 unsigned u32OffsetHigh64
;
686 unsigned u32Reserved
;
687 } VBOXIDTE64_TRAPGATE
;
689 /** Pointer to IDT Entry, 64-bit mode, Trap gate view. */
690 typedef VBOXIDTE64_TRAPGATE
*PVBOXIDTE64_TRAPGATE
;
692 /** IDT Entry, 64-bit mode, Generic view. */
693 #pragma pack(1) /* paranoia */
694 typedef struct VBOXIDTE64_GENERIC
696 /** Low offset word. */
697 unsigned u16OffsetLow
: 16;
698 /** Segment Selector. */
699 unsigned u16SegSel
: 16;
702 /** Fixed value bit 0 - Set to 0. */
703 unsigned u1Fixed0
: 1;
704 /** Fixed value bit 1 - Set to 0. */
705 unsigned u1Fixed1
: 1;
706 /** IDT Type part one (not used for task gate). */
707 unsigned u3Type1
: 3;
708 /** IDT Type part two. */
709 unsigned u5Type2
: 5;
710 /** Descriptor Privilege level. */
713 unsigned u1Present
: 1;
714 /** High offset word. */
715 unsigned u16OffsetHigh
: 16;
716 /** Offset bits 32..63. */
717 unsigned u32OffsetHigh64
;
719 unsigned u32Reserved
;
720 } VBOXIDTE64_GENERIC
;
722 /** Pointer to IDT Entry, 64-bit mode, Generic view. */
723 typedef VBOXIDTE64_GENERIC
*PVBOXIDTE64_GENERIC
;
725 /** IDT Entry, 64-bit mode. */
726 #pragma pack(1) /* paranoia */
727 typedef union VBOXIDTE64
729 /** Trap gate view. */
730 VBOXIDTE64_TRAPGATE Trap
;
731 /** Interrupt gate view. */
732 VBOXIDTE64_INTERRUPTGATE Int
;
733 /** Generic IDT view. */
734 VBOXIDTE64_GENERIC Gen
;
736 /** 8 bit unsigned integer view. */
738 /** 16 bit unsigned integer view. */
740 /** 32 bit unsigned integer view. */
742 /** 64 bit unsigned integer view. */
746 /** Pointer to IDT Entry. */
747 typedef VBOXIDTE64
*PVBOXIDTE64
;
748 /** Pointer to IDT Entry. */
749 typedef VBOXIDTE64
const *PCVBOXIDTE64
;
753 typedef struct VBOXIDTR
755 /** Size of the IDT. */
757 /** Address of the IDT. */
759 } VBOXIDTR
, *PVBOXIDTR
;
765 /** @def VBOXIDTE_OFFSET
766 * Return the offset of an IDT entry.
768 #define VBOXIDTE_OFFSET(desc) \
769 ( ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
770 | ( (desc).Gen.u16OffsetLow ) )
772 /** @def VBOXIDTE64_OFFSET
773 * Return the offset of an IDT entry.
775 #define VBOXIDTE64_OFFSET(desc) \
776 ( ((uint64_t)((desc).Gen.u32OffsetHigh64) << 32) \
777 | ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
778 | ( (desc).Gen.u16OffsetLow ) )
782 typedef struct VBOXGDTR
784 /** Size of the GDT. */
786 /** Address of the GDT. */
790 /** Pointer to GDTR. */
791 typedef VBOXGDTR
*PVBOXGDTR
;
797 * 32-bit Task Segment used in raw mode.
798 * @todo Move this to SELM! Use X86TSS32 instead.
801 typedef struct VBOXTSS
803 /** 0x00 - Back link to previous task. (static) */
806 /** 0x04 - Ring-0 stack pointer. (static) */
808 /** 0x08 - Ring-0 stack segment. (static) */
810 uint16_t padding_ss0
;
811 /** 0x0c - Ring-1 stack pointer. (static) */
813 /** 0x10 - Ring-1 stack segment. (static) */
815 uint16_t padding_ss1
;
816 /** 0x14 - Ring-2 stack pointer. (static) */
818 /** 0x18 - Ring-2 stack segment. (static) */
820 uint16_t padding_ss2
;
821 /** 0x1c - Page directory for the task. (static) */
823 /** 0x20 - EIP before task switch. */
825 /** 0x24 - EFLAGS before task switch. */
827 /** 0x28 - EAX before task switch. */
829 /** 0x2c - ECX before task switch. */
831 /** 0x30 - EDX before task switch. */
833 /** 0x34 - EBX before task switch. */
835 /** 0x38 - ESP before task switch. */
837 /** 0x3c - EBP before task switch. */
839 /** 0x40 - ESI before task switch. */
841 /** 0x44 - EDI before task switch. */
843 /** 0x48 - ES before task switch. */
846 /** 0x4c - CS before task switch. */
849 /** 0x50 - SS before task switch. */
852 /** 0x54 - DS before task switch. */
855 /** 0x58 - FS before task switch. */
858 /** 0x5c - GS before task switch. */
861 /** 0x60 - LDTR before task switch. */
863 uint16_t padding_ldt
;
864 /** 0x64 - Debug trap flag */
866 /** 0x66 - Offset relative to the TSS of the start of the I/O Bitmap
867 * and the end of the interrupt redirection bitmap. */
868 uint16_t offIoBitmap
;
869 /** 0x68 - 32 bytes for the virtual interrupt redirection bitmap. (VME) */
870 uint8_t IntRedirBitmap
[32];
873 /** Pointer to task segment. */
874 typedef VBOXTSS
*PVBOXTSS
;
875 /** Pointer to const task segment. */
876 typedef const VBOXTSS
*PCVBOXTSS
;
879 /** Pointer to a callback method table provided by the VM API user. */
880 typedef struct VMM2USERMETHODS
const *PCVMM2USERMETHODS
;
884 * Data transport buffer (scatter/gather)
886 typedef struct PDMDATASEG
888 /** Length of buffer in entry. */
890 /** Pointer to the start of the buffer. */
893 /** Pointer to a data transport segment. */
894 typedef PDMDATASEG
*PPDMDATASEG
;
895 /** Pointer to a const data transport segment. */
896 typedef PDMDATASEG
const *PCPDMDATASEG
;
900 * Forms of generic segment offloading.
902 typedef enum PDMNETWORKGSOTYPE
904 /** Invalid zero value. */
905 PDMNETWORKGSOTYPE_INVALID
= 0,
906 /** TCP/IPv4 - no CWR/ECE encoding. */
907 PDMNETWORKGSOTYPE_IPV4_TCP
,
908 /** TCP/IPv6 - no CWR/ECE encoding. */
909 PDMNETWORKGSOTYPE_IPV6_TCP
,
911 PDMNETWORKGSOTYPE_IPV4_UDP
,
913 PDMNETWORKGSOTYPE_IPV6_UDP
,
914 /** TCP/IPv6 over IPv4 tunneling - no CWR/ECE encoding.
915 * The header offsets and sizes relates to IPv4 and TCP, the IPv6 header is
916 * figured out as needed.
917 * @todo Needs checking against facts, this is just an outline of the idea. */
918 PDMNETWORKGSOTYPE_IPV4_IPV6_TCP
,
919 /** UDP/IPv6 over IPv4 tunneling.
920 * The header offsets and sizes relates to IPv4 and UDP, the IPv6 header is
921 * figured out as needed.
922 * @todo Needs checking against facts, this is just an outline of the idea. */
923 PDMNETWORKGSOTYPE_IPV4_IPV6_UDP
,
924 /** The end of valid GSO types. */
925 PDMNETWORKGSOTYPE_END
930 * Generic segment offloading context.
932 * We generally follow the E1000 specs wrt to which header fields we change.
933 * However the GSO type implies where the checksum fields are and that they are
934 * always updated from scratch (no half done pseudo checksums).
936 * @remarks This is part of the internal network GSO packets. Take great care
937 * when making changes. The size is expected to be exactly 8 bytes.
939 typedef struct PDMNETWORKGSO
941 /** The type of segmentation offloading we're performing (PDMNETWORKGSOTYPE). */
943 /** The total header size. */
945 /** The max segment size (MSS) to apply. */
948 /** Offset of the first header (IPv4 / IPv6). 0 if not not needed. */
950 /** Offset of the second header (TCP / UDP). 0 if not not needed. */
952 /** The header size used for segmentation (equal to offHdr2 in UFO). */
957 /** Pointer to a GSO context. */
958 typedef PDMNETWORKGSO
*PPDMNETWORKGSO
;
959 /** Pointer to a const GSO context. */
960 typedef PDMNETWORKGSO
const *PCPDMNETWORKGSO
;
964 * The current ROM page protection.
966 * @remarks This is part of the saved state.
968 typedef enum PGMROMPROT
970 /** The customary invalid value. */
971 PGMROMPROT_INVALID
= 0,
972 /** Read from the virgin ROM page, ignore writes.
973 * Map the virgin page, use write access handler to ignore writes. */
974 PGMROMPROT_READ_ROM_WRITE_IGNORE
,
975 /** Read from the virgin ROM page, write to the shadow RAM.
976 * Map the virgin page, use write access handler to change the shadow RAM. */
977 PGMROMPROT_READ_ROM_WRITE_RAM
,
978 /** Read from the shadow ROM page, ignore writes.
979 * Map the shadow page read-only, use write access handler to ignore writes. */
980 PGMROMPROT_READ_RAM_WRITE_IGNORE
,
981 /** Read from the shadow ROM page, ignore writes.
982 * Map the shadow page read-write, disabled write access handler. */
983 PGMROMPROT_READ_RAM_WRITE_RAM
,
984 /** The end of valid values. */
986 /** The usual 32-bit type size hack. */
987 PGMROMPROT_32BIT_HACK
= 0x7fffffff
994 typedef struct PGMPAGEMAPLOCK
996 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
997 /** The locked page. */
999 /** Pointer to the CPU that made the mapping.
1000 * In ring-0 and raw-mode context we don't intend to ever allow long term
1001 * locking and this is a way of making sure we're still on the same CPU. */
1004 /** Pointer to the PGMPAGE and lock type.
1005 * bit-0 abuse: set=write, clear=read. */
1006 uintptr_t uPageAndType
;
1007 /** Read lock type value. */
1008 # define PGMPAGEMAPLOCK_TYPE_READ ((uintptr_t)0)
1009 /** Write lock type value. */
1010 # define PGMPAGEMAPLOCK_TYPE_WRITE ((uintptr_t)1)
1011 /** Lock type mask. */
1012 # define PGMPAGEMAPLOCK_TYPE_MASK ((uintptr_t)1)
1013 /** Pointer to the PGMCHUNKR3MAP. */
1017 /** Pointer to a page mapping lock. */
1018 typedef PGMPAGEMAPLOCK
*PPGMPAGEMAPLOCK
;
1021 /** Pointer to a info helper callback structure. */
1022 typedef struct DBGFINFOHLP
*PDBGFINFOHLP
;
1023 /** Pointer to a const info helper callback structure. */
1024 typedef const struct DBGFINFOHLP
*PCDBGFINFOHLP
;
1026 /** Pointer to a const register descriptor. */
1027 typedef struct DBGFREGDESC
const *PCDBGFREGDESC
;
1030 /** Configuration manager tree node - A key. */
1031 typedef struct CFGMNODE
*PCFGMNODE
;
1033 /** Configuration manager tree leaf - A value. */
1034 typedef struct CFGMLEAF
*PCFGMLEAF
;
1040 typedef enum CPUMMODE
1042 /** The usual invalid zero entry. */
1043 CPUMMODE_INVALID
= 0,
1046 /** Protected mode (32-bit). */
1048 /** Long mode (64-bit). */
1054 * CPU mode flags (DISSTATE::mode).
1056 typedef enum DISCPUMODE
1058 DISCPUMODE_INVALID
= 0,
1062 /** hack forcing the size of the enum to 32-bits. */
1063 DISCPUMODE_MAKE_32BIT_HACK
= 0x7fffffff
1066 /** Pointer to the disassembler state. */
1067 typedef struct DISSTATE
*PDISSTATE
;
1068 /** Pointer to a const disassembler state. */
1069 typedef struct DISSTATE
const *PCDISSTATE
;
1071 /** @deprecated PDISSTATE and change pCpu and pDisState to pDis. */
1072 typedef PDISSTATE PDISCPUSTATE
;
1073 /** @deprecated PCDISSTATE and change pCpu and pDisState to pDis. */
1074 typedef PCDISSTATE PCDISCPUSTATE
;