- Timestamp:
- Feb 10, 2025 11:05:23 AM (3 months ago)
- svn:sync-xref-src-repo-rev:
- 167432
- Location:
- trunk
- Files:
-
- 18 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pgm.h
r107227 r108132 257 257 * 258 258 * @note Part of saved state. Change with extreme care. 259 * @note Due to PGMGetShadowMode() and the possibility that we will be 260 * running ARMv8 VMs on a AMD64 hosts, it's safer to combine these 261 * modes. We could rethink this if we start using PGMMODE exclusively 262 * for the guest mode and come up with a different enum for the host. 259 263 */ 260 264 typedef enum PGMMODE … … 262 266 /** The usual invalid value. */ 263 267 PGMMODE_INVALID = 0, 264 #ifndef VBOX_VMM_TARGET_ARMV8 268 269 /** @name X86 270 * @{ */ 265 271 /** Real mode. */ 266 272 PGMMODE_REAL, … … 285 291 /** Extended paging (Intel) mode. */ 286 292 PGMMODE_EPT, 287 /** Special mode used by NEM to indicate no shadow paging necessary. */ 288 PGMMODE_NONE, 289 #else 290 /** Paging is not enabled by the guest. */ 291 PGMMODE_NONE, 293 /** @} */ 294 295 /** ARMv8: Paging is not enabled by the guest. 296 * AMD64 host: Special mode used by NEM to indicate no shadow paging 297 * necessary. Not used by X86 guests. */ 298 PGMMODE_NONE = 32, 299 300 /** @name ARMv8 301 * @{ */ 292 302 /** VMSAv8-32 Virtual Memory System Architecture v8 - 32-bit variant enabled. */ 293 303 PGMMODE_VMSA_V8_32, 294 304 /** VMSAv8-64 Virtual Memory System Architecture v8 - 64-bit variant enabled. */ 295 305 PGMMODE_VMSA_V8_64, 296 #endif 306 /** @} */ 307 297 308 /** The max number of modes */ 298 309 PGMMODE_MAX, … … 782 793 VMM_INT_DECL(const char *) PGMGetSlatModeName(PGMSLAT enmSlatMode); 783 794 #endif 784 VMM_INT_DECL(RTGCPHYS) PGMGetGuestCR3Phys(PVMCPU pVCpu);785 795 VMM_INT_DECL(void) PGMNotifyNxeChanged(PVMCPU pVCpu, bool fNxe); 786 796 VMMDECL(bool) PGMHasDirtyPages(PVM pVM); -
trunk/include/VBox/vmm/vmmr3vtable-def.h
r107276 r108132 662 662 VTABLE_ENTRY(PGMPhysSimpleWriteGCPtr) 663 663 VTABLE_ENTRY(PGMPhysWriteGCPtr) 664 VTABLE_ ENTRY(PGMShwMakePageWritable)664 VTABLE_RESERVED(pfnPGMR3Reserved0) 665 665 VTABLE_ENTRY(PGMR3QueryGlobalMemoryStats) 666 666 VTABLE_ENTRY(PGMR3QueryMemoryStats) -
trunk/src/VBox/VMM/Makefile.kmk
r107893 r108132 169 169 VMMR3/PGMHandler.cpp \ 170 170 VMMR3/PGMPhys.cpp \ 171 VMMR3/PGMPool.cpp \172 171 VMMR3/PGMSavedState.cpp \ 173 172 VMMR3/PGMSharedPage.cpp \ … … 219 218 VMMAll/PGMAllHandler.cpp \ 220 219 VMMAll/PGMAllPhys.cpp \ 221 VMMAll/PGMAllPool.cpp \222 220 VMMAll/SELMAll.cpp \ 223 221 VMMAll/EMAll.cpp \ … … 233 231 VMMAll/VMAll.cpp \ 234 232 VMMAll/VMMAll.cpp 233 ifn1of (VBOX_WITH_ONLY_PGM_NEM_MODE, $(VBoxVMM_DEFS)) 234 VBoxVMM_SOURCES += \ 235 VMMR3/PGMPool.cpp \ 236 VMMAll/PGMAllPool.cpp 237 endif 235 238 VBoxVMM_SOURCES.amd64 += \ 236 239 VMMR3/PGMR3DbgA.asm \ … … 466 469 VMMR3/PDMThread.cpp \ 467 470 VMMR3/PGM.cpp \ 468 VMMR3/PGM-armv8.cpp \469 471 VMMR3/PGMDbg.cpp \ 470 472 VMMR3/PGMHandler.cpp \ 471 473 VMMR3/PGMPhys.cpp \ 472 VMMR3/PGMPool.cpp \473 474 VMMR3/PGMSavedState.cpp \ 474 475 VMMR3/PGMSharedPage.cpp \ … … 502 503 VMMAll/PDMAllQueue.cpp \ 503 504 VMMAll/PDMAllTask.cpp \ 505 VMMAll/PGMAll.cpp \ 504 506 VMMAll/PGMAllHandler.cpp \ 505 507 VMMAll/PGMAllPhys.cpp \ 506 VMMAll/PGMAllPool.cpp \507 508 VMMAll/EMAll.cpp \ 508 509 VMMAll/GICAll.cpp \ -
trunk/src/VBox/VMM/VMMAll/AllPdbTypeHack.cpp
r106061 r108132 30 30 * Header Files * 31 31 *********************************************************************************************************************************/ 32 #ifdef VBOX_VMM_TARGET_AGNOSTIC 33 # ifdef RT_ARCH_AMD64 34 # define VBOX_VMM_TARGET_X86 35 # elif defined(RT_ARCH_ARM64) 36 # define VBOX_VMM_TARGET_ARMV8 37 # else 38 # error "port me" 39 # endif 40 #endif 32 41 #include <VBox/vmm/cfgm.h> 33 42 #include <VBox/vmm/cpum.h> … … 40 49 #include "../include/PDMInternal.h" 41 50 #include <VBox/vmm/pdm.h> 42 #include "../include/CFGMInternal.h" 43 #include "../include/CPUMInternal.h" 44 #include "../include/MMInternal.h" 45 #include "../include/PGMInternal.h" 46 #include "../include/SELMInternal.h" 47 #include "../include/TRPMInternal.h" 48 #include "../include/TMInternal.h" 49 #include "../include/IOMInternal.h" 51 #if !defined(VBOX_WITH_MINIMAL_R0) || !defined(IN_RING0) 52 # include "../include/CPUMInternal.h" 53 # include "../include/CFGMInternal.h" 54 # include "../include/MMInternal.h" 55 # include "../include/PGMInternal.h" 56 # include "../include/SELMInternal.h" 57 # include "../include/TRPMInternal.h" 58 # include "../include/TMInternal.h" 59 # include "../include/IOMInternal.h" 60 #endif 50 61 #ifdef IN_RING3 51 # include "../include/SSMInternal.h"62 # include "../include/SSMInternal.h" 52 63 #endif 53 #include "../include/HMInternal.h"54 64 #include "../include/VMMInternal.h" 55 #include "../include/DBGFInternal.h" 56 #include "../include/GIMInternal.h" 57 #include "../include/APICInternal.h" 58 #include "../include/STAMInternal.h" 65 #if !defined(VBOX_WITH_MINIMAL_R0) || !defined(IN_RING0) 66 # include "../include/HMInternal.h" 67 # include "../include/DBGFInternal.h" 68 # include "../include/GIMInternal.h" 69 # include "../include/APICInternal.h" 70 # include "../include/STAMInternal.h" 71 # include "../include/IEMInternal.h" 72 # include "../include/NEMInternal.h" 73 # include "../VMMR0/GMMR0Internal.h" 74 # include "../include/EMInternal.h" 75 #endif 59 76 #include "../include/VMInternal.h" 60 #include "../include/EMInternal.h"61 #include "../include/IEMInternal.h"62 #include "../include/NEMInternal.h"63 #include "../VMMR0/GMMR0Internal.h"64 77 #include "../VMMR0/GVMMR0Internal.h" 65 78 #include <VBox/vmm/vmcc.h> -
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r107171 r108132 32 32 #define LOG_GROUP LOG_GROUP_PGM 33 33 #define VBOX_WITHOUT_PAGING_BIT_FIELDS /* 64-bit bitfields are just asking for trouble. See @bugref{9841} and others. */ 34 #ifdef IN_RING0 35 # define VBOX_VMM_TARGET_X86 36 #endif 34 37 #include <VBox/vmm/pgm.h> 35 38 #include <VBox/vmm/cpum.h> … … 60 63 * Internal Functions * 61 64 *********************************************************************************************************************************/ 65 #ifdef VBOX_VMM_TARGET_X86 62 66 DECLINLINE(int) pgmShwGetLongModePDPtr(PVMCPUCC pVCpu, RTGCPTR64 GCPtr, PX86PML4E *ppPml4e, PX86PDPT *ppPdpt, PX86PDPAE *ppPD); 63 67 DECLINLINE(int) pgmShwGetPaePoolPagePD(PVMCPUCC pVCpu, RTGCPTR GCPtr, PPGMPOOLPAGE *ppShwPde); 64 68 DECLINLINE(int) pgmGstMapCr3(PVMCPUCC pVCpu, RTGCPHYS GCPhysCr3, PRTHCPTR pHCPtrGuestCr3); 65 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT69 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 66 70 static int pgmGstSlatWalk(PVMCPUCC pVCpu, RTGCPHYS GCPhysNested, bool fIsLinearAddrValid, RTGCPTR GCPtrNested, PPGMPTWALK pWalk, 67 71 PPGMPTWALKGST pGstWalk); … … 69 73 static int pgmShwGetNestedEPTPDPtr(PVMCPUCC pVCpu, RTGCPTR64 GCPhysNested, PEPTPDPT *ppPdpt, PEPTPD *ppPD, 70 74 PPGMPTWALKGST pGstWalkAll); 71 # endif75 # endif 72 76 static int pgmShwSyncLongModePDPtr(PVMCPUCC pVCpu, RTGCPTR64 GCPtr, X86PGPAEUINT uGstPml4e, X86PGPAEUINT uGstPdpe, PX86PDPAE *ppPD); 73 77 static int pgmShwGetEPTPDPtr(PVMCPUCC pVCpu, RTGCPTR64 GCPtr, PEPTPDPT *ppPdpt, PEPTPD *ppPD); 74 # ifdef PGM_WITH_PAGE_ZEROING_DETECTION78 # ifdef PGM_WITH_PAGE_ZEROING_DETECTION 75 79 static bool pgmHandlePageZeroingCode(PVMCPUCC pVCpu, PCPUMCTX pCtx); 76 #endif 77 80 # endif 81 #endif /* VBOX_VMM_TARGET_X86 */ 82 83 84 #ifdef VBOX_VMM_TARGET_X86 78 85 79 86 /* 80 87 * Second level transation - EPT. 81 88 */ 82 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT83 # define PGM_SLAT_TYPE PGM_SLAT_TYPE_EPT84 # include "PGMSlatDefs.h"85 # include "PGMAllGstSlatEpt.cpp.h"86 # undef PGM_SLAT_TYPE87 # endif89 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 90 # define PGM_SLAT_TYPE PGM_SLAT_TYPE_EPT 91 # include "PGMSlatDefs.h" 92 # include "PGMAllGstSlatEpt.cpp.h" 93 # undef PGM_SLAT_TYPE 94 # endif 88 95 89 96 … … 91 98 * Shadow - 32-bit mode 92 99 */ 93 # define PGM_SHW_TYPE PGM_TYPE_32BIT94 # define PGM_SHW_NAME(name) PGM_SHW_NAME_32BIT(name)95 # include "PGMAllShw.h"100 # define PGM_SHW_TYPE PGM_TYPE_32BIT 101 # define PGM_SHW_NAME(name) PGM_SHW_NAME_32BIT(name) 102 # include "PGMAllShw.h" 96 103 97 104 /* Guest - real mode */ 98 # define PGM_GST_TYPE PGM_TYPE_REAL99 # define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name)100 # define PGM_BTH_NAME(name) PGM_BTH_NAME_32BIT_REAL(name)101 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_32BIT_PT_FOR_PHYS102 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_32BIT_PD_PHYS103 # include "PGMGstDefs.h"104 # include "PGMAllGst.h"105 # include "PGMAllBth.h"106 # undef BTH_PGMPOOLKIND_PT_FOR_PT107 # undef BTH_PGMPOOLKIND_ROOT108 # undef PGM_BTH_NAME109 # undef PGM_GST_TYPE110 # undef PGM_GST_NAME105 # define PGM_GST_TYPE PGM_TYPE_REAL 106 # define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 107 # define PGM_BTH_NAME(name) PGM_BTH_NAME_32BIT_REAL(name) 108 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_32BIT_PT_FOR_PHYS 109 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_32BIT_PD_PHYS 110 # include "PGMGstDefs.h" 111 # include "PGMAllGst.h" 112 # include "PGMAllBth.h" 113 # undef BTH_PGMPOOLKIND_PT_FOR_PT 114 # undef BTH_PGMPOOLKIND_ROOT 115 # undef PGM_BTH_NAME 116 # undef PGM_GST_TYPE 117 # undef PGM_GST_NAME 111 118 112 119 /* Guest - protected mode */ 113 # define PGM_GST_TYPE PGM_TYPE_PROT114 # define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name)115 # define PGM_BTH_NAME(name) PGM_BTH_NAME_32BIT_PROT(name)116 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_32BIT_PT_FOR_PHYS117 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_32BIT_PD_PHYS118 # include "PGMGstDefs.h"119 # include "PGMAllGst.h"120 # include "PGMAllBth.h"121 # undef BTH_PGMPOOLKIND_PT_FOR_PT122 # undef BTH_PGMPOOLKIND_ROOT123 # undef PGM_BTH_NAME124 # undef PGM_GST_TYPE125 # undef PGM_GST_NAME120 # define PGM_GST_TYPE PGM_TYPE_PROT 121 # define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 122 # define PGM_BTH_NAME(name) PGM_BTH_NAME_32BIT_PROT(name) 123 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_32BIT_PT_FOR_PHYS 124 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_32BIT_PD_PHYS 125 # include "PGMGstDefs.h" 126 # include "PGMAllGst.h" 127 # include "PGMAllBth.h" 128 # undef BTH_PGMPOOLKIND_PT_FOR_PT 129 # undef BTH_PGMPOOLKIND_ROOT 130 # undef PGM_BTH_NAME 131 # undef PGM_GST_TYPE 132 # undef PGM_GST_NAME 126 133 127 134 /* Guest - 32-bit mode */ 128 #define PGM_GST_TYPE PGM_TYPE_32BIT 129 #define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 130 #define PGM_BTH_NAME(name) PGM_BTH_NAME_32BIT_32BIT(name) 131 #define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_32BIT_PT_FOR_32BIT_PT 132 #define BTH_PGMPOOLKIND_PT_FOR_BIG PGMPOOLKIND_32BIT_PT_FOR_32BIT_4MB 133 #define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_32BIT_PD 134 #include "PGMGstDefs.h" 135 #include "PGMAllGst.h" 136 #include "PGMAllBth.h" 137 #undef BTH_PGMPOOLKIND_PT_FOR_BIG 138 #undef BTH_PGMPOOLKIND_PT_FOR_PT 139 #undef BTH_PGMPOOLKIND_ROOT 140 #undef PGM_BTH_NAME 141 #undef PGM_GST_TYPE 142 #undef PGM_GST_NAME 143 144 #undef PGM_SHW_TYPE 145 #undef PGM_SHW_NAME 146 147 148 /* 149 * Shadow - PAE mode 150 */ 151 #define PGM_SHW_TYPE PGM_TYPE_PAE 152 #define PGM_SHW_NAME(name) PGM_SHW_NAME_PAE(name) 153 #define PGM_BTH_NAME(name) PGM_BTH_NAME_PAE_REAL(name) 154 #include "PGMAllShw.h" 155 156 /* Guest - real mode */ 157 #define PGM_GST_TYPE PGM_TYPE_REAL 158 #define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 159 #define PGM_BTH_NAME(name) PGM_BTH_NAME_PAE_REAL(name) 160 #define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PHYS 161 #define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_PAE_PDPT_PHYS 162 #include "PGMGstDefs.h" 163 #include "PGMAllBth.h" 164 #undef BTH_PGMPOOLKIND_PT_FOR_PT 165 #undef BTH_PGMPOOLKIND_ROOT 166 #undef PGM_BTH_NAME 167 #undef PGM_GST_TYPE 168 #undef PGM_GST_NAME 169 170 /* Guest - protected mode */ 171 #define PGM_GST_TYPE PGM_TYPE_PROT 172 #define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 173 #define PGM_BTH_NAME(name) PGM_BTH_NAME_PAE_PROT(name) 174 #define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PHYS 175 #define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_PAE_PDPT_PHYS 176 #include "PGMGstDefs.h" 177 #include "PGMAllBth.h" 178 #undef BTH_PGMPOOLKIND_PT_FOR_PT 179 #undef BTH_PGMPOOLKIND_ROOT 180 #undef PGM_BTH_NAME 181 #undef PGM_GST_TYPE 182 #undef PGM_GST_NAME 183 184 /* Guest - 32-bit mode */ 185 #define PGM_GST_TYPE PGM_TYPE_32BIT 186 #define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 187 #define PGM_BTH_NAME(name) PGM_BTH_NAME_PAE_32BIT(name) 188 #define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_32BIT_PT 189 #define BTH_PGMPOOLKIND_PT_FOR_BIG PGMPOOLKIND_PAE_PT_FOR_32BIT_4MB 190 #define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_PAE_PDPT_FOR_32BIT 191 #include "PGMGstDefs.h" 192 #include "PGMAllBth.h" 193 #undef BTH_PGMPOOLKIND_PT_FOR_BIG 194 #undef BTH_PGMPOOLKIND_PT_FOR_PT 195 #undef BTH_PGMPOOLKIND_ROOT 196 #undef PGM_BTH_NAME 197 #undef PGM_GST_TYPE 198 #undef PGM_GST_NAME 199 200 201 /* Guest - PAE mode */ 202 #define PGM_GST_TYPE PGM_TYPE_PAE 203 #define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 204 #define PGM_BTH_NAME(name) PGM_BTH_NAME_PAE_PAE(name) 205 #define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PAE_PT 206 #define BTH_PGMPOOLKIND_PT_FOR_BIG PGMPOOLKIND_PAE_PT_FOR_PAE_2MB 207 #define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_PAE_PDPT 208 #include "PGMGstDefs.h" 209 #include "PGMAllGst.h" 210 #include "PGMAllBth.h" 211 #undef BTH_PGMPOOLKIND_PT_FOR_BIG 212 #undef BTH_PGMPOOLKIND_PT_FOR_PT 213 #undef BTH_PGMPOOLKIND_ROOT 214 #undef PGM_BTH_NAME 215 #undef PGM_GST_TYPE 216 #undef PGM_GST_NAME 217 218 #undef PGM_SHW_TYPE 219 #undef PGM_SHW_NAME 220 221 222 /* 223 * Shadow - AMD64 mode 224 */ 225 #define PGM_SHW_TYPE PGM_TYPE_AMD64 226 #define PGM_SHW_NAME(name) PGM_SHW_NAME_AMD64(name) 227 #include "PGMAllShw.h" 228 229 /* Guest - protected mode (only used for AMD-V nested paging in 64 bits mode) */ 230 /** @todo retire this hack. */ 231 #define PGM_GST_TYPE PGM_TYPE_PROT 232 #define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 233 #define PGM_BTH_NAME(name) PGM_BTH_NAME_AMD64_PROT(name) 234 #define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PHYS 235 #define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_PAE_PD_PHYS 236 #include "PGMGstDefs.h" 237 #include "PGMAllBth.h" 238 #undef BTH_PGMPOOLKIND_PT_FOR_PT 239 #undef BTH_PGMPOOLKIND_ROOT 240 #undef PGM_BTH_NAME 241 #undef PGM_GST_TYPE 242 #undef PGM_GST_NAME 243 244 #ifdef VBOX_WITH_64_BITS_GUESTS 245 /* Guest - AMD64 mode */ 246 # define PGM_GST_TYPE PGM_TYPE_AMD64 247 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 248 # define PGM_BTH_NAME(name) PGM_BTH_NAME_AMD64_AMD64(name) 249 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PAE_PT 250 # define BTH_PGMPOOLKIND_PT_FOR_BIG PGMPOOLKIND_PAE_PT_FOR_PAE_2MB 251 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_64BIT_PML4 135 # define PGM_GST_TYPE PGM_TYPE_32BIT 136 # define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 137 # define PGM_BTH_NAME(name) PGM_BTH_NAME_32BIT_32BIT(name) 138 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_32BIT_PT_FOR_32BIT_PT 139 # define BTH_PGMPOOLKIND_PT_FOR_BIG PGMPOOLKIND_32BIT_PT_FOR_32BIT_4MB 140 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_32BIT_PD 252 141 # include "PGMGstDefs.h" 253 142 # include "PGMAllGst.h" … … 259 148 # undef PGM_GST_TYPE 260 149 # undef PGM_GST_NAME 261 #endif /* VBOX_WITH_64_BITS_GUESTS */ 262 263 #undef PGM_SHW_TYPE 264 #undef PGM_SHW_NAME 150 151 # undef PGM_SHW_TYPE 152 # undef PGM_SHW_NAME 153 154 155 /* 156 * Shadow - PAE mode 157 */ 158 # define PGM_SHW_TYPE PGM_TYPE_PAE 159 # define PGM_SHW_NAME(name) PGM_SHW_NAME_PAE(name) 160 # define PGM_BTH_NAME(name) PGM_BTH_NAME_PAE_REAL(name) 161 # include "PGMAllShw.h" 162 163 /* Guest - real mode */ 164 # define PGM_GST_TYPE PGM_TYPE_REAL 165 # define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 166 # define PGM_BTH_NAME(name) PGM_BTH_NAME_PAE_REAL(name) 167 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PHYS 168 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_PAE_PDPT_PHYS 169 # include "PGMGstDefs.h" 170 # include "PGMAllBth.h" 171 # undef BTH_PGMPOOLKIND_PT_FOR_PT 172 # undef BTH_PGMPOOLKIND_ROOT 173 # undef PGM_BTH_NAME 174 # undef PGM_GST_TYPE 175 # undef PGM_GST_NAME 176 177 /* Guest - protected mode */ 178 # define PGM_GST_TYPE PGM_TYPE_PROT 179 # define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 180 # define PGM_BTH_NAME(name) PGM_BTH_NAME_PAE_PROT(name) 181 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PHYS 182 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_PAE_PDPT_PHYS 183 # include "PGMGstDefs.h" 184 # include "PGMAllBth.h" 185 # undef BTH_PGMPOOLKIND_PT_FOR_PT 186 # undef BTH_PGMPOOLKIND_ROOT 187 # undef PGM_BTH_NAME 188 # undef PGM_GST_TYPE 189 # undef PGM_GST_NAME 190 191 /* Guest - 32-bit mode */ 192 # define PGM_GST_TYPE PGM_TYPE_32BIT 193 # define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 194 # define PGM_BTH_NAME(name) PGM_BTH_NAME_PAE_32BIT(name) 195 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_32BIT_PT 196 # define BTH_PGMPOOLKIND_PT_FOR_BIG PGMPOOLKIND_PAE_PT_FOR_32BIT_4MB 197 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_PAE_PDPT_FOR_32BIT 198 # include "PGMGstDefs.h" 199 # include "PGMAllBth.h" 200 # undef BTH_PGMPOOLKIND_PT_FOR_BIG 201 # undef BTH_PGMPOOLKIND_PT_FOR_PT 202 # undef BTH_PGMPOOLKIND_ROOT 203 # undef PGM_BTH_NAME 204 # undef PGM_GST_TYPE 205 # undef PGM_GST_NAME 206 207 208 /* Guest - PAE mode */ 209 # define PGM_GST_TYPE PGM_TYPE_PAE 210 # define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 211 # define PGM_BTH_NAME(name) PGM_BTH_NAME_PAE_PAE(name) 212 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PAE_PT 213 # define BTH_PGMPOOLKIND_PT_FOR_BIG PGMPOOLKIND_PAE_PT_FOR_PAE_2MB 214 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_PAE_PDPT 215 # include "PGMGstDefs.h" 216 # include "PGMAllGst.h" 217 # include "PGMAllBth.h" 218 # undef BTH_PGMPOOLKIND_PT_FOR_BIG 219 # undef BTH_PGMPOOLKIND_PT_FOR_PT 220 # undef BTH_PGMPOOLKIND_ROOT 221 # undef PGM_BTH_NAME 222 # undef PGM_GST_TYPE 223 # undef PGM_GST_NAME 224 225 # undef PGM_SHW_TYPE 226 # undef PGM_SHW_NAME 227 228 229 /* 230 * Shadow - AMD64 mode 231 */ 232 # define PGM_SHW_TYPE PGM_TYPE_AMD64 233 # define PGM_SHW_NAME(name) PGM_SHW_NAME_AMD64(name) 234 # include "PGMAllShw.h" 235 236 /* Guest - protected mode (only used for AMD-V nested paging in 64 bits mode) */ 237 /** @todo retire this hack. */ 238 # define PGM_GST_TYPE PGM_TYPE_PROT 239 # define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 240 # define PGM_BTH_NAME(name) PGM_BTH_NAME_AMD64_PROT(name) 241 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PHYS 242 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_PAE_PD_PHYS 243 # include "PGMGstDefs.h" 244 # include "PGMAllBth.h" 245 # undef BTH_PGMPOOLKIND_PT_FOR_PT 246 # undef BTH_PGMPOOLKIND_ROOT 247 # undef PGM_BTH_NAME 248 # undef PGM_GST_TYPE 249 # undef PGM_GST_NAME 250 251 # ifdef VBOX_WITH_64_BITS_GUESTS 252 /* Guest - AMD64 mode */ 253 # define PGM_GST_TYPE PGM_TYPE_AMD64 254 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 255 # define PGM_BTH_NAME(name) PGM_BTH_NAME_AMD64_AMD64(name) 256 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_PAE_PT_FOR_PAE_PT 257 # define BTH_PGMPOOLKIND_PT_FOR_BIG PGMPOOLKIND_PAE_PT_FOR_PAE_2MB 258 # define BTH_PGMPOOLKIND_ROOT PGMPOOLKIND_64BIT_PML4 259 # include "PGMGstDefs.h" 260 # include "PGMAllGst.h" 261 # include "PGMAllBth.h" 262 # undef BTH_PGMPOOLKIND_PT_FOR_BIG 263 # undef BTH_PGMPOOLKIND_PT_FOR_PT 264 # undef BTH_PGMPOOLKIND_ROOT 265 # undef PGM_BTH_NAME 266 # undef PGM_GST_TYPE 267 # undef PGM_GST_NAME 268 # endif /* VBOX_WITH_64_BITS_GUESTS */ 269 270 # undef PGM_SHW_TYPE 271 # undef PGM_SHW_NAME 265 272 266 273 … … 268 275 * Shadow - 32-bit nested paging mode. 269 276 */ 270 # define PGM_SHW_TYPE PGM_TYPE_NESTED_32BIT271 # define PGM_SHW_NAME(name) PGM_SHW_NAME_NESTED_32BIT(name)272 # include "PGMAllShw.h"277 # define PGM_SHW_TYPE PGM_TYPE_NESTED_32BIT 278 # define PGM_SHW_NAME(name) PGM_SHW_NAME_NESTED_32BIT(name) 279 # include "PGMAllShw.h" 273 280 274 281 /* Guest - real mode */ 275 #define PGM_GST_TYPE PGM_TYPE_REAL 276 #define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 277 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_32BIT_REAL(name) 278 #include "PGMGstDefs.h" 279 #include "PGMAllBth.h" 280 #undef PGM_BTH_NAME 281 #undef PGM_GST_TYPE 282 #undef PGM_GST_NAME 283 284 /* Guest - protected mode */ 285 #define PGM_GST_TYPE PGM_TYPE_PROT 286 #define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 287 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_32BIT_PROT(name) 288 #include "PGMGstDefs.h" 289 #include "PGMAllBth.h" 290 #undef PGM_BTH_NAME 291 #undef PGM_GST_TYPE 292 #undef PGM_GST_NAME 293 294 /* Guest - 32-bit mode */ 295 #define PGM_GST_TYPE PGM_TYPE_32BIT 296 #define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 297 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_32BIT_32BIT(name) 298 #include "PGMGstDefs.h" 299 #include "PGMAllBth.h" 300 #undef PGM_BTH_NAME 301 #undef PGM_GST_TYPE 302 #undef PGM_GST_NAME 303 304 /* Guest - PAE mode */ 305 #define PGM_GST_TYPE PGM_TYPE_PAE 306 #define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 307 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_32BIT_PAE(name) 308 #include "PGMGstDefs.h" 309 #include "PGMAllBth.h" 310 #undef PGM_BTH_NAME 311 #undef PGM_GST_TYPE 312 #undef PGM_GST_NAME 313 314 #ifdef VBOX_WITH_64_BITS_GUESTS 315 /* Guest - AMD64 mode */ 316 # define PGM_GST_TYPE PGM_TYPE_AMD64 317 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 318 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_32BIT_AMD64(name) 282 # define PGM_GST_TYPE PGM_TYPE_REAL 283 # define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 284 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_32BIT_REAL(name) 319 285 # include "PGMGstDefs.h" 320 286 # include "PGMAllBth.h" … … 322 288 # undef PGM_GST_TYPE 323 289 # undef PGM_GST_NAME 324 #endif /* VBOX_WITH_64_BITS_GUESTS */325 326 #undef PGM_SHW_TYPE327 #undef PGM_SHW_NAME328 329 330 /*331 * Shadow - PAE nested paging mode.332 */333 #define PGM_SHW_TYPE PGM_TYPE_NESTED_PAE334 #define PGM_SHW_NAME(name) PGM_SHW_NAME_NESTED_PAE(name)335 #include "PGMAllShw.h"336 337 /* Guest - real mode */338 #define PGM_GST_TYPE PGM_TYPE_REAL339 #define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name)340 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_PAE_REAL(name)341 #include "PGMGstDefs.h"342 #include "PGMAllBth.h"343 #undef PGM_BTH_NAME344 #undef PGM_GST_TYPE345 #undef PGM_GST_NAME346 290 347 291 /* Guest - protected mode */ 348 #define PGM_GST_TYPE PGM_TYPE_PROT 349 #define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 350 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_PAE_PROT(name) 351 #include "PGMGstDefs.h" 352 #include "PGMAllBth.h" 353 #undef PGM_BTH_NAME 354 #undef PGM_GST_TYPE 355 #undef PGM_GST_NAME 356 357 /* Guest - 32-bit mode */ 358 #define PGM_GST_TYPE PGM_TYPE_32BIT 359 #define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 360 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_PAE_32BIT(name) 361 #include "PGMGstDefs.h" 362 #include "PGMAllBth.h" 363 #undef PGM_BTH_NAME 364 #undef PGM_GST_TYPE 365 #undef PGM_GST_NAME 366 367 /* Guest - PAE mode */ 368 #define PGM_GST_TYPE PGM_TYPE_PAE 369 #define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 370 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_PAE_PAE(name) 371 #include "PGMGstDefs.h" 372 #include "PGMAllBth.h" 373 #undef PGM_BTH_NAME 374 #undef PGM_GST_TYPE 375 #undef PGM_GST_NAME 376 377 #ifdef VBOX_WITH_64_BITS_GUESTS 378 /* Guest - AMD64 mode */ 379 # define PGM_GST_TYPE PGM_TYPE_AMD64 380 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 381 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_PAE_AMD64(name) 292 # define PGM_GST_TYPE PGM_TYPE_PROT 293 # define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 294 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_32BIT_PROT(name) 382 295 # include "PGMGstDefs.h" 383 296 # include "PGMAllBth.h" … … 385 298 # undef PGM_GST_TYPE 386 299 # undef PGM_GST_NAME 387 #endif /* VBOX_WITH_64_BITS_GUESTS */388 389 #undef PGM_SHW_TYPE390 #undef PGM_SHW_NAME391 392 393 /*394 * Shadow - AMD64 nested paging mode.395 */396 #define PGM_SHW_TYPE PGM_TYPE_NESTED_AMD64397 #define PGM_SHW_NAME(name) PGM_SHW_NAME_NESTED_AMD64(name)398 #include "PGMAllShw.h"399 400 /* Guest - real mode */401 #define PGM_GST_TYPE PGM_TYPE_REAL402 #define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name)403 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64_REAL(name)404 #include "PGMGstDefs.h"405 #include "PGMAllBth.h"406 #undef PGM_BTH_NAME407 #undef PGM_GST_TYPE408 #undef PGM_GST_NAME409 410 /* Guest - protected mode */411 #define PGM_GST_TYPE PGM_TYPE_PROT412 #define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name)413 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64_PROT(name)414 #include "PGMGstDefs.h"415 #include "PGMAllBth.h"416 #undef PGM_BTH_NAME417 #undef PGM_GST_TYPE418 #undef PGM_GST_NAME419 300 420 301 /* Guest - 32-bit mode */ 421 #define PGM_GST_TYPE PGM_TYPE_32BIT 422 #define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 423 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64_32BIT(name) 424 #include "PGMGstDefs.h" 425 #include "PGMAllBth.h" 426 #undef PGM_BTH_NAME 427 #undef PGM_GST_TYPE 428 #undef PGM_GST_NAME 429 430 /* Guest - PAE mode */ 431 #define PGM_GST_TYPE PGM_TYPE_PAE 432 #define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 433 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64_PAE(name) 434 #include "PGMGstDefs.h" 435 #include "PGMAllBth.h" 436 #undef PGM_BTH_NAME 437 #undef PGM_GST_TYPE 438 #undef PGM_GST_NAME 439 440 #ifdef VBOX_WITH_64_BITS_GUESTS 441 /* Guest - AMD64 mode */ 442 # define PGM_GST_TYPE PGM_TYPE_AMD64 443 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 444 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64_AMD64(name) 302 # define PGM_GST_TYPE PGM_TYPE_32BIT 303 # define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 304 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_32BIT_32BIT(name) 445 305 # include "PGMGstDefs.h" 446 306 # include "PGMAllBth.h" … … 448 308 # undef PGM_GST_TYPE 449 309 # undef PGM_GST_NAME 450 #endif /* VBOX_WITH_64_BITS_GUESTS */ 451 452 #undef PGM_SHW_TYPE 453 #undef PGM_SHW_NAME 310 311 /* Guest - PAE mode */ 312 # define PGM_GST_TYPE PGM_TYPE_PAE 313 # define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 314 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_32BIT_PAE(name) 315 # include "PGMGstDefs.h" 316 # include "PGMAllBth.h" 317 # undef PGM_BTH_NAME 318 # undef PGM_GST_TYPE 319 # undef PGM_GST_NAME 320 321 # ifdef VBOX_WITH_64_BITS_GUESTS 322 /* Guest - AMD64 mode */ 323 # define PGM_GST_TYPE PGM_TYPE_AMD64 324 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 325 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_32BIT_AMD64(name) 326 # include "PGMGstDefs.h" 327 # include "PGMAllBth.h" 328 # undef PGM_BTH_NAME 329 # undef PGM_GST_TYPE 330 # undef PGM_GST_NAME 331 # endif /* VBOX_WITH_64_BITS_GUESTS */ 332 333 # undef PGM_SHW_TYPE 334 # undef PGM_SHW_NAME 335 336 337 /* 338 * Shadow - PAE nested paging mode. 339 */ 340 # define PGM_SHW_TYPE PGM_TYPE_NESTED_PAE 341 # define PGM_SHW_NAME(name) PGM_SHW_NAME_NESTED_PAE(name) 342 # include "PGMAllShw.h" 343 344 /* Guest - real mode */ 345 # define PGM_GST_TYPE PGM_TYPE_REAL 346 # define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 347 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_PAE_REAL(name) 348 # include "PGMGstDefs.h" 349 # include "PGMAllBth.h" 350 # undef PGM_BTH_NAME 351 # undef PGM_GST_TYPE 352 # undef PGM_GST_NAME 353 354 /* Guest - protected mode */ 355 # define PGM_GST_TYPE PGM_TYPE_PROT 356 # define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 357 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_PAE_PROT(name) 358 # include "PGMGstDefs.h" 359 # include "PGMAllBth.h" 360 # undef PGM_BTH_NAME 361 # undef PGM_GST_TYPE 362 # undef PGM_GST_NAME 363 364 /* Guest - 32-bit mode */ 365 # define PGM_GST_TYPE PGM_TYPE_32BIT 366 # define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 367 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_PAE_32BIT(name) 368 # include "PGMGstDefs.h" 369 # include "PGMAllBth.h" 370 # undef PGM_BTH_NAME 371 # undef PGM_GST_TYPE 372 # undef PGM_GST_NAME 373 374 /* Guest - PAE mode */ 375 # define PGM_GST_TYPE PGM_TYPE_PAE 376 # define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 377 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_PAE_PAE(name) 378 # include "PGMGstDefs.h" 379 # include "PGMAllBth.h" 380 # undef PGM_BTH_NAME 381 # undef PGM_GST_TYPE 382 # undef PGM_GST_NAME 383 384 # ifdef VBOX_WITH_64_BITS_GUESTS 385 /* Guest - AMD64 mode */ 386 # define PGM_GST_TYPE PGM_TYPE_AMD64 387 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 388 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_PAE_AMD64(name) 389 # include "PGMGstDefs.h" 390 # include "PGMAllBth.h" 391 # undef PGM_BTH_NAME 392 # undef PGM_GST_TYPE 393 # undef PGM_GST_NAME 394 # endif /* VBOX_WITH_64_BITS_GUESTS */ 395 396 # undef PGM_SHW_TYPE 397 # undef PGM_SHW_NAME 398 399 400 /* 401 * Shadow - AMD64 nested paging mode. 402 */ 403 # define PGM_SHW_TYPE PGM_TYPE_NESTED_AMD64 404 # define PGM_SHW_NAME(name) PGM_SHW_NAME_NESTED_AMD64(name) 405 # include "PGMAllShw.h" 406 407 /* Guest - real mode */ 408 # define PGM_GST_TYPE PGM_TYPE_REAL 409 # define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 410 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64_REAL(name) 411 # include "PGMGstDefs.h" 412 # include "PGMAllBth.h" 413 # undef PGM_BTH_NAME 414 # undef PGM_GST_TYPE 415 # undef PGM_GST_NAME 416 417 /* Guest - protected mode */ 418 # define PGM_GST_TYPE PGM_TYPE_PROT 419 # define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 420 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64_PROT(name) 421 # include "PGMGstDefs.h" 422 # include "PGMAllBth.h" 423 # undef PGM_BTH_NAME 424 # undef PGM_GST_TYPE 425 # undef PGM_GST_NAME 426 427 /* Guest - 32-bit mode */ 428 # define PGM_GST_TYPE PGM_TYPE_32BIT 429 # define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 430 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64_32BIT(name) 431 # include "PGMGstDefs.h" 432 # include "PGMAllBth.h" 433 # undef PGM_BTH_NAME 434 # undef PGM_GST_TYPE 435 # undef PGM_GST_NAME 436 437 /* Guest - PAE mode */ 438 # define PGM_GST_TYPE PGM_TYPE_PAE 439 # define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 440 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64_PAE(name) 441 # include "PGMGstDefs.h" 442 # include "PGMAllBth.h" 443 # undef PGM_BTH_NAME 444 # undef PGM_GST_TYPE 445 # undef PGM_GST_NAME 446 447 # ifdef VBOX_WITH_64_BITS_GUESTS 448 /* Guest - AMD64 mode */ 449 # define PGM_GST_TYPE PGM_TYPE_AMD64 450 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 451 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64_AMD64(name) 452 # include "PGMGstDefs.h" 453 # include "PGMAllBth.h" 454 # undef PGM_BTH_NAME 455 # undef PGM_GST_TYPE 456 # undef PGM_GST_NAME 457 # endif /* VBOX_WITH_64_BITS_GUESTS */ 458 459 # undef PGM_SHW_TYPE 460 # undef PGM_SHW_NAME 454 461 455 462 … … 457 464 * Shadow - EPT. 458 465 */ 459 # define PGM_SHW_TYPE PGM_TYPE_EPT460 # define PGM_SHW_NAME(name) PGM_SHW_NAME_EPT(name)461 # include "PGMAllShw.h"466 # define PGM_SHW_TYPE PGM_TYPE_EPT 467 # define PGM_SHW_NAME(name) PGM_SHW_NAME_EPT(name) 468 # include "PGMAllShw.h" 462 469 463 470 /* Guest - real mode */ 464 #define PGM_GST_TYPE PGM_TYPE_REAL 465 #define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 466 #define PGM_BTH_NAME(name) PGM_BTH_NAME_EPT_REAL(name) 467 #define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS 468 #include "PGMGstDefs.h" 469 #include "PGMAllBth.h" 470 #undef BTH_PGMPOOLKIND_PT_FOR_PT 471 #undef PGM_BTH_NAME 472 #undef PGM_GST_TYPE 473 #undef PGM_GST_NAME 474 475 /* Guest - protected mode */ 476 #define PGM_GST_TYPE PGM_TYPE_PROT 477 #define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 478 #define PGM_BTH_NAME(name) PGM_BTH_NAME_EPT_PROT(name) 479 #define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS 480 #include "PGMGstDefs.h" 481 #include "PGMAllBth.h" 482 #undef BTH_PGMPOOLKIND_PT_FOR_PT 483 #undef PGM_BTH_NAME 484 #undef PGM_GST_TYPE 485 #undef PGM_GST_NAME 486 487 /* Guest - 32-bit mode */ 488 #define PGM_GST_TYPE PGM_TYPE_32BIT 489 #define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 490 #define PGM_BTH_NAME(name) PGM_BTH_NAME_EPT_32BIT(name) 491 #define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS 492 #include "PGMGstDefs.h" 493 #include "PGMAllBth.h" 494 #undef BTH_PGMPOOLKIND_PT_FOR_PT 495 #undef PGM_BTH_NAME 496 #undef PGM_GST_TYPE 497 #undef PGM_GST_NAME 498 499 /* Guest - PAE mode */ 500 #define PGM_GST_TYPE PGM_TYPE_PAE 501 #define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 502 #define PGM_BTH_NAME(name) PGM_BTH_NAME_EPT_PAE(name) 503 #define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS 504 #include "PGMGstDefs.h" 505 #include "PGMAllBth.h" 506 #undef BTH_PGMPOOLKIND_PT_FOR_PT 507 #undef PGM_BTH_NAME 508 #undef PGM_GST_TYPE 509 #undef PGM_GST_NAME 510 511 #ifdef VBOX_WITH_64_BITS_GUESTS 512 /* Guest - AMD64 mode */ 513 # define PGM_GST_TYPE PGM_TYPE_AMD64 514 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 515 # define PGM_BTH_NAME(name) PGM_BTH_NAME_EPT_AMD64(name) 516 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS 471 # define PGM_GST_TYPE PGM_TYPE_REAL 472 # define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 473 # define PGM_BTH_NAME(name) PGM_BTH_NAME_EPT_REAL(name) 474 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS 517 475 # include "PGMGstDefs.h" 518 476 # include "PGMAllBth.h" … … 521 479 # undef PGM_GST_TYPE 522 480 # undef PGM_GST_NAME 523 #endif /* VBOX_WITH_64_BITS_GUESTS */ 524 525 #undef PGM_SHW_TYPE 526 #undef PGM_SHW_NAME 481 482 /* Guest - protected mode */ 483 # define PGM_GST_TYPE PGM_TYPE_PROT 484 # define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 485 # define PGM_BTH_NAME(name) PGM_BTH_NAME_EPT_PROT(name) 486 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS 487 # include "PGMGstDefs.h" 488 # include "PGMAllBth.h" 489 # undef BTH_PGMPOOLKIND_PT_FOR_PT 490 # undef PGM_BTH_NAME 491 # undef PGM_GST_TYPE 492 # undef PGM_GST_NAME 493 494 /* Guest - 32-bit mode */ 495 # define PGM_GST_TYPE PGM_TYPE_32BIT 496 # define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 497 # define PGM_BTH_NAME(name) PGM_BTH_NAME_EPT_32BIT(name) 498 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS 499 # include "PGMGstDefs.h" 500 # include "PGMAllBth.h" 501 # undef BTH_PGMPOOLKIND_PT_FOR_PT 502 # undef PGM_BTH_NAME 503 # undef PGM_GST_TYPE 504 # undef PGM_GST_NAME 505 506 /* Guest - PAE mode */ 507 # define PGM_GST_TYPE PGM_TYPE_PAE 508 # define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 509 # define PGM_BTH_NAME(name) PGM_BTH_NAME_EPT_PAE(name) 510 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS 511 # include "PGMGstDefs.h" 512 # include "PGMAllBth.h" 513 # undef BTH_PGMPOOLKIND_PT_FOR_PT 514 # undef PGM_BTH_NAME 515 # undef PGM_GST_TYPE 516 # undef PGM_GST_NAME 517 518 # ifdef VBOX_WITH_64_BITS_GUESTS 519 /* Guest - AMD64 mode */ 520 # define PGM_GST_TYPE PGM_TYPE_AMD64 521 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 522 # define PGM_BTH_NAME(name) PGM_BTH_NAME_EPT_AMD64(name) 523 # define BTH_PGMPOOLKIND_PT_FOR_PT PGMPOOLKIND_EPT_PT_FOR_PHYS 524 # include "PGMGstDefs.h" 525 # include "PGMAllBth.h" 526 # undef BTH_PGMPOOLKIND_PT_FOR_PT 527 # undef PGM_BTH_NAME 528 # undef PGM_GST_TYPE 529 # undef PGM_GST_NAME 530 # endif /* VBOX_WITH_64_BITS_GUESTS */ 531 532 # undef PGM_SHW_TYPE 533 # undef PGM_SHW_NAME 527 534 528 535 … … 530 537 * Shadow - NEM / None. 531 538 */ 532 # define PGM_SHW_TYPE PGM_TYPE_NONE533 # define PGM_SHW_NAME(name) PGM_SHW_NAME_NONE(name)534 # include "PGMAllShw.h"539 # define PGM_SHW_TYPE PGM_TYPE_NONE 540 # define PGM_SHW_NAME(name) PGM_SHW_NAME_NONE(name) 541 # include "PGMAllShw.h" 535 542 536 543 /* Guest - real mode */ 537 #define PGM_GST_TYPE PGM_TYPE_REAL 538 #define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 539 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_REAL(name) 540 #include "PGMGstDefs.h" 541 #include "PGMAllBth.h" 542 #undef PGM_BTH_NAME 543 #undef PGM_GST_TYPE 544 #undef PGM_GST_NAME 545 546 /* Guest - protected mode */ 547 #define PGM_GST_TYPE PGM_TYPE_PROT 548 #define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 549 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_PROT(name) 550 #include "PGMGstDefs.h" 551 #include "PGMAllBth.h" 552 #undef PGM_BTH_NAME 553 #undef PGM_GST_TYPE 554 #undef PGM_GST_NAME 555 556 /* Guest - 32-bit mode */ 557 #define PGM_GST_TYPE PGM_TYPE_32BIT 558 #define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 559 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_32BIT(name) 560 #include "PGMGstDefs.h" 561 #include "PGMAllBth.h" 562 #undef PGM_BTH_NAME 563 #undef PGM_GST_TYPE 564 #undef PGM_GST_NAME 565 566 /* Guest - PAE mode */ 567 #define PGM_GST_TYPE PGM_TYPE_PAE 568 #define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 569 #define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_PAE(name) 570 #include "PGMGstDefs.h" 571 #include "PGMAllBth.h" 572 #undef PGM_BTH_NAME 573 #undef PGM_GST_TYPE 574 #undef PGM_GST_NAME 575 576 #ifdef VBOX_WITH_64_BITS_GUESTS 577 /* Guest - AMD64 mode */ 578 # define PGM_GST_TYPE PGM_TYPE_AMD64 579 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 580 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_AMD64(name) 544 # define PGM_GST_TYPE PGM_TYPE_REAL 545 # define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 546 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_REAL(name) 581 547 # include "PGMGstDefs.h" 582 548 # include "PGMAllBth.h" … … 584 550 # undef PGM_GST_TYPE 585 551 # undef PGM_GST_NAME 586 #endif /* VBOX_WITH_64_BITS_GUESTS */ 587 588 #undef PGM_SHW_TYPE 589 #undef PGM_SHW_NAME 552 553 /* Guest - protected mode */ 554 # define PGM_GST_TYPE PGM_TYPE_PROT 555 # define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 556 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_PROT(name) 557 # include "PGMGstDefs.h" 558 # include "PGMAllBth.h" 559 # undef PGM_BTH_NAME 560 # undef PGM_GST_TYPE 561 # undef PGM_GST_NAME 562 563 /* Guest - 32-bit mode */ 564 # define PGM_GST_TYPE PGM_TYPE_32BIT 565 # define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 566 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_32BIT(name) 567 # include "PGMGstDefs.h" 568 # include "PGMAllBth.h" 569 # undef PGM_BTH_NAME 570 # undef PGM_GST_TYPE 571 # undef PGM_GST_NAME 572 573 /* Guest - PAE mode */ 574 # define PGM_GST_TYPE PGM_TYPE_PAE 575 # define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 576 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_PAE(name) 577 # include "PGMGstDefs.h" 578 # include "PGMAllBth.h" 579 # undef PGM_BTH_NAME 580 # undef PGM_GST_TYPE 581 # undef PGM_GST_NAME 582 583 # ifdef VBOX_WITH_64_BITS_GUESTS 584 /* Guest - AMD64 mode */ 585 # define PGM_GST_TYPE PGM_TYPE_AMD64 586 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 587 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_AMD64(name) 588 # include "PGMGstDefs.h" 589 # include "PGMAllBth.h" 590 # undef PGM_BTH_NAME 591 # undef PGM_GST_TYPE 592 # undef PGM_GST_NAME 593 # endif /* VBOX_WITH_64_BITS_GUESTS */ 594 595 # undef PGM_SHW_TYPE 596 # undef PGM_SHW_NAME 590 597 591 598 … … 604 611 PGM_GST_NAME_REAL(Enter), 605 612 PGM_GST_NAME_REAL(Exit), 606 # ifdef IN_RING3613 # ifdef IN_RING3 607 614 PGM_GST_NAME_REAL(Relocate), 608 # endif615 # endif 609 616 }, 610 617 { … … 615 622 PGM_GST_NAME_PROT(Enter), 616 623 PGM_GST_NAME_PROT(Exit), 617 # ifdef IN_RING3624 # ifdef IN_RING3 618 625 PGM_GST_NAME_PROT(Relocate), 619 # endif626 # endif 620 627 }, 621 628 { … … 626 633 PGM_GST_NAME_32BIT(Enter), 627 634 PGM_GST_NAME_32BIT(Exit), 628 # ifdef IN_RING3635 # ifdef IN_RING3 629 636 PGM_GST_NAME_32BIT(Relocate), 630 # endif637 # endif 631 638 }, 632 639 { … … 637 644 PGM_GST_NAME_PAE(Enter), 638 645 PGM_GST_NAME_PAE(Exit), 639 # ifdef IN_RING3646 # ifdef IN_RING3 640 647 PGM_GST_NAME_PAE(Relocate), 641 # endif648 # endif 642 649 }, 643 # ifdef VBOX_WITH_64_BITS_GUESTS650 # ifdef VBOX_WITH_64_BITS_GUESTS 644 651 { 645 652 PGM_TYPE_AMD64, … … 649 656 PGM_GST_NAME_AMD64(Enter), 650 657 PGM_GST_NAME_AMD64(Exit), 651 # ifdef IN_RING3658 # ifdef IN_RING3 652 659 PGM_GST_NAME_AMD64(Relocate), 660 # endif 661 }, 653 662 # endif 654 },655 #endif656 663 }; 657 664 … … 671 678 PGM_SHW_NAME_32BIT(Enter), 672 679 PGM_SHW_NAME_32BIT(Exit), 673 # ifdef IN_RING3680 # ifdef IN_RING3 674 681 PGM_SHW_NAME_32BIT(Relocate), 675 # endif682 # endif 676 683 }, 677 684 { … … 681 688 PGM_SHW_NAME_PAE(Enter), 682 689 PGM_SHW_NAME_PAE(Exit), 683 # ifdef IN_RING3690 # ifdef IN_RING3 684 691 PGM_SHW_NAME_PAE(Relocate), 685 # endif692 # endif 686 693 }, 687 694 { … … 691 698 PGM_SHW_NAME_AMD64(Enter), 692 699 PGM_SHW_NAME_AMD64(Exit), 693 # ifdef IN_RING3700 # ifdef IN_RING3 694 701 PGM_SHW_NAME_AMD64(Relocate), 695 # endif702 # endif 696 703 }, 697 704 { … … 701 708 PGM_SHW_NAME_NESTED_32BIT(Enter), 702 709 PGM_SHW_NAME_NESTED_32BIT(Exit), 703 # ifdef IN_RING3710 # ifdef IN_RING3 704 711 PGM_SHW_NAME_NESTED_32BIT(Relocate), 705 # endif712 # endif 706 713 }, 707 714 { … … 711 718 PGM_SHW_NAME_NESTED_PAE(Enter), 712 719 PGM_SHW_NAME_NESTED_PAE(Exit), 713 # ifdef IN_RING3720 # ifdef IN_RING3 714 721 PGM_SHW_NAME_NESTED_PAE(Relocate), 715 # endif722 # endif 716 723 }, 717 724 { … … 721 728 PGM_SHW_NAME_NESTED_AMD64(Enter), 722 729 PGM_SHW_NAME_NESTED_AMD64(Exit), 723 # ifdef IN_RING3730 # ifdef IN_RING3 724 731 PGM_SHW_NAME_NESTED_AMD64(Relocate), 725 # endif732 # endif 726 733 }, 727 734 { … … 731 738 PGM_SHW_NAME_EPT(Enter), 732 739 PGM_SHW_NAME_EPT(Exit), 733 # ifdef IN_RING3740 # ifdef IN_RING3 734 741 PGM_SHW_NAME_EPT(Relocate), 735 # endif742 # endif 736 743 }, 737 744 { … … 741 748 PGM_SHW_NAME_NONE(Enter), 742 749 PGM_SHW_NAME_NONE(Exit), 743 # ifdef IN_RING3750 # ifdef IN_RING3 744 751 PGM_SHW_NAME_NONE(Relocate), 745 # endif752 # endif 746 753 }, 747 754 }; … … 753 760 PGMMODEDATABTH const g_aPgmBothModeData[PGM_BOTH_MODE_DATA_ARRAY_SIZE] = 754 761 { 755 # if !defined(IN_RING3) && !defined(VBOX_STRICT)756 # define PGMMODEDATABTH_NULL_ENTRY() { UINT32_MAX, UINT32_MAX, NULL, NULL, NULL, NULL, NULL, NULL, NULL }757 # define PGMMODEDATABTH_ENTRY(uShwT, uGstT, Nm) \762 # if !defined(IN_RING3) && !defined(VBOX_STRICT) 763 # define PGMMODEDATABTH_NULL_ENTRY() { UINT32_MAX, UINT32_MAX, NULL, NULL, NULL, NULL, NULL, NULL, NULL } 764 # define PGMMODEDATABTH_ENTRY(uShwT, uGstT, Nm) \ 758 765 { uShwT, uGstT, Nm(InvalidatePage), Nm(SyncCR3), Nm(PrefetchPage), Nm(MapCR3), Nm(UnmapCR3), Nm(Enter), Nm(Trap0eHandler), Nm(NestedTrap0eHandler) } 759 766 760 # elif !defined(IN_RING3) && defined(VBOX_STRICT)761 # define PGMMODEDATABTH_NULL_ENTRY() { UINT32_MAX, UINT32_MAX, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }762 # define PGMMODEDATABTH_ENTRY(uShwT, uGstT, Nm) \767 # elif !defined(IN_RING3) && defined(VBOX_STRICT) 768 # define PGMMODEDATABTH_NULL_ENTRY() { UINT32_MAX, UINT32_MAX, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } 769 # define PGMMODEDATABTH_ENTRY(uShwT, uGstT, Nm) \ 763 770 { uShwT, uGstT, Nm(InvalidatePage), Nm(SyncCR3), Nm(PrefetchPage), Nm(MapCR3), Nm(UnmapCR3), Nm(Enter), Nm(Trap0eHandler), Nm(NestedTrap0eHandler), Nm(AssertCR3) } 764 771 765 # elif defined(IN_RING3) && !defined(VBOX_STRICT)766 # define PGMMODEDATABTH_NULL_ENTRY() { UINT32_MAX, UINT32_MAX, NULL, NULL, NULL, NULL, NULL, NULL }767 # define PGMMODEDATABTH_ENTRY(uShwT, uGstT, Nm) \772 # elif defined(IN_RING3) && !defined(VBOX_STRICT) 773 # define PGMMODEDATABTH_NULL_ENTRY() { UINT32_MAX, UINT32_MAX, NULL, NULL, NULL, NULL, NULL, NULL } 774 # define PGMMODEDATABTH_ENTRY(uShwT, uGstT, Nm) \ 768 775 { uShwT, uGstT, Nm(InvalidatePage), Nm(SyncCR3), Nm(PrefetchPage), Nm(MapCR3), Nm(UnmapCR3), Nm(Enter), } 769 776 770 # elif defined(IN_RING3) && defined(VBOX_STRICT)771 # define PGMMODEDATABTH_NULL_ENTRY() { UINT32_MAX, UINT32_MAX, NULL, NULL, NULL, NULL, NULL, NULL, NULL }772 # define PGMMODEDATABTH_ENTRY(uShwT, uGstT, Nm) \777 # elif defined(IN_RING3) && defined(VBOX_STRICT) 778 # define PGMMODEDATABTH_NULL_ENTRY() { UINT32_MAX, UINT32_MAX, NULL, NULL, NULL, NULL, NULL, NULL, NULL } 779 # define PGMMODEDATABTH_ENTRY(uShwT, uGstT, Nm) \ 773 780 { uShwT, uGstT, Nm(InvalidatePage), Nm(SyncCR3), Nm(PrefetchPage), Nm(MapCR3), Nm(UnmapCR3), Nm(Enter), Nm(AssertCR3) } 774 781 775 # else776 # error "Misconfig."777 # endif782 # else 783 # error "Misconfig." 784 # endif 778 785 779 786 /* 32-bit shadow paging mode: */ … … 809 816 PGMMODEDATABTH_NULL_ENTRY(), //PGMMODEDATABTH_ENTRY(PGM_TYPE_AMD64, PGM_TYPE_32BIT, PGM_BTH_NAME_AMD64_32BIT), 810 817 PGMMODEDATABTH_NULL_ENTRY(), //PGMMODEDATABTH_ENTRY(PGM_TYPE_AMD64, PGM_TYPE_PAE, PGM_BTH_NAME_AMD64_PAE), 811 # ifdef VBOX_WITH_64_BITS_GUESTS818 # ifdef VBOX_WITH_64_BITS_GUESTS 812 819 PGMMODEDATABTH_ENTRY(PGM_TYPE_AMD64, PGM_TYPE_AMD64, PGM_BTH_NAME_AMD64_AMD64), 813 # else820 # else 814 821 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_AMD64, PGM_TYPE_AMD64 - illegal */ 815 # endif822 # endif 816 823 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_AMD64, PGM_TYPE_NESTED_32BIT - illegal */ 817 824 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_AMD64, PGM_TYPE_NESTED_PAE - illegal */ … … 826 833 PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_32BIT, PGM_TYPE_32BIT, PGM_BTH_NAME_NESTED_32BIT_32BIT), 827 834 PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_32BIT, PGM_TYPE_PAE, PGM_BTH_NAME_NESTED_32BIT_PAE), 828 # ifdef VBOX_WITH_64_BITS_GUESTS835 # ifdef VBOX_WITH_64_BITS_GUESTS 829 836 PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_32BIT, PGM_TYPE_AMD64, PGM_BTH_NAME_NESTED_32BIT_AMD64), 830 # else837 # else 831 838 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_32BIT, PGM_TYPE_AMD64 - illegal */ 832 # endif839 # endif 833 840 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_32BIT, PGM_TYPE_NESTED_32BIT - illegal */ 834 841 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_32BIT, PGM_TYPE_NESTED_PAE - illegal */ … … 843 850 PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_PAE, PGM_TYPE_32BIT, PGM_BTH_NAME_NESTED_PAE_32BIT), 844 851 PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_PAE, PGM_TYPE_PAE, PGM_BTH_NAME_NESTED_PAE_PAE), 845 # ifdef VBOX_WITH_64_BITS_GUESTS852 # ifdef VBOX_WITH_64_BITS_GUESTS 846 853 PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_PAE, PGM_TYPE_AMD64, PGM_BTH_NAME_NESTED_PAE_AMD64), 847 # else854 # else 848 855 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_PAE, PGM_TYPE_AMD64 - illegal */ 849 # endif856 # endif 850 857 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_PAE, PGM_TYPE_NESTED_32BIT - illegal */ 851 858 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_PAE, PGM_TYPE_NESTED_PAE - illegal */ … … 860 867 PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_AMD64, PGM_TYPE_32BIT, PGM_BTH_NAME_NESTED_AMD64_32BIT), 861 868 PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_AMD64, PGM_TYPE_PAE, PGM_BTH_NAME_NESTED_AMD64_PAE), 862 # ifdef VBOX_WITH_64_BITS_GUESTS869 # ifdef VBOX_WITH_64_BITS_GUESTS 863 870 PGMMODEDATABTH_ENTRY(PGM_TYPE_NESTED_AMD64, PGM_TYPE_AMD64, PGM_BTH_NAME_NESTED_AMD64_AMD64), 864 # else871 # else 865 872 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_AMD64, PGM_TYPE_AMD64 - illegal */ 866 # endif873 # endif 867 874 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_AMD64, PGM_TYPE_NESTED_32BIT - illegal */ 868 875 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_AMD64, PGM_TYPE_NESTED_PAE - illegal */ … … 877 884 PGMMODEDATABTH_ENTRY(PGM_TYPE_EPT, PGM_TYPE_32BIT, PGM_BTH_NAME_EPT_32BIT), 878 885 PGMMODEDATABTH_ENTRY(PGM_TYPE_EPT, PGM_TYPE_PAE, PGM_BTH_NAME_EPT_PAE), 879 # ifdef VBOX_WITH_64_BITS_GUESTS886 # ifdef VBOX_WITH_64_BITS_GUESTS 880 887 PGMMODEDATABTH_ENTRY(PGM_TYPE_EPT, PGM_TYPE_AMD64, PGM_BTH_NAME_EPT_AMD64), 881 # else888 # else 882 889 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_EPT, PGM_TYPE_AMD64 - illegal */ 883 # endif890 # endif 884 891 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_EPT, PGM_TYPE_NESTED_32BIT - illegal */ 885 892 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_EPT, PGM_TYPE_NESTED_PAE - illegal */ … … 894 901 PGMMODEDATABTH_ENTRY(PGM_TYPE_NONE, PGM_TYPE_32BIT, PGM_BTH_NAME_EPT_32BIT), 895 902 PGMMODEDATABTH_ENTRY(PGM_TYPE_NONE, PGM_TYPE_PAE, PGM_BTH_NAME_EPT_PAE), 896 # ifdef VBOX_WITH_64_BITS_GUESTS903 # ifdef VBOX_WITH_64_BITS_GUESTS 897 904 PGMMODEDATABTH_ENTRY(PGM_TYPE_NONE, PGM_TYPE_AMD64, PGM_BTH_NAME_EPT_AMD64), 898 # else905 # else 899 906 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_AMD64 - illegal */ 900 # endif907 # endif 901 908 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_NESTED_32BIT - illegal */ 902 909 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_NESTED_PAE - illegal */ … … 906 913 907 914 908 # undef PGMMODEDATABTH_ENTRY909 # undef PGMMODEDATABTH_NULL_ENTRY915 # undef PGMMODEDATABTH_ENTRY 916 # undef PGMMODEDATABTH_NULL_ENTRY 910 917 }; 911 918 … … 927 934 /* [PGMMODE_NESTED_AMD64] = */ X86_CR3_AMD64_PAGE_MASK, 928 935 /* [PGMMODE_EPT] = */ X86_CR3_EPT_PAGE_MASK, 936 /* [12] = */ 0, 937 /* [13] = */ 0, 938 /* [14] = */ 0, 939 /* [15] = */ 0, 940 /* [16] = */ 0, 941 /* [17] = */ 0, 942 /* [18] = */ 0, 943 /* [19] = */ 0, 944 /* [20] = */ 0, 945 /* [21] = */ 0, 946 /* [22] = */ 0, 947 /* [23] = */ 0, 948 /* [24] = */ 0, 949 /* [25] = */ 0, 950 /* [26] = */ 0, 951 /* [27] = */ 0, 952 /* [28] = */ 0, 953 /* [29] = */ 0, 954 /* [30] = */ 0, 955 /* [31] = */ 0, 929 956 /* [PGMMODE_NONE] = */ X86_CR3_AMD64_PAGE_MASK, 930 957 }; 931 958 AssertCompile(PGMMODE_NONE == 32); 959 960 961 #elif defined(VBOX_VMM_TARGET_ARMV8) 962 963 /** @todo Proper ARMv8 guest support for PGM */ 964 # include "PGMAllGst-armv8.h" 965 966 #else 967 # error "port me" 968 #endif 969 970 971 #ifdef VBOX_VMM_TARGET_X86 932 972 933 973 /** … … 974 1014 975 1015 976 # ifdef IN_RING0977 /** 978 * #PF Handler.1016 # ifdef IN_RING0 1017 /** 1018 * \#PF Handler. 979 1019 * 980 1020 * @returns VBox status code (appropriate for trap handling and GC return). … … 993 1033 994 1034 995 # ifdef VBOX_WITH_STATISTICS1035 # ifdef VBOX_WITH_STATISTICS 996 1036 /* 997 1037 * Error code stats. … … 1031 1071 STAM_COUNTER_INC(&pVCpu->pgm.s.Stats.StatRZTrap0eSVReserved); 1032 1072 } 1033 # endif /* VBOX_WITH_STATISTICS */1073 # endif /* VBOX_WITH_STATISTICS */ 1034 1074 1035 1075 /* … … 1074 1114 return rc; 1075 1115 } 1076 # endif /* IN_RING0 */1116 # endif /* IN_RING0 */ 1077 1117 1078 1118 … … 1282 1322 } 1283 1323 1284 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE1324 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1285 1325 1286 1326 /** … … 1742 1782 1743 1783 1744 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT1784 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 1745 1785 /** 1746 1786 * Syncs the SHADOW nested-guest page directory pointer for the specified address. … … 1849 1889 return VINF_SUCCESS; 1850 1890 } 1851 # endif /* VBOX_WITH_NESTED_HWVIRT_VMX_EPT */1852 1853 1854 # ifdef IN_RING01891 # endif /* VBOX_WITH_NESTED_HWVIRT_VMX_EPT */ 1892 1893 1894 # ifdef IN_RING0 1855 1895 /** 1856 1896 * Synchronizes a range of nested page table entries. … … 1907 1947 return rc; 1908 1948 } 1909 # endif /* IN_RING0 */ 1910 1911 #endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */ 1949 # endif /* IN_RING0 */ 1950 1951 # endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */ 1952 1953 #endif /* VBOX_VMM_TARGET_X86 */ 1954 1912 1955 1913 1956 /** … … 1924 1967 VMCPU_ASSERT_EMT(pVCpu); 1925 1968 Assert(pWalk); 1969 #ifdef VBOX_VMM_TARGET_X86 1926 1970 uintptr_t idx = pVCpu->pgm.s.idxGuestModeData; 1927 1971 AssertReturn(idx < RT_ELEMENTS(g_aPgmGuestModeData), VERR_PGM_MODE_IPE); 1928 1972 AssertReturn(g_aPgmGuestModeData[idx].pfnGetPage, VERR_PGM_MODE_IPE); 1929 1973 return g_aPgmGuestModeData[idx].pfnGetPage(pVCpu, GCPtr, pWalk); 1930 } 1931 1974 1975 #elif defined(VBOX_VMM_TARGET_ARMV8) 1976 return pgmGstGetPageArmv8Hack(pVCpu, GCPtr, pWalk); 1977 #else 1978 # error "port me" 1979 #endif 1980 } 1981 1982 #ifdef VBOX_VMM_TARGET_X86 1932 1983 1933 1984 /** … … 1980 2031 1981 2032 1982 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT2033 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 1983 2034 /** 1984 2035 * Unmaps the guest CR3. … … 1994 2045 return g_aPgmBothModeData[idxBth].pfnUnmapCR3(pVCpu); 1995 2046 } 1996 #endif 2047 # endif 2048 2049 #endif /* VBOX_VMM_TARGET_X86 */ 1997 2050 1998 2051 … … 2018 2071 { 2019 2072 VMCPU_ASSERT_EMT(pVCpu); 2073 #ifdef VBOX_VMM_TARGET_X86 2020 2074 switch (pVCpu->pgm.s.enmGuestMode) 2021 2075 { … … 2048 2102 return VERR_PGM_NOT_USED_IN_MODE; 2049 2103 } 2104 2105 #elif defined(VBOX_VMM_TARGET_ARMV8) 2106 /** @todo temporary hack. */ 2107 RT_NOREF(pGstWalk); 2108 return pgmGstGetPageArmv8Hack(pVCpu, GCPtr, pWalk); 2109 2110 #else 2111 # error "port me" 2112 #endif 2050 2113 } 2051 2114 … … 2118 2181 int pgmGstPtWalkNext(PVMCPUCC pVCpu, RTGCPTR GCPtr, PPGMPTWALK pWalk, PPGMPTWALKGST pGstWalk) 2119 2182 { 2183 #ifdef VBOX_VMM_TARGET_X86 /** @todo optimize for ARMv8 */ 2120 2184 /* 2121 2185 * We can only handle successfully walks. … … 2212 2276 } 2213 2277 } 2278 #endif /* VBOX_VMM_TARGET_X86 */ 2214 2279 /* Case we don't handle. Do full walk. */ 2215 2280 return pgmGstPtWalk(pVCpu, GCPtr, pWalk, pGstWalk); … … 2217 2282 2218 2283 2284 #ifdef VBOX_VMM_TARGET_X86 2219 2285 /** 2220 2286 * Modify page flags for a range of pages in the guest's tables … … 2261 2327 return rc; 2262 2328 } 2263 2329 #endif /* VBOX_VMM_TARGET_X86 */ 2330 2331 #ifdef VBOX_VMM_TARGET_X86 2264 2332 2265 2333 /** … … 2464 2532 2465 2533 2466 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT2534 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 2467 2535 /** 2468 2536 * Performs the lazy mapping of the guest PML4 table when using EPT paging. … … 2487 2555 if (RT_SUCCESS(rc)) 2488 2556 { 2489 # ifdef IN_RING32557 # ifdef IN_RING3 2490 2558 pVCpu->pgm.s.pGstEptPml4R0 = NIL_RTR0PTR; 2491 2559 pVCpu->pgm.s.pGstEptPml4R3 = *ppEptPml4; 2492 # else2560 # else 2493 2561 pVCpu->pgm.s.pGstEptPml4R3 = NIL_RTR3PTR; 2494 2562 pVCpu->pgm.s.pGstEptPml4R0 = *ppEptPml4; 2495 # endif2563 # endif 2496 2564 PGM_UNLOCK(pVM); 2497 2565 return VINF_SUCCESS; … … 2503 2571 return rc; 2504 2572 } 2505 # endif2573 # endif 2506 2574 2507 2575 … … 2513 2581 VMMDECL(RTHCPHYS) PGMGetHyperCR3(PVMCPU pVCpu) 2514 2582 { 2515 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE2583 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2516 2584 PPGMPOOLPAGE pPoolPage = pVCpu->pgm.s.CTX_SUFF(pShwPageCR3); 2517 2585 AssertPtrReturn(pPoolPage, NIL_RTHCPHYS); 2518 2586 return pPoolPage->Core.Key; 2519 # else2587 # else 2520 2588 RT_NOREF(pVCpu); 2521 2589 return NIL_RTHCPHYS; 2522 # endif2590 # endif 2523 2591 } 2524 2592 … … 2540 2608 2541 2609 2542 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT2610 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 2543 2611 /** 2544 2612 * Performs second-level address translation for the given CR3 and updates the … … 2583 2651 return VINF_SUCCESS; 2584 2652 } 2585 # endif2653 # endif 2586 2654 2587 2655 … … 2601 2669 { 2602 2670 STAM_PROFILE_START(&pVCpu->pgm.s.Stats.CTX_MID_Z(Stat,FlushTLB), a); 2603 PVMCC pVM = pVCpu->CTX_SUFF(pVM);2604 2671 2605 2672 VMCPU_ASSERT_EMT(pVCpu); … … 2669 2736 { 2670 2737 #ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT 2671 PPGMPOOL pPool = pVM->pgm.s.CTX_SUFF(pPool); 2738 PVMCC const pVM = pVCpu->CTX_SUFF(pVM); 2739 PPGMPOOL const pPool = pVM->pgm.s.CTX_SUFF(pPool); 2672 2740 if (pPool->cDirtyPages) 2673 2741 { … … 2790 2858 VMMDECL(int) PGMSyncCR3(PVMCPUCC pVCpu, uint64_t cr0, uint64_t cr3, uint64_t cr4, bool fGlobal) 2791 2859 { 2792 int rc;2793 2794 2860 VMCPU_ASSERT_EMT(pVCpu); 2795 2861 2862 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2796 2863 /* 2797 2864 * The pool may have pending stuff and even require a return to ring-3 to 2798 2865 * clear the whole thing. 2799 2866 */ 2800 rc = pgmPoolSyncCR3(pVCpu); 2801 if (rc != VINF_SUCCESS) 2802 return rc; 2867 int rcPool = pgmPoolSyncCR3(pVCpu); 2868 if (rcPool != VINF_SUCCESS) 2869 return rcPool; 2870 #endif 2803 2871 2804 2872 /* … … 2845 2913 /* CR3 SLAT translation failed but we try to pretend it 2846 2914 succeeded for the reasons mentioned in PGMHCChangeMode(). */ 2847 AssertMsgFailed(("Failed to translate CR3 %#RX64. rc =%Rrc\n", cr3, rc2));2915 AssertMsgFailed(("Failed to translate CR3 %#RX64. rc2=%Rrc\n", cr3, rc2)); 2848 2916 pVCpu->pgm.s.GCPhysCR3 = NIL_RTGCPHYS; 2849 2917 pVCpu->pgm.s.GCPhysNstGstCR3 = NIL_RTGCPHYS; … … 2853 2921 #endif 2854 2922 Assert(!pVCpu->pgm.s.CTX_SUFF(fPaePdpesAndCr3Mapped)); 2923 int rc = VINF_SUCCESS; 2855 2924 if (GCPhysOldCR3 != GCPhysCR3) 2856 2925 { … … 2868 2937 Log(("PGMSyncCR3: pending pgm pool sync after MapCR3!\n")); 2869 2938 #ifdef IN_RING3 2939 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2870 2940 rc = pgmPoolSyncCR3(pVCpu); 2941 # else 2942 rc = VINF_SUCCESS; 2943 # endif 2871 2944 #else 2872 2945 if (rc == VINF_PGM_SYNC_CR3) … … 2887 2960 AssertReturn(idxBth < RT_ELEMENTS(g_aPgmBothModeData), VERR_PGM_MODE_IPE); 2888 2961 AssertReturn(g_aPgmBothModeData[idxBth].pfnSyncCR3, VERR_PGM_MODE_IPE); 2889 rc = g_aPgmBothModeData[idxBth].pfnSyncCR3(pVCpu, cr0, cr3, cr4, fGlobal);2962 int rcSync = g_aPgmBothModeData[idxBth].pfnSyncCR3(pVCpu, cr0, cr3, cr4, fGlobal); 2890 2963 2891 2964 STAM_PROFILE_STOP(&pVCpu->pgm.s.Stats.CTX_MID_Z(Stat,SyncCR3), a); 2892 AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 || RT_FAILURE(rc), ("rc=%Rrc\n", rc));2893 if (rc == VINF_SUCCESS)2965 AssertMsg(rcSync == VINF_SUCCESS || rcSync == VINF_PGM_SYNC_CR3 || RT_FAILURE(rcSync), ("rcSync=%Rrc\n", rcSync)); 2966 if (rcSync == VINF_SUCCESS) 2894 2967 { 2895 2968 if (pVCpu->pgm.s.fSyncFlags & PGM_SYNC_CLEAR_PGM_POOL) … … 2910 2983 * Now flush the CR3 (guest context). 2911 2984 */ 2912 if (rc == VINF_SUCCESS)2985 if (rcSync == VINF_SUCCESS) 2913 2986 PGM_INVL_VCPU_TLBS(pVCpu); 2914 return rc ;2987 return rcSync; 2915 2988 } 2916 2989 … … 3381 3454 } 3382 3455 3456 #endif /* VBOX_VMM_TARGET_X86 */ 3383 3457 3384 3458 /** … … 3400 3474 STAM_REL_COUNTER_INC(&pVCpu->pgm.s.cGuestModeChanges); 3401 3475 3476 #ifdef VBOX_VMM_TARGET_X86 3402 3477 /* 3403 3478 * Calc the shadow mode and switcher. … … 3447 3522 AssertPtrReturn(g_aPgmGuestModeData[idxNewGst].pfnExit, VERR_PGM_MODE_IPE); 3448 3523 AssertPtrReturn(g_aPgmGuestModeData[idxNewGst].pfnEnter, VERR_PGM_MODE_IPE); 3449 # ifdef IN_RING33524 # ifdef IN_RING3 3450 3525 AssertPtrReturn(g_aPgmGuestModeData[idxNewGst].pfnRelocate, VERR_PGM_MODE_IPE); 3451 # endif3526 # endif 3452 3527 3453 3528 uintptr_t const idxNewShw = pVCpu->pgm.s.idxShadowModeData = pgmModeToType(enmShadowMode); … … 3458 3533 AssertPtrReturn(g_aPgmShadowModeData[idxNewShw].pfnExit, VERR_PGM_MODE_IPE); 3459 3534 AssertPtrReturn(g_aPgmShadowModeData[idxNewShw].pfnEnter, VERR_PGM_MODE_IPE); 3460 # ifdef IN_RING33535 # ifdef IN_RING3 3461 3536 AssertPtrReturn(g_aPgmShadowModeData[idxNewShw].pfnRelocate, VERR_PGM_MODE_IPE); 3462 # endif3537 # endif 3463 3538 3464 3539 uintptr_t const idxNewBth = pVCpu->pgm.s.idxBothModeData = (idxNewShw - PGM_TYPE_FIRST_SHADOW) * PGM_TYPE_END + idxNewGst; … … 3471 3546 AssertPtrReturn(g_aPgmBothModeData[idxNewBth].pfnUnmapCR3, VERR_PGM_MODE_IPE); 3472 3547 AssertPtrReturn(g_aPgmBothModeData[idxNewBth].pfnEnter, VERR_PGM_MODE_IPE); 3473 # ifdef VBOX_STRICT3548 # ifdef VBOX_STRICT 3474 3549 AssertPtrReturn(g_aPgmBothModeData[idxNewBth].pfnAssertCR3, VERR_PGM_MODE_IPE); 3475 # endif3550 # endif 3476 3551 3477 3552 /* … … 3515 3590 case PGMMODE_PAE: 3516 3591 if (!pVM->cpum.ro.GuestFeatures.fPae) 3517 # ifdef IN_RING3 /** @todo r=bird: wrong place, probably hasn't really worked for a while. */3592 # ifdef IN_RING3 /** @todo r=bird: wrong place, probably hasn't really worked for a while. */ 3518 3593 return VMSetRuntimeError(pVM, VMSETRTERR_FLAGS_FATAL, "PAEmode", 3519 3594 N_("The guest is trying to switch to the PAE mode which is currently disabled by default in VirtualBox. PAE support can be enabled using the VM settings (System/Processor)")); 3520 # else3595 # else 3521 3596 AssertLogRelMsgFailedReturn(("enmGuestMode=%s - Try enable PAE for the guest!\n", PGMGetModeName(enmGuestMode)), VERR_PGM_MODE_IPE); 3522 3597 3523 # endif3598 # endif 3524 3599 GCPhysCR3 = CPUMGetGuestCR3(pVCpu) & X86_CR3_PAE_PAGE_MASK; 3525 3600 break; 3526 3601 3527 # ifdef VBOX_WITH_64_BITS_GUESTS3602 # ifdef VBOX_WITH_64_BITS_GUESTS 3528 3603 case PGMMODE_AMD64_NX: 3529 3604 case PGMMODE_AMD64: 3530 3605 GCPhysCR3 = CPUMGetGuestCR3(pVCpu) & X86_CR3_AMD64_PAGE_MASK; 3531 3606 break; 3532 # endif3607 # endif 3533 3608 default: 3534 3609 AssertLogRelMsgFailedReturn(("enmGuestMode=%d\n", enmGuestMode), VERR_PGM_MODE_IPE); 3535 3610 } 3536 3611 3537 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT3612 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 3538 3613 /* 3539 3614 * If a nested-guest is using EPT paging: … … 3582 3657 else 3583 3658 Assert(pVCpu->pgm.s.GCPhysNstGstCR3 == NIL_RTGCPHYS); 3584 # endif3659 # endif 3585 3660 3586 3661 /* … … 3609 3684 HMHCChangedPagingMode(pVM, pVCpu, pVCpu->pgm.s.enmShadowMode, pVCpu->pgm.s.enmGuestMode); 3610 3685 return rc; 3611 } 3612 3613 3686 3687 #elif defined(VBOX_VMM_TARGET_ARMV8) 3688 //AssertReleaseFailed(); /** @todo Called by the PGM saved state code. */ 3689 RT_NOREF(pVM, pVCpu, enmGuestMode, fForce); 3690 return VINF_SUCCESS; 3691 3692 #else 3693 # error "port me" 3694 #endif 3695 } 3696 3697 3698 #ifdef VBOX_VMM_TARGET_X86 3614 3699 /** 3615 3700 * Called by CPUM or REM when CR0.WP changes to 1. … … 3638 3723 } 3639 3724 } 3725 #endif /* VBOX_VMM_TARGET_X86 */ 3640 3726 3641 3727 … … 3662 3748 VMMDECL(PGMMODE) PGMGetShadowMode(PVMCPU pVCpu) 3663 3749 { 3750 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 3664 3751 return pVCpu->pgm.s.enmShadowMode; 3665 } 3666 3667 3752 #else 3753 RT_NOREF(pVCpu); 3754 return PGMMODE_NONE; 3755 #endif 3756 } 3757 3758 3759 #ifdef VBOX_VMM_TARGET_X86 3668 3760 /** 3669 3761 * Gets the current host paging mode. … … 3701 3793 return PGMMODE_INVALID; 3702 3794 } 3795 #endif /* VBOX_VMM_TARGET_X86 */ 3703 3796 3704 3797 … … 3725 3818 case PGMMODE_EPT: return "EPT"; 3726 3819 case PGMMODE_NONE: return "None"; 3820 case PGMMODE_VMSA_V8_32: return "VMSAv8-32"; 3821 case PGMMODE_VMSA_V8_64: return "VMSAv8-64"; 3727 3822 default: return "unknown mode value"; 3728 3823 } … … 3752 3847 3753 3848 3754 /** 3755 * Gets the physical address represented in the guest CR3 as PGM sees it. 3756 * 3757 * This is mainly for logging and debugging. 3758 * 3759 * @returns PGM's guest CR3 value. 3760 * @param pVCpu The cross context virtual CPU structure. 3761 */ 3762 VMM_INT_DECL(RTGCPHYS) PGMGetGuestCR3Phys(PVMCPU pVCpu) 3763 { 3764 return pVCpu->pgm.s.GCPhysCR3; 3765 } 3766 3767 3768 3849 #ifdef VBOX_VMM_TARGET_X86 3769 3850 /** 3770 3851 * Notification from CPUM that the EFER.NXE bit has changed. … … 3823 3904 } 3824 3905 } 3906 #endif /* VBOX_VMM_TARGET_X86 */ 3825 3907 3826 3908 … … 3833 3915 VMMDECL(bool) PGMHasDirtyPages(PVM pVM) 3834 3916 { 3917 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 3835 3918 return pVM->pgm.s.CTX_SUFF(pPool)->cDirtyPages != 0; 3836 } 3837 3838 3839 /** 3840 * Check if this VCPU currently owns the PGM lock. 3841 * 3842 * @returns bool owner/not owner 3843 * @param pVM The cross context VM structure. 3844 */ 3845 VMMDECL(bool) PGMIsLockOwner(PVMCC pVM) 3846 { 3847 return PDMCritSectIsOwner(pVM, &pVM->pgm.s.CritSectX); 3919 #else 3920 RT_NOREF(pVM); 3921 return false; 3922 #endif 3848 3923 } 3849 3924 … … 3862 3937 pVM->pgm.s.fUseLargePages = fUseLargePages; 3863 3938 return VINF_SUCCESS; 3939 } 3940 3941 3942 /** 3943 * Check if this VCPU currently owns the PGM lock. 3944 * 3945 * @returns bool owner/not owner 3946 * @param pVM The cross context VM structure. 3947 */ 3948 VMMDECL(bool) PGMIsLockOwner(PVMCC pVM) 3949 { 3950 return PDMCritSectIsOwner(pVM, &pVM->pgm.s.CritSectX); 3864 3951 } 3865 3952 … … 4071 4158 } 4072 4159 4073 4074 #ifdef VBOX_STRICT 4160 #ifdef VBOX_VMM_TARGET_X86 4161 4162 # ifdef VBOX_STRICT 4075 4163 /** 4076 4164 * Asserts that everything related to the guest CR3 is correctly shadowed. … … 4088 4176 VMMDECL(unsigned) PGMAssertCR3(PVMCC pVM, PVMCPUCC pVCpu, uint64_t cr3, uint64_t cr4) 4089 4177 { 4178 AssertReturn(pVM->enmTarget == VMTARGET_X86, 0); 4090 4179 STAM_PROFILE_START(&pVCpu->pgm.s.Stats.CTX_MID_Z(Stat,SyncCR3), a); 4091 4180 … … 4101 4190 return cErrors; 4102 4191 } 4103 # endif /* VBOX_STRICT */4192 # endif /* VBOX_STRICT */ 4104 4193 4105 4194 … … 4123 4212 } 4124 4213 4214 #endif /* VBOX_VMM_TARGET_X86 */ 4125 4215 #ifdef PGM_WITH_PAGE_ZEROING_DETECTION 4216 # ifndef VBOX_VMM_TARGET_X86 4217 # error "misconfig: PGM_WITH_PAGE_ZEROING_DETECTION not implemented for ARM guests" 4218 # endif 4126 4219 4127 4220 /** -
trunk/src/VBox/VMM/VMMAll/PGMAllGst-armv8.h
r108119 r108132 1 1 /* $Id$ */ 2 2 /** @file 3 * PGM - Page Manager and Monitor, ARMv8 variant. (Mixing stuff here, not good?)3 * PGM - Page Manager, ARMv8 Guest Paging Template - All context code. 4 4 */ 5 5 … … 26 26 */ 27 27 28 29 /** @page pg_pgm_armv8 PGM - The Page Manager and Monitor (ARMv8 variant)30 *31 * For now this is just a stub for bringing up the ARMv8 hypervisor. We'll see how32 * much we really need here later on and whether it makes sense to merge this with the original PGM.cpp33 * (avoiding \#ifdef hell for with this as I'm not confident enough to fiddle around with PGM too much at this point).34 */35 36 37 /*********************************************************************************************************************************38 * Header Files *39 *********************************************************************************************************************************/40 #define LOG_GROUP LOG_GROUP_PGM41 #define VBOX_WITHOUT_PAGING_BIT_FIELDS /* 64-bit bitfields are just asking for trouble. See @bugref{9841} and others. */42 #include <VBox/vmm/dbgf.h>43 #include <VBox/vmm/pgm.h>44 #include <VBox/vmm/cpum.h>45 #include <VBox/vmm/cpum-armv8.h>46 #include <VBox/vmm/iom.h>47 #include <VBox/sup.h>48 #include <VBox/vmm/mm.h>49 #include <VBox/vmm/em.h>50 #include <VBox/vmm/stam.h>51 #include <VBox/vmm/selm.h>52 #include <VBox/vmm/ssm.h>53 #include <VBox/vmm/hm.h>54 #include "PGMInternal.h"55 #include <VBox/vmm/vmcc.h>56 #include <VBox/vmm/uvm.h>57 #include "PGMInline.h"58 59 #include <VBox/dbg.h>60 #include <VBox/param.h>61 #include <VBox/err.h>62 63 #include <iprt/asm.h>64 #include <iprt/assert.h>65 #include <iprt/env.h>66 #include <iprt/file.h>67 #include <iprt/mem.h>68 #include <iprt/rand.h>69 #include <iprt/string.h>70 #include <iprt/thread.h>71 72 73 #if 0 /* now in taken from PGM.cpp where it came from */74 75 76 /*********************************************************************************************************************************77 * Internal Functions *78 *********************************************************************************************************************************/79 #ifdef VBOX_STRICT80 static FNVMATSTATE pgmR3ResetNoMorePhysWritesFlag;81 #endif82 83 84 /*********************************************************************************************************************************85 * Global Variables *86 *********************************************************************************************************************************/87 #ifndef VBOX_WITH_PGM_NEM_MODE88 # error "This requires VBOX_WITH_PGM_NEM_MODE to be set at all times!"89 #endif90 91 /**92 * Interface that NEM uses to switch PGM into simplified memory managment mode.93 *94 * This call occurs before PGMR3Init.95 *96 * @param pVM The cross context VM structure.97 */98 VMMR3_INT_DECL(void) PGMR3EnableNemMode(PVM pVM)99 {100 AssertFatal(!PDMCritSectIsInitialized(&pVM->pgm.s.CritSectX));101 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE102 pVM->pgm.s.fNemMode = true;103 #endif104 }105 106 107 /**108 * Checks whether the simplificed memory management mode for NEM is enabled.109 *110 * @returns true if enabled, false if not.111 * @param pVM The cross context VM structure.112 */113 VMMR3_INT_DECL(bool) PGMR3IsNemModeEnabled(PVM pVM)114 {115 RT_NOREF(pVM);116 return PGM_IS_IN_NEM_MODE(pVM);117 }118 119 120 /**121 * Initiates the paging of VM.122 *123 * @returns VBox status code.124 * @param pVM The cross context VM structure.125 */126 VMMR3DECL(int) PGMR3Init(PVM pVM)127 {128 LogFlow(("PGMR3Init:\n"));129 130 /*131 * Assert alignment and sizes.132 */133 AssertCompile(sizeof(pVM->pgm.s) <= sizeof(pVM->pgm.padding));134 AssertCompile(sizeof(pVM->apCpusR3[0]->pgm.s) <= sizeof(pVM->apCpusR3[0]->pgm.padding));135 AssertCompileMemberAlignment(PGM, CritSectX, sizeof(uintptr_t));136 137 bool const fDriverless = SUPR3IsDriverless();138 139 /*140 * Init the structure.141 */142 /*pVM->pgm.s.fRestoreRomPagesAtReset = false;*/143 144 /* We always use the simplified memory mode on arm. */145 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE146 pVM->pgm.s.fNemMode = true;147 #endif148 149 for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.aHandyPages); i++)150 {151 pVM->pgm.s.aHandyPages[i].HCPhysGCPhys = NIL_GMMPAGEDESC_PHYS;152 pVM->pgm.s.aHandyPages[i].fZeroed = false;153 pVM->pgm.s.aHandyPages[i].idPage = NIL_GMM_PAGEID;154 pVM->pgm.s.aHandyPages[i].idSharedPage = NIL_GMM_PAGEID;155 }156 157 for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.aLargeHandyPage); i++)158 {159 pVM->pgm.s.aLargeHandyPage[i].HCPhysGCPhys = NIL_GMMPAGEDESC_PHYS;160 pVM->pgm.s.aLargeHandyPage[i].fZeroed = false;161 pVM->pgm.s.aLargeHandyPage[i].idPage = NIL_GMM_PAGEID;162 pVM->pgm.s.aLargeHandyPage[i].idSharedPage = NIL_GMM_PAGEID;163 }164 165 AssertReleaseReturn(pVM->pgm.s.cPhysHandlerTypes == 0, VERR_WRONG_ORDER);166 for (size_t i = 0; i < RT_ELEMENTS(pVM->pgm.s.aPhysHandlerTypes); i++)167 {168 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)169 if (fDriverless)170 #endif171 pVM->pgm.s.aPhysHandlerTypes[i].hType = i | (RTRandU64() & ~(uint64_t)PGMPHYSHANDLERTYPE_IDX_MASK);172 pVM->pgm.s.aPhysHandlerTypes[i].enmKind = PGMPHYSHANDLERKIND_INVALID;173 pVM->pgm.s.aPhysHandlerTypes[i].pfnHandler = pgmR3HandlerPhysicalHandlerInvalid;174 }175 176 #if 0177 /* Init the per-CPU part. */178 for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)179 {180 PVMCPU pVCpu = pVM->apCpusR3[idCpu];181 PPGMCPU pPGM = &pVCpu->pgm.s;182 }183 #endif184 185 /*186 * Read the configuration.187 */188 PCFGMNODE const pCfgPGM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "/PGM");189 190 /** @todo RamPreAlloc doesn't work for NEM-mode. */191 int rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "RamPreAlloc", &pVM->pgm.s.fRamPreAlloc,192 #ifdef VBOX_WITH_PREALLOC_RAM_BY_DEFAULT193 true194 #else195 false196 #endif197 );198 AssertLogRelRCReturn(rc, rc);199 200 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE201 rc = CFGMR3QueryU32Def(pCfgPGM, "MaxRing3Chunks", &pVM->pgm.s.ChunkR3Map.cMax, UINT32_MAX);202 AssertLogRelRCReturn(rc, rc);203 for (uint32_t i = 0; i < RT_ELEMENTS(pVM->pgm.s.ChunkR3Map.Tlb.aEntries); i++)204 pVM->pgm.s.ChunkR3Map.Tlb.aEntries[i].idChunk = NIL_GMM_CHUNKID;205 #endif206 207 /*208 * Get the configured RAM size - to estimate saved state size.209 */210 uint64_t cbRam;211 rc = CFGMR3QueryU64(CFGMR3GetRoot(pVM), "RamSize", &cbRam);212 if (rc == VERR_CFGM_VALUE_NOT_FOUND)213 cbRam = 0;214 else if (RT_SUCCESS(rc))215 {216 if (cbRam < GUEST_PAGE_SIZE)217 cbRam = 0;218 cbRam = RT_ALIGN_64(cbRam, GUEST_PAGE_SIZE);219 }220 else221 {222 AssertMsgFailed(("Configuration error: Failed to query integer \"RamSize\", rc=%Rrc.\n", rc));223 return rc;224 }225 226 /** @cfgm{/PGM/ZeroRamPagesOnReset, boolean, true}227 * Whether to clear RAM pages on (hard) reset. */228 rc = CFGMR3QueryBoolDef(pCfgPGM, "ZeroRamPagesOnReset", &pVM->pgm.s.fZeroRamPagesOnReset, true);229 AssertLogRelRCReturn(rc, rc);230 231 /*232 * Register callbacks, string formatters and the saved state data unit.233 */234 #ifdef VBOX_STRICT235 VMR3AtStateRegister(pVM->pUVM, pgmR3ResetNoMorePhysWritesFlag, NULL);236 #endif237 PGMRegisterStringFormatTypes();238 239 rc = pgmR3InitSavedState(pVM, cbRam);240 if (RT_FAILURE(rc))241 return rc;242 243 /*244 * Initialize the PGM critical section and flush the phys TLBs245 */246 rc = PDMR3CritSectInit(pVM, &pVM->pgm.s.CritSectX, RT_SRC_POS, "PGM");247 AssertRCReturn(rc, rc);248 249 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE250 pgmR3PhysChunkInvalidateTLB(pVM, false /*fInRendezvous*/); /* includes pgmPhysInvalidatePageMapTLB call */251 #endif252 253 /*254 * For the time being we sport a full set of handy pages in addition to the base255 * memory to simplify things.256 */257 rc = MMR3ReserveHandyPages(pVM, RT_ELEMENTS(pVM->pgm.s.aHandyPages)); /** @todo this should be changed to PGM_HANDY_PAGES_MIN but this needs proper testing... */258 AssertRCReturn(rc, rc);259 260 /*261 * Setup the zero page (HCPHysZeroPg is set by ring-0).262 */263 RT_ZERO(pVM->pgm.s.abZeroPg); /* paranoia */264 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE265 if (fDriverless)266 pVM->pgm.s.HCPhysZeroPg = _4G - GUEST_PAGE_SIZE * 2 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */;267 AssertRelease(pVM->pgm.s.HCPhysZeroPg != NIL_RTHCPHYS);268 AssertRelease(pVM->pgm.s.HCPhysZeroPg != 0);269 #endif270 271 /*272 * Setup the invalid MMIO page (HCPhysMmioPg is set by ring-0).273 * (The invalid bits in HCPhysInvMmioPg are set later on init complete.)274 */275 ASMMemFill32(pVM->pgm.s.abMmioPg, sizeof(pVM->pgm.s.abMmioPg), 0xfeedface);276 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE277 if (fDriverless)278 pVM->pgm.s.HCPhysMmioPg = _4G - GUEST_PAGE_SIZE * 3 /* fake to avoid PGM_PAGE_INIT_ZERO assertion */;279 AssertRelease(pVM->pgm.s.HCPhysMmioPg != NIL_RTHCPHYS);280 AssertRelease(pVM->pgm.s.HCPhysMmioPg != 0);281 pVM->pgm.s.HCPhysInvMmioPg = pVM->pgm.s.HCPhysMmioPg;282 #endif283 284 /*285 * Initialize physical access handlers.286 */287 /** @cfgm{/PGM/MaxPhysicalAccessHandlers, uint32_t, 32, 65536, 6144}288 * Number of physical access handlers allowed (subject to rounding). This is289 * managed as one time allocation during initializations. The default is290 * lower for a driverless setup. */291 /** @todo can lower it for nested paging too, at least when there is no292 * nested guest involved. */293 uint32_t cAccessHandlers = 0;294 rc = CFGMR3QueryU32Def(pCfgPGM, "MaxPhysicalAccessHandlers", &cAccessHandlers, !fDriverless ? 6144 : 640);295 AssertLogRelRCReturn(rc, rc);296 AssertLogRelMsgStmt(cAccessHandlers >= 32, ("cAccessHandlers=%#x, min 32\n", cAccessHandlers), cAccessHandlers = 32);297 AssertLogRelMsgStmt(cAccessHandlers <= _64K, ("cAccessHandlers=%#x, max 65536\n", cAccessHandlers), cAccessHandlers = _64K);298 #if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)299 if (!fDriverless)300 {301 rc = VMMR3CallR0(pVM, VMMR0_DO_PGM_PHYS_HANDLER_INIT, cAccessHandlers, NULL);302 AssertRCReturn(rc, rc);303 AssertPtr(pVM->pgm.s.pPhysHandlerTree);304 AssertPtr(pVM->pgm.s.PhysHandlerAllocator.m_paNodes);305 AssertPtr(pVM->pgm.s.PhysHandlerAllocator.m_pbmAlloc);306 }307 else308 #endif309 {310 uint32_t cbTreeAndBitmap = 0;311 uint32_t const cbTotalAligned = pgmHandlerPhysicalCalcTableSizes(&cAccessHandlers, &cbTreeAndBitmap);312 uint8_t *pb = NULL;313 rc = SUPR3PageAlloc(cbTotalAligned >> HOST_PAGE_SHIFT, 0, (void **)&pb);314 AssertLogRelRCReturn(rc, rc);315 316 pVM->pgm.s.PhysHandlerAllocator.initSlabAllocator(cAccessHandlers, (PPGMPHYSHANDLER)&pb[cbTreeAndBitmap],317 (uint64_t *)&pb[sizeof(PGMPHYSHANDLERTREE)]);318 pVM->pgm.s.pPhysHandlerTree = (PPGMPHYSHANDLERTREE)pb;319 pVM->pgm.s.pPhysHandlerTree->initWithAllocator(&pVM->pgm.s.PhysHandlerAllocator);320 }321 322 /*323 * Register the physical access handler protecting ROMs.324 */325 if (RT_SUCCESS(rc))326 /** @todo why isn't pgmPhysRomWriteHandler registered for ring-0? */327 rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE, 0 /*fFlags*/, pgmPhysRomWriteHandler,328 "ROM write protection", &pVM->pgm.s.hRomPhysHandlerType);329 330 /*331 * Register the physical access handler doing dirty MMIO2 tracing.332 */333 if (RT_SUCCESS(rc))334 rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE, PGMPHYSHANDLER_F_KEEP_PGM_LOCK,335 pgmPhysMmio2WriteHandler, "MMIO2 dirty page tracing",336 &pVM->pgm.s.hMmio2DirtyPhysHandlerType);337 338 if (RT_SUCCESS(rc))339 return VINF_SUCCESS;340 341 /* Almost no cleanup necessary, MM frees all memory. */342 PDMR3CritSectDelete(pVM, &pVM->pgm.s.CritSectX);343 344 return rc;345 }346 347 348 /**349 * Ring-3 init finalizing (not required here).350 *351 * @returns VBox status code.352 * @param pVM The cross context VM structure.353 */354 VMMR3DECL(int) PGMR3InitFinalize(PVM pVM)355 {356 RT_NOREF(pVM);357 int rc = VINF_SUCCESS;358 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE359 if (pVM->pgm.s.fRamPreAlloc)360 rc = pgmR3PhysRamPreAllocate(pVM);361 #endif362 363 //pgmLogState(pVM);364 LogRel(("PGM: PGMR3InitFinalize done: %Rrc\n", rc));365 return rc;366 }367 368 369 /**370 * Init phase completed callback.371 *372 * @returns VBox status code.373 * @param pVM The cross context VM structure.374 * @param enmWhat What has been completed.375 * @thread EMT(0)376 */377 VMMR3_INT_DECL(int) PGMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat)378 {379 switch (enmWhat)380 {381 case VMINITCOMPLETED_HM:382 AssertLogRelReturn(!pVM->pgm.s.fPciPassthrough, VERR_PGM_PCI_PASSTHRU_MISCONFIG);383 break;384 385 default:386 /* shut up gcc */387 break;388 }389 390 return VINF_SUCCESS;391 }392 393 394 /**395 * Applies relocations to data and code managed by this component.396 *397 * This function will be called at init and whenever the VMM need to relocate it398 * self inside the GC.399 *400 * @param pVM The cross context VM structure.401 * @param offDelta Relocation delta relative to old location.402 */403 VMMR3DECL(void) PGMR3Relocate(PVM pVM, RTGCINTPTR offDelta)404 {405 LogFlow(("PGMR3Relocate: offDelta=%RGv\n", offDelta));406 RT_NOREF(pVM, offDelta);407 }408 409 410 /**411 * Resets a virtual CPU when unplugged.412 *413 * @param pVM The cross context VM structure.414 * @param pVCpu The cross context virtual CPU structure.415 */416 VMMR3DECL(void) PGMR3ResetCpu(PVM pVM, PVMCPU pVCpu)417 {418 RT_NOREF(pVM, pVCpu);419 }420 421 422 /**423 * The VM is being reset.424 *425 * For the PGM component this means that any PD write monitors426 * needs to be removed.427 *428 * @param pVM The cross context VM structure.429 */430 VMMR3_INT_DECL(void) PGMR3Reset(PVM pVM)431 {432 LogFlow(("PGMR3Reset:\n"));433 VM_ASSERT_EMT(pVM);434 435 PGM_LOCK_VOID(pVM);436 437 #ifdef DEBUG438 DBGFR3_INFO_LOG_SAFE(pVM, "mappings", NULL);439 DBGFR3_INFO_LOG_SAFE(pVM, "handlers", "all nostat");440 #endif441 442 //pgmLogState(pVM);443 PGM_UNLOCK(pVM);444 }445 446 447 /**448 * Memory setup after VM construction or reset.449 *450 * @param pVM The cross context VM structure.451 * @param fAtReset Indicates the context, after reset if @c true or after452 * construction if @c false.453 */454 VMMR3_INT_DECL(void) PGMR3MemSetup(PVM pVM, bool fAtReset)455 {456 if (fAtReset)457 {458 PGM_LOCK_VOID(pVM);459 460 int rc = pgmR3PhysRamZeroAll(pVM);461 AssertReleaseRC(rc);462 463 rc = pgmR3PhysRomReset(pVM);464 AssertReleaseRC(rc);465 466 PGM_UNLOCK(pVM);467 }468 }469 470 471 #ifdef VBOX_STRICT472 /**473 * VM state change callback for clearing fNoMorePhysWrites after474 * a snapshot has been created.475 */476 static DECLCALLBACK(void) pgmR3ResetNoMorePhysWritesFlag(PUVM pUVM, PCVMMR3VTABLE pVMM, VMSTATE enmState,477 VMSTATE enmOldState, void *pvUser)478 {479 if ( enmState == VMSTATE_RUNNING480 || enmState == VMSTATE_RESUMING)481 pUVM->pVM->pgm.s.fNoMorePhysWrites = false;482 RT_NOREF(pVMM, enmOldState, pvUser);483 }484 #endif485 486 /**487 * Private API to reset fNoMorePhysWrites.488 */489 VMMR3_INT_DECL(void) PGMR3ResetNoMorePhysWritesFlag(PVM pVM)490 {491 pVM->pgm.s.fNoMorePhysWrites = false;492 }493 494 /**495 * Terminates the PGM.496 *497 * @returns VBox status code.498 * @param pVM The cross context VM structure.499 */500 VMMR3DECL(int) PGMR3Term(PVM pVM)501 {502 /* Must free shared pages here. */503 PGM_LOCK_VOID(pVM);504 pgmR3PhysRamTerm(pVM);505 pgmR3PhysRomTerm(pVM);506 PGM_UNLOCK(pVM);507 508 PGMDeregisterStringFormatTypes();509 return PDMR3CritSectDelete(pVM, &pVM->pgm.s.CritSectX);510 }511 512 513 /**514 * Perform an integrity check on the PGM component.515 *516 * @returns VINF_SUCCESS if everything is fine.517 * @returns VBox error status after asserting on integrity breach.518 * @param pVM The cross context VM structure.519 */520 VMMR3DECL(int) PGMR3CheckIntegrity(PVM pVM)521 {522 RT_NOREF(pVM);523 return VINF_SUCCESS;524 }525 526 #endif527 528 VMMDECL(bool) PGMHasDirtyPages(PVM pVM)529 {530 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE531 return pVM->pgm.s.CTX_SUFF(pPool)->cDirtyPages != 0;532 #else533 RT_NOREF(pVM);534 return false;535 #endif536 }537 538 539 VMMDECL(bool) PGMIsLockOwner(PVMCC pVM)540 {541 return PDMCritSectIsOwner(pVM, &pVM->pgm.s.CritSectX);542 }543 544 545 VMMDECL(int) PGMSetLargePageUsage(PVMCC pVM, bool fUseLargePages)546 {547 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);548 549 pVM->pgm.s.fUseLargePages = fUseLargePages;550 return VINF_SUCCESS;551 }552 553 554 #if defined(VBOX_STRICT) || defined(DOXYGEN_RUNNING)555 int pgmLockDebug(PVMCC pVM, bool fVoid, RT_SRC_POS_DECL)556 #else557 int pgmLock(PVMCC pVM, bool fVoid)558 #endif559 {560 #if defined(VBOX_STRICT)561 int rc = PDMCritSectEnterDebug(pVM, &pVM->pgm.s.CritSectX, VINF_SUCCESS, (uintptr_t)ASMReturnAddress(), RT_SRC_POS_ARGS);562 #else563 int rc = PDMCritSectEnter(pVM, &pVM->pgm.s.CritSectX, VINF_SUCCESS);564 #endif565 if (RT_SUCCESS(rc))566 return rc;567 if (fVoid)568 PDM_CRITSECT_RELEASE_ASSERT_RC(pVM, &pVM->pgm.s.CritSectX, rc);569 else570 AssertRC(rc);571 return rc;572 }573 574 575 void pgmUnlock(PVMCC pVM)576 {577 uint32_t cDeprecatedPageLocks = pVM->pgm.s.cDeprecatedPageLocks;578 pVM->pgm.s.cDeprecatedPageLocks = 0;579 int rc = PDMCritSectLeave(pVM, &pVM->pgm.s.CritSectX);580 if (rc == VINF_SEM_NESTED)581 pVM->pgm.s.cDeprecatedPageLocks = cDeprecatedPageLocks;582 }583 584 585 #if !defined(IN_R0) || defined(LOG_ENABLED)586 587 /** Format handler for PGMPAGE.588 * @copydoc FNRTSTRFORMATTYPE */589 static DECLCALLBACK(size_t) pgmFormatTypeHandlerPage(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,590 const char *pszType, void const *pvValue,591 int cchWidth, int cchPrecision, unsigned fFlags,592 void *pvUser)593 {594 size_t cch;595 PCPGMPAGE pPage = (PCPGMPAGE)pvValue;596 if (RT_VALID_PTR(pPage))597 {598 char szTmp[64+80];599 600 cch = 0;601 602 /* The single char state stuff. */603 static const char s_achPageStates[4] = { 'Z', 'A', 'W', 'S' };604 szTmp[cch++] = s_achPageStates[PGM_PAGE_GET_STATE_NA(pPage)];605 606 # define IS_PART_INCLUDED(lvl) ( !(fFlags & RTSTR_F_PRECISION) || cchPrecision == (lvl) || cchPrecision >= (lvl)+10 )607 if (IS_PART_INCLUDED(5))608 {609 static const char s_achHandlerStates[4*2] = { '-', 't', 'w', 'a' , '_', 'T', 'W', 'A' };610 szTmp[cch++] = s_achHandlerStates[ PGM_PAGE_GET_HNDL_PHYS_STATE(pPage)611 | ((uint8_t)PGM_PAGE_IS_HNDL_PHYS_NOT_IN_HM(pPage) << 2)];612 }613 614 /* The type. */615 if (IS_PART_INCLUDED(4))616 {617 szTmp[cch++] = ':';618 static const char s_achPageTypes[8][4] = { "INV", "RAM", "MI2", "M2A", "SHA", "ROM", "MIO", "BAD" };619 szTmp[cch++] = s_achPageTypes[PGM_PAGE_GET_TYPE_NA(pPage)][0];620 szTmp[cch++] = s_achPageTypes[PGM_PAGE_GET_TYPE_NA(pPage)][1];621 szTmp[cch++] = s_achPageTypes[PGM_PAGE_GET_TYPE_NA(pPage)][2];622 }623 624 /* The numbers. */625 if (IS_PART_INCLUDED(3))626 {627 szTmp[cch++] = ':';628 cch += RTStrFormatNumber(&szTmp[cch], PGM_PAGE_GET_HCPHYS_NA(pPage), 16, 12, 0, RTSTR_F_ZEROPAD | RTSTR_F_64BIT);629 }630 631 if (IS_PART_INCLUDED(2))632 {633 szTmp[cch++] = ':';634 cch += RTStrFormatNumber(&szTmp[cch], PGM_PAGE_GET_PAGEID(pPage), 16, 7, 0, RTSTR_F_ZEROPAD | RTSTR_F_32BIT);635 }636 637 if (IS_PART_INCLUDED(6))638 {639 szTmp[cch++] = ':';640 static const char s_achRefs[4] = { '-', 'U', '!', 'L' };641 szTmp[cch++] = s_achRefs[PGM_PAGE_GET_TD_CREFS_NA(pPage)];642 cch += RTStrFormatNumber(&szTmp[cch], PGM_PAGE_GET_TD_IDX_NA(pPage), 16, 4, 0, RTSTR_F_ZEROPAD | RTSTR_F_16BIT);643 }644 # undef IS_PART_INCLUDED645 646 cch = pfnOutput(pvArgOutput, szTmp, cch);647 }648 else649 cch = pfnOutput(pvArgOutput, RT_STR_TUPLE("<bad-pgmpage-ptr>"));650 NOREF(pszType); NOREF(cchWidth); NOREF(pvUser);651 return cch;652 }653 654 655 /** Format handler for PGMRAMRANGE.656 * @copydoc FNRTSTRFORMATTYPE */657 static DECLCALLBACK(size_t) pgmFormatTypeHandlerRamRange(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,658 const char *pszType, void const *pvValue,659 int cchWidth, int cchPrecision, unsigned fFlags,660 void *pvUser)661 {662 size_t cch;663 PGMRAMRANGE const *pRam = (PGMRAMRANGE const *)pvValue;664 if (RT_VALID_PTR(pRam))665 {666 char szTmp[80];667 cch = RTStrPrintf(szTmp, sizeof(szTmp), "%RGp-%RGp", pRam->GCPhys, pRam->GCPhysLast);668 cch = pfnOutput(pvArgOutput, szTmp, cch);669 }670 else671 cch = pfnOutput(pvArgOutput, RT_STR_TUPLE("<bad-pgmramrange-ptr>"));672 NOREF(pszType); NOREF(cchWidth); NOREF(cchPrecision); NOREF(pvUser); NOREF(fFlags);673 return cch;674 }675 676 /** Format type andlers to be registered/deregistered. */677 static const struct678 {679 char szType[24];680 PFNRTSTRFORMATTYPE pfnHandler;681 } g_aPgmFormatTypes[] =682 {683 { "pgmpage", pgmFormatTypeHandlerPage },684 { "pgmramrange", pgmFormatTypeHandlerRamRange }685 };686 687 #endif /* !IN_R0 || LOG_ENABLED */688 689 690 VMMDECL(int) PGMRegisterStringFormatTypes(void)691 {692 #if !defined(IN_R0) || defined(LOG_ENABLED)693 int rc = VINF_SUCCESS;694 unsigned i;695 for (i = 0; RT_SUCCESS(rc) && i < RT_ELEMENTS(g_aPgmFormatTypes); i++)696 {697 rc = RTStrFormatTypeRegister(g_aPgmFormatTypes[i].szType, g_aPgmFormatTypes[i].pfnHandler, NULL);698 # ifdef IN_RING0699 if (rc == VERR_ALREADY_EXISTS)700 {701 /* in case of cleanup failure in ring-0 */702 RTStrFormatTypeDeregister(g_aPgmFormatTypes[i].szType);703 rc = RTStrFormatTypeRegister(g_aPgmFormatTypes[i].szType, g_aPgmFormatTypes[i].pfnHandler, NULL);704 }705 # endif706 }707 if (RT_FAILURE(rc))708 while (i-- > 0)709 RTStrFormatTypeDeregister(g_aPgmFormatTypes[i].szType);710 711 return rc;712 #else713 return VINF_SUCCESS;714 #endif715 }716 717 718 VMMDECL(void) PGMDeregisterStringFormatTypes(void)719 {720 #if !defined(IN_R0) || defined(LOG_ENABLED)721 for (unsigned i = 0; i < RT_ELEMENTS(g_aPgmFormatTypes); i++)722 RTStrFormatTypeDeregister(g_aPgmFormatTypes[i].szType);723 #endif724 }725 726 727 VMMDECL(int) PGMGstModifyPage(PVMCPUCC pVCpu, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask)728 {729 STAM_PROFILE_START(&pVCpu->pgm.s.Stats.CTX_MID_Z(Stat,GstModifyPage), a);730 VMCPU_ASSERT_EMT(pVCpu);731 732 /*733 * Validate input.734 */735 Assert(cb);736 737 LogFlow(("PGMGstModifyPage %RGv %d bytes fFlags=%08llx fMask=%08llx\n", GCPtr, cb, fFlags, fMask));738 RT_NOREF(pVCpu, GCPtr, cb, fFlags, fMask);739 740 AssertReleaseFailed();741 return VERR_NOT_IMPLEMENTED;742 }743 744 745 VMMDECL(PGMMODE) PGMGetGuestMode(PVMCPU pVCpu)746 {747 VMCPU_ASSERT_EMT(pVCpu);748 749 bool fMmuEnabled = CPUMGetGuestMmuEnabled(pVCpu);750 if (!fMmuEnabled)751 return PGMMODE_NONE;752 753 CPUMMODE enmCpuMode = CPUMGetGuestMode(pVCpu);754 return enmCpuMode == CPUMMODE_ARMV8_AARCH64755 ? PGMMODE_VMSA_V8_64756 : PGMMODE_VMSA_V8_32;757 }758 759 760 VMMDECL(PGMMODE) PGMGetShadowMode(PVMCPU pVCpu)761 {762 RT_NOREF(pVCpu);763 return PGMMODE_NONE; /* NEM doesn't need any shadow paging. */764 }765 28 766 29 … … 797 60 798 61 799 VMMDECL(int) PGMGstGetPage(PVMCPUCC pVCpu, RTGCPTR GCPtr, PPGMPTWALK pWalk)62 DECLINLINE(int) pgmGstGetPageArmv8Hack(PVMCPUCC pVCpu, RTGCPTR GCPtr, PPGMPTWALK pWalk) 800 63 { 801 64 VMCPU_ASSERT_EMT(pVCpu); … … 948 211 } 949 212 950 951 VMMDECL(int) PGMShwMakePageReadonly(PVMCPUCC pVCpu, RTGCPTR GCPtr, uint32_t fOpFlags)952 {953 AssertReleaseFailed();954 RT_NOREF(pVCpu, GCPtr, fOpFlags);955 return VERR_NOT_IMPLEMENTED;956 }957 958 959 VMMDECL(int) PGMShwMakePageWritable(PVMCPUCC pVCpu, RTGCPTR GCPtr, uint32_t fOpFlags)960 {961 AssertReleaseFailed();962 RT_NOREF(pVCpu, GCPtr, fOpFlags);963 return VERR_NOT_IMPLEMENTED;964 }965 966 967 VMMDECL(int) PGMShwMakePageNotPresent(PVMCPUCC pVCpu, RTGCPTR GCPtr, uint32_t fOpFlags)968 {969 AssertReleaseFailed();970 RT_NOREF(pVCpu, GCPtr, fOpFlags);971 return VERR_NOT_IMPLEMENTED;972 }973 974 975 VMM_INT_DECL(int) PGMHCChangeMode(PVMCC pVM, PVMCPUCC pVCpu, PGMMODE enmGuestMode, bool fForce)976 {977 //AssertReleaseFailed(); /** @todo Called by the PGM saved state code. */978 RT_NOREF(pVM, pVCpu, enmGuestMode, fForce);979 return VINF_SUCCESS;980 }981 982 983 VMMDECL(int) PGMShwGetPage(PVMCPUCC pVCpu, RTGCPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys)984 {985 AssertReleaseFailed();986 RT_NOREF(pVCpu, GCPtr, pfFlags, pHCPhys);987 return VERR_NOT_SUPPORTED;988 }989 990 991 int pgmR3ExitShadowModeBeforePoolFlush(PVMCPU pVCpu)992 {993 RT_NOREF(pVCpu);994 return VINF_SUCCESS;995 }996 997 998 int pgmR3ReEnterShadowModeAfterPoolFlush(PVM pVM, PVMCPU pVCpu)999 {1000 RT_NOREF(pVM, pVCpu);1001 return VINF_SUCCESS;1002 }1003 1004 1005 void pgmR3RefreshShadowModeAfterA20Change(PVMCPU pVCpu)1006 {1007 RT_NOREF(pVCpu);1008 }1009 1010 1011 int pgmGstPtWalk(PVMCPUCC pVCpu, RTGCPTR GCPtr, PPGMPTWALK pWalk, PPGMPTWALKGST pGstWalk)1012 {1013 VMCPU_ASSERT_EMT(pVCpu);1014 RT_NOREF(pGstWalk);1015 return PGMGstGetPage(pVCpu, GCPtr, pWalk);1016 }1017 1018 1019 int pgmGstPtWalkNext(PVMCPUCC pVCpu, RTGCPTR GCPtr, PPGMPTWALK pWalk, PPGMPTWALKGST pGstWalk)1020 {1021 VMCPU_ASSERT_EMT(pVCpu);1022 return pgmGstPtWalk(pVCpu, GCPtr, pWalk, pGstWalk); /** @todo Always do full walk for now. */1023 }1024 -
trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
r107179 r108132 32 32 #define LOG_GROUP LOG_GROUP_PGM 33 33 #define VBOX_WITHOUT_PAGING_BIT_FIELDS /* 64-bit bitfields are just asking for trouble. See @bugref{9841} and others. */ 34 #ifdef IN_RING0 35 # define VBOX_VMM_TARGET_X86 36 #endif 34 37 #include <VBox/vmm/dbgf.h> 35 38 #include <VBox/vmm/pgm.h> … … 561 564 PGM_PAGE_SET_HNDL_PHYS_STATE(pPage, uState, pCurType->fNotInHm); 562 565 566 #if defined(VBOX_WITH_NATIVE_NEM) || !defined(VBOX_WITH_ONLY_PGM_NEM_MODE) 563 567 const RTGCPHYS GCPhysPage = pRam->GCPhys + (i << GUEST_PAGE_SHIFT); 568 #endif 569 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 564 570 int rc2 = pgmPoolTrackUpdateGCPhys(pVM, GCPhysPage, pPage, 565 571 false /* allow updates of PTEs (instead of flushing) */, &fFlushTLBs); 566 572 if (rc2 != VINF_SUCCESS && rc == VINF_SUCCESS) 567 573 rc = rc2; 574 #endif 568 575 569 576 #ifdef VBOX_WITH_NATIVE_NEM … … 871 878 /* This should normally not be necessary. */ 872 879 PGM_PAGE_SET_HNDL_PHYS_STATE_ONLY(pPage, uState); 880 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 873 881 bool fFlushTLBs; 874 882 rc = pgmPoolTrackUpdateGCPhys(pVM, GCPhys, pPage, false /*fFlushPTEs*/, &fFlushTLBs); … … 877 885 else 878 886 AssertRC(rc); 887 #endif 879 888 880 889 #ifdef VBOX_WITH_NATIVE_NEM … … 925 934 * Flush any shadow page table references *first*. 926 935 */ 936 #if defined(VBOX_VMM_TARGET_ARMV8) 937 AssertReleaseFailed(); 938 #endif 939 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 927 940 bool fFlushTLBs = false; 928 941 int rc = pgmPoolTrackUpdateGCPhys(pVM, GCPhysPage, pPage, true /*fFlushPTEs*/, &fFlushTLBs); 929 942 AssertLogRelRCReturnVoid(rc); 930 #if defined(VBOX_VMM_TARGET_ARMV8)931 AssertReleaseFailed();932 #else933 943 HMFlushTlbOnAllVCpus(pVM); 934 944 #endif … … 956 966 { 957 967 PPGMPHYSHANDLER pHandler; 958 rc= pgmHandlerPhysicalLookup(pVM, GCPhysPage, &pHandler);959 if (RT_SUCCESS(rc ))968 int rc2 = pgmHandlerPhysicalLookup(pVM, GCPhysPage, &pHandler); 969 if (RT_SUCCESS(rc2)) 960 970 { 961 971 Assert(pHandler->cAliasedPages > 0); … … 963 973 } 964 974 else 965 AssertMsgFailed(("rc =%Rrc GCPhysPage=%RGp\n", rc, GCPhysPage));975 AssertMsgFailed(("rc2=%Rrc GCPhysPage=%RGp\n", rc2, GCPhysPage)); 966 976 } 967 977 -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r107194 r108132 32 32 #define LOG_GROUP LOG_GROUP_PGM_PHYS 33 33 #define VBOX_WITHOUT_PAGING_BIT_FIELDS /* 64-bit bitfields are just asking for trouble. See @bugref{9841} and others. */ 34 #ifdef IN_RING0 35 # define VBOX_VMM_TARGET_X86 36 #endif 34 37 #include <VBox/vmm/pgm.h> 35 38 #include <VBox/vmm/trpm.h> … … 4867 4870 memcpy(pvDst, pvSrc, cb); 4868 4871 PGMPhysReleasePageMappingLock(pVM, &Lock); 4872 #ifdef VBOX_VMM_TARGET_X86 4869 4873 rc = PGMGstModifyPage(pVCpu, GCPtrDst, 1, X86_PTE_A | X86_PTE_D, ~(uint64_t)(X86_PTE_A | X86_PTE_D)); AssertRC(rc); 4874 #elif !defined(VBOX_VMM_TARGET_ARMV8) 4875 # error "misconfig" 4876 #endif 4870 4877 return VINF_SUCCESS; 4871 4878 } … … 4874 4881 memcpy(pvDst, pvSrc, cbPage); 4875 4882 PGMPhysReleasePageMappingLock(pVM, &Lock); 4883 #ifdef VBOX_VMM_TARGET_X86 4876 4884 rc = PGMGstModifyPage(pVCpu, GCPtrDst, 1, X86_PTE_A | X86_PTE_D, ~(uint64_t)(X86_PTE_A | X86_PTE_D)); AssertRC(rc); 4885 #elif !defined(VBOX_VMM_TARGET_ARMV8) 4886 # error "misconfig" 4887 #endif 4877 4888 GCPtrDst = (RTGCPTR)((RTGCUINTPTR)GCPtrDst + cbPage); 4878 4889 pvSrc = (const uint8_t *)pvSrc + cbPage; … … 4894 4905 memcpy(pvDst, pvSrc, cb); 4895 4906 PGMPhysReleasePageMappingLock(pVM, &Lock); 4907 #ifdef VBOX_VMM_TARGET_X86 4896 4908 rc = PGMGstModifyPage(pVCpu, GCPtrDst, 1, X86_PTE_A | X86_PTE_D, ~(uint64_t)(X86_PTE_A | X86_PTE_D)); AssertRC(rc); 4909 #elif !defined(VBOX_VMM_TARGET_ARMV8) 4910 # error "misconfig" 4911 #endif 4897 4912 return VINF_SUCCESS; 4898 4913 } … … 4901 4916 memcpy(pvDst, pvSrc, GUEST_PAGE_SIZE); 4902 4917 PGMPhysReleasePageMappingLock(pVM, &Lock); 4918 #ifdef VBOX_VMM_TARGET_X86 4903 4919 rc = PGMGstModifyPage(pVCpu, GCPtrDst, 1, X86_PTE_A | X86_PTE_D, ~(uint64_t)(X86_PTE_A | X86_PTE_D)); AssertRC(rc); 4920 #elif !defined(VBOX_VMM_TARGET_ARMV8) 4921 # error "misconfig" 4922 #endif 4904 4923 GCPtrDst = (RTGCPTR)((RTGCUINTPTR)GCPtrDst + GUEST_PAGE_SIZE); 4905 4924 pvSrc = (const uint8_t *)pvSrc + GUEST_PAGE_SIZE; … … 4952 4971 RTGCPHYS const GCPhys = Walk.GCPhys | ((RTGCUINTPTR)GCPtrSrc & GUEST_PAGE_OFFSET_MASK); 4953 4972 4973 #ifdef VBOX_VMM_TARGET_X86 4954 4974 /* mark the guest page as accessed. */ 4955 4975 if (!(Walk.fEffective & X86_PTE_A)) … … 4958 4978 AssertRC(rc); 4959 4979 } 4960 4980 #elif !defined(VBOX_VMM_TARGET_ARMV8) 4981 # error "misconfig" 4982 #endif 4961 4983 return PGMPhysRead(pVM, GCPhys, pvDst, cb, enmOrigin); 4962 4984 } … … 4973 4995 RTGCPHYS const GCPhys = Walk.GCPhys | ((RTGCUINTPTR)GCPtrSrc & GUEST_PAGE_OFFSET_MASK); 4974 4996 4997 #ifdef VBOX_VMM_TARGET_X86 4975 4998 /* mark the guest page as accessed. */ 4976 4999 if (!(Walk.fEffective & X86_PTE_A)) … … 4979 5002 AssertRC(rc); 4980 5003 } 5004 #elif !defined(VBOX_VMM_TARGET_ARMV8) 5005 # error "misconfig" 5006 #endif 4981 5007 4982 5008 /* copy */ … … 5047 5073 Log(("PGMPhysWriteGCPtr: Writing to RO page %RGv %#x\n", GCPtrDst, cb)); 5048 5074 5075 #ifdef VBOX_VMM_TARGET_X86 5049 5076 /* Mark the guest page as accessed and dirty if necessary. */ 5050 5077 if ((Walk.fEffective & (X86_PTE_A | X86_PTE_D)) != (X86_PTE_A | X86_PTE_D)) … … 5053 5080 AssertRC(rc); 5054 5081 } 5082 #elif !defined(VBOX_VMM_TARGET_ARMV8) 5083 # error "misconfig" 5084 #endif 5055 5085 5056 5086 return PGMPhysWrite(pVM, GCPhys, pvSrc, cb, enmOrigin); … … 5072 5102 Log(("PGMPhysWriteGCPtr: Writing to RO page %RGv %#x\n", GCPtrDst, cb)); 5073 5103 5104 #ifdef VBOX_VMM_TARGET_X86 5074 5105 /* Mark the guest page as accessed and dirty if necessary. */ 5075 5106 if ((Walk.fEffective & (X86_PTE_A | X86_PTE_D)) != (X86_PTE_A | X86_PTE_D)) … … 5078 5109 AssertRC(rc); 5079 5110 } 5111 #elif !defined(VBOX_VMM_TARGET_ARMV8) 5112 # error "misconfig" 5113 #endif 5080 5114 5081 5115 /* copy */ … … 5373 5407 { 5374 5408 PGM_A20_APPLY_TO_VAR(pVCpu, GCPhys); 5409 RT_NOREF(pVCpu); 5375 5410 5376 5411 PGM_LOCK_VOID(pVM); -
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r106061 r108132 32 32 #define LOG_GROUP LOG_GROUP_PGM_POOL 33 33 #define VBOX_WITHOUT_PAGING_BIT_FIELDS /* 64-bit bitfields are just asking for trouble. See @bugref{9841} and others. */ 34 #ifndef VBOX_VMM_TARGET_X86 35 # define VBOX_VMM_TARGET_X86 36 #endif 34 37 #include <VBox/vmm/pgm.h> 35 38 #include <VBox/vmm/mm.h> -
trunk/src/VBox/VMM/VMMR0/PGMR0.cpp
r106061 r108132 30 30 * Header Files * 31 31 *********************************************************************************************************************************/ 32 #define VBOX_VMM_TARGET_X86 32 33 #define LOG_GROUP LOG_GROUP_PGM 33 34 #define VBOX_WITHOUT_PAGING_BIT_FIELDS /* 64-bit bitfields are just asking for trouble. See @bugref{9841} and others. */ -
trunk/src/VBox/VMM/VMMR0/PGMR0Pool.cpp
r106061 r108132 32 32 #define LOG_GROUP LOG_GROUP_PGM_POOL 33 33 #define VBOX_WITHOUT_PAGING_BIT_FIELDS /* 64-bit bitfields are just asking for trouble. See @bugref{9841} and others. */ 34 #define VBOX_VMM_TARGET_X86 34 35 #include <VBox/vmm/pgm.h> 35 36 #include <VBox/vmm/hm.h> -
trunk/src/VBox/VMM/VMMR0/PGMR0SharedPage.cpp
r106061 r108132 32 32 #define LOG_GROUP LOG_GROUP_PGM_SHARED 33 33 #define VBOX_WITHOUT_PAGING_BIT_FIELDS /* 64-bit bitfields are just asking for trouble. See @bugref{9841} and others. */ 34 #define VBOX_VMM_TARGET_X86 34 35 #include <VBox/vmm/pgm.h> 35 36 #include <VBox/vmm/iem.h> -
trunk/src/VBox/VMM/VMMR3/PGM.cpp
r107876 r108132 1069 1069 rc = pgmR3InitPaging(pVM); 1070 1070 1071 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1071 1072 /* 1072 1073 * Init the page pool. … … 1074 1075 if (RT_SUCCESS(rc)) 1075 1076 rc = pgmR3PoolInit(pVM); 1077 # endif 1076 1078 1077 1079 if (RT_SUCCESS(rc)) … … 1934 1936 } 1935 1937 1938 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1936 1939 /* 1937 1940 * The page pool. 1938 1941 */ 1939 1942 pgmR3PoolRelocate(pVM); 1943 # endif 1940 1944 1941 1945 #else … … 1970 1974 STAM_REL_COUNTER_RESET(&pVCpu->pgm.s.cGuestModeChanges); 1971 1975 1976 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1972 1977 pgmR3PoolResetUnpluggedCpu(pVM, pVCpu); 1978 # endif 1973 1979 1974 1980 /* … … 2073 2079 # ifdef PGM_WITH_A20 2074 2080 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 2081 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2075 2082 pgmR3RefreshShadowModeAfterA20Change(pVCpu); 2076 2083 HMFlushTlb(pVCpu); 2084 # endif 2077 2085 # endif 2078 2086 } … … 2401 2409 } 2402 2410 2411 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2403 2412 2404 2413 /** … … 2429 2438 } 2430 2439 2431 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE2440 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2432 2441 Assert(pVCpu->pgm.s.pShwPageCR3R3 == NULL); 2433 # endif2442 # endif 2434 2443 return rc; 2435 2444 } … … 2451 2460 AssertRCSuccessReturn(rc, VERR_IPE_UNEXPECTED_INFO_STATUS); 2452 2461 2453 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE2462 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 2454 2463 Assert(pVCpu->pgm.s.pShwPageCR3R3 != NULL || pVCpu->pgm.s.enmShadowMode == PGMMODE_NONE); 2455 # endif2464 # endif 2456 2465 AssertMsg( pVCpu->pgm.s.enmShadowMode >= PGMMODE_NESTED_32BIT 2457 2466 || CPUMGetHyperCR3(pVCpu) == PGMGetHyperCR3(pVCpu), … … 2475 2484 } 2476 2485 2486 # endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */ 2477 2487 #endif /* VBOX_VMM_TARGET_X86 */ 2478 2488 #ifdef VBOX_WITH_DEBUGGER -
trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
r107625 r108132 406 406 * not be informed about writes and keep bogus gst->shw mappings around. 407 407 */ 408 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 408 409 pgmPoolFlushPageByGCPhys(pVM, *pGCPhys); 410 #endif 409 411 Assert(!PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage)); 410 412 /** @todo r=bird: return VERR_PGM_PHYS_PAGE_RESERVED here if it still has … … 5353 5355 RTGCPHYS const GCPhysPage = pRom->GCPhys + (iPage << GUEST_PAGE_SHIFT); 5354 5356 PPGMPAGE pRamPage = pgmPhysGetPage(pVM, GCPhysPage); 5357 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 5355 5358 int rc2 = pgmPoolTrackUpdateGCPhys(pVM, GCPhysPage, pRamPage, true /*fFlushPTEs*/, &fFlushTLB); 5356 5359 if (rc2 != VINF_SUCCESS && (rc == VINF_SUCCESS || RT_FAILURE(rc2))) 5357 5360 rc = rc2; 5361 #endif 5358 5362 #ifdef VBOX_WITH_NATIVE_NEM 5359 5363 uint8_t u2State = PGM_PAGE_GET_NEM_STATE(pRamPage); … … 5448 5452 RTGCPHYS *paPhysPage = (RTGCPHYS *)paUser[2]; 5449 5453 int rc = VINF_SUCCESS; 5454 RT_NOREF(pVCpu); 5450 5455 5451 5456 Log(("pgmR3PhysChangeMemBalloonRendezvous: %s %x pages\n", (fInflate) ? "inflate" : "deflate", cPages)); … … 5454 5459 if (fInflate) 5455 5460 { 5461 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 5456 5462 /* Flush the PGM pool cache as we might have stale references to pages that we just freed. */ 5457 5463 pgmR3PoolClearAllRendezvous(pVM, pVCpu, NULL); 5464 # endif 5458 5465 5459 5466 /* Replace pages with ZERO pages. */ … … 5481 5488 LogFlow(("balloon page: %RGp\n", paPhysPage[i])); 5482 5489 5490 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 5483 5491 /* Flush the shadow PT if this page was previously used as a guest page table. */ 5484 5492 pgmPoolFlushPageByGCPhys(pVM, paPhysPage[i]); 5493 # endif 5485 5494 5486 5495 rc = pgmPhysFreePage(pVM, pReq, &cPendingPages, pPage, paPhysPage[i], (PGMPAGETYPE)PGM_PAGE_GET_TYPE(pPage)); … … 5526 5535 } 5527 5536 5528 # if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)5537 # if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) 5529 5538 /* Notify GMM about the balloon change. */ 5530 5539 rc = GMMR3BalloonedPages(pVM, (fInflate) ? GMMBALLOONACTION_INFLATE : GMMBALLOONACTION_DEFLATE, cPages); … … 5539 5548 pVM->pgm.s.cBalloonedPages += cPages; 5540 5549 } 5541 # endif5550 # endif 5542 5551 5543 5552 PGM_UNLOCK(pVM); … … 5697 5706 } 5698 5707 } 5708 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 5699 5709 pgmR3PoolWriteProtectPages(pVM); 5710 #endif 5700 5711 PGM_INVL_ALL_VCPU_TLBS(pVM); 5701 5712 for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) … … 5968 5979 if (pVM->pgm.s.ChunkR3Map.c >= pVM->pgm.s.ChunkR3Map.cMax) 5969 5980 { 5981 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 5970 5982 /* Flush the pgm pool cache; call the internal rendezvous handler as we're already in a rendezvous handler here. */ 5971 5983 /** @todo also not really efficient to unmap a chunk that contains PD 5972 5984 * or PT pages. */ 5973 5985 pgmR3PoolClearAllRendezvous(pVM, pVM->apCpusR3[0], NULL /* no need to flush the REM TLB as we already did that above */); 5986 #endif 5974 5987 5975 5988 /* … … 6350 6363 # ifdef PGM_WITH_A20 6351 6364 VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); 6365 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 6352 6366 pgmR3RefreshShadowModeAfterA20Change(pVCpu); 6353 6367 HMFlushTlb(pVCpu); 6368 # endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */ 6354 6369 # endif 6355 6370 # if 0 /* PGMGetPage will apply the A20 mask to the GCPhys it returns, so we must invalid both sides of the TLB. */ -
trunk/src/VBox/VMM/VMMR3/PGMSavedState.cpp
r107227 r108132 1937 1937 pgmR3ScanMmio2Pages(pVM, uPass); 1938 1938 pgmR3ScanRamPages(pVM, false /*fFinalPass*/); 1939 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1939 1940 pgmR3PoolClearAll(pVM, true /*fFlushRemTlb*/); /** @todo this could perhaps be optimized a bit. */ 1941 #endif 1940 1942 1941 1943 /* … … 3167 3169 PVMCPU pVCpu = pVM->apCpusR3[i]; 3168 3170 pVCpu->pgm.s.GCPhysA20Mask = ~((RTGCPHYS)!pVCpu->pgm.s.fA20Enabled << 20); 3171 #ifdef VBOX_VMM_TARGET_X86 3172 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 3169 3173 pgmR3RefreshShadowModeAfterA20Change(pVCpu); 3174 # endif 3175 #endif 3170 3176 } 3171 3177 … … 3328 3334 PVMCPU pVCpu = pVM->apCpusR3[i]; 3329 3335 3336 /** @todo ARM VMs may have an invalid value here, since PGMMODE_NONE was 3337 * moved from 12 to 31. Thus far, though, this is a complete NOOP on 3338 * ARM and we still have very limited PGM functionality there (the 3339 * saved state is mostly X86-isms). */ 3330 3340 rc = PGMHCChangeMode(pVM, pVCpu, pVCpu->pgm.s.enmGuestMode, false /* fForce */); 3331 3341 AssertLogRelRCReturn(rc, rc); -
trunk/src/VBox/VMM/VMMR3/VMMR3.def
r107276 r108132 335 335 PGMPhysSimpleWriteGCPtr 336 336 PGMPhysWriteGCPtr 337 PGMShwMakePageWritable338 337 PGMR3QueryGlobalMemoryStats 339 338 PGMR3QueryMemoryStats -
trunk/src/VBox/VMM/include/PDMInternal.h
r107308 r108132 48 48 #include <VBox/vmm/pdmcommon.h> 49 49 #include <VBox/vmm/pdmtask.h> 50 #ifdef VBOX_VMM_TARGET_ARMV8 50 #if defined(VBOX_VMM_TARGET_X86) || defined(VBOX_VMM_TARGET_AGNOSTIC) 51 # include <VBox/vmm/pdmapic.h> 52 #endif 53 #if defined(VBOX_VMM_TARGET_ARMV8) || defined(VBOX_VMM_TARGET_AGNOSTIC) 51 54 # include <VBox/vmm/pdmgic.h> 52 #else53 # include <VBox/vmm/pdmapic.h>54 55 #endif 55 56 #include <VBox/sup.h> … … 1828 1829 # define PDM_TO_APICBACKEND(a_pVM) (&((a_pVM)->pdm.s.Ic.u.x86.ApicBackend)) 1829 1830 # define PDMCPU_TO_APICBACKEND(a_pVCpu) (&((a_pVCpu)->CTX_SUFF(pVM)->pdm.s.Ic.u.x86.ApicBackend)) 1830 # else1831 # else 1831 1832 # define PDM_TO_APICBACKEND(a_pVM) (&((a_pVM)->pdmr0.s.Ic.u.x86.ApicBackend)) 1832 1833 # define PDMCPU_TO_APICBACKEND(a_pVCpu) (&((a_pVCpu)->CTX_SUFF(pVM)->pdmr0.s.Ic.u.x86.ApicBackend)) 1833 # endif1834 # endif 1834 1835 #else 1835 1836 # ifdef IN_RING3 1836 1837 # define PDM_TO_GICBACKEND(a_pVM) (&((a_pVM)->pdm.s.Ic.u.armv8.GicBackend)) 1837 1838 # define PDMCPU_TO_GICBACKEND(a_pVCpu) (&((a_pVCpu)->CTX_SUFF(pVM)->pdm.s.Ic.u.armv8.GicBackend)) 1838 #else 1839 # error "Implement me" 1840 #endif 1839 # else 1840 # ifndef VBOX_WITH_MINIMAL_R0 /* hack for AllPdbTypeHack.cpp */ 1841 # error "Implement me" 1842 # endif 1843 # endif 1841 1844 #endif 1842 1845 -
trunk/src/VBox/VMM/include/PGMInline.h
r107171 r108132 1162 1162 } 1163 1163 1164 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 1164 1165 1165 1166 /** … … 1190 1191 * Just deal with the simple case here. 1191 1192 */ 1192 # ifdef VBOX_STRICT1193 # ifdef VBOX_STRICT 1193 1194 PVMCC pVM = pPool->CTX_SUFF(pVM); NOREF(pVM); 1194 # endif1195 # ifdef LOG_ENABLED1195 # endif 1196 # ifdef LOG_ENABLED 1196 1197 const unsigned uOrg = PGM_PAGE_GET_TRACKING(pPhysPage); 1197 # endif1198 # endif 1198 1199 const unsigned cRefs = PGM_PAGE_GET_TD_CREFS(pPhysPage); 1199 1200 if (cRefs == 1) 1200 1201 { 1201 # if 0 /* for more debug info */1202 # if 0 /* for more debug info */ 1202 1203 AssertMsg( pPoolPage->idx == PGM_PAGE_GET_TD_IDX(pPhysPage) 1203 1204 && iPte == PGM_PAGE_GET_PTE_INDEX(pPhysPage), … … 1207 1208 pPool->aPages[PGM_PAGE_GET_TD_IDX(pPhysPage)].enmKind, 1208 1209 ((uint64_t *)pPoolPage->CTX_SUFF(pvPage))[iPte])); 1209 # else1210 # else 1210 1211 Assert(pPoolPage->idx == PGM_PAGE_GET_TD_IDX(pPhysPage)); 1211 1212 Assert(iPte == PGM_PAGE_GET_PTE_INDEX(pPhysPage)); 1212 # endif1213 # endif 1213 1214 /* Invalidate the tracking data. */ 1214 1215 PGM_PAGE_SET_TRACKING(pVM, pPhysPage, 0); … … 1316 1317 } 1317 1318 1319 #endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */ 1318 1320 1319 1321 /** @} */ -
trunk/src/VBox/VMM/include/PGMInternal.h
r107194 r108132 76 76 * Optimization for PAE page tables that are modified often 77 77 */ 78 #if ndef VBOX_VMM_TARGET_ARMV878 #if !defined(VBOX_VMM_TARGET_ARMV8) && !defined(VBOX_WITH_ONLY_PGM_NEM_MODE) 79 79 # define PGMPOOL_WITH_OPTIMIZED_DIRTY_PT 80 80 #endif … … 2513 2513 /** @name A20 gate macros 2514 2514 * @{ */ 2515 #define PGM_WITH_A20 2515 #if defined(VBOX_VMM_TARGET_X86) || defined(DOXYGEN_RUNNING) 2516 # define PGM_WITH_A20 2517 #elif !defined(VBOX_VMM_TARGET_ARMV8) && !defined(IN_TSTVMSTRUCT) 2518 # error "Misconfig" 2519 #endif 2516 2520 #ifdef PGM_WITH_A20 2517 2521 # define PGM_A20_IS_ENABLED(a_pVCpu) ((a_pVCpu)->pgm.s.fA20Enabled) … … 4000 4004 void pgmR3PhysAssertSharedPageChecksums(PVM pVM); 4001 4005 4006 # ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 4002 4007 int pgmR3PoolInit(PVM pVM); 4003 4008 void pgmR3PoolRelocate(PVM pVM); … … 4007 4012 DECLCALLBACK(VBOXSTRICTRC) pgmR3PoolClearAllRendezvous(PVM pVM, PVMCPU pVCpu, void *fpvFlushRemTbl); 4008 4013 void pgmR3PoolWriteProtectPages(PVM pVM); 4014 # endif 4009 4015 4010 4016 #endif /* IN_RING3 */ 4011 #ifdef IN_RING0 4017 #ifndef VBOX_WITH_ONLY_PGM_NEM_MODE 4018 # ifdef IN_RING0 4012 4019 int pgmR0PoolInitVM(PGVM pGVM); 4013 # endif4020 # endif 4014 4021 int pgmPoolAlloc(PVMCC pVM, RTGCPHYS GCPhys, PGMPOOLKIND enmKind, PGMPOOLACCESS enmAccess, bool fA20Enabled, 4015 4022 uint16_t iUser, uint32_t iUserTable, bool fLockPage, PPPGMPOOLPAGE ppPage); … … 4076 4083 int pgmR3ReEnterShadowModeAfterPoolFlush(PVM pVM, PVMCPU pVCpu); 4077 4084 void pgmR3RefreshShadowModeAfterA20Change(PVMCPU pVCpu); 4085 #endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */ 4078 4086 4079 4087 int pgmShwMakePageSupervisorAndWritable(PVMCPUCC pVCpu, RTGCPTR GCPtr, bool fBigPage, uint32_t fOpFlags);
Note:
See TracChangeset
for help on using the changeset viewer.