VirtualBox

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

Last change on this file was 108968, checked in by vboxsync, 3 weeks ago

VMM,Main,Devices: Respect VBOX_VMM_TARGET_ARMV8 correctly on amd64 hosts (for IEM debugging purposes). jiraref:VBP-1598

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette