VirtualBox

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

Last change on this file since 41901 was 41901, checked in by vboxsync, 13 years ago

VBox/types.h: VBOXGDTR_VER1_6 -> cpumctx-v1_6.h.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 32.3 KB
Line 
1/** @file
2 * VirtualBox - Types.
3 */
4
5/*
6 * Copyright (C) 2006-2007 Oracle Corporation
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
26#ifndef ___VBox_types_h
27#define ___VBox_types_h
28
29#include <VBox/cdefs.h>
30#include <iprt/types.h>
31
32
33/** @defgroup grp_types Basic VBox Types
34 * @{
35 */
36
37
38/** @defgroup grp_types_both Common Guest and Host Context Basic Types
39 * @ingroup grp_types
40 * @{
41 */
42
43
44/** @defgroup grp_types_hc Host Context Basic Types
45 * @ingroup grp_types_both
46 * @{
47 */
48
49/** @} */
50
51
52/** @defgroup grp_types_gc Guest Context Basic Types
53 * @ingroup grp_types_both
54 * @{
55 */
56
57/** @} */
58
59
60/** Pointer to per support driver session data.
61 * (The data is a R0 entity and private to the the R0 SUP part. All
62 * other should consider this a sort of handle.) */
63typedef R0PTRTYPE(struct SUPDRVSESSION *) PSUPDRVSESSION;
64
65/** Pointer to a VM. */
66typedef struct VM *PVM;
67/** Pointer to a VM - Ring-0 Ptr. */
68typedef R0PTRTYPE(struct VM *) PVMR0;
69/** Pointer to a VM - Ring-3 Ptr. */
70typedef R3PTRTYPE(struct VM *) PVMR3;
71/** Pointer to a VM - RC Ptr. */
72typedef RCPTRTYPE(struct VM *) PVMRC;
73
74/** Pointer to a virtual CPU structure. */
75typedef struct VMCPU * PVMCPU;
76/** Pointer to a virtual CPU structure - Ring-3 Ptr. */
77typedef R3PTRTYPE(struct VMCPU *) PVMCPUR3;
78/** Pointer to a virtual CPU structure - Ring-0 Ptr. */
79typedef R0PTRTYPE(struct VMCPU *) PVMCPUR0;
80/** Pointer to a virtual CPU structure - RC Ptr. */
81typedef RCPTRTYPE(struct VMCPU *) PVMCPURC;
82
83/** Pointer to a ring-0 (global) VM structure. */
84typedef R0PTRTYPE(struct GVM *) PGVM;
85
86/** Pointer to a ring-3 (user mode) VM structure. */
87typedef R3PTRTYPE(struct UVM *) PUVM;
88
89/** Pointer to a ring-3 (user mode) VMCPU structure. */
90typedef R3PTRTYPE(struct UVMCPU *) PUVMCPU;
91
92/** Virtual CPU ID. */
93typedef uint32_t VMCPUID;
94/** Pointer to a virtual CPU ID. */
95typedef VMCPUID *PVMCPUID;
96/** @name Special CPU ID values.
97 * Most of these are for request scheduling.
98 *
99 * @{ */
100/** All virtual CPUs. */
101#define VMCPUID_ALL UINT32_C(0xfffffff2)
102/** All virtual CPUs, descending order. */
103#define VMCPUID_ALL_REVERSE UINT32_C(0xfffffff3)
104/** Any virtual CPU.
105 * Intended for scheduling a VM request or some other task. */
106#define VMCPUID_ANY UINT32_C(0xfffffff4)
107/** Any virtual CPU; always queue for future execution.
108 * Intended for scheduling a VM request or some other task. */
109#define VMCPUID_ANY_QUEUE UINT32_C(0xfffffff5)
110/** The NIL value. */
111#define NIL_VMCPUID UINT32_C(0xfffffffd)
112/** @} */
113
114/**
115 * Virtual CPU set.
116 */
117typedef struct VMCPUSET
118{
119 /** The bitmap data. */
120 uint32_t au32Bitmap[8 /*256/32*/];
121} VMCPUSET;
122/** Pointer to a Virtual CPU set. */
123typedef VMCPUSET *PVMCPUSET;
124/** Pointer to a const Virtual CPU set. */
125typedef VMCPUSET const *PCVMCPUSET;
126
127
128/**
129 * VM State
130 */
131typedef enum VMSTATE
132{
133 /** The VM is being created. */
134 VMSTATE_CREATING = 0,
135 /** The VM is created. */
136 VMSTATE_CREATED,
137 /** The VM state is being loaded from file. */
138 VMSTATE_LOADING,
139 /** The VM is being powered on */
140 VMSTATE_POWERING_ON,
141 /** The VM is being resumed. */
142 VMSTATE_RESUMING,
143 /** The VM is runnning. */
144 VMSTATE_RUNNING,
145 /** Live save: The VM is running and the state is being saved. */
146 VMSTATE_RUNNING_LS,
147 /** Fault Tolerance: The VM is running and the state is being synced. */
148 VMSTATE_RUNNING_FT,
149 /** The VM is being reset. */
150 VMSTATE_RESETTING,
151 /** Live save: The VM is being reset and immediately suspended. */
152 VMSTATE_RESETTING_LS,
153 /** The VM is being suspended. */
154 VMSTATE_SUSPENDING,
155 /** Live save: The VM is being suspended during a live save operation, either as
156 * part of the normal flow or VMR3Reset. */
157 VMSTATE_SUSPENDING_LS,
158 /** Live save: The VM is being suspended by VMR3Suspend during live save. */
159 VMSTATE_SUSPENDING_EXT_LS,
160 /** The VM is suspended. */
161 VMSTATE_SUSPENDED,
162 /** Live save: The VM has been suspended and is waiting for the live save
163 * operation to move on. */
164 VMSTATE_SUSPENDED_LS,
165 /** Live save: The VM has been suspended by VMR3Suspend during a live save. */
166 VMSTATE_SUSPENDED_EXT_LS,
167 /** The VM is suspended and its state is being saved by EMT(0). (See SSM) */
168 VMSTATE_SAVING,
169 /** The VM is being debugged. (See DBGF.) */
170 VMSTATE_DEBUGGING,
171 /** Live save: The VM is being debugged while the live phase is going on. */
172 VMSTATE_DEBUGGING_LS,
173 /** The VM is being powered off. */
174 VMSTATE_POWERING_OFF,
175 /** Live save: The VM is being powered off and the save cancelled. */
176 VMSTATE_POWERING_OFF_LS,
177 /** The VM is switched off, awaiting destruction. */
178 VMSTATE_OFF,
179 /** Live save: Waiting for cancellation and transition to VMSTATE_OFF. */
180 VMSTATE_OFF_LS,
181 /** The VM is powered off because of a fatal error. */
182 VMSTATE_FATAL_ERROR,
183 /** Live save: Waiting for cancellation and transition to FatalError. */
184 VMSTATE_FATAL_ERROR_LS,
185 /** The VM is in guru meditation over a fatal failure. */
186 VMSTATE_GURU_MEDITATION,
187 /** Live save: Waiting for cancellation and transition to GuruMeditation. */
188 VMSTATE_GURU_MEDITATION_LS,
189 /** The VM is screwed because of a failed state loading. */
190 VMSTATE_LOAD_FAILURE,
191 /** The VM is being destroyed. */
192 VMSTATE_DESTROYING,
193 /** Terminated. */
194 VMSTATE_TERMINATED,
195 /** hack forcing the size of the enum to 32-bits. */
196 VMSTATE_MAKE_32BIT_HACK = 0x7fffffff
197} VMSTATE;
198
199/** @def VBOXSTRICTRC_STRICT_ENABLED
200 * Indicates that VBOXSTRICTRC is in strict mode.
201 */
202#if defined(__cplusplus) \
203 && ARCH_BITS == 64 /* cdecl requires classes and structs as hidden params. */ \
204 && !defined(_MSC_VER) /* trouble similar to 32-bit gcc. */ \
205 && ( defined(RT_STRICT) \
206 || defined(VBOX_STRICT) \
207 || defined(DEBUG) \
208 || defined(DOXYGEN_RUNNING) )
209# define VBOXSTRICTRC_STRICT_ENABLED 1
210# ifdef _MSC_VER
211# pragma warning(disable:4190)
212# endif
213#endif
214
215/** We need RTERR_STRICT_RC. */
216#if defined(VBOXSTRICTRC_STRICT_ENABLED) && !defined(RTERR_STRICT_RC)
217# define RTERR_STRICT_RC 1
218#endif
219
220/**
221 * Strict VirtualBox status code.
222 *
223 * This is normally an 32-bit integer and the only purpose of the type is to
224 * highlight the special handling that is required. But in strict build it is a
225 * class that causes compilation and runtime errors for some of the incorrect
226 * handling.
227 */
228#ifdef VBOXSTRICTRC_STRICT_ENABLED
229struct VBOXSTRICTRC
230{
231protected:
232 /** The status code. */
233 int32_t m_rc;
234
235public:
236 /** Default constructor setting the status to VERR_IPE_UNINITIALIZED_STATUS. */
237 VBOXSTRICTRC()
238#ifdef VERR_IPE_UNINITIALIZED_STATUS
239 : m_rc(VERR_IPE_UNINITIALIZED_STATUS)
240#else
241 : m_rc(-233 /*VERR_IPE_UNINITIALIZED_STATUS*/)
242#endif
243 {
244 }
245
246 /** Constructor for normal integer status codes. */
247 VBOXSTRICTRC(int32_t const rc)
248 : m_rc(rc)
249 {
250 }
251
252 /** Getter that VBOXSTRICTRC_VAL can use. */
253 int32_t getValue() const { return m_rc; }
254
255 /** @name Comparison operators
256 * @{ */
257 bool operator==(int32_t rc) const { return m_rc == rc; }
258 bool operator!=(int32_t rc) const { return m_rc != rc; }
259 bool operator<=(int32_t rc) const { return m_rc <= rc; }
260 bool operator>=(int32_t rc) const { return m_rc >= rc; }
261 bool operator<(int32_t rc) const { return m_rc < rc; }
262 bool operator>(int32_t rc) const { return m_rc > rc; }
263
264 bool operator==(const VBOXSTRICTRC &rRc) const { return m_rc == rRc.m_rc; }
265 bool operator!=(const VBOXSTRICTRC &rRc) const { return m_rc != rRc.m_rc; }
266 bool operator<=(const VBOXSTRICTRC &rRc) const { return m_rc <= rRc.m_rc; }
267 bool operator>=(const VBOXSTRICTRC &rRc) const { return m_rc >= rRc.m_rc; }
268 bool operator<(const VBOXSTRICTRC &rRc) const { return m_rc < rRc.m_rc; }
269 bool operator>(const VBOXSTRICTRC &rRc) const { return m_rc > rRc.m_rc; }
270 /** @} */
271
272 /** Special automatic cast for RT_SUCCESS_NP. */
273 operator RTErrStrictType2() const { return RTErrStrictType2(m_rc); }
274
275private:
276 /** @name Constructors that will prevent some of the bad types.
277 * @{ */
278 VBOXSTRICTRC(uint8_t rc) : m_rc(-999) { NOREF(rc); }
279 VBOXSTRICTRC(uint16_t rc) : m_rc(-999) { NOREF(rc); }
280 VBOXSTRICTRC(uint32_t rc) : m_rc(-999) { NOREF(rc); }
281 VBOXSTRICTRC(uint64_t rc) : m_rc(-999) { NOREF(rc); }
282
283 VBOXSTRICTRC(int8_t rc) : m_rc(-999) { NOREF(rc); }
284 VBOXSTRICTRC(int16_t rc) : m_rc(-999) { NOREF(rc); }
285 VBOXSTRICTRC(int64_t rc) : m_rc(-999) { NOREF(rc); }
286 /** @} */
287};
288#else
289typedef int32_t VBOXSTRICTRC;
290#endif
291
292/** @def VBOXSTRICTRC_VAL
293 * Explicit getter.
294 * @param rcStrict The strict VirtualBox status code.
295 */
296#ifdef VBOXSTRICTRC_STRICT_ENABLED
297# define VBOXSTRICTRC_VAL(rcStrict) ( (rcStrict).getValue() )
298#else
299# define VBOXSTRICTRC_VAL(rcStrict) (rcStrict)
300#endif
301
302/** @def VBOXSTRICTRC_TODO
303 * Returns that needs dealing with.
304 * @param rcStrict The strict VirtualBox status code.
305 */
306#define VBOXSTRICTRC_TODO(rcStrict) VBOXSTRICTRC_VAL(rcStrict)
307
308
309/** Pointer to a PDM Base Interface. */
310typedef struct PDMIBASE *PPDMIBASE;
311/** Pointer to a pointer to a PDM Base Interface. */
312typedef PPDMIBASE *PPPDMIBASE;
313
314/** Pointer to a PDM Device Instance. */
315typedef struct PDMDEVINS *PPDMDEVINS;
316/** Pointer to a pointer to a PDM Device Instance. */
317typedef PPDMDEVINS *PPPDMDEVINS;
318/** R3 pointer to a PDM Device Instance. */
319typedef R3PTRTYPE(PPDMDEVINS) PPDMDEVINSR3;
320/** R0 pointer to a PDM Device Instance. */
321typedef R0PTRTYPE(PPDMDEVINS) PPDMDEVINSR0;
322/** RC pointer to a PDM Device Instance. */
323typedef RCPTRTYPE(PPDMDEVINS) PPDMDEVINSRC;
324
325/** Pointer to a PDM USB Device Instance. */
326typedef struct PDMUSBINS *PPDMUSBINS;
327/** Pointer to a pointer to a PDM USB Device Instance. */
328typedef PPDMUSBINS *PPPDMUSBINS;
329
330/** Pointer to a PDM Driver Instance. */
331typedef struct PDMDRVINS *PPDMDRVINS;
332/** Pointer to a pointer to a PDM Driver Instance. */
333typedef PPDMDRVINS *PPPDMDRVINS;
334/** R3 pointer to a PDM Driver Instance. */
335typedef R3PTRTYPE(PPDMDRVINS) PPDMDRVINSR3;
336/** R0 pointer to a PDM Driver Instance. */
337typedef R0PTRTYPE(PPDMDRVINS) PPDMDRVINSR0;
338/** RC pointer to a PDM Driver Instance. */
339typedef RCPTRTYPE(PPDMDRVINS) PPDMDRVINSRC;
340
341/** Pointer to a PDM Service Instance. */
342typedef struct PDMSRVINS *PPDMSRVINS;
343/** Pointer to a pointer to a PDM Service Instance. */
344typedef PPDMSRVINS *PPPDMSRVINS;
345
346/** Pointer to a PDM critical section. */
347typedef union PDMCRITSECT *PPDMCRITSECT;
348/** Pointer to a const PDM critical section. */
349typedef const union PDMCRITSECT *PCPDMCRITSECT;
350
351/** R3 pointer to a timer. */
352typedef R3PTRTYPE(struct TMTIMER *) PTMTIMERR3;
353/** Pointer to a R3 pointer to a timer. */
354typedef PTMTIMERR3 *PPTMTIMERR3;
355
356/** R0 pointer to a timer. */
357typedef R0PTRTYPE(struct TMTIMER *) PTMTIMERR0;
358/** Pointer to a R3 pointer to a timer. */
359typedef PTMTIMERR0 *PPTMTIMERR0;
360
361/** RC pointer to a timer. */
362typedef RCPTRTYPE(struct TMTIMER *) PTMTIMERRC;
363/** Pointer to a RC pointer to a timer. */
364typedef PTMTIMERRC *PPTMTIMERRC;
365
366/** Pointer to a timer. */
367typedef CTX_SUFF(PTMTIMER) PTMTIMER;
368/** Pointer to a pointer to a timer. */
369typedef PTMTIMER *PPTMTIMER;
370
371/** SSM Operation handle. */
372typedef struct SSMHANDLE *PSSMHANDLE;
373/** Pointer to a const SSM stream method table. */
374typedef struct SSMSTRMOPS const *PCSSMSTRMOPS;
375
376/** Pointer to a CPUMCTX. */
377typedef struct CPUMCTX *PCPUMCTX;
378/** Pointer to a const CPUMCTX. */
379typedef const struct CPUMCTX *PCCPUMCTX;
380
381/** Pointer to a CPU context core. */
382typedef struct CPUMCTXCORE *PCPUMCTXCORE;
383/** Pointer to a const CPU context core. */
384typedef const struct CPUMCTXCORE *PCCPUMCTXCORE;
385
386/** Pointer to selector hidden registers. */
387typedef struct CPUMSELREGHID *PCPUMSELREGHID;
388/** Pointer to const selector hidden registers. */
389typedef const struct CPUMSELREGHID *PCCPUMSELREGHID;
390
391/** @} */
392
393
394/** @defgroup grp_types_idt Interrupt Descriptor Table Entry.
395 * @ingroup grp_types
396 * @todo This all belongs in x86.h!
397 * @{ */
398
399/** @todo VBOXIDT -> VBOXDESCIDT, skip the complex variations. We'll never use them. */
400
401/** IDT Entry, Task Gate view. */
402#pragma pack(1) /* paranoia */
403typedef struct VBOXIDTE_TASKGATE
404{
405 /** Reserved. */
406 unsigned u16Reserved1 : 16;
407 /** Task Segment Selector. */
408 unsigned u16TSS : 16;
409 /** More reserved. */
410 unsigned u8Reserved2 : 8;
411 /** Fixed value bit 0 - Set to 1. */
412 unsigned u1Fixed0 : 1;
413 /** Busy bit. */
414 unsigned u1Busy : 1;
415 /** Fixed value bit 2 - Set to 1. */
416 unsigned u1Fixed1 : 1;
417 /** Fixed value bit 3 - Set to 0. */
418 unsigned u1Fixed2 : 1;
419 /** Fixed value bit 4 - Set to 0. */
420 unsigned u1Fixed3 : 1;
421 /** Descriptor Privilege level. */
422 unsigned u2DPL : 2;
423 /** Present flag. */
424 unsigned u1Present : 1;
425 /** Reserved. */
426 unsigned u16Reserved3 : 16;
427} VBOXIDTE_TASKGATE;
428#pragma pack()
429/** Pointer to IDT Entry, Task gate view. */
430typedef VBOXIDTE_TASKGATE *PVBOXIDTE_TASKGATE;
431
432
433/** IDT Entry, Intertupt gate view. */
434#pragma pack(1) /* paranoia */
435typedef struct VBOXIDTE_INTERRUPTGATE
436{
437 /** Low offset word. */
438 unsigned u16OffsetLow : 16;
439 /** Segment Selector. */
440 unsigned u16SegSel : 16;
441 /** Reserved. */
442 unsigned u5Reserved2 : 5;
443 /** Fixed value bit 0 - Set to 0. */
444 unsigned u1Fixed0 : 1;
445 /** Fixed value bit 1 - Set to 0. */
446 unsigned u1Fixed1 : 1;
447 /** Fixed value bit 2 - Set to 0. */
448 unsigned u1Fixed2 : 1;
449 /** Fixed value bit 3 - Set to 0. */
450 unsigned u1Fixed3 : 1;
451 /** Fixed value bit 4 - Set to 1. */
452 unsigned u1Fixed4 : 1;
453 /** Fixed value bit 5 - Set to 1. */
454 unsigned u1Fixed5 : 1;
455 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
456 unsigned u132BitGate : 1;
457 /** Fixed value bit 5 - Set to 0. */
458 unsigned u1Fixed6 : 1;
459 /** Descriptor Privilege level. */
460 unsigned u2DPL : 2;
461 /** Present flag. */
462 unsigned u1Present : 1;
463 /** High offset word. */
464 unsigned u16OffsetHigh : 16;
465} VBOXIDTE_INTERRUPTGATE;
466#pragma pack()
467/** Pointer to IDT Entry, Interrupt gate view. */
468typedef VBOXIDTE_INTERRUPTGATE *PVBOXIDTE_INTERRUPTGATE;
469
470/** IDT Entry, Trap Gate view. */
471#pragma pack(1) /* paranoia */
472typedef struct VBOXIDTE_TRAPGATE
473{
474 /** Low offset word. */
475 unsigned u16OffsetLow : 16;
476 /** Segment Selector. */
477 unsigned u16SegSel : 16;
478 /** Reserved. */
479 unsigned u5Reserved2 : 5;
480 /** Fixed value bit 0 - Set to 0. */
481 unsigned u1Fixed0 : 1;
482 /** Fixed value bit 1 - Set to 0. */
483 unsigned u1Fixed1 : 1;
484 /** Fixed value bit 2 - Set to 0. */
485 unsigned u1Fixed2 : 1;
486 /** Fixed value bit 3 - Set to 1. */
487 unsigned u1Fixed3 : 1;
488 /** Fixed value bit 4 - Set to 1. */
489 unsigned u1Fixed4 : 1;
490 /** Fixed value bit 5 - Set to 1. */
491 unsigned u1Fixed5 : 1;
492 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
493 unsigned u132BitGate : 1;
494 /** Fixed value bit 5 - Set to 0. */
495 unsigned u1Fixed6 : 1;
496 /** Descriptor Privilege level. */
497 unsigned u2DPL : 2;
498 /** Present flag. */
499 unsigned u1Present : 1;
500 /** High offset word. */
501 unsigned u16OffsetHigh : 16;
502} VBOXIDTE_TRAPGATE;
503#pragma pack()
504/** Pointer to IDT Entry, Trap Gate view. */
505typedef VBOXIDTE_TRAPGATE *PVBOXIDTE_TRAPGATE;
506
507/** IDT Entry Generic view. */
508#pragma pack(1) /* paranoia */
509typedef struct VBOXIDTE_GENERIC
510{
511 /** Low offset word. */
512 unsigned u16OffsetLow : 16;
513 /** Segment Selector. */
514 unsigned u16SegSel : 16;
515 /** Reserved. */
516 unsigned u5Reserved : 5;
517 /** IDT Type part one (not used for task gate). */
518 unsigned u3Type1 : 3;
519 /** IDT Type part two. */
520 unsigned u5Type2 : 5;
521 /** Descriptor Privilege level. */
522 unsigned u2DPL : 2;
523 /** Present flag. */
524 unsigned u1Present : 1;
525 /** High offset word. */
526 unsigned u16OffsetHigh : 16;
527} VBOXIDTE_GENERIC;
528#pragma pack()
529/** Pointer to IDT Entry Generic view. */
530typedef VBOXIDTE_GENERIC *PVBOXIDTE_GENERIC;
531
532/** IDT Type1 value. (Reserved for task gate!) */
533#define VBOX_IDTE_TYPE1 0
534/** IDT Type2 value - Task gate. */
535#define VBOX_IDTE_TYPE2_TASK 0x5
536/** IDT Type2 value - 16 bit interrupt gate. */
537#define VBOX_IDTE_TYPE2_INT_16 0x6
538/** IDT Type2 value - 32 bit interrupt gate. */
539#define VBOX_IDTE_TYPE2_INT_32 0xe
540/** IDT Type2 value - 16 bit trap gate. */
541#define VBOX_IDTE_TYPE2_TRAP_16 0x7
542/** IDT Type2 value - 32 bit trap gate. */
543#define VBOX_IDTE_TYPE2_TRAP_32 0xf
544
545/** IDT Entry. */
546#pragma pack(1) /* paranoia */
547typedef union VBOXIDTE
548{
549 /** Task gate view. */
550 VBOXIDTE_TASKGATE Task;
551 /** Trap gate view. */
552 VBOXIDTE_TRAPGATE Trap;
553 /** Interrupt gate view. */
554 VBOXIDTE_INTERRUPTGATE Int;
555 /** Generic IDT view. */
556 VBOXIDTE_GENERIC Gen;
557
558 /** 8 bit unsigned integer view. */
559 uint8_t au8[8];
560 /** 16 bit unsigned integer view. */
561 uint16_t au16[4];
562 /** 32 bit unsigned integer view. */
563 uint32_t au32[2];
564 /** 64 bit unsigned integer view. */
565 uint64_t au64;
566} VBOXIDTE;
567#pragma pack()
568/** Pointer to IDT Entry. */
569typedef VBOXIDTE *PVBOXIDTE;
570/** Pointer to IDT Entry. */
571typedef VBOXIDTE const *PCVBOXIDTE;
572
573/** IDT Entry, 64-bit mode, Intertupt gate view. */
574#pragma pack(1) /* paranoia */
575typedef struct VBOXIDTE64_INTERRUPTGATE
576{
577 /** Low offset word. */
578 unsigned u16OffsetLow : 16;
579 /** Segment Selector. */
580 unsigned u16SegSel : 16;
581 /** Interrupt Stack Table Index. */
582 unsigned u3Ist : 3;
583 /** Fixed value bit 0 - Set to 0. */
584 unsigned u1Fixed0 : 1;
585 /** Fixed value bit 1 - Set to 0. */
586 unsigned u1Fixed1 : 1;
587 /** Fixed value bit 2 - Set to 0. */
588 unsigned u1Fixed2 : 1;
589 /** Fixed value bit 3 - Set to 0. */
590 unsigned u1Fixed3 : 1;
591 /** Fixed value bit 4 - Set to 0. */
592 unsigned u1Fixed4 : 1;
593 /** Fixed value bit 5 - Set to 0. */
594 unsigned u1Fixed5 : 1;
595 /** Fixed value bit 6 - Set to 1. */
596 unsigned u1Fixed6 : 1;
597 /** Fixed value bit 7 - Set to 1. */
598 unsigned u1Fixed7 : 1;
599 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
600 unsigned u132BitGate : 1;
601 /** Fixed value bit 5 - Set to 0. */
602 unsigned u1Fixed8 : 1;
603 /** Descriptor Privilege level. */
604 unsigned u2DPL : 2;
605 /** Present flag. */
606 unsigned u1Present : 1;
607 /** High offset word. */
608 unsigned u16OffsetHigh : 16;
609 /** Offset bits 32..63. */
610 unsigned u32OffsetHigh64;
611 /** Reserved. */
612 unsigned u32Reserved;
613} VBOXIDTE64_INTERRUPTGATE;
614#pragma pack()
615/** Pointer to IDT Entry, 64-bit mode, Interrupt gate view. */
616typedef VBOXIDTE64_INTERRUPTGATE *PVBOXIDTE64_INTERRUPTGATE;
617
618/** IDT Entry, 64-bit mode, Trap gate view. */
619#pragma pack(1) /* paranoia */
620typedef struct VBOXIDTE64_TRAPGATE
621{
622 /** Low offset word. */
623 unsigned u16OffsetLow : 16;
624 /** Segment Selector. */
625 unsigned u16SegSel : 16;
626 /** Interrupt Stack Table Index. */
627 unsigned u3Ist : 3;
628 /** Fixed value bit 0 - Set to 0. */
629 unsigned u1Fixed0 : 1;
630 /** Fixed value bit 1 - Set to 0. */
631 unsigned u1Fixed1 : 1;
632 /** Fixed value bit 2 - Set to 0. */
633 unsigned u1Fixed2 : 1;
634 /** Fixed value bit 3 - Set to 0. */
635 unsigned u1Fixed3 : 1;
636 /** Fixed value bit 4 - Set to 0. */
637 unsigned u1Fixed4 : 1;
638 /** Fixed value bit 5 - Set to 1. */
639 unsigned u1Fixed5 : 1;
640 /** Fixed value bit 6 - Set to 1. */
641 unsigned u1Fixed6 : 1;
642 /** Fixed value bit 7 - Set to 1. */
643 unsigned u1Fixed7 : 1;
644 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
645 unsigned u132BitGate : 1;
646 /** Fixed value bit 5 - Set to 0. */
647 unsigned u1Fixed8 : 1;
648 /** Descriptor Privilege level. */
649 unsigned u2DPL : 2;
650 /** Present flag. */
651 unsigned u1Present : 1;
652 /** High offset word. */
653 unsigned u16OffsetHigh : 16;
654 /** Offset bits 32..63. */
655 unsigned u32OffsetHigh64;
656 /** Reserved. */
657 unsigned u32Reserved;
658} VBOXIDTE64_TRAPGATE;
659#pragma pack()
660/** Pointer to IDT Entry, 64-bit mode, Trap gate view. */
661typedef VBOXIDTE64_TRAPGATE *PVBOXIDTE64_TRAPGATE;
662
663/** IDT Entry, 64-bit mode, Generic view. */
664#pragma pack(1) /* paranoia */
665typedef struct VBOXIDTE64_GENERIC
666{
667 /** Low offset word. */
668 unsigned u16OffsetLow : 16;
669 /** Segment Selector. */
670 unsigned u16SegSel : 16;
671 /** Reserved. */
672 unsigned u3Ist : 3;
673 /** Fixed value bit 0 - Set to 0. */
674 unsigned u1Fixed0 : 1;
675 /** Fixed value bit 1 - Set to 0. */
676 unsigned u1Fixed1 : 1;
677 /** IDT Type part one (not used for task gate). */
678 unsigned u3Type1 : 3;
679 /** IDT Type part two. */
680 unsigned u5Type2 : 5;
681 /** Descriptor Privilege level. */
682 unsigned u2DPL : 2;
683 /** Present flag. */
684 unsigned u1Present : 1;
685 /** High offset word. */
686 unsigned u16OffsetHigh : 16;
687 /** Offset bits 32..63. */
688 unsigned u32OffsetHigh64;
689 /** Reserved. */
690 unsigned u32Reserved;
691} VBOXIDTE64_GENERIC;
692#pragma pack()
693/** Pointer to IDT Entry, 64-bit mode, Generic view. */
694typedef VBOXIDTE64_GENERIC *PVBOXIDTE64_GENERIC;
695
696/** IDT Entry, 64-bit mode. */
697#pragma pack(1) /* paranoia */
698typedef union VBOXIDTE64
699{
700 /** Trap gate view. */
701 VBOXIDTE64_TRAPGATE Trap;
702 /** Interrupt gate view. */
703 VBOXIDTE64_INTERRUPTGATE Int;
704 /** Generic IDT view. */
705 VBOXIDTE64_GENERIC Gen;
706
707 /** 8 bit unsigned integer view. */
708 uint8_t au8[16];
709 /** 16 bit unsigned integer view. */
710 uint16_t au16[8];
711 /** 32 bit unsigned integer view. */
712 uint32_t au32[4];
713 /** 64 bit unsigned integer view. */
714 uint64_t au64[2];
715} VBOXIDTE64;
716#pragma pack()
717/** Pointer to IDT Entry. */
718typedef VBOXIDTE64 *PVBOXIDTE64;
719/** Pointer to IDT Entry. */
720typedef VBOXIDTE64 const *PCVBOXIDTE64;
721
722#pragma pack(1)
723/** IDTR */
724typedef struct VBOXIDTR
725{
726 /** Size of the IDT. */
727 uint16_t cbIdt;
728 /** Address of the IDT. */
729 uint64_t pIdt;
730} VBOXIDTR, *PVBOXIDTR;
731#pragma pack()
732
733/** @} */
734
735
736/** @def VBOXIDTE_OFFSET
737 * Return the offset of an IDT entry.
738 */
739#define VBOXIDTE_OFFSET(desc) \
740 ( ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
741 | ( (desc).Gen.u16OffsetLow ) )
742
743/** @def VBOXIDTE64_OFFSET
744 * Return the offset of an IDT entry.
745 */
746#define VBOXIDTE64_OFFSET(desc) \
747 ( ((uint64_t)((desc).Gen.u32OffsetHigh64) << 32) \
748 | ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
749 | ( (desc).Gen.u16OffsetLow ) )
750
751#pragma pack(1)
752/** GDTR */
753typedef struct VBOXGDTR
754{
755 /** Size of the GDT. */
756 uint16_t cbGdt;
757 /** Address of the GDT. */
758 uint64_t pGdt;
759} VBOXGDTR;
760#pragma pack()
761/** Pointer to GDTR. */
762typedef VBOXGDTR *PVBOXGDTR;
763
764/** @} */
765
766
767/**
768 * 32-bit Task Segment used in raw mode.
769 * @todo Move this to SELM! Use X86TSS32 instead.
770 */
771#pragma pack(1)
772typedef struct VBOXTSS
773{
774 /** 0x00 - Back link to previous task. (static) */
775 RTSEL selPrev;
776 uint16_t padding1;
777 /** 0x04 - Ring-0 stack pointer. (static) */
778 uint32_t esp0;
779 /** 0x08 - Ring-0 stack segment. (static) */
780 RTSEL ss0;
781 uint16_t padding_ss0;
782 /** 0x0c - Ring-1 stack pointer. (static) */
783 uint32_t esp1;
784 /** 0x10 - Ring-1 stack segment. (static) */
785 RTSEL ss1;
786 uint16_t padding_ss1;
787 /** 0x14 - Ring-2 stack pointer. (static) */
788 uint32_t esp2;
789 /** 0x18 - Ring-2 stack segment. (static) */
790 RTSEL ss2;
791 uint16_t padding_ss2;
792 /** 0x1c - Page directory for the task. (static) */
793 uint32_t cr3;
794 /** 0x20 - EIP before task switch. */
795 uint32_t eip;
796 /** 0x24 - EFLAGS before task switch. */
797 uint32_t eflags;
798 /** 0x28 - EAX before task switch. */
799 uint32_t eax;
800 /** 0x2c - ECX before task switch. */
801 uint32_t ecx;
802 /** 0x30 - EDX before task switch. */
803 uint32_t edx;
804 /** 0x34 - EBX before task switch. */
805 uint32_t ebx;
806 /** 0x38 - ESP before task switch. */
807 uint32_t esp;
808 /** 0x3c - EBP before task switch. */
809 uint32_t ebp;
810 /** 0x40 - ESI before task switch. */
811 uint32_t esi;
812 /** 0x44 - EDI before task switch. */
813 uint32_t edi;
814 /** 0x48 - ES before task switch. */
815 RTSEL es;
816 uint16_t padding_es;
817 /** 0x4c - CS before task switch. */
818 RTSEL cs;
819 uint16_t padding_cs;
820 /** 0x50 - SS before task switch. */
821 RTSEL ss;
822 uint16_t padding_ss;
823 /** 0x54 - DS before task switch. */
824 RTSEL ds;
825 uint16_t padding_ds;
826 /** 0x58 - FS before task switch. */
827 RTSEL fs;
828 uint16_t padding_fs;
829 /** 0x5c - GS before task switch. */
830 RTSEL gs;
831 uint16_t padding_gs;
832 /** 0x60 - LDTR before task switch. */
833 RTSEL selLdt;
834 uint16_t padding_ldt;
835 /** 0x64 - Debug trap flag */
836 uint16_t fDebugTrap;
837 /** 0x66 - Offset relative to the TSS of the start of the I/O Bitmap
838 * and the end of the interrupt redirection bitmap. */
839 uint16_t offIoBitmap;
840 /** 0x68 - 32 bytes for the virtual interrupt redirection bitmap. (VME) */
841 uint8_t IntRedirBitmap[32];
842} VBOXTSS;
843#pragma pack()
844/** Pointer to task segment. */
845typedef VBOXTSS *PVBOXTSS;
846/** Pointer to const task segment. */
847typedef const VBOXTSS *PCVBOXTSS;
848
849
850/** Pointer to a callback method table provided by the VM API user. */
851typedef struct VMM2USERMETHODS const *PCVMM2USERMETHODS;
852
853
854/**
855 * Data transport buffer (scatter/gather)
856 */
857typedef struct PDMDATASEG
858{
859 /** Length of buffer in entry. */
860 size_t cbSeg;
861 /** Pointer to the start of the buffer. */
862 void *pvSeg;
863} PDMDATASEG;
864/** Pointer to a data transport segment. */
865typedef PDMDATASEG *PPDMDATASEG;
866/** Pointer to a const data transport segment. */
867typedef PDMDATASEG const *PCPDMDATASEG;
868
869
870/**
871 * Forms of generic segment offloading.
872 */
873typedef enum PDMNETWORKGSOTYPE
874{
875 /** Invalid zero value. */
876 PDMNETWORKGSOTYPE_INVALID = 0,
877 /** TCP/IPv4 - no CWR/ECE encoding. */
878 PDMNETWORKGSOTYPE_IPV4_TCP,
879 /** TCP/IPv6 - no CWR/ECE encoding. */
880 PDMNETWORKGSOTYPE_IPV6_TCP,
881 /** UDP/IPv4. */
882 PDMNETWORKGSOTYPE_IPV4_UDP,
883 /** UDP/IPv6. */
884 PDMNETWORKGSOTYPE_IPV6_UDP,
885 /** TCP/IPv6 over IPv4 tunneling - no CWR/ECE encoding.
886 * The header offsets and sizes relates to IPv4 and TCP, the IPv6 header is
887 * figured out as needed.
888 * @todo Needs checking against facts, this is just an outline of the idea. */
889 PDMNETWORKGSOTYPE_IPV4_IPV6_TCP,
890 /** UDP/IPv6 over IPv4 tunneling.
891 * The header offsets and sizes relates to IPv4 and UDP, the IPv6 header is
892 * figured out as needed.
893 * @todo Needs checking against facts, this is just an outline of the idea. */
894 PDMNETWORKGSOTYPE_IPV4_IPV6_UDP,
895 /** The end of valid GSO types. */
896 PDMNETWORKGSOTYPE_END
897} PDMNETWORKGSOTYPE;
898
899
900/**
901 * Generic segment offloading context.
902 *
903 * We generally follow the E1000 specs wrt to which header fields we change.
904 * However the GSO type implies where the checksum fields are and that they are
905 * always updated from scratch (no half done pseudo checksums).
906 *
907 * @remarks This is part of the internal network GSO packets. Take great care
908 * when making changes. The size is expected to be exactly 8 bytes.
909 */
910typedef struct PDMNETWORKGSO
911{
912 /** The type of segmentation offloading we're performing (PDMNETWORKGSOTYPE). */
913 uint8_t u8Type;
914 /** The total header size. */
915 uint8_t cbHdrsTotal;
916 /** The max segment size (MSS) to apply. */
917 uint16_t cbMaxSeg;
918
919 /** Offset of the first header (IPv4 / IPv6). 0 if not not needed. */
920 uint8_t offHdr1;
921 /** Offset of the second header (TCP / UDP). 0 if not not needed. */
922 uint8_t offHdr2;
923 /** The header size used for segmentation (equal to offHdr2 in UFO). */
924 uint8_t cbHdrsSeg;
925 /** Unused. */
926 uint8_t u8Unused;
927} PDMNETWORKGSO;
928/** Pointer to a GSO context. */
929typedef PDMNETWORKGSO *PPDMNETWORKGSO;
930/** Pointer to a const GSO context. */
931typedef PDMNETWORKGSO const *PCPDMNETWORKGSO;
932
933
934/**
935 * The current ROM page protection.
936 *
937 * @remarks This is part of the saved state.
938 */
939typedef enum PGMROMPROT
940{
941 /** The customary invalid value. */
942 PGMROMPROT_INVALID = 0,
943 /** Read from the virgin ROM page, ignore writes.
944 * Map the virgin page, use write access handler to ignore writes. */
945 PGMROMPROT_READ_ROM_WRITE_IGNORE,
946 /** Read from the virgin ROM page, write to the shadow RAM.
947 * Map the virgin page, use write access handler to change the shadow RAM. */
948 PGMROMPROT_READ_ROM_WRITE_RAM,
949 /** Read from the shadow ROM page, ignore writes.
950 * Map the shadow page read-only, use write access handler to ignore writes. */
951 PGMROMPROT_READ_RAM_WRITE_IGNORE,
952 /** Read from the shadow ROM page, ignore writes.
953 * Map the shadow page read-write, disabled write access handler. */
954 PGMROMPROT_READ_RAM_WRITE_RAM,
955 /** The end of valid values. */
956 PGMROMPROT_END,
957 /** The usual 32-bit type size hack. */
958 PGMROMPROT_32BIT_HACK = 0x7fffffff
959} PGMROMPROT;
960
961
962/**
963 * Page mapping lock.
964 */
965typedef struct PGMPAGEMAPLOCK
966{
967#if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
968 /** The locked page. */
969 void *pvPage;
970 /** Pointer to the CPU that made the mapping.
971 * In ring-0 and raw-mode context we don't intend to ever allow long term
972 * locking and this is a way of making sure we're still on the same CPU. */
973 PVMCPU pVCpu;
974#else
975 /** Pointer to the PGMPAGE and lock type.
976 * bit-0 abuse: set=write, clear=read. */
977 uintptr_t uPageAndType;
978/** Read lock type value. */
979# define PGMPAGEMAPLOCK_TYPE_READ ((uintptr_t)0)
980/** Write lock type value. */
981# define PGMPAGEMAPLOCK_TYPE_WRITE ((uintptr_t)1)
982/** Lock type mask. */
983# define PGMPAGEMAPLOCK_TYPE_MASK ((uintptr_t)1)
984 /** Pointer to the PGMCHUNKR3MAP. */
985 void *pvMap;
986#endif
987} PGMPAGEMAPLOCK;
988/** Pointer to a page mapping lock. */
989typedef PGMPAGEMAPLOCK *PPGMPAGEMAPLOCK;
990
991
992/** Pointer to a info helper callback structure. */
993typedef struct DBGFINFOHLP *PDBGFINFOHLP;
994/** Pointer to a const info helper callback structure. */
995typedef const struct DBGFINFOHLP *PCDBGFINFOHLP;
996
997/** Pointer to a const register descriptor. */
998typedef struct DBGFREGDESC const *PCDBGFREGDESC;
999
1000
1001/** Configuration manager tree node - A key. */
1002typedef struct CFGMNODE *PCFGMNODE;
1003
1004/** Configuration manager tree leaf - A value. */
1005typedef struct CFGMLEAF *PCFGMLEAF;
1006
1007
1008/**
1009 * CPU modes.
1010 */
1011typedef enum CPUMMODE
1012{
1013 /** The usual invalid zero entry. */
1014 CPUMMODE_INVALID = 0,
1015 /** Real mode. */
1016 CPUMMODE_REAL,
1017 /** Protected mode (32-bit). */
1018 CPUMMODE_PROTECTED,
1019 /** Long mode (64-bit). */
1020 CPUMMODE_LONG
1021} CPUMMODE;
1022
1023
1024/** Pointer to the disassembler state. */
1025typedef struct DISSTATE *PDISSTATE;
1026/** Pointer to a const disassembler state. */
1027typedef struct DISSTATE const *PCDISSTATE;
1028
1029/** @deprecated PDISSTATE and change pCpu and pDisState to pDis. */
1030typedef PDISSTATE PDISCPUSTATE;
1031/** @deprecated PCDISSTATE and change pCpu and pDisState to pDis. */
1032typedef PCDISSTATE PCDISCPUSTATE;
1033
1034
1035/** @} */
1036
1037#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