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