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