1 | /** @file
|
---|
2 | * CPUM - CPU Monitor(/ Manager).
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-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_cpum_h
|
---|
37 | #define VBOX_INCLUDED_vmm_cpum_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <VBox/types.h>
|
---|
43 | #include <VBox/vmm/cpumctx.h>
|
---|
44 | #include <VBox/vmm/stam.h>
|
---|
45 | #include <VBox/vmm/vmapi.h>
|
---|
46 | #include <VBox/vmm/cpum-common.h>
|
---|
47 |
|
---|
48 | #ifndef VBOX_VMM_TARGET_ARMV8
|
---|
49 | # include <VBox/vmm/cpum-x86-amd64.h>
|
---|
50 | #else
|
---|
51 | # include <VBox/vmm/cpum-armv8.h>
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | RT_C_DECLS_BEGIN
|
---|
55 |
|
---|
56 | /** @defgroup grp_cpum The CPU Monitor / Manager API
|
---|
57 | * @ingroup grp_vmm
|
---|
58 | * @{
|
---|
59 | */
|
---|
60 |
|
---|
61 | #ifndef VBOX_FOR_DTRACE_LIB
|
---|
62 |
|
---|
63 | VMMDECL(PCPUMCTX) CPUMQueryGuestCtxPtr(PVMCPU pVCpu);
|
---|
64 | VMMDECL(CPUMMODE) CPUMGetGuestMode(PVMCPU pVCpu);
|
---|
65 |
|
---|
66 | /** @name Guest Register Getters.
|
---|
67 | * @{ */
|
---|
68 | VMMDECL(uint64_t) CPUMGetGuestFlatPC(PVMCPU pVCpu);
|
---|
69 | VMMDECL(uint64_t) CPUMGetGuestFlatSP(PVMCPU pVCpu);
|
---|
70 | VMMDECL(CPUMCPUVENDOR) CPUMGetGuestCpuVendor(PVM pVM);
|
---|
71 | VMMDECL(CPUMMICROARCH) CPUMGetGuestMicroarch(PCVM pVM);
|
---|
72 | VMMDECL(void) CPUMGetGuestAddrWidths(PCVM pVM, uint8_t *pcPhysAddrWidth, uint8_t *pcLinearAddrWidth);
|
---|
73 | /** @} */
|
---|
74 |
|
---|
75 | /** @name Misc Guest Predicate Functions.
|
---|
76 | * @{ */
|
---|
77 | VMMDECL(bool) CPUMIsGuestIn64BitCode(PVMCPU pVCpu);
|
---|
78 | /** @} */
|
---|
79 |
|
---|
80 | VMMDECL(CPUMCPUVENDOR) CPUMGetHostCpuVendor(PVM pVM);
|
---|
81 | VMMDECL(CPUMMICROARCH) CPUMGetHostMicroarch(PCVM pVM);
|
---|
82 |
|
---|
83 | #ifdef IN_RING3
|
---|
84 | /** @defgroup grp_cpum_r3 The CPUM ring-3 API
|
---|
85 | * @{
|
---|
86 | */
|
---|
87 |
|
---|
88 | VMMR3DECL(int) CPUMR3Init(PVM pVM);
|
---|
89 | VMMR3DECL(int) CPUMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
|
---|
90 | VMMR3DECL(void) CPUMR3LogCpuIdAndMsrFeatures(PVM pVM);
|
---|
91 | VMMR3DECL(void) CPUMR3Relocate(PVM pVM);
|
---|
92 | VMMR3DECL(int) CPUMR3Term(PVM pVM);
|
---|
93 | VMMR3DECL(void) CPUMR3Reset(PVM pVM);
|
---|
94 | VMMR3DECL(void) CPUMR3ResetCpu(PVM pVM, PVMCPU pVCpu);
|
---|
95 | VMMDECL(bool) CPUMR3IsStateRestorePending(PVM pVM);
|
---|
96 | VMMDECL(const char *) CPUMMicroarchName(CPUMMICROARCH enmMicroarch);
|
---|
97 | VMMR3DECL(const char *) CPUMCpuVendorName(CPUMCPUVENDOR enmVendor);
|
---|
98 |
|
---|
99 | VMMR3DECL(uint32_t) CPUMR3DbGetEntries(void);
|
---|
100 | /** Pointer to CPUMR3DbGetEntries. */
|
---|
101 | typedef DECLCALLBACKPTR(uint32_t, PFNCPUMDBGETENTRIES, (void));
|
---|
102 | VMMR3DECL(PCCPUMDBENTRY) CPUMR3DbGetEntryByIndex(uint32_t idxCpuDb);
|
---|
103 | /** Pointer to CPUMR3DbGetEntryByIndex. */
|
---|
104 | typedef DECLCALLBACKPTR(PCCPUMDBENTRY, PFNCPUMDBGETENTRYBYINDEX, (uint32_t idxCpuDb));
|
---|
105 | VMMR3DECL(PCCPUMDBENTRY) CPUMR3DbGetEntryByName(const char *pszName);
|
---|
106 | /** Pointer to CPUMR3DbGetEntryByName. */
|
---|
107 | typedef DECLCALLBACKPTR(PCCPUMDBENTRY, PFNCPUMDBGETENTRYBYNAME, (const char *pszName));
|
---|
108 |
|
---|
109 | VMMR3_INT_DECL(void) CPUMR3NemActivateGuestDebugState(PVMCPUCC pVCpu);
|
---|
110 | VMMR3_INT_DECL(void) CPUMR3NemActivateHyperDebugState(PVMCPUCC pVCpu);
|
---|
111 | /** @} */
|
---|
112 | #endif /* IN_RING3 */
|
---|
113 |
|
---|
114 | #endif /* !VBOX_FOR_DTRACE_LIB */
|
---|
115 | /** @} */
|
---|
116 | RT_C_DECLS_END
|
---|
117 |
|
---|
118 |
|
---|
119 | #endif /* !VBOX_INCLUDED_vmm_cpum_h */
|
---|
120 |
|
---|