1 | /** @file
|
---|
2 | * NEM - The Native Execution Manager.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2018-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_vmm_nem_h
|
---|
27 | #define VBOX_INCLUDED_vmm_nem_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/types.h>
|
---|
33 | #include <VBox/vmm/vmapi.h>
|
---|
34 | #include <VBox/vmm/pgm.h>
|
---|
35 |
|
---|
36 |
|
---|
37 | RT_C_DECLS_BEGIN
|
---|
38 |
|
---|
39 | /** @defgroup grp_nem The Native Execution Manager API
|
---|
40 | * @ingroup grp_vmm
|
---|
41 | * @{
|
---|
42 | */
|
---|
43 |
|
---|
44 | /** @defgroup grp_nem_r3 The NEM ring-3 Context API
|
---|
45 | * @{
|
---|
46 | */
|
---|
47 | VMMR3_INT_DECL(int) NEMR3InitConfig(PVM pVM);
|
---|
48 | VMMR3_INT_DECL(int) NEMR3Init(PVM pVM, bool fFallback, bool fForced);
|
---|
49 | VMMR3_INT_DECL(int) NEMR3InitAfterCPUM(PVM pVM);
|
---|
50 | #ifdef IN_RING3
|
---|
51 | VMMR3_INT_DECL(int) NEMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
|
---|
52 | #endif
|
---|
53 | VMMR3_INT_DECL(int) NEMR3Term(PVM pVM);
|
---|
54 | VMMR3DECL(bool) NEMR3IsEnabled(PUVM pVM);
|
---|
55 | VMMR3_INT_DECL(bool) NEMR3NeedSpecialTscMode(PVM pVM);
|
---|
56 | VMMR3_INT_DECL(void) NEMR3Reset(PVM pVM);
|
---|
57 | VMMR3_INT_DECL(void) NEMR3ResetCpu(PVMCPU pVCpu, bool fInitIpi);
|
---|
58 | VMMR3DECL(const char *) NEMR3GetExitName(uint32_t uExit);
|
---|
59 | VMMR3_INT_DECL(VBOXSTRICTRC) NEMR3RunGC(PVM pVM, PVMCPU pVCpu);
|
---|
60 | VMMR3_INT_DECL(bool) NEMR3CanExecuteGuest(PVM pVM, PVMCPU pVCpu);
|
---|
61 | VMMR3_INT_DECL(bool) NEMR3SetSingleInstruction(PVM pVM, PVMCPU pVCpu, bool fEnable);
|
---|
62 | VMMR3_INT_DECL(void) NEMR3NotifyFF(PVM pVM, PVMCPU pVCpu, uint32_t fFlags);
|
---|
63 |
|
---|
64 | VMMR3_INT_DECL(int) NEMR3NotifyPhysRamRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb);
|
---|
65 | VMMR3_INT_DECL(int) NEMR3NotifyPhysMmioExMap(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, uint32_t fFlags, void *pvMmio2);
|
---|
66 | VMMR3_INT_DECL(int) NEMR3NotifyPhysMmioExUnmap(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, uint32_t fFlags);
|
---|
67 | /** @name Flags for NEMR3NotifyPhysMmioExMap and NEMR3NotifyPhysMmioExUnmap.
|
---|
68 | * @{ */
|
---|
69 | /** Set if it's MMIO2 being mapped or unmapped. */
|
---|
70 | #define NEM_NOTIFY_PHYS_MMIO_EX_F_MMIO2 RT_BIT(0)
|
---|
71 | /** Set if the range is replacing RAM rather that unused space. */
|
---|
72 | #define NEM_NOTIFY_PHYS_MMIO_EX_F_REPLACE RT_BIT(1)
|
---|
73 | /** @} */
|
---|
74 |
|
---|
75 | VMMR3_INT_DECL(int) NEMR3NotifyPhysRomRegisterEarly(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, uint32_t fFlags);
|
---|
76 | VMMR3_INT_DECL(int) NEMR3NotifyPhysRomRegisterLate(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, uint32_t fFlags);
|
---|
77 | /** @name Flags for NEMR3NotifyPhysRomRegisterEarly and NEMR3NotifyPhysRomRegisterLate.
|
---|
78 | * @{ */
|
---|
79 | /** Set if the range is replacing RAM rather that unused space. */
|
---|
80 | #define NEM_NOTIFY_PHYS_ROM_F_REPLACE RT_BIT(1)
|
---|
81 | /** Set if it's MMIO2 being mapped or unmapped. */
|
---|
82 | #define NEM_NOTIFY_PHYS_ROM_F_SHADOW RT_BIT(2)
|
---|
83 | /** @} */
|
---|
84 |
|
---|
85 | VMMR3_INT_DECL(void) NEMR3NotifySetA20(PVMCPU pVCpu, bool fEnabled);
|
---|
86 | /** @} */
|
---|
87 |
|
---|
88 |
|
---|
89 | /** @defgroup grp_nem_r0 The NEM ring-0 Context API
|
---|
90 | * @{ */
|
---|
91 | VMMR0_INT_DECL(int) NEMR0InitVM(PGVM pGVM);
|
---|
92 | VMMR0_INT_DECL(int) NEMR0InitVMPart2(PGVM pGVM);
|
---|
93 | VMMR0_INT_DECL(void) NEMR0CleanupVM(PGVM pGVM);
|
---|
94 | VMMR0_INT_DECL(int) NEMR0MapPages(PGVM pGVM, VMCPUID idCpu);
|
---|
95 | VMMR0_INT_DECL(int) NEMR0UnmapPages(PGVM pGVM, VMCPUID idCpu);
|
---|
96 | VMMR0_INT_DECL(int) NEMR0ExportState(PGVM pGVM, VMCPUID idCpu);
|
---|
97 | VMMR0_INT_DECL(int) NEMR0ImportState(PGVM pGVM, VMCPUID idCpu, uint64_t fWhat);
|
---|
98 | VMMR0_INT_DECL(int) NEMR0QueryCpuTick(PGVM pGVM, VMCPUID idCpu);
|
---|
99 | VMMR0_INT_DECL(int) NEMR0ResumeCpuTickOnAll(PGVM pGVM, VMCPUID idCpu, uint64_t uPausedTscValue);
|
---|
100 | VMMR0_INT_DECL(VBOXSTRICTRC) NEMR0RunGuestCode(PGVM pGVM, VMCPUID idCpu);
|
---|
101 | VMMR0_INT_DECL(int) NEMR0UpdateStatistics(PGVM pGVM, VMCPUID idCpu);
|
---|
102 | VMMR0_INT_DECL(int) NEMR0DoExperiment(PGVM pGVM, VMCPUID idCpu, uint64_t u64Arg);
|
---|
103 | /** @} */
|
---|
104 |
|
---|
105 |
|
---|
106 | /** @defgroup grp_nem_hc The NEM Host Context API
|
---|
107 | * @{
|
---|
108 | */
|
---|
109 | VMM_INT_DECL(bool) NEMHCIsLongModeAllowed(PVMCC pVM);
|
---|
110 | VMM_INT_DECL(int) NEMImportStateOnDemand(PVMCPUCC pVCpu, uint64_t fWhat);
|
---|
111 |
|
---|
112 | VMM_INT_DECL(void) NEMHCNotifyHandlerPhysicalRegister(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb);
|
---|
113 | VMM_INT_DECL(void) NEMHCNotifyHandlerPhysicalDeregister(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb,
|
---|
114 | int fRestoreAsRAM, bool fRestoreAsRAM2);
|
---|
115 | VMM_INT_DECL(void) NEMHCNotifyHandlerPhysicalModify(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld,
|
---|
116 | RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fRestoreAsRAM);
|
---|
117 |
|
---|
118 | VMM_INT_DECL(int) NEMHCNotifyPhysPageAllocated(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
|
---|
119 | PGMPAGETYPE enmType, uint8_t *pu2State);
|
---|
120 | VMM_INT_DECL(void) NEMHCNotifyPhysPageProtChanged(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
|
---|
121 | PGMPAGETYPE enmType, uint8_t *pu2State);
|
---|
122 | VMM_INT_DECL(void) NEMHCNotifyPhysPageChanged(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhysPrev, RTHCPHYS HCPhysNew,
|
---|
123 | uint32_t fPageProt, PGMPAGETYPE enmType, uint8_t *pu2State);
|
---|
124 | /** @name NEM_PAGE_PROT_XXX - Page protection
|
---|
125 | * @{ */
|
---|
126 | #define NEM_PAGE_PROT_NONE UINT32_C(0) /**< All access causes VM exits. */
|
---|
127 | #define NEM_PAGE_PROT_READ RT_BIT(0) /**< Read access. */
|
---|
128 | #define NEM_PAGE_PROT_EXECUTE RT_BIT(1) /**< Execute access. */
|
---|
129 | #define NEM_PAGE_PROT_WRITE RT_BIT(2) /**< write access. */
|
---|
130 | /** @} */
|
---|
131 |
|
---|
132 | VMM_INT_DECL(int) NEMHCQueryCpuTick(PVMCPUCC pVCpu, uint64_t *pcTicks, uint32_t *puAux);
|
---|
133 | VMM_INT_DECL(int) NEMHCResumeCpuTickOnAll(PVMCC pVM, PVMCPUCC pVCpu, uint64_t uPausedTscValue);
|
---|
134 |
|
---|
135 | /** @} */
|
---|
136 |
|
---|
137 | /** @} */
|
---|
138 | RT_C_DECLS_END
|
---|
139 |
|
---|
140 |
|
---|
141 | #endif /* !VBOX_INCLUDED_vmm_nem_h */
|
---|
142 |
|
---|