1 | /** @file
|
---|
2 | * VM - The Virtual Machine Monitor, VTable ring-3 API.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2022-2023 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_vmm_vmmr3vtable_h
|
---|
37 | #define VBOX_INCLUDED_vmm_vmmr3vtable_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <VBox/types.h>
|
---|
43 | #include <VBox/vmm/cfgm.h>
|
---|
44 | #include <VBox/vmm/cpum.h>
|
---|
45 | #include <VBox/vmm/dbgf.h>
|
---|
46 | #include <VBox/vmm/dbgfflowtrace.h>
|
---|
47 | #include <VBox/vmm/em.h>
|
---|
48 | #include <VBox/vmm/hm.h>
|
---|
49 | #include <VBox/vmm/pdmapi.h>
|
---|
50 | #include <VBox/vmm/pdmasynccompletion.h>
|
---|
51 | #include <VBox/vmm/pdmcritsect.h>
|
---|
52 | #include <VBox/vmm/pdmdrv.h>
|
---|
53 | #include <VBox/vmm/pdmnetshaper.h>
|
---|
54 | #include <VBox/vmm/pdmqueue.h>
|
---|
55 | #include <VBox/vmm/pdmusb.h>
|
---|
56 | #include <VBox/vmm/pdmthread.h>
|
---|
57 | #include <VBox/vmm/pgm.h>
|
---|
58 | #include <VBox/vmm/ssm.h>
|
---|
59 | #include <VBox/vmm/stam.h>
|
---|
60 | #include <VBox/vmm/tm.h>
|
---|
61 | #include <VBox/vmm/vmm.h>
|
---|
62 | #include <VBox/dbg.h>
|
---|
63 |
|
---|
64 | #include <iprt/stdarg.h>
|
---|
65 |
|
---|
66 | RT_C_DECLS_BEGIN
|
---|
67 |
|
---|
68 | /** @defgroup grp_vmm_vtable VMM Function Table
|
---|
69 | * @ingroup grp_vmm
|
---|
70 | * @{ */
|
---|
71 |
|
---|
72 |
|
---|
73 | /** Magic and version for the VMM vtable. (Magic: Emmet Cohen) */
|
---|
74 | #define VMMR3VTABLE_MAGIC_VERSION RT_MAKE_U64(0x19900525, 0x00050000)
|
---|
75 | /** Compatibility mask: These bits must match - magic and major version. */
|
---|
76 | #define VMMR3VTABLE_MAGIC_VERSION_MASK RT_MAKE_U64(0xffffffff, 0xffff0000)
|
---|
77 |
|
---|
78 | /** Checks if @a a_uTableMagicVersion can be used by code compiled
|
---|
79 | * against @a a_CompiledMagicVersion */
|
---|
80 | #define VMMR3VTABLE_IS_COMPATIBLE_EX(a_uTableMagicVersion, a_CompiledMagicVersion) \
|
---|
81 | ( (a_uTableMagicVersion) >= (a_CompiledMagicVersion) /* table must be same or later version */ \
|
---|
82 | && ((a_uTableMagicVersion) & VMMR3VTABLE_MAGIC_VERSION_MASK) == ((a_CompiledMagicVersion) & VMMR3VTABLE_MAGIC_VERSION_MASK) )
|
---|
83 |
|
---|
84 | /** Checks if @a a_uTableMagicVersion can be used by this us. */
|
---|
85 | #define VMMR3VTABLE_IS_COMPATIBLE(a_uTableMagicVersion) \
|
---|
86 | VMMR3VTABLE_IS_COMPATIBLE_EX(a_uTableMagicVersion, VMMR3VTABLE_MAGIC_VERSION)
|
---|
87 |
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Function for getting the vtable of a VMM DLL/SO/DyLib.
|
---|
91 | *
|
---|
92 | * @returns the pointer to the vtable.
|
---|
93 | */
|
---|
94 | typedef DECLCALLBACKTYPE(PCVMMR3VTABLE, FNVMMGETVTABLE,(void));
|
---|
95 | /** Pointer to VMM vtable getter. */
|
---|
96 | typedef FNVMMGETVTABLE *PFNVMMGETVTABLE;
|
---|
97 | /** The name of the FNVMMGETVTABLE function. */
|
---|
98 | #define VMMR3VTABLE_GETTER_NAME "VMMR3GetVTable"
|
---|
99 |
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * VTable for the ring-3 VMM API.
|
---|
103 | */
|
---|
104 | typedef struct VMMR3VTABLE
|
---|
105 | {
|
---|
106 | /** VMMR3VTABLE_MAGIC_VERSION. */
|
---|
107 | uint64_t uMagicVersion;
|
---|
108 | /** Flags (TBD). */
|
---|
109 | uint64_t fFlags;
|
---|
110 | /** The description of this VMM. */
|
---|
111 | const char *pszDescription;
|
---|
112 |
|
---|
113 | /** @def VTABLE_ENTRY
|
---|
114 | * Define a VTable entry for the given function. */
|
---|
115 | #if defined(DOXYGEN_RUNNING) \
|
---|
116 | || (defined(__cplusplus) && (defined(__clang_major__) || RT_GNUC_PREREQ_EX(4, 8, /*non-gcc: */1) /* For 4.8+ we enable c++11 */))
|
---|
117 | # define VTABLE_ENTRY(a_Api) /** @copydoc a_Api */ decltype(a_Api) *pfn ## a_Api;
|
---|
118 | #elif defined(__GNUC__)
|
---|
119 | # define VTABLE_ENTRY(a_Api) /** @copydoc a_Api */ typeof(a_Api) *pfn ## a_Api;
|
---|
120 | #else
|
---|
121 | # error "Unsupported compiler"
|
---|
122 | #endif
|
---|
123 | /** @def VTABLE_RESERVED
|
---|
124 | * Define a reserved VTable entry with the given name. */
|
---|
125 | #define VTABLE_RESERVED(a_Name) DECLCALLBACKMEMBER(int, a_Name,(void));
|
---|
126 |
|
---|
127 | #include "vmmr3vtable-def.h"
|
---|
128 |
|
---|
129 | #undef VTABLE_ENTRY
|
---|
130 | #undef VTABLE_RESERVED
|
---|
131 |
|
---|
132 | /** VMMR3VTABLE_MAGIC_VERSION. */
|
---|
133 | uint64_t uMagicVersionEnd;
|
---|
134 | } VMMR3VTABLE;
|
---|
135 |
|
---|
136 | /** @} */
|
---|
137 |
|
---|
138 | RT_C_DECLS_END
|
---|
139 |
|
---|
140 | #endif /* !VBOX_INCLUDED_vmm_vmmr3vtable_h */
|
---|
141 |
|
---|