Changeset 96978 in vbox
- Timestamp:
- Oct 4, 2022 11:37:47 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r96900 r96978 64 64 DECLINLINE(int) pgmGstMapCr3(PVMCPUCC pVCpu, RTGCPHYS GCPhysCr3, PRTHCPTR pHCPtrGuestCr3); 65 65 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 66 static int pgmGstSlatWalk(PVMCPUCC pVCpu, RTGCPHYS GCPhysNested, bool fIsLinearAddrValid, RTGCPTR GCPtrNested, PPGMPTWALK pWalk,67 PPGMPTWALK GST pGstWalk);66 static int pgmGstSlatWalk(PVMCPUCC pVCpu, RTGCPHYS GCPhysNested, bool fIsLinearAddrValid, RTGCPTR GCPtrNested, 67 PPGMPTWALK pWalk, PPGMPTWALKGST pGstWalk); 68 68 static int pgmGstSlatWalkPhys(PVMCPUCC pVCpu, PGMSLAT enmSlatMode, RTGCPHYS GCPhysNested, PPGMPTWALK pWalk, 69 69 PPGMPTWALKGST pGstWalk); … … 76 76 77 77 78 /* 79 * Second level transation - EPT. 80 */ 78 81 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 79 82 # define PGM_SLAT_TYPE PGM_SLAT_TYPE_EPT … … 902 905 903 906 904 /** 905 * Gets the CR3 mask corresponding to the given paging mode. 907 /** Mask array used by pgmGetCr3MaskForMode. 908 * X86_CR3_AMD64_PAGE_MASK is used for modes that doesn't have a CR3 or EPTP. */ 909 static uint64_t const g_auCr3MaskForMode[PGMMODE_MAX] = 910 { 911 /* [PGMMODE_INVALID] = */ X86_CR3_AMD64_PAGE_MASK, 912 /* [PGMMODE_REAL] = */ X86_CR3_AMD64_PAGE_MASK, 913 /* [PGMMODE_PROTECTED] = */ X86_CR3_AMD64_PAGE_MASK, 914 /* [PGMMODE_32_BIT] = */ X86_CR3_PAGE_MASK, 915 /* [PGMMODE_PAE] = */ X86_CR3_PAE_PAGE_MASK, 916 /* [PGMMODE_PAE_NX] = */ X86_CR3_PAE_PAGE_MASK, 917 /* [PGMMODE_AMD64] = */ X86_CR3_AMD64_PAGE_MASK, 918 /* [PGMMODE_AMD64_NX] = */ X86_CR3_AMD64_PAGE_MASK, 919 /* [PGMMODE_NESTED_32BIT = */ X86_CR3_PAGE_MASK, 920 /* [PGMMODE_NESTED_PAE] = */ X86_CR3_PAE_PAGE_MASK, 921 /* [PGMMODE_NESTED_AMD64] = */ X86_CR3_AMD64_PAGE_MASK, 922 /* [PGMMODE_EPT] = */ X86_CR3_EPT_PAGE_MASK, 923 /* [PGMMODE_NONE] = */ X86_CR3_AMD64_PAGE_MASK, 924 }; 925 926 927 /** 928 * Gets the physical address mask for CR3 in the given paging mode. 929 * 930 * The mask is for eliminating flags and other stuff in CR3/EPTP when 931 * extracting the physical address. It is not for validating whether there are 932 * reserved bits set. PGM ASSUMES that whoever loaded the CR3 value and passed 933 * it to PGM checked for reserved bits, including reserved physical address 934 * bits. 906 935 * 907 936 * @returns The CR3 mask. … … 911 940 DECLINLINE(uint64_t) pgmGetCr3MaskForMode(PGMMODE enmMode, PGMSLAT enmSlatMode) 912 941 { 913 /** @todo This work can be optimized either by storing the masks in914 * pVCpu->pgm.s.afGstCr3Masks[] for all PGMMODEs -or- just do this once and915 * store the result when entering guest mode since we currently use it only916 * for enmGuestMode. */917 942 if (enmSlatMode == PGMSLAT_DIRECT) 918 943 { 919 944 Assert(enmMode != PGMMODE_EPT); 920 switch (enmMode) 921 { 922 case PGMMODE_PAE: 923 case PGMMODE_PAE_NX: 924 return X86_CR3_PAE_PAGE_MASK; 925 case PGMMODE_AMD64: 926 case PGMMODE_AMD64_NX: 927 return X86_CR3_AMD64_PAGE_MASK; 928 default: 929 return X86_CR3_PAGE_MASK; 930 } 931 } 932 else 933 { 934 Assert(enmSlatMode == PGMSLAT_EPT); 935 return X86_CR3_EPT_PAGE_MASK; 936 } 945 return g_auCr3MaskForMode[(unsigned)enmMode < (unsigned)PGMMODE_MAX ? enmMode : 0]; 946 } 947 Assert(enmSlatMode == PGMSLAT_EPT); 948 return X86_CR3_EPT_PAGE_MASK; 937 949 } 938 950 … … 940 952 /** 941 953 * Gets the masked CR3 value according to the current guest paging mode. 954 * 955 * See disclaimer in pgmGetCr3MaskForMode. 942 956 * 943 957 * @returns The masked PGM CR3 value. … … 2008 2022 } 2009 2023 2010 2011 2024 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 2025 2012 2026 /** 2013 2027 * Performs a guest second-level address translation (SLAT). … … 2088 2102 } 2089 2103 } 2104 2090 2105 #endif /* VBOX_WITH_NESTED_HWVIRT_VMX_EPT */ 2091 2092 2106 2093 2107 /**
Note:
See TracChangeset
for help on using the changeset viewer.