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