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 | #ifdef VBOX_WITH_LOTS_OF_DBGF_BPS
|
---|
525 | /** A cross context DBGF breakpoint owner handle. */
|
---|
526 | typedef uint32_t DBGFBPOWNER;
|
---|
527 | /** Pointer to a cross context DBGF breakpoint owner handle. */
|
---|
528 | typedef DBGFBPOWNER *PDBGFBPOWNER;
|
---|
529 | /** A NIL DBGF breakpoint owner handle. */
|
---|
530 | #define NIL_DBGFBPOWNER ((uint32_t)UINT32_MAX)
|
---|
531 |
|
---|
532 | /** A cross context DBGF breakpoint handle. */
|
---|
533 | typedef uint32_t DBGFBP;
|
---|
534 | /** Pointer to a cross context DBGF breakpoint handle. */
|
---|
535 | typedef DBGFBP *PDBGFBP;
|
---|
536 | /** A NIL DBGF breakpoint handle. */
|
---|
537 | #define NIL_DBGFBP ((uint32_t)UINT32_MAX)
|
---|
538 | #endif
|
---|
539 | /** @} */
|
---|
540 |
|
---|
541 |
|
---|
542 | /** @defgroup grp_types_idt Interrupt Descriptor Table Entry.
|
---|
543 | * @todo This all belongs in x86.h!
|
---|
544 | * @{ */
|
---|
545 |
|
---|
546 | /** @todo VBOXIDT -> VBOXDESCIDT, skip the complex variations. We'll never use them. */
|
---|
547 |
|
---|
548 | /** IDT Entry, Task Gate view. */
|
---|
549 | #pragma pack(1) /* paranoia */
|
---|
550 | typedef struct VBOXIDTE_TASKGATE
|
---|
551 | {
|
---|
552 | /** Reserved. */
|
---|
553 | unsigned u16Reserved1 : 16;
|
---|
554 | /** Task Segment Selector. */
|
---|
555 | unsigned u16TSS : 16;
|
---|
556 | /** More reserved. */
|
---|
557 | unsigned u8Reserved2 : 8;
|
---|
558 | /** Fixed value bit 0 - Set to 1. */
|
---|
559 | unsigned u1Fixed0 : 1;
|
---|
560 | /** Busy bit. */
|
---|
561 | unsigned u1Busy : 1;
|
---|
562 | /** Fixed value bit 2 - Set to 1. */
|
---|
563 | unsigned u1Fixed1 : 1;
|
---|
564 | /** Fixed value bit 3 - Set to 0. */
|
---|
565 | unsigned u1Fixed2 : 1;
|
---|
566 | /** Fixed value bit 4 - Set to 0. */
|
---|
567 | unsigned u1Fixed3 : 1;
|
---|
568 | /** Descriptor Privilege level. */
|
---|
569 | unsigned u2DPL : 2;
|
---|
570 | /** Present flag. */
|
---|
571 | unsigned u1Present : 1;
|
---|
572 | /** Reserved. */
|
---|
573 | unsigned u16Reserved3 : 16;
|
---|
574 | } VBOXIDTE_TASKGATE;
|
---|
575 | #pragma pack()
|
---|
576 | /** Pointer to IDT Entry, Task gate view. */
|
---|
577 | typedef VBOXIDTE_TASKGATE *PVBOXIDTE_TASKGATE;
|
---|
578 |
|
---|
579 |
|
---|
580 | /** IDT Entry, Intertupt gate view. */
|
---|
581 | #pragma pack(1) /* paranoia */
|
---|
582 | typedef struct VBOXIDTE_INTERRUPTGATE
|
---|
583 | {
|
---|
584 | /** Low offset word. */
|
---|
585 | unsigned u16OffsetLow : 16;
|
---|
586 | /** Segment Selector. */
|
---|
587 | unsigned u16SegSel : 16;
|
---|
588 | /** Reserved. */
|
---|
589 | unsigned u5Reserved2 : 5;
|
---|
590 | /** Fixed value bit 0 - Set to 0. */
|
---|
591 | unsigned u1Fixed0 : 1;
|
---|
592 | /** Fixed value bit 1 - Set to 0. */
|
---|
593 | unsigned u1Fixed1 : 1;
|
---|
594 | /** Fixed value bit 2 - Set to 0. */
|
---|
595 | unsigned u1Fixed2 : 1;
|
---|
596 | /** Fixed value bit 3 - Set to 0. */
|
---|
597 | unsigned u1Fixed3 : 1;
|
---|
598 | /** Fixed value bit 4 - Set to 1. */
|
---|
599 | unsigned u1Fixed4 : 1;
|
---|
600 | /** Fixed value bit 5 - Set to 1. */
|
---|
601 | unsigned u1Fixed5 : 1;
|
---|
602 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
603 | unsigned u132BitGate : 1;
|
---|
604 | /** Fixed value bit 5 - Set to 0. */
|
---|
605 | unsigned u1Fixed6 : 1;
|
---|
606 | /** Descriptor Privilege level. */
|
---|
607 | unsigned u2DPL : 2;
|
---|
608 | /** Present flag. */
|
---|
609 | unsigned u1Present : 1;
|
---|
610 | /** High offset word. */
|
---|
611 | unsigned u16OffsetHigh : 16;
|
---|
612 | } VBOXIDTE_INTERRUPTGATE;
|
---|
613 | #pragma pack()
|
---|
614 | /** Pointer to IDT Entry, Interrupt gate view. */
|
---|
615 | typedef VBOXIDTE_INTERRUPTGATE *PVBOXIDTE_INTERRUPTGATE;
|
---|
616 |
|
---|
617 | /** IDT Entry, Trap Gate view. */
|
---|
618 | #pragma pack(1) /* paranoia */
|
---|
619 | typedef struct VBOXIDTE_TRAPGATE
|
---|
620 | {
|
---|
621 | /** Low offset word. */
|
---|
622 | unsigned u16OffsetLow : 16;
|
---|
623 | /** Segment Selector. */
|
---|
624 | unsigned u16SegSel : 16;
|
---|
625 | /** Reserved. */
|
---|
626 | unsigned u5Reserved2 : 5;
|
---|
627 | /** Fixed value bit 0 - Set to 0. */
|
---|
628 | unsigned u1Fixed0 : 1;
|
---|
629 | /** Fixed value bit 1 - Set to 0. */
|
---|
630 | unsigned u1Fixed1 : 1;
|
---|
631 | /** Fixed value bit 2 - Set to 0. */
|
---|
632 | unsigned u1Fixed2 : 1;
|
---|
633 | /** Fixed value bit 3 - Set to 1. */
|
---|
634 | unsigned u1Fixed3 : 1;
|
---|
635 | /** Fixed value bit 4 - Set to 1. */
|
---|
636 | unsigned u1Fixed4 : 1;
|
---|
637 | /** Fixed value bit 5 - Set to 1. */
|
---|
638 | unsigned u1Fixed5 : 1;
|
---|
639 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
640 | unsigned u132BitGate : 1;
|
---|
641 | /** Fixed value bit 5 - Set to 0. */
|
---|
642 | unsigned u1Fixed6 : 1;
|
---|
643 | /** Descriptor Privilege level. */
|
---|
644 | unsigned u2DPL : 2;
|
---|
645 | /** Present flag. */
|
---|
646 | unsigned u1Present : 1;
|
---|
647 | /** High offset word. */
|
---|
648 | unsigned u16OffsetHigh : 16;
|
---|
649 | } VBOXIDTE_TRAPGATE;
|
---|
650 | #pragma pack()
|
---|
651 | /** Pointer to IDT Entry, Trap Gate view. */
|
---|
652 | typedef VBOXIDTE_TRAPGATE *PVBOXIDTE_TRAPGATE;
|
---|
653 |
|
---|
654 | /** IDT Entry Generic view. */
|
---|
655 | #pragma pack(1) /* paranoia */
|
---|
656 | typedef struct VBOXIDTE_GENERIC
|
---|
657 | {
|
---|
658 | /** Low offset word. */
|
---|
659 | unsigned u16OffsetLow : 16;
|
---|
660 | /** Segment Selector. */
|
---|
661 | unsigned u16SegSel : 16;
|
---|
662 | /** Reserved. */
|
---|
663 | unsigned u5Reserved : 5;
|
---|
664 | /** IDT Type part one (not used for task gate). */
|
---|
665 | unsigned u3Type1 : 3;
|
---|
666 | /** IDT Type part two. */
|
---|
667 | unsigned u5Type2 : 5;
|
---|
668 | /** Descriptor Privilege level. */
|
---|
669 | unsigned u2DPL : 2;
|
---|
670 | /** Present flag. */
|
---|
671 | unsigned u1Present : 1;
|
---|
672 | /** High offset word. */
|
---|
673 | unsigned u16OffsetHigh : 16;
|
---|
674 | } VBOXIDTE_GENERIC;
|
---|
675 | #pragma pack()
|
---|
676 | /** Pointer to IDT Entry Generic view. */
|
---|
677 | typedef VBOXIDTE_GENERIC *PVBOXIDTE_GENERIC;
|
---|
678 |
|
---|
679 | /** IDT Type1 value. (Reserved for task gate!) */
|
---|
680 | #define VBOX_IDTE_TYPE1 0
|
---|
681 | /** IDT Type2 value - Task gate. */
|
---|
682 | #define VBOX_IDTE_TYPE2_TASK 0x5
|
---|
683 | /** IDT Type2 value - 16 bit interrupt gate. */
|
---|
684 | #define VBOX_IDTE_TYPE2_INT_16 0x6
|
---|
685 | /** IDT Type2 value - 32 bit interrupt gate. */
|
---|
686 | #define VBOX_IDTE_TYPE2_INT_32 0xe
|
---|
687 | /** IDT Type2 value - 16 bit trap gate. */
|
---|
688 | #define VBOX_IDTE_TYPE2_TRAP_16 0x7
|
---|
689 | /** IDT Type2 value - 32 bit trap gate. */
|
---|
690 | #define VBOX_IDTE_TYPE2_TRAP_32 0xf
|
---|
691 |
|
---|
692 | /** IDT Entry. */
|
---|
693 | #pragma pack(1) /* paranoia */
|
---|
694 | typedef union VBOXIDTE
|
---|
695 | {
|
---|
696 | /** Task gate view. */
|
---|
697 | VBOXIDTE_TASKGATE Task;
|
---|
698 | /** Trap gate view. */
|
---|
699 | VBOXIDTE_TRAPGATE Trap;
|
---|
700 | /** Interrupt gate view. */
|
---|
701 | VBOXIDTE_INTERRUPTGATE Int;
|
---|
702 | /** Generic IDT view. */
|
---|
703 | VBOXIDTE_GENERIC Gen;
|
---|
704 |
|
---|
705 | /** 8 bit unsigned integer view. */
|
---|
706 | uint8_t au8[8];
|
---|
707 | /** 16 bit unsigned integer view. */
|
---|
708 | uint16_t au16[4];
|
---|
709 | /** 32 bit unsigned integer view. */
|
---|
710 | uint32_t au32[2];
|
---|
711 | /** 64 bit unsigned integer view. */
|
---|
712 | uint64_t au64;
|
---|
713 | } VBOXIDTE;
|
---|
714 | #pragma pack()
|
---|
715 | /** Pointer to IDT Entry. */
|
---|
716 | typedef VBOXIDTE *PVBOXIDTE;
|
---|
717 | /** Pointer to IDT Entry. */
|
---|
718 | typedef VBOXIDTE const *PCVBOXIDTE;
|
---|
719 |
|
---|
720 | /** IDT Entry, 64-bit mode, Intertupt gate view. */
|
---|
721 | #pragma pack(1) /* paranoia */
|
---|
722 | typedef struct VBOXIDTE64_INTERRUPTGATE
|
---|
723 | {
|
---|
724 | /** Low offset word. */
|
---|
725 | unsigned u16OffsetLow : 16;
|
---|
726 | /** Segment Selector. */
|
---|
727 | unsigned u16SegSel : 16;
|
---|
728 | /** Interrupt Stack Table Index. */
|
---|
729 | unsigned u3Ist : 3;
|
---|
730 | /** Fixed value bit 0 - Set to 0. */
|
---|
731 | unsigned u1Fixed0 : 1;
|
---|
732 | /** Fixed value bit 1 - Set to 0. */
|
---|
733 | unsigned u1Fixed1 : 1;
|
---|
734 | /** Fixed value bit 2 - Set to 0. */
|
---|
735 | unsigned u1Fixed2 : 1;
|
---|
736 | /** Fixed value bit 3 - Set to 0. */
|
---|
737 | unsigned u1Fixed3 : 1;
|
---|
738 | /** Fixed value bit 4 - Set to 0. */
|
---|
739 | unsigned u1Fixed4 : 1;
|
---|
740 | /** Fixed value bit 5 - Set to 0. */
|
---|
741 | unsigned u1Fixed5 : 1;
|
---|
742 | /** Fixed value bit 6 - Set to 1. */
|
---|
743 | unsigned u1Fixed6 : 1;
|
---|
744 | /** Fixed value bit 7 - Set to 1. */
|
---|
745 | unsigned u1Fixed7 : 1;
|
---|
746 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
747 | unsigned u132BitGate : 1;
|
---|
748 | /** Fixed value bit 5 - Set to 0. */
|
---|
749 | unsigned u1Fixed8 : 1;
|
---|
750 | /** Descriptor Privilege level. */
|
---|
751 | unsigned u2DPL : 2;
|
---|
752 | /** Present flag. */
|
---|
753 | unsigned u1Present : 1;
|
---|
754 | /** High offset word. */
|
---|
755 | unsigned u16OffsetHigh : 16;
|
---|
756 | /** Offset bits 32..63. */
|
---|
757 | unsigned u32OffsetHigh64;
|
---|
758 | /** Reserved. */
|
---|
759 | unsigned u32Reserved;
|
---|
760 | } VBOXIDTE64_INTERRUPTGATE;
|
---|
761 | #pragma pack()
|
---|
762 | /** Pointer to IDT Entry, 64-bit mode, Interrupt gate view. */
|
---|
763 | typedef VBOXIDTE64_INTERRUPTGATE *PVBOXIDTE64_INTERRUPTGATE;
|
---|
764 |
|
---|
765 | /** IDT Entry, 64-bit mode, Trap gate view. */
|
---|
766 | #pragma pack(1) /* paranoia */
|
---|
767 | typedef struct VBOXIDTE64_TRAPGATE
|
---|
768 | {
|
---|
769 | /** Low offset word. */
|
---|
770 | unsigned u16OffsetLow : 16;
|
---|
771 | /** Segment Selector. */
|
---|
772 | unsigned u16SegSel : 16;
|
---|
773 | /** Interrupt Stack Table Index. */
|
---|
774 | unsigned u3Ist : 3;
|
---|
775 | /** Fixed value bit 0 - Set to 0. */
|
---|
776 | unsigned u1Fixed0 : 1;
|
---|
777 | /** Fixed value bit 1 - Set to 0. */
|
---|
778 | unsigned u1Fixed1 : 1;
|
---|
779 | /** Fixed value bit 2 - Set to 0. */
|
---|
780 | unsigned u1Fixed2 : 1;
|
---|
781 | /** Fixed value bit 3 - Set to 0. */
|
---|
782 | unsigned u1Fixed3 : 1;
|
---|
783 | /** Fixed value bit 4 - Set to 0. */
|
---|
784 | unsigned u1Fixed4 : 1;
|
---|
785 | /** Fixed value bit 5 - Set to 1. */
|
---|
786 | unsigned u1Fixed5 : 1;
|
---|
787 | /** Fixed value bit 6 - Set to 1. */
|
---|
788 | unsigned u1Fixed6 : 1;
|
---|
789 | /** Fixed value bit 7 - Set to 1. */
|
---|
790 | unsigned u1Fixed7 : 1;
|
---|
791 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
792 | unsigned u132BitGate : 1;
|
---|
793 | /** Fixed value bit 5 - Set to 0. */
|
---|
794 | unsigned u1Fixed8 : 1;
|
---|
795 | /** Descriptor Privilege level. */
|
---|
796 | unsigned u2DPL : 2;
|
---|
797 | /** Present flag. */
|
---|
798 | unsigned u1Present : 1;
|
---|
799 | /** High offset word. */
|
---|
800 | unsigned u16OffsetHigh : 16;
|
---|
801 | /** Offset bits 32..63. */
|
---|
802 | unsigned u32OffsetHigh64;
|
---|
803 | /** Reserved. */
|
---|
804 | unsigned u32Reserved;
|
---|
805 | } VBOXIDTE64_TRAPGATE;
|
---|
806 | #pragma pack()
|
---|
807 | /** Pointer to IDT Entry, 64-bit mode, Trap gate view. */
|
---|
808 | typedef VBOXIDTE64_TRAPGATE *PVBOXIDTE64_TRAPGATE;
|
---|
809 |
|
---|
810 | /** IDT Entry, 64-bit mode, Generic view. */
|
---|
811 | #pragma pack(1) /* paranoia */
|
---|
812 | typedef struct VBOXIDTE64_GENERIC
|
---|
813 | {
|
---|
814 | /** Low offset word. */
|
---|
815 | unsigned u16OffsetLow : 16;
|
---|
816 | /** Segment Selector. */
|
---|
817 | unsigned u16SegSel : 16;
|
---|
818 | /** Reserved. */
|
---|
819 | unsigned u3Ist : 3;
|
---|
820 | /** Fixed value bit 0 - Set to 0. */
|
---|
821 | unsigned u1Fixed0 : 1;
|
---|
822 | /** Fixed value bit 1 - Set to 0. */
|
---|
823 | unsigned u1Fixed1 : 1;
|
---|
824 | /** IDT Type part one (not used for task gate). */
|
---|
825 | unsigned u3Type1 : 3;
|
---|
826 | /** IDT Type part two. */
|
---|
827 | unsigned u5Type2 : 5;
|
---|
828 | /** Descriptor Privilege level. */
|
---|
829 | unsigned u2DPL : 2;
|
---|
830 | /** Present flag. */
|
---|
831 | unsigned u1Present : 1;
|
---|
832 | /** High offset word. */
|
---|
833 | unsigned u16OffsetHigh : 16;
|
---|
834 | /** Offset bits 32..63. */
|
---|
835 | unsigned u32OffsetHigh64;
|
---|
836 | /** Reserved. */
|
---|
837 | unsigned u32Reserved;
|
---|
838 | } VBOXIDTE64_GENERIC;
|
---|
839 | #pragma pack()
|
---|
840 | /** Pointer to IDT Entry, 64-bit mode, Generic view. */
|
---|
841 | typedef VBOXIDTE64_GENERIC *PVBOXIDTE64_GENERIC;
|
---|
842 |
|
---|
843 | /** IDT Entry, 64-bit mode. */
|
---|
844 | #pragma pack(1) /* paranoia */
|
---|
845 | typedef union VBOXIDTE64
|
---|
846 | {
|
---|
847 | /** Trap gate view. */
|
---|
848 | VBOXIDTE64_TRAPGATE Trap;
|
---|
849 | /** Interrupt gate view. */
|
---|
850 | VBOXIDTE64_INTERRUPTGATE Int;
|
---|
851 | /** Generic IDT view. */
|
---|
852 | VBOXIDTE64_GENERIC Gen;
|
---|
853 |
|
---|
854 | /** 8 bit unsigned integer view. */
|
---|
855 | uint8_t au8[16];
|
---|
856 | /** 16 bit unsigned integer view. */
|
---|
857 | uint16_t au16[8];
|
---|
858 | /** 32 bit unsigned integer view. */
|
---|
859 | uint32_t au32[4];
|
---|
860 | /** 64 bit unsigned integer view. */
|
---|
861 | uint64_t au64[2];
|
---|
862 | } VBOXIDTE64;
|
---|
863 | #pragma pack()
|
---|
864 | /** Pointer to IDT Entry. */
|
---|
865 | typedef VBOXIDTE64 *PVBOXIDTE64;
|
---|
866 | /** Pointer to IDT Entry. */
|
---|
867 | typedef VBOXIDTE64 const *PCVBOXIDTE64;
|
---|
868 |
|
---|
869 | #pragma pack(1)
|
---|
870 | /** IDTR */
|
---|
871 | typedef struct VBOXIDTR
|
---|
872 | {
|
---|
873 | /** Size of the IDT. */
|
---|
874 | uint16_t cbIdt;
|
---|
875 | /** Address of the IDT. */
|
---|
876 | uint64_t pIdt;
|
---|
877 | } VBOXIDTR, *PVBOXIDTR;
|
---|
878 | #pragma pack()
|
---|
879 |
|
---|
880 |
|
---|
881 | /** @def VBOXIDTE_OFFSET
|
---|
882 | * Return the offset of an IDT entry.
|
---|
883 | */
|
---|
884 | #define VBOXIDTE_OFFSET(desc) \
|
---|
885 | ( ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
|
---|
886 | | ( (desc).Gen.u16OffsetLow ) )
|
---|
887 |
|
---|
888 | /** @def VBOXIDTE64_OFFSET
|
---|
889 | * Return the offset of an IDT entry.
|
---|
890 | */
|
---|
891 | #define VBOXIDTE64_OFFSET(desc) \
|
---|
892 | ( ((uint64_t)((desc).Gen.u32OffsetHigh64) << 32) \
|
---|
893 | | ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
|
---|
894 | | ( (desc).Gen.u16OffsetLow ) )
|
---|
895 |
|
---|
896 | #pragma pack(1)
|
---|
897 | /** GDTR */
|
---|
898 | typedef struct VBOXGDTR
|
---|
899 | {
|
---|
900 | /** Size of the GDT. */
|
---|
901 | uint16_t cbGdt;
|
---|
902 | /** Address of the GDT. */
|
---|
903 | uint64_t pGdt;
|
---|
904 | } VBOXGDTR;
|
---|
905 | #pragma pack()
|
---|
906 | /** Pointer to GDTR. */
|
---|
907 | typedef VBOXGDTR *PVBOXGDTR;
|
---|
908 |
|
---|
909 | /** @} */
|
---|
910 |
|
---|
911 |
|
---|
912 | /**
|
---|
913 | * 32-bit Task Segment used in raw mode.
|
---|
914 | * @todo Move this to SELM! Use X86TSS32 instead.
|
---|
915 | */
|
---|
916 | #pragma pack(1)
|
---|
917 | typedef struct VBOXTSS
|
---|
918 | {
|
---|
919 | /** 0x00 - Back link to previous task. (static) */
|
---|
920 | RTSEL selPrev;
|
---|
921 | uint16_t padding1;
|
---|
922 | /** 0x04 - Ring-0 stack pointer. (static) */
|
---|
923 | uint32_t esp0;
|
---|
924 | /** 0x08 - Ring-0 stack segment. (static) */
|
---|
925 | RTSEL ss0;
|
---|
926 | uint16_t padding_ss0;
|
---|
927 | /** 0x0c - Ring-1 stack pointer. (static) */
|
---|
928 | uint32_t esp1;
|
---|
929 | /** 0x10 - Ring-1 stack segment. (static) */
|
---|
930 | RTSEL ss1;
|
---|
931 | uint16_t padding_ss1;
|
---|
932 | /** 0x14 - Ring-2 stack pointer. (static) */
|
---|
933 | uint32_t esp2;
|
---|
934 | /** 0x18 - Ring-2 stack segment. (static) */
|
---|
935 | RTSEL ss2;
|
---|
936 | uint16_t padding_ss2;
|
---|
937 | /** 0x1c - Page directory for the task. (static) */
|
---|
938 | uint32_t cr3;
|
---|
939 | /** 0x20 - EIP before task switch. */
|
---|
940 | uint32_t eip;
|
---|
941 | /** 0x24 - EFLAGS before task switch. */
|
---|
942 | uint32_t eflags;
|
---|
943 | /** 0x28 - EAX before task switch. */
|
---|
944 | uint32_t eax;
|
---|
945 | /** 0x2c - ECX before task switch. */
|
---|
946 | uint32_t ecx;
|
---|
947 | /** 0x30 - EDX before task switch. */
|
---|
948 | uint32_t edx;
|
---|
949 | /** 0x34 - EBX before task switch. */
|
---|
950 | uint32_t ebx;
|
---|
951 | /** 0x38 - ESP before task switch. */
|
---|
952 | uint32_t esp;
|
---|
953 | /** 0x3c - EBP before task switch. */
|
---|
954 | uint32_t ebp;
|
---|
955 | /** 0x40 - ESI before task switch. */
|
---|
956 | uint32_t esi;
|
---|
957 | /** 0x44 - EDI before task switch. */
|
---|
958 | uint32_t edi;
|
---|
959 | /** 0x48 - ES before task switch. */
|
---|
960 | RTSEL es;
|
---|
961 | uint16_t padding_es;
|
---|
962 | /** 0x4c - CS before task switch. */
|
---|
963 | RTSEL cs;
|
---|
964 | uint16_t padding_cs;
|
---|
965 | /** 0x50 - SS before task switch. */
|
---|
966 | RTSEL ss;
|
---|
967 | uint16_t padding_ss;
|
---|
968 | /** 0x54 - DS before task switch. */
|
---|
969 | RTSEL ds;
|
---|
970 | uint16_t padding_ds;
|
---|
971 | /** 0x58 - FS before task switch. */
|
---|
972 | RTSEL fs;
|
---|
973 | uint16_t padding_fs;
|
---|
974 | /** 0x5c - GS before task switch. */
|
---|
975 | RTSEL gs;
|
---|
976 | uint16_t padding_gs;
|
---|
977 | /** 0x60 - LDTR before task switch. */
|
---|
978 | RTSEL selLdt;
|
---|
979 | uint16_t padding_ldt;
|
---|
980 | /** 0x64 - Debug trap flag */
|
---|
981 | uint16_t fDebugTrap;
|
---|
982 | /** 0x66 - Offset relative to the TSS of the start of the I/O Bitmap
|
---|
983 | * and the end of the interrupt redirection bitmap. */
|
---|
984 | uint16_t offIoBitmap;
|
---|
985 | /** 0x68 - 32 bytes for the virtual interrupt redirection bitmap. (VME) */
|
---|
986 | uint8_t IntRedirBitmap[32];
|
---|
987 | } VBOXTSS;
|
---|
988 | #pragma pack()
|
---|
989 | /** Pointer to task segment. */
|
---|
990 | typedef VBOXTSS *PVBOXTSS;
|
---|
991 | /** Pointer to const task segment. */
|
---|
992 | typedef const VBOXTSS *PCVBOXTSS;
|
---|
993 |
|
---|
994 |
|
---|
995 | /** Pointer to a callback method table provided by the VM API user. */
|
---|
996 | typedef struct VMM2USERMETHODS const *PCVMM2USERMETHODS;
|
---|
997 |
|
---|
998 |
|
---|
999 | /**
|
---|
1000 | * Data transport buffer (scatter/gather)
|
---|
1001 | */
|
---|
1002 | typedef struct PDMDATASEG
|
---|
1003 | {
|
---|
1004 | /** Length of buffer in entry. */
|
---|
1005 | size_t cbSeg;
|
---|
1006 | /** Pointer to the start of the buffer. */
|
---|
1007 | void *pvSeg;
|
---|
1008 | } PDMDATASEG;
|
---|
1009 | /** Pointer to a data transport segment. */
|
---|
1010 | typedef PDMDATASEG *PPDMDATASEG;
|
---|
1011 | /** Pointer to a const data transport segment. */
|
---|
1012 | typedef PDMDATASEG const *PCPDMDATASEG;
|
---|
1013 |
|
---|
1014 |
|
---|
1015 | /**
|
---|
1016 | * Forms of generic segment offloading.
|
---|
1017 | */
|
---|
1018 | typedef enum PDMNETWORKGSOTYPE
|
---|
1019 | {
|
---|
1020 | /** Invalid zero value. */
|
---|
1021 | PDMNETWORKGSOTYPE_INVALID = 0,
|
---|
1022 | /** TCP/IPv4 - no CWR/ECE encoding. */
|
---|
1023 | PDMNETWORKGSOTYPE_IPV4_TCP,
|
---|
1024 | /** TCP/IPv6 - no CWR/ECE encoding. */
|
---|
1025 | PDMNETWORKGSOTYPE_IPV6_TCP,
|
---|
1026 | /** UDP/IPv4. */
|
---|
1027 | PDMNETWORKGSOTYPE_IPV4_UDP,
|
---|
1028 | /** UDP/IPv6. */
|
---|
1029 | PDMNETWORKGSOTYPE_IPV6_UDP,
|
---|
1030 | /** TCP/IPv6 over IPv4 tunneling - no CWR/ECE encoding.
|
---|
1031 | * The header offsets and sizes relates to IPv4 and TCP, the IPv6 header is
|
---|
1032 | * figured out as needed.
|
---|
1033 | * @todo Needs checking against facts, this is just an outline of the idea. */
|
---|
1034 | PDMNETWORKGSOTYPE_IPV4_IPV6_TCP,
|
---|
1035 | /** UDP/IPv6 over IPv4 tunneling.
|
---|
1036 | * The header offsets and sizes relates to IPv4 and UDP, the IPv6 header is
|
---|
1037 | * figured out as needed.
|
---|
1038 | * @todo Needs checking against facts, this is just an outline of the idea. */
|
---|
1039 | PDMNETWORKGSOTYPE_IPV4_IPV6_UDP,
|
---|
1040 | /** The end of valid GSO types. */
|
---|
1041 | PDMNETWORKGSOTYPE_END
|
---|
1042 | } PDMNETWORKGSOTYPE;
|
---|
1043 |
|
---|
1044 |
|
---|
1045 | /**
|
---|
1046 | * Generic segment offloading context.
|
---|
1047 | *
|
---|
1048 | * We generally follow the E1000 specs wrt to which header fields we change.
|
---|
1049 | * However the GSO type implies where the checksum fields are and that they are
|
---|
1050 | * always updated from scratch (no half done pseudo checksums).
|
---|
1051 | *
|
---|
1052 | * @remarks This is part of the internal network GSO packets. Take great care
|
---|
1053 | * when making changes. The size is expected to be exactly 8 bytes.
|
---|
1054 | *
|
---|
1055 | * @ingroup grp_pdm
|
---|
1056 | */
|
---|
1057 | typedef struct PDMNETWORKGSO
|
---|
1058 | {
|
---|
1059 | /** The type of segmentation offloading we're performing (PDMNETWORKGSOTYPE). */
|
---|
1060 | uint8_t u8Type;
|
---|
1061 | /** The total header size. */
|
---|
1062 | uint8_t cbHdrsTotal;
|
---|
1063 | /** The max segment size (MSS) to apply. */
|
---|
1064 | uint16_t cbMaxSeg;
|
---|
1065 |
|
---|
1066 | /** Offset of the first header (IPv4 / IPv6). 0 if not not needed. */
|
---|
1067 | uint8_t offHdr1;
|
---|
1068 | /** Offset of the second header (TCP / UDP). 0 if not not needed. */
|
---|
1069 | uint8_t offHdr2;
|
---|
1070 | /** The header size used for segmentation (equal to offHdr2 in UFO). */
|
---|
1071 | uint8_t cbHdrsSeg;
|
---|
1072 | /** Unused. */
|
---|
1073 | uint8_t u8Unused;
|
---|
1074 | } PDMNETWORKGSO;
|
---|
1075 | /** Pointer to a GSO context.
|
---|
1076 | * @ingroup grp_pdm */
|
---|
1077 | typedef PDMNETWORKGSO *PPDMNETWORKGSO;
|
---|
1078 | /** Pointer to a const GSO context.
|
---|
1079 | * @ingroup grp_pdm */
|
---|
1080 | typedef PDMNETWORKGSO const *PCPDMNETWORKGSO;
|
---|
1081 |
|
---|
1082 | /** Pointer to a PDM filter handle.
|
---|
1083 | * @ingroup grp_pdm_net_shaper */
|
---|
1084 | typedef struct PDMNSFILTER *PPDMNSFILTER;
|
---|
1085 | /** Pointer to a network shaper.
|
---|
1086 | * @ingroup grp_pdm_net_shaper */
|
---|
1087 | typedef struct PDMNETSHAPER *PPDMNETSHAPER;
|
---|
1088 |
|
---|
1089 |
|
---|
1090 | /**
|
---|
1091 | * The current ROM page protection.
|
---|
1092 | *
|
---|
1093 | * @remarks This is part of the saved state.
|
---|
1094 | * @ingroup grp_pgm
|
---|
1095 | */
|
---|
1096 | typedef enum PGMROMPROT
|
---|
1097 | {
|
---|
1098 | /** The customary invalid value. */
|
---|
1099 | PGMROMPROT_INVALID = 0,
|
---|
1100 | /** Read from the virgin ROM page, ignore writes.
|
---|
1101 | * Map the virgin page, use write access handler to ignore writes. */
|
---|
1102 | PGMROMPROT_READ_ROM_WRITE_IGNORE,
|
---|
1103 | /** Read from the virgin ROM page, write to the shadow RAM.
|
---|
1104 | * Map the virgin page, use write access handler to change the shadow RAM. */
|
---|
1105 | PGMROMPROT_READ_ROM_WRITE_RAM,
|
---|
1106 | /** Read from the shadow ROM page, ignore writes.
|
---|
1107 | * Map the shadow page read-only, use write access handler to ignore writes. */
|
---|
1108 | PGMROMPROT_READ_RAM_WRITE_IGNORE,
|
---|
1109 | /** Read from the shadow ROM page, ignore writes.
|
---|
1110 | * Map the shadow page read-write, disabled write access handler. */
|
---|
1111 | PGMROMPROT_READ_RAM_WRITE_RAM,
|
---|
1112 | /** The end of valid values. */
|
---|
1113 | PGMROMPROT_END,
|
---|
1114 | /** The usual 32-bit type size hack. */
|
---|
1115 | PGMROMPROT_32BIT_HACK = 0x7fffffff
|
---|
1116 | } PGMROMPROT;
|
---|
1117 |
|
---|
1118 |
|
---|
1119 | /**
|
---|
1120 | * Page mapping lock.
|
---|
1121 | * @ingroup grp_pgm
|
---|
1122 | */
|
---|
1123 | typedef struct PGMPAGEMAPLOCK
|
---|
1124 | {
|
---|
1125 | #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
|
---|
1126 | /** The locked page. */
|
---|
1127 | void *pvPage;
|
---|
1128 | /** Pointer to the CPU that made the mapping.
|
---|
1129 | * In ring-0 and raw-mode context we don't intend to ever allow long term
|
---|
1130 | * locking and this is a way of making sure we're still on the same CPU. */
|
---|
1131 | PVMCPU pVCpu;
|
---|
1132 | #else
|
---|
1133 | /** Pointer to the PGMPAGE and lock type.
|
---|
1134 | * bit-0 abuse: set=write, clear=read. */
|
---|
1135 | uintptr_t uPageAndType;
|
---|
1136 | /** Read lock type value. */
|
---|
1137 | # define PGMPAGEMAPLOCK_TYPE_READ ((uintptr_t)0)
|
---|
1138 | /** Write lock type value. */
|
---|
1139 | # define PGMPAGEMAPLOCK_TYPE_WRITE ((uintptr_t)1)
|
---|
1140 | /** Lock type mask. */
|
---|
1141 | # define PGMPAGEMAPLOCK_TYPE_MASK ((uintptr_t)1)
|
---|
1142 | /** Pointer to the PGMCHUNKR3MAP. */
|
---|
1143 | void *pvMap;
|
---|
1144 | #endif
|
---|
1145 | } PGMPAGEMAPLOCK;
|
---|
1146 | /** Pointer to a page mapping lock.
|
---|
1147 | * @ingroup grp_pgm */
|
---|
1148 | typedef PGMPAGEMAPLOCK *PPGMPAGEMAPLOCK;
|
---|
1149 |
|
---|
1150 |
|
---|
1151 | /** Pointer to a info helper callback structure. */
|
---|
1152 | typedef struct DBGFINFOHLP *PDBGFINFOHLP;
|
---|
1153 | /** Pointer to a const info helper callback structure. */
|
---|
1154 | typedef const struct DBGFINFOHLP *PCDBGFINFOHLP;
|
---|
1155 |
|
---|
1156 | /** Pointer to a const register descriptor. */
|
---|
1157 | typedef struct DBGFREGDESC const *PCDBGFREGDESC;
|
---|
1158 |
|
---|
1159 |
|
---|
1160 | /** Configuration manager tree node - A key. */
|
---|
1161 | typedef struct CFGMNODE *PCFGMNODE;
|
---|
1162 |
|
---|
1163 | /** Configuration manager tree leaf - A value. */
|
---|
1164 | typedef struct CFGMLEAF *PCFGMLEAF;
|
---|
1165 |
|
---|
1166 |
|
---|
1167 | /**
|
---|
1168 | * CPU modes.
|
---|
1169 | */
|
---|
1170 | typedef enum CPUMMODE
|
---|
1171 | {
|
---|
1172 | /** The usual invalid zero entry. */
|
---|
1173 | CPUMMODE_INVALID = 0,
|
---|
1174 | /** Real mode. */
|
---|
1175 | CPUMMODE_REAL,
|
---|
1176 | /** Protected mode (32-bit). */
|
---|
1177 | CPUMMODE_PROTECTED,
|
---|
1178 | /** Long mode (64-bit). */
|
---|
1179 | CPUMMODE_LONG
|
---|
1180 | } CPUMMODE;
|
---|
1181 |
|
---|
1182 |
|
---|
1183 | /**
|
---|
1184 | * CPU mode flags (DISSTATE::mode).
|
---|
1185 | */
|
---|
1186 | typedef enum DISCPUMODE
|
---|
1187 | {
|
---|
1188 | DISCPUMODE_INVALID = 0,
|
---|
1189 | DISCPUMODE_16BIT,
|
---|
1190 | DISCPUMODE_32BIT,
|
---|
1191 | DISCPUMODE_64BIT,
|
---|
1192 | /** hack forcing the size of the enum to 32-bits. */
|
---|
1193 | DISCPUMODE_MAKE_32BIT_HACK = 0x7fffffff
|
---|
1194 | } DISCPUMODE;
|
---|
1195 |
|
---|
1196 | /** Pointer to the disassembler state. */
|
---|
1197 | typedef struct DISSTATE *PDISSTATE;
|
---|
1198 | /** Pointer to a const disassembler state. */
|
---|
1199 | typedef struct DISSTATE const *PCDISSTATE;
|
---|
1200 |
|
---|
1201 | /** @deprecated PDISSTATE and change pCpu and pDisState to pDis. */
|
---|
1202 | typedef PDISSTATE PDISCPUSTATE;
|
---|
1203 | /** @deprecated PCDISSTATE and change pCpu and pDisState to pDis. */
|
---|
1204 | typedef PCDISSTATE PCDISCPUSTATE;
|
---|
1205 |
|
---|
1206 |
|
---|
1207 | /**
|
---|
1208 | * Shared region description (needed by GMM and others, thus global).
|
---|
1209 | * @ingroup grp_vmmdev
|
---|
1210 | */
|
---|
1211 | typedef struct VMMDEVSHAREDREGIONDESC
|
---|
1212 | {
|
---|
1213 | RTGCPTR64 GCRegionAddr;
|
---|
1214 | uint32_t cbRegion;
|
---|
1215 | uint32_t u32Alignment;
|
---|
1216 | } VMMDEVSHAREDREGIONDESC;
|
---|
1217 |
|
---|
1218 |
|
---|
1219 | /**
|
---|
1220 | * A PCI bus:device:function (BDF) identifier.
|
---|
1221 | *
|
---|
1222 | * All 16 bits of a BDF are valid according to the PCI spec. We need one extra bit
|
---|
1223 | * to determine whether the BDF is valid in interfaces where the BDF may be
|
---|
1224 | * optional.
|
---|
1225 | */
|
---|
1226 | typedef uint32_t PCIBDF;
|
---|
1227 | /** PCIBDF flag: Invalid. */
|
---|
1228 | #define PCI_BDF_F_INVALID RT_BIT(31)
|
---|
1229 | /** Nil PCIBDF value. */
|
---|
1230 | #define NIL_PCIBDF PCI_BDF_F_INVALID
|
---|
1231 |
|
---|
1232 | /** Pointer to an MSI message struct. */
|
---|
1233 | typedef struct MSIMSG *PMSIMSG;
|
---|
1234 | /** Pointer to a const MSI message struct. */
|
---|
1235 | typedef const struct MSIMSG *PCMSIMSG;
|
---|
1236 |
|
---|
1237 |
|
---|
1238 | /** @} */
|
---|
1239 |
|
---|
1240 | #endif /* !VBOX_INCLUDED_types_h */
|
---|