1 | /** @file
|
---|
2 | * VirtualBox - Types.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2019 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 | #if defined(IN_RING0) && defined(VBOX_BUGREF_9217_PART_I)
|
---|
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 | #if defined(IN_RING0) && defined(VBOX_BUGREF_9217_PART_I)
|
---|
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 | #if defined(IN_RING0) && defined(VBOX_BUGREF_9217_PART_I)
|
---|
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 | #if defined(IN_RING0) && defined(VBOX_BUGREF_9217_PART_I)
|
---|
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 | /** Pointer to a PDM Base Interface. */
|
---|
368 | typedef struct PDMIBASE *PPDMIBASE;
|
---|
369 | /** Pointer to a pointer to a PDM Base Interface. */
|
---|
370 | typedef PPDMIBASE *PPPDMIBASE;
|
---|
371 |
|
---|
372 | /** Pointer to a PDM Device Instance. */
|
---|
373 | typedef struct PDMDEVINS *PPDMDEVINS;
|
---|
374 | /** Pointer to a pointer to a PDM Device Instance. */
|
---|
375 | typedef PPDMDEVINS *PPPDMDEVINS;
|
---|
376 | /** R3 pointer to a PDM Device Instance. */
|
---|
377 | typedef R3PTRTYPE(PPDMDEVINS) PPDMDEVINSR3;
|
---|
378 | /** R0 pointer to a PDM Device Instance. */
|
---|
379 | typedef R0PTRTYPE(PPDMDEVINS) PPDMDEVINSR0;
|
---|
380 | /** RC pointer to a PDM Device Instance. */
|
---|
381 | typedef RCPTRTYPE(PPDMDEVINS) PPDMDEVINSRC;
|
---|
382 |
|
---|
383 | /** Pointer to a PDM PCI device structure. */
|
---|
384 | typedef struct PDMPCIDEV *PPDMPCIDEV;
|
---|
385 |
|
---|
386 | /** Pointer to a PDM USB Device Instance. */
|
---|
387 | typedef struct PDMUSBINS *PPDMUSBINS;
|
---|
388 | /** Pointer to a pointer to a PDM USB Device Instance. */
|
---|
389 | typedef PPDMUSBINS *PPPDMUSBINS;
|
---|
390 |
|
---|
391 | /** Pointer to a PDM Driver Instance. */
|
---|
392 | typedef struct PDMDRVINS *PPDMDRVINS;
|
---|
393 | /** Pointer to a pointer to a PDM Driver Instance. */
|
---|
394 | typedef PPDMDRVINS *PPPDMDRVINS;
|
---|
395 | /** R3 pointer to a PDM Driver Instance. */
|
---|
396 | typedef R3PTRTYPE(PPDMDRVINS) PPDMDRVINSR3;
|
---|
397 | /** R0 pointer to a PDM Driver Instance. */
|
---|
398 | typedef R0PTRTYPE(PPDMDRVINS) PPDMDRVINSR0;
|
---|
399 | /** RC pointer to a PDM Driver Instance. */
|
---|
400 | typedef RCPTRTYPE(PPDMDRVINS) PPDMDRVINSRC;
|
---|
401 |
|
---|
402 | /** Pointer to a PDM Service Instance. */
|
---|
403 | typedef struct PDMSRVINS *PPDMSRVINS;
|
---|
404 | /** Pointer to a pointer to a PDM Service Instance. */
|
---|
405 | typedef PPDMSRVINS *PPPDMSRVINS;
|
---|
406 |
|
---|
407 | /** Pointer to a PDM critical section. */
|
---|
408 | typedef union PDMCRITSECT *PPDMCRITSECT;
|
---|
409 | /** Pointer to a const PDM critical section. */
|
---|
410 | typedef const union PDMCRITSECT *PCPDMCRITSECT;
|
---|
411 |
|
---|
412 | /** Pointer to a PDM read/write critical section. */
|
---|
413 | typedef union PDMCRITSECTRW *PPDMCRITSECTRW;
|
---|
414 | /** Pointer to a const PDM read/write critical section. */
|
---|
415 | typedef union PDMCRITSECTRW const *PCPDMCRITSECTRW;
|
---|
416 |
|
---|
417 | /** R3 pointer to a timer. */
|
---|
418 | typedef R3PTRTYPE(struct TMTIMER *) PTMTIMERR3;
|
---|
419 | /** Pointer to a R3 pointer to a timer. */
|
---|
420 | typedef PTMTIMERR3 *PPTMTIMERR3;
|
---|
421 |
|
---|
422 | /** R0 pointer to a timer. */
|
---|
423 | typedef R0PTRTYPE(struct TMTIMER *) PTMTIMERR0;
|
---|
424 | /** Pointer to a R3 pointer to a timer. */
|
---|
425 | typedef PTMTIMERR0 *PPTMTIMERR0;
|
---|
426 |
|
---|
427 | /** RC pointer to a timer. */
|
---|
428 | typedef RCPTRTYPE(struct TMTIMER *) PTMTIMERRC;
|
---|
429 | /** Pointer to a RC pointer to a timer. */
|
---|
430 | typedef PTMTIMERRC *PPTMTIMERRC;
|
---|
431 |
|
---|
432 | /** Pointer to a timer. */
|
---|
433 | typedef CTX_SUFF(PTMTIMER) PTMTIMER;
|
---|
434 | /** Pointer to a pointer to a timer. */
|
---|
435 | typedef PTMTIMER *PPTMTIMER;
|
---|
436 |
|
---|
437 | /** SSM Operation handle. */
|
---|
438 | typedef struct SSMHANDLE *PSSMHANDLE;
|
---|
439 | /** Pointer to a const SSM stream method table. */
|
---|
440 | typedef struct SSMSTRMOPS const *PCSSMSTRMOPS;
|
---|
441 |
|
---|
442 | /** Pointer to a CPUMCTX. */
|
---|
443 | typedef struct CPUMCTX *PCPUMCTX;
|
---|
444 | /** Pointer to a const CPUMCTX. */
|
---|
445 | typedef const struct CPUMCTX *PCCPUMCTX;
|
---|
446 |
|
---|
447 | /** Pointer to a CPU context core. */
|
---|
448 | typedef struct CPUMCTXCORE *PCPUMCTXCORE;
|
---|
449 | /** Pointer to a const CPU context core. */
|
---|
450 | typedef const struct CPUMCTXCORE *PCCPUMCTXCORE;
|
---|
451 |
|
---|
452 | /** Pointer to a selector register. */
|
---|
453 | typedef struct CPUMSELREG *PCPUMSELREG;
|
---|
454 | /** Pointer to a const selector register. */
|
---|
455 | typedef const struct CPUMSELREG *PCCPUMSELREG;
|
---|
456 |
|
---|
457 | /** Pointer to selector hidden registers.
|
---|
458 | * @deprecated Replaced by PCPUMSELREG */
|
---|
459 | typedef struct CPUMSELREG *PCPUMSELREGHID;
|
---|
460 | /** Pointer to const selector hidden registers.
|
---|
461 | * @deprecated Replaced by PCCPUMSELREG */
|
---|
462 | typedef const struct CPUMSELREG *PCCPUMSELREGHID;
|
---|
463 |
|
---|
464 | /** @} */
|
---|
465 |
|
---|
466 |
|
---|
467 | /** @defgroup grp_types_idt Interrupt Descriptor Table Entry.
|
---|
468 | * @todo This all belongs in x86.h!
|
---|
469 | * @{ */
|
---|
470 |
|
---|
471 | /** @todo VBOXIDT -> VBOXDESCIDT, skip the complex variations. We'll never use them. */
|
---|
472 |
|
---|
473 | /** IDT Entry, Task Gate view. */
|
---|
474 | #pragma pack(1) /* paranoia */
|
---|
475 | typedef struct VBOXIDTE_TASKGATE
|
---|
476 | {
|
---|
477 | /** Reserved. */
|
---|
478 | unsigned u16Reserved1 : 16;
|
---|
479 | /** Task Segment Selector. */
|
---|
480 | unsigned u16TSS : 16;
|
---|
481 | /** More reserved. */
|
---|
482 | unsigned u8Reserved2 : 8;
|
---|
483 | /** Fixed value bit 0 - Set to 1. */
|
---|
484 | unsigned u1Fixed0 : 1;
|
---|
485 | /** Busy bit. */
|
---|
486 | unsigned u1Busy : 1;
|
---|
487 | /** Fixed value bit 2 - Set to 1. */
|
---|
488 | unsigned u1Fixed1 : 1;
|
---|
489 | /** Fixed value bit 3 - Set to 0. */
|
---|
490 | unsigned u1Fixed2 : 1;
|
---|
491 | /** Fixed value bit 4 - Set to 0. */
|
---|
492 | unsigned u1Fixed3 : 1;
|
---|
493 | /** Descriptor Privilege level. */
|
---|
494 | unsigned u2DPL : 2;
|
---|
495 | /** Present flag. */
|
---|
496 | unsigned u1Present : 1;
|
---|
497 | /** Reserved. */
|
---|
498 | unsigned u16Reserved3 : 16;
|
---|
499 | } VBOXIDTE_TASKGATE;
|
---|
500 | #pragma pack()
|
---|
501 | /** Pointer to IDT Entry, Task gate view. */
|
---|
502 | typedef VBOXIDTE_TASKGATE *PVBOXIDTE_TASKGATE;
|
---|
503 |
|
---|
504 |
|
---|
505 | /** IDT Entry, Intertupt gate view. */
|
---|
506 | #pragma pack(1) /* paranoia */
|
---|
507 | typedef struct VBOXIDTE_INTERRUPTGATE
|
---|
508 | {
|
---|
509 | /** Low offset word. */
|
---|
510 | unsigned u16OffsetLow : 16;
|
---|
511 | /** Segment Selector. */
|
---|
512 | unsigned u16SegSel : 16;
|
---|
513 | /** Reserved. */
|
---|
514 | unsigned u5Reserved2 : 5;
|
---|
515 | /** Fixed value bit 0 - Set to 0. */
|
---|
516 | unsigned u1Fixed0 : 1;
|
---|
517 | /** Fixed value bit 1 - Set to 0. */
|
---|
518 | unsigned u1Fixed1 : 1;
|
---|
519 | /** Fixed value bit 2 - Set to 0. */
|
---|
520 | unsigned u1Fixed2 : 1;
|
---|
521 | /** Fixed value bit 3 - Set to 0. */
|
---|
522 | unsigned u1Fixed3 : 1;
|
---|
523 | /** Fixed value bit 4 - Set to 1. */
|
---|
524 | unsigned u1Fixed4 : 1;
|
---|
525 | /** Fixed value bit 5 - Set to 1. */
|
---|
526 | unsigned u1Fixed5 : 1;
|
---|
527 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
528 | unsigned u132BitGate : 1;
|
---|
529 | /** Fixed value bit 5 - Set to 0. */
|
---|
530 | unsigned u1Fixed6 : 1;
|
---|
531 | /** Descriptor Privilege level. */
|
---|
532 | unsigned u2DPL : 2;
|
---|
533 | /** Present flag. */
|
---|
534 | unsigned u1Present : 1;
|
---|
535 | /** High offset word. */
|
---|
536 | unsigned u16OffsetHigh : 16;
|
---|
537 | } VBOXIDTE_INTERRUPTGATE;
|
---|
538 | #pragma pack()
|
---|
539 | /** Pointer to IDT Entry, Interrupt gate view. */
|
---|
540 | typedef VBOXIDTE_INTERRUPTGATE *PVBOXIDTE_INTERRUPTGATE;
|
---|
541 |
|
---|
542 | /** IDT Entry, Trap Gate view. */
|
---|
543 | #pragma pack(1) /* paranoia */
|
---|
544 | typedef struct VBOXIDTE_TRAPGATE
|
---|
545 | {
|
---|
546 | /** Low offset word. */
|
---|
547 | unsigned u16OffsetLow : 16;
|
---|
548 | /** Segment Selector. */
|
---|
549 | unsigned u16SegSel : 16;
|
---|
550 | /** Reserved. */
|
---|
551 | unsigned u5Reserved2 : 5;
|
---|
552 | /** Fixed value bit 0 - Set to 0. */
|
---|
553 | unsigned u1Fixed0 : 1;
|
---|
554 | /** Fixed value bit 1 - Set to 0. */
|
---|
555 | unsigned u1Fixed1 : 1;
|
---|
556 | /** Fixed value bit 2 - Set to 0. */
|
---|
557 | unsigned u1Fixed2 : 1;
|
---|
558 | /** Fixed value bit 3 - Set to 1. */
|
---|
559 | unsigned u1Fixed3 : 1;
|
---|
560 | /** Fixed value bit 4 - Set to 1. */
|
---|
561 | unsigned u1Fixed4 : 1;
|
---|
562 | /** Fixed value bit 5 - Set to 1. */
|
---|
563 | unsigned u1Fixed5 : 1;
|
---|
564 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
565 | unsigned u132BitGate : 1;
|
---|
566 | /** Fixed value bit 5 - Set to 0. */
|
---|
567 | unsigned u1Fixed6 : 1;
|
---|
568 | /** Descriptor Privilege level. */
|
---|
569 | unsigned u2DPL : 2;
|
---|
570 | /** Present flag. */
|
---|
571 | unsigned u1Present : 1;
|
---|
572 | /** High offset word. */
|
---|
573 | unsigned u16OffsetHigh : 16;
|
---|
574 | } VBOXIDTE_TRAPGATE;
|
---|
575 | #pragma pack()
|
---|
576 | /** Pointer to IDT Entry, Trap Gate view. */
|
---|
577 | typedef VBOXIDTE_TRAPGATE *PVBOXIDTE_TRAPGATE;
|
---|
578 |
|
---|
579 | /** IDT Entry Generic view. */
|
---|
580 | #pragma pack(1) /* paranoia */
|
---|
581 | typedef struct VBOXIDTE_GENERIC
|
---|
582 | {
|
---|
583 | /** Low offset word. */
|
---|
584 | unsigned u16OffsetLow : 16;
|
---|
585 | /** Segment Selector. */
|
---|
586 | unsigned u16SegSel : 16;
|
---|
587 | /** Reserved. */
|
---|
588 | unsigned u5Reserved : 5;
|
---|
589 | /** IDT Type part one (not used for task gate). */
|
---|
590 | unsigned u3Type1 : 3;
|
---|
591 | /** IDT Type part two. */
|
---|
592 | unsigned u5Type2 : 5;
|
---|
593 | /** Descriptor Privilege level. */
|
---|
594 | unsigned u2DPL : 2;
|
---|
595 | /** Present flag. */
|
---|
596 | unsigned u1Present : 1;
|
---|
597 | /** High offset word. */
|
---|
598 | unsigned u16OffsetHigh : 16;
|
---|
599 | } VBOXIDTE_GENERIC;
|
---|
600 | #pragma pack()
|
---|
601 | /** Pointer to IDT Entry Generic view. */
|
---|
602 | typedef VBOXIDTE_GENERIC *PVBOXIDTE_GENERIC;
|
---|
603 |
|
---|
604 | /** IDT Type1 value. (Reserved for task gate!) */
|
---|
605 | #define VBOX_IDTE_TYPE1 0
|
---|
606 | /** IDT Type2 value - Task gate. */
|
---|
607 | #define VBOX_IDTE_TYPE2_TASK 0x5
|
---|
608 | /** IDT Type2 value - 16 bit interrupt gate. */
|
---|
609 | #define VBOX_IDTE_TYPE2_INT_16 0x6
|
---|
610 | /** IDT Type2 value - 32 bit interrupt gate. */
|
---|
611 | #define VBOX_IDTE_TYPE2_INT_32 0xe
|
---|
612 | /** IDT Type2 value - 16 bit trap gate. */
|
---|
613 | #define VBOX_IDTE_TYPE2_TRAP_16 0x7
|
---|
614 | /** IDT Type2 value - 32 bit trap gate. */
|
---|
615 | #define VBOX_IDTE_TYPE2_TRAP_32 0xf
|
---|
616 |
|
---|
617 | /** IDT Entry. */
|
---|
618 | #pragma pack(1) /* paranoia */
|
---|
619 | typedef union VBOXIDTE
|
---|
620 | {
|
---|
621 | /** Task gate view. */
|
---|
622 | VBOXIDTE_TASKGATE Task;
|
---|
623 | /** Trap gate view. */
|
---|
624 | VBOXIDTE_TRAPGATE Trap;
|
---|
625 | /** Interrupt gate view. */
|
---|
626 | VBOXIDTE_INTERRUPTGATE Int;
|
---|
627 | /** Generic IDT view. */
|
---|
628 | VBOXIDTE_GENERIC Gen;
|
---|
629 |
|
---|
630 | /** 8 bit unsigned integer view. */
|
---|
631 | uint8_t au8[8];
|
---|
632 | /** 16 bit unsigned integer view. */
|
---|
633 | uint16_t au16[4];
|
---|
634 | /** 32 bit unsigned integer view. */
|
---|
635 | uint32_t au32[2];
|
---|
636 | /** 64 bit unsigned integer view. */
|
---|
637 | uint64_t au64;
|
---|
638 | } VBOXIDTE;
|
---|
639 | #pragma pack()
|
---|
640 | /** Pointer to IDT Entry. */
|
---|
641 | typedef VBOXIDTE *PVBOXIDTE;
|
---|
642 | /** Pointer to IDT Entry. */
|
---|
643 | typedef VBOXIDTE const *PCVBOXIDTE;
|
---|
644 |
|
---|
645 | /** IDT Entry, 64-bit mode, Intertupt gate view. */
|
---|
646 | #pragma pack(1) /* paranoia */
|
---|
647 | typedef struct VBOXIDTE64_INTERRUPTGATE
|
---|
648 | {
|
---|
649 | /** Low offset word. */
|
---|
650 | unsigned u16OffsetLow : 16;
|
---|
651 | /** Segment Selector. */
|
---|
652 | unsigned u16SegSel : 16;
|
---|
653 | /** Interrupt Stack Table Index. */
|
---|
654 | unsigned u3Ist : 3;
|
---|
655 | /** Fixed value bit 0 - Set to 0. */
|
---|
656 | unsigned u1Fixed0 : 1;
|
---|
657 | /** Fixed value bit 1 - Set to 0. */
|
---|
658 | unsigned u1Fixed1 : 1;
|
---|
659 | /** Fixed value bit 2 - Set to 0. */
|
---|
660 | unsigned u1Fixed2 : 1;
|
---|
661 | /** Fixed value bit 3 - Set to 0. */
|
---|
662 | unsigned u1Fixed3 : 1;
|
---|
663 | /** Fixed value bit 4 - Set to 0. */
|
---|
664 | unsigned u1Fixed4 : 1;
|
---|
665 | /** Fixed value bit 5 - Set to 0. */
|
---|
666 | unsigned u1Fixed5 : 1;
|
---|
667 | /** Fixed value bit 6 - Set to 1. */
|
---|
668 | unsigned u1Fixed6 : 1;
|
---|
669 | /** Fixed value bit 7 - Set to 1. */
|
---|
670 | unsigned u1Fixed7 : 1;
|
---|
671 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
672 | unsigned u132BitGate : 1;
|
---|
673 | /** Fixed value bit 5 - Set to 0. */
|
---|
674 | unsigned u1Fixed8 : 1;
|
---|
675 | /** Descriptor Privilege level. */
|
---|
676 | unsigned u2DPL : 2;
|
---|
677 | /** Present flag. */
|
---|
678 | unsigned u1Present : 1;
|
---|
679 | /** High offset word. */
|
---|
680 | unsigned u16OffsetHigh : 16;
|
---|
681 | /** Offset bits 32..63. */
|
---|
682 | unsigned u32OffsetHigh64;
|
---|
683 | /** Reserved. */
|
---|
684 | unsigned u32Reserved;
|
---|
685 | } VBOXIDTE64_INTERRUPTGATE;
|
---|
686 | #pragma pack()
|
---|
687 | /** Pointer to IDT Entry, 64-bit mode, Interrupt gate view. */
|
---|
688 | typedef VBOXIDTE64_INTERRUPTGATE *PVBOXIDTE64_INTERRUPTGATE;
|
---|
689 |
|
---|
690 | /** IDT Entry, 64-bit mode, Trap gate view. */
|
---|
691 | #pragma pack(1) /* paranoia */
|
---|
692 | typedef struct VBOXIDTE64_TRAPGATE
|
---|
693 | {
|
---|
694 | /** Low offset word. */
|
---|
695 | unsigned u16OffsetLow : 16;
|
---|
696 | /** Segment Selector. */
|
---|
697 | unsigned u16SegSel : 16;
|
---|
698 | /** Interrupt Stack Table Index. */
|
---|
699 | unsigned u3Ist : 3;
|
---|
700 | /** Fixed value bit 0 - Set to 0. */
|
---|
701 | unsigned u1Fixed0 : 1;
|
---|
702 | /** Fixed value bit 1 - Set to 0. */
|
---|
703 | unsigned u1Fixed1 : 1;
|
---|
704 | /** Fixed value bit 2 - Set to 0. */
|
---|
705 | unsigned u1Fixed2 : 1;
|
---|
706 | /** Fixed value bit 3 - Set to 0. */
|
---|
707 | unsigned u1Fixed3 : 1;
|
---|
708 | /** Fixed value bit 4 - Set to 0. */
|
---|
709 | unsigned u1Fixed4 : 1;
|
---|
710 | /** Fixed value bit 5 - Set to 1. */
|
---|
711 | unsigned u1Fixed5 : 1;
|
---|
712 | /** Fixed value bit 6 - Set to 1. */
|
---|
713 | unsigned u1Fixed6 : 1;
|
---|
714 | /** Fixed value bit 7 - Set to 1. */
|
---|
715 | unsigned u1Fixed7 : 1;
|
---|
716 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
717 | unsigned u132BitGate : 1;
|
---|
718 | /** Fixed value bit 5 - Set to 0. */
|
---|
719 | unsigned u1Fixed8 : 1;
|
---|
720 | /** Descriptor Privilege level. */
|
---|
721 | unsigned u2DPL : 2;
|
---|
722 | /** Present flag. */
|
---|
723 | unsigned u1Present : 1;
|
---|
724 | /** High offset word. */
|
---|
725 | unsigned u16OffsetHigh : 16;
|
---|
726 | /** Offset bits 32..63. */
|
---|
727 | unsigned u32OffsetHigh64;
|
---|
728 | /** Reserved. */
|
---|
729 | unsigned u32Reserved;
|
---|
730 | } VBOXIDTE64_TRAPGATE;
|
---|
731 | #pragma pack()
|
---|
732 | /** Pointer to IDT Entry, 64-bit mode, Trap gate view. */
|
---|
733 | typedef VBOXIDTE64_TRAPGATE *PVBOXIDTE64_TRAPGATE;
|
---|
734 |
|
---|
735 | /** IDT Entry, 64-bit mode, Generic view. */
|
---|
736 | #pragma pack(1) /* paranoia */
|
---|
737 | typedef struct VBOXIDTE64_GENERIC
|
---|
738 | {
|
---|
739 | /** Low offset word. */
|
---|
740 | unsigned u16OffsetLow : 16;
|
---|
741 | /** Segment Selector. */
|
---|
742 | unsigned u16SegSel : 16;
|
---|
743 | /** Reserved. */
|
---|
744 | unsigned u3Ist : 3;
|
---|
745 | /** Fixed value bit 0 - Set to 0. */
|
---|
746 | unsigned u1Fixed0 : 1;
|
---|
747 | /** Fixed value bit 1 - Set to 0. */
|
---|
748 | unsigned u1Fixed1 : 1;
|
---|
749 | /** IDT Type part one (not used for task gate). */
|
---|
750 | unsigned u3Type1 : 3;
|
---|
751 | /** IDT Type part two. */
|
---|
752 | unsigned u5Type2 : 5;
|
---|
753 | /** Descriptor Privilege level. */
|
---|
754 | unsigned u2DPL : 2;
|
---|
755 | /** Present flag. */
|
---|
756 | unsigned u1Present : 1;
|
---|
757 | /** High offset word. */
|
---|
758 | unsigned u16OffsetHigh : 16;
|
---|
759 | /** Offset bits 32..63. */
|
---|
760 | unsigned u32OffsetHigh64;
|
---|
761 | /** Reserved. */
|
---|
762 | unsigned u32Reserved;
|
---|
763 | } VBOXIDTE64_GENERIC;
|
---|
764 | #pragma pack()
|
---|
765 | /** Pointer to IDT Entry, 64-bit mode, Generic view. */
|
---|
766 | typedef VBOXIDTE64_GENERIC *PVBOXIDTE64_GENERIC;
|
---|
767 |
|
---|
768 | /** IDT Entry, 64-bit mode. */
|
---|
769 | #pragma pack(1) /* paranoia */
|
---|
770 | typedef union VBOXIDTE64
|
---|
771 | {
|
---|
772 | /** Trap gate view. */
|
---|
773 | VBOXIDTE64_TRAPGATE Trap;
|
---|
774 | /** Interrupt gate view. */
|
---|
775 | VBOXIDTE64_INTERRUPTGATE Int;
|
---|
776 | /** Generic IDT view. */
|
---|
777 | VBOXIDTE64_GENERIC Gen;
|
---|
778 |
|
---|
779 | /** 8 bit unsigned integer view. */
|
---|
780 | uint8_t au8[16];
|
---|
781 | /** 16 bit unsigned integer view. */
|
---|
782 | uint16_t au16[8];
|
---|
783 | /** 32 bit unsigned integer view. */
|
---|
784 | uint32_t au32[4];
|
---|
785 | /** 64 bit unsigned integer view. */
|
---|
786 | uint64_t au64[2];
|
---|
787 | } VBOXIDTE64;
|
---|
788 | #pragma pack()
|
---|
789 | /** Pointer to IDT Entry. */
|
---|
790 | typedef VBOXIDTE64 *PVBOXIDTE64;
|
---|
791 | /** Pointer to IDT Entry. */
|
---|
792 | typedef VBOXIDTE64 const *PCVBOXIDTE64;
|
---|
793 |
|
---|
794 | #pragma pack(1)
|
---|
795 | /** IDTR */
|
---|
796 | typedef struct VBOXIDTR
|
---|
797 | {
|
---|
798 | /** Size of the IDT. */
|
---|
799 | uint16_t cbIdt;
|
---|
800 | /** Address of the IDT. */
|
---|
801 | uint64_t pIdt;
|
---|
802 | } VBOXIDTR, *PVBOXIDTR;
|
---|
803 | #pragma pack()
|
---|
804 |
|
---|
805 | /** @} */
|
---|
806 |
|
---|
807 |
|
---|
808 | /** @def VBOXIDTE_OFFSET
|
---|
809 | * Return the offset of an IDT entry.
|
---|
810 | */
|
---|
811 | #define VBOXIDTE_OFFSET(desc) \
|
---|
812 | ( ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
|
---|
813 | | ( (desc).Gen.u16OffsetLow ) )
|
---|
814 |
|
---|
815 | /** @def VBOXIDTE64_OFFSET
|
---|
816 | * Return the offset of an IDT entry.
|
---|
817 | */
|
---|
818 | #define VBOXIDTE64_OFFSET(desc) \
|
---|
819 | ( ((uint64_t)((desc).Gen.u32OffsetHigh64) << 32) \
|
---|
820 | | ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
|
---|
821 | | ( (desc).Gen.u16OffsetLow ) )
|
---|
822 |
|
---|
823 | #pragma pack(1)
|
---|
824 | /** GDTR */
|
---|
825 | typedef struct VBOXGDTR
|
---|
826 | {
|
---|
827 | /** Size of the GDT. */
|
---|
828 | uint16_t cbGdt;
|
---|
829 | /** Address of the GDT. */
|
---|
830 | uint64_t pGdt;
|
---|
831 | } VBOXGDTR;
|
---|
832 | #pragma pack()
|
---|
833 | /** Pointer to GDTR. */
|
---|
834 | typedef VBOXGDTR *PVBOXGDTR;
|
---|
835 |
|
---|
836 | /** @} */
|
---|
837 |
|
---|
838 |
|
---|
839 | /**
|
---|
840 | * 32-bit Task Segment used in raw mode.
|
---|
841 | * @todo Move this to SELM! Use X86TSS32 instead.
|
---|
842 | */
|
---|
843 | #pragma pack(1)
|
---|
844 | typedef struct VBOXTSS
|
---|
845 | {
|
---|
846 | /** 0x00 - Back link to previous task. (static) */
|
---|
847 | RTSEL selPrev;
|
---|
848 | uint16_t padding1;
|
---|
849 | /** 0x04 - Ring-0 stack pointer. (static) */
|
---|
850 | uint32_t esp0;
|
---|
851 | /** 0x08 - Ring-0 stack segment. (static) */
|
---|
852 | RTSEL ss0;
|
---|
853 | uint16_t padding_ss0;
|
---|
854 | /** 0x0c - Ring-1 stack pointer. (static) */
|
---|
855 | uint32_t esp1;
|
---|
856 | /** 0x10 - Ring-1 stack segment. (static) */
|
---|
857 | RTSEL ss1;
|
---|
858 | uint16_t padding_ss1;
|
---|
859 | /** 0x14 - Ring-2 stack pointer. (static) */
|
---|
860 | uint32_t esp2;
|
---|
861 | /** 0x18 - Ring-2 stack segment. (static) */
|
---|
862 | RTSEL ss2;
|
---|
863 | uint16_t padding_ss2;
|
---|
864 | /** 0x1c - Page directory for the task. (static) */
|
---|
865 | uint32_t cr3;
|
---|
866 | /** 0x20 - EIP before task switch. */
|
---|
867 | uint32_t eip;
|
---|
868 | /** 0x24 - EFLAGS before task switch. */
|
---|
869 | uint32_t eflags;
|
---|
870 | /** 0x28 - EAX before task switch. */
|
---|
871 | uint32_t eax;
|
---|
872 | /** 0x2c - ECX before task switch. */
|
---|
873 | uint32_t ecx;
|
---|
874 | /** 0x30 - EDX before task switch. */
|
---|
875 | uint32_t edx;
|
---|
876 | /** 0x34 - EBX before task switch. */
|
---|
877 | uint32_t ebx;
|
---|
878 | /** 0x38 - ESP before task switch. */
|
---|
879 | uint32_t esp;
|
---|
880 | /** 0x3c - EBP before task switch. */
|
---|
881 | uint32_t ebp;
|
---|
882 | /** 0x40 - ESI before task switch. */
|
---|
883 | uint32_t esi;
|
---|
884 | /** 0x44 - EDI before task switch. */
|
---|
885 | uint32_t edi;
|
---|
886 | /** 0x48 - ES before task switch. */
|
---|
887 | RTSEL es;
|
---|
888 | uint16_t padding_es;
|
---|
889 | /** 0x4c - CS before task switch. */
|
---|
890 | RTSEL cs;
|
---|
891 | uint16_t padding_cs;
|
---|
892 | /** 0x50 - SS before task switch. */
|
---|
893 | RTSEL ss;
|
---|
894 | uint16_t padding_ss;
|
---|
895 | /** 0x54 - DS before task switch. */
|
---|
896 | RTSEL ds;
|
---|
897 | uint16_t padding_ds;
|
---|
898 | /** 0x58 - FS before task switch. */
|
---|
899 | RTSEL fs;
|
---|
900 | uint16_t padding_fs;
|
---|
901 | /** 0x5c - GS before task switch. */
|
---|
902 | RTSEL gs;
|
---|
903 | uint16_t padding_gs;
|
---|
904 | /** 0x60 - LDTR before task switch. */
|
---|
905 | RTSEL selLdt;
|
---|
906 | uint16_t padding_ldt;
|
---|
907 | /** 0x64 - Debug trap flag */
|
---|
908 | uint16_t fDebugTrap;
|
---|
909 | /** 0x66 - Offset relative to the TSS of the start of the I/O Bitmap
|
---|
910 | * and the end of the interrupt redirection bitmap. */
|
---|
911 | uint16_t offIoBitmap;
|
---|
912 | /** 0x68 - 32 bytes for the virtual interrupt redirection bitmap. (VME) */
|
---|
913 | uint8_t IntRedirBitmap[32];
|
---|
914 | } VBOXTSS;
|
---|
915 | #pragma pack()
|
---|
916 | /** Pointer to task segment. */
|
---|
917 | typedef VBOXTSS *PVBOXTSS;
|
---|
918 | /** Pointer to const task segment. */
|
---|
919 | typedef const VBOXTSS *PCVBOXTSS;
|
---|
920 |
|
---|
921 |
|
---|
922 | /** Pointer to a callback method table provided by the VM API user. */
|
---|
923 | typedef struct VMM2USERMETHODS const *PCVMM2USERMETHODS;
|
---|
924 |
|
---|
925 |
|
---|
926 | /**
|
---|
927 | * Data transport buffer (scatter/gather)
|
---|
928 | */
|
---|
929 | typedef struct PDMDATASEG
|
---|
930 | {
|
---|
931 | /** Length of buffer in entry. */
|
---|
932 | size_t cbSeg;
|
---|
933 | /** Pointer to the start of the buffer. */
|
---|
934 | void *pvSeg;
|
---|
935 | } PDMDATASEG;
|
---|
936 | /** Pointer to a data transport segment. */
|
---|
937 | typedef PDMDATASEG *PPDMDATASEG;
|
---|
938 | /** Pointer to a const data transport segment. */
|
---|
939 | typedef PDMDATASEG const *PCPDMDATASEG;
|
---|
940 |
|
---|
941 |
|
---|
942 | /**
|
---|
943 | * Forms of generic segment offloading.
|
---|
944 | */
|
---|
945 | typedef enum PDMNETWORKGSOTYPE
|
---|
946 | {
|
---|
947 | /** Invalid zero value. */
|
---|
948 | PDMNETWORKGSOTYPE_INVALID = 0,
|
---|
949 | /** TCP/IPv4 - no CWR/ECE encoding. */
|
---|
950 | PDMNETWORKGSOTYPE_IPV4_TCP,
|
---|
951 | /** TCP/IPv6 - no CWR/ECE encoding. */
|
---|
952 | PDMNETWORKGSOTYPE_IPV6_TCP,
|
---|
953 | /** UDP/IPv4. */
|
---|
954 | PDMNETWORKGSOTYPE_IPV4_UDP,
|
---|
955 | /** UDP/IPv6. */
|
---|
956 | PDMNETWORKGSOTYPE_IPV6_UDP,
|
---|
957 | /** TCP/IPv6 over IPv4 tunneling - no CWR/ECE encoding.
|
---|
958 | * The header offsets and sizes relates to IPv4 and TCP, the IPv6 header is
|
---|
959 | * figured out as needed.
|
---|
960 | * @todo Needs checking against facts, this is just an outline of the idea. */
|
---|
961 | PDMNETWORKGSOTYPE_IPV4_IPV6_TCP,
|
---|
962 | /** UDP/IPv6 over IPv4 tunneling.
|
---|
963 | * The header offsets and sizes relates to IPv4 and UDP, the IPv6 header is
|
---|
964 | * figured out as needed.
|
---|
965 | * @todo Needs checking against facts, this is just an outline of the idea. */
|
---|
966 | PDMNETWORKGSOTYPE_IPV4_IPV6_UDP,
|
---|
967 | /** The end of valid GSO types. */
|
---|
968 | PDMNETWORKGSOTYPE_END
|
---|
969 | } PDMNETWORKGSOTYPE;
|
---|
970 |
|
---|
971 |
|
---|
972 | /**
|
---|
973 | * Generic segment offloading context.
|
---|
974 | *
|
---|
975 | * We generally follow the E1000 specs wrt to which header fields we change.
|
---|
976 | * However the GSO type implies where the checksum fields are and that they are
|
---|
977 | * always updated from scratch (no half done pseudo checksums).
|
---|
978 | *
|
---|
979 | * @remarks This is part of the internal network GSO packets. Take great care
|
---|
980 | * when making changes. The size is expected to be exactly 8 bytes.
|
---|
981 | *
|
---|
982 | * @ingroup grp_pdm
|
---|
983 | */
|
---|
984 | typedef struct PDMNETWORKGSO
|
---|
985 | {
|
---|
986 | /** The type of segmentation offloading we're performing (PDMNETWORKGSOTYPE). */
|
---|
987 | uint8_t u8Type;
|
---|
988 | /** The total header size. */
|
---|
989 | uint8_t cbHdrsTotal;
|
---|
990 | /** The max segment size (MSS) to apply. */
|
---|
991 | uint16_t cbMaxSeg;
|
---|
992 |
|
---|
993 | /** Offset of the first header (IPv4 / IPv6). 0 if not not needed. */
|
---|
994 | uint8_t offHdr1;
|
---|
995 | /** Offset of the second header (TCP / UDP). 0 if not not needed. */
|
---|
996 | uint8_t offHdr2;
|
---|
997 | /** The header size used for segmentation (equal to offHdr2 in UFO). */
|
---|
998 | uint8_t cbHdrsSeg;
|
---|
999 | /** Unused. */
|
---|
1000 | uint8_t u8Unused;
|
---|
1001 | } PDMNETWORKGSO;
|
---|
1002 | /** Pointer to a GSO context.
|
---|
1003 | * @ingroup grp_pdm */
|
---|
1004 | typedef PDMNETWORKGSO *PPDMNETWORKGSO;
|
---|
1005 | /** Pointer to a const GSO context.
|
---|
1006 | * @ingroup grp_pdm */
|
---|
1007 | typedef PDMNETWORKGSO const *PCPDMNETWORKGSO;
|
---|
1008 |
|
---|
1009 | /** Pointer to a PDM filter handle.
|
---|
1010 | * @ingroup grp_pdm_net_shaper */
|
---|
1011 | typedef struct PDMNSFILTER *PPDMNSFILTER;
|
---|
1012 | /** Pointer to a network shaper.
|
---|
1013 | * @ingroup grp_pdm_net_shaper */
|
---|
1014 | typedef struct PDMNETSHAPER *PPDMNETSHAPER;
|
---|
1015 |
|
---|
1016 |
|
---|
1017 | /**
|
---|
1018 | * The current ROM page protection.
|
---|
1019 | *
|
---|
1020 | * @remarks This is part of the saved state.
|
---|
1021 | * @ingroup grp_pgm
|
---|
1022 | */
|
---|
1023 | typedef enum PGMROMPROT
|
---|
1024 | {
|
---|
1025 | /** The customary invalid value. */
|
---|
1026 | PGMROMPROT_INVALID = 0,
|
---|
1027 | /** Read from the virgin ROM page, ignore writes.
|
---|
1028 | * Map the virgin page, use write access handler to ignore writes. */
|
---|
1029 | PGMROMPROT_READ_ROM_WRITE_IGNORE,
|
---|
1030 | /** Read from the virgin ROM page, write to the shadow RAM.
|
---|
1031 | * Map the virgin page, use write access handler to change the shadow RAM. */
|
---|
1032 | PGMROMPROT_READ_ROM_WRITE_RAM,
|
---|
1033 | /** Read from the shadow ROM page, ignore writes.
|
---|
1034 | * Map the shadow page read-only, use write access handler to ignore writes. */
|
---|
1035 | PGMROMPROT_READ_RAM_WRITE_IGNORE,
|
---|
1036 | /** Read from the shadow ROM page, ignore writes.
|
---|
1037 | * Map the shadow page read-write, disabled write access handler. */
|
---|
1038 | PGMROMPROT_READ_RAM_WRITE_RAM,
|
---|
1039 | /** The end of valid values. */
|
---|
1040 | PGMROMPROT_END,
|
---|
1041 | /** The usual 32-bit type size hack. */
|
---|
1042 | PGMROMPROT_32BIT_HACK = 0x7fffffff
|
---|
1043 | } PGMROMPROT;
|
---|
1044 |
|
---|
1045 |
|
---|
1046 | /**
|
---|
1047 | * Page mapping lock.
|
---|
1048 | * @ingroup grp_pgm
|
---|
1049 | */
|
---|
1050 | typedef struct PGMPAGEMAPLOCK
|
---|
1051 | {
|
---|
1052 | #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
|
---|
1053 | /** The locked page. */
|
---|
1054 | void *pvPage;
|
---|
1055 | /** Pointer to the CPU that made the mapping.
|
---|
1056 | * In ring-0 and raw-mode context we don't intend to ever allow long term
|
---|
1057 | * locking and this is a way of making sure we're still on the same CPU. */
|
---|
1058 | PVMCPU pVCpu;
|
---|
1059 | #else
|
---|
1060 | /** Pointer to the PGMPAGE and lock type.
|
---|
1061 | * bit-0 abuse: set=write, clear=read. */
|
---|
1062 | uintptr_t uPageAndType;
|
---|
1063 | /** Read lock type value. */
|
---|
1064 | # define PGMPAGEMAPLOCK_TYPE_READ ((uintptr_t)0)
|
---|
1065 | /** Write lock type value. */
|
---|
1066 | # define PGMPAGEMAPLOCK_TYPE_WRITE ((uintptr_t)1)
|
---|
1067 | /** Lock type mask. */
|
---|
1068 | # define PGMPAGEMAPLOCK_TYPE_MASK ((uintptr_t)1)
|
---|
1069 | /** Pointer to the PGMCHUNKR3MAP. */
|
---|
1070 | void *pvMap;
|
---|
1071 | #endif
|
---|
1072 | } PGMPAGEMAPLOCK;
|
---|
1073 | /** Pointer to a page mapping lock.
|
---|
1074 | * @ingroup grp_pgm */
|
---|
1075 | typedef PGMPAGEMAPLOCK *PPGMPAGEMAPLOCK;
|
---|
1076 |
|
---|
1077 |
|
---|
1078 | /** Pointer to a info helper callback structure. */
|
---|
1079 | typedef struct DBGFINFOHLP *PDBGFINFOHLP;
|
---|
1080 | /** Pointer to a const info helper callback structure. */
|
---|
1081 | typedef const struct DBGFINFOHLP *PCDBGFINFOHLP;
|
---|
1082 |
|
---|
1083 | /** Pointer to a const register descriptor. */
|
---|
1084 | typedef struct DBGFREGDESC const *PCDBGFREGDESC;
|
---|
1085 |
|
---|
1086 |
|
---|
1087 | /** Configuration manager tree node - A key. */
|
---|
1088 | typedef struct CFGMNODE *PCFGMNODE;
|
---|
1089 |
|
---|
1090 | /** Configuration manager tree leaf - A value. */
|
---|
1091 | typedef struct CFGMLEAF *PCFGMLEAF;
|
---|
1092 |
|
---|
1093 |
|
---|
1094 | /**
|
---|
1095 | * CPU modes.
|
---|
1096 | */
|
---|
1097 | typedef enum CPUMMODE
|
---|
1098 | {
|
---|
1099 | /** The usual invalid zero entry. */
|
---|
1100 | CPUMMODE_INVALID = 0,
|
---|
1101 | /** Real mode. */
|
---|
1102 | CPUMMODE_REAL,
|
---|
1103 | /** Protected mode (32-bit). */
|
---|
1104 | CPUMMODE_PROTECTED,
|
---|
1105 | /** Long mode (64-bit). */
|
---|
1106 | CPUMMODE_LONG
|
---|
1107 | } CPUMMODE;
|
---|
1108 |
|
---|
1109 |
|
---|
1110 | /**
|
---|
1111 | * CPU mode flags (DISSTATE::mode).
|
---|
1112 | */
|
---|
1113 | typedef enum DISCPUMODE
|
---|
1114 | {
|
---|
1115 | DISCPUMODE_INVALID = 0,
|
---|
1116 | DISCPUMODE_16BIT,
|
---|
1117 | DISCPUMODE_32BIT,
|
---|
1118 | DISCPUMODE_64BIT,
|
---|
1119 | /** hack forcing the size of the enum to 32-bits. */
|
---|
1120 | DISCPUMODE_MAKE_32BIT_HACK = 0x7fffffff
|
---|
1121 | } DISCPUMODE;
|
---|
1122 |
|
---|
1123 | /** Pointer to the disassembler state. */
|
---|
1124 | typedef struct DISSTATE *PDISSTATE;
|
---|
1125 | /** Pointer to a const disassembler state. */
|
---|
1126 | typedef struct DISSTATE const *PCDISSTATE;
|
---|
1127 |
|
---|
1128 | /** @deprecated PDISSTATE and change pCpu and pDisState to pDis. */
|
---|
1129 | typedef PDISSTATE PDISCPUSTATE;
|
---|
1130 | /** @deprecated PCDISSTATE and change pCpu and pDisState to pDis. */
|
---|
1131 | typedef PCDISSTATE PCDISCPUSTATE;
|
---|
1132 |
|
---|
1133 |
|
---|
1134 | /**
|
---|
1135 | * Shared region description (needed by GMM and others, thus global).
|
---|
1136 | * @ingroup grp_vmmdev
|
---|
1137 | */
|
---|
1138 | typedef struct VMMDEVSHAREDREGIONDESC
|
---|
1139 | {
|
---|
1140 | RTGCPTR64 GCRegionAddr;
|
---|
1141 | uint32_t cbRegion;
|
---|
1142 | uint32_t u32Alignment;
|
---|
1143 | } VMMDEVSHAREDREGIONDESC;
|
---|
1144 |
|
---|
1145 |
|
---|
1146 | /** @} */
|
---|
1147 |
|
---|
1148 | #endif /* !VBOX_INCLUDED_types_h */
|
---|