Changeset 72966 in vbox for trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
- Timestamp:
- Jul 8, 2018 6:22:48 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r72965 r72966 116 116 117 117 /** Assert that the required state bits are fetched. */ 118 #define HMSVM_CPUMCTX_ASSERT(a_pVCpu, a_fExtrnMbz) AssertMsg(!((a_pVCpu)->cpum.GstCtx.fExtrn & (a_fExtrnMbz)), \ 119 ("fExtrn=%#RX64 fExtrnMbz=%#RX64\n", \ 120 (a_pVCpu)->cpum.GstCtx.fExtrn, (a_fExtrnMbz))) 118 #define HMSVM_CPUMCTX_ASSERT(a_pVCpu, a_fExtrnMbz) AssertMsg(!((a_pVCpu)->cpum.GstCtx.fExtrn & (a_fExtrnMbz)), \ 119 ("fExtrn=%#RX64 fExtrnMbz=%#RX64\n", \ 120 (a_pVCpu)->cpum.GstCtx.fExtrn, (a_fExtrnMbz))) 121 122 /** Assert that preemption is disabled or covered by thread-context hooks. */ 123 #define HMSVM_ASSERT_PREEMPT_SAFE(a_pVCpu) Assert( VMMR0ThreadCtxHookIsEnabled((a_pVCpu)) \ 124 || !RTThreadPreemptIsEnabled(NIL_RTTHREAD)); 125 126 /** Assert that we haven't migrated CPUs when thread-context hooks are not 127 * used. */ 128 #define HMSVM_ASSERT_CPU_SAFE(a_pVCpu) AssertMsg( VMMR0ThreadCtxHookIsEnabled((a_pVCpu)) \ 129 || (a_pVCpu)->hm.s.idEnteredCpu == RTMpCpuId(), \ 130 ("Illegal migration! Entered on CPU %u Current %u\n", \ 131 (a_pVCpu)->hm.s.idEnteredCpu, RTMpCpuId())); 132 133 /** Assert that we're not executing a nested-guest. */ 134 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM 135 # define HMSVM_ASSERT_NOT_IN_NESTED_GUEST(a_pCtx) Assert(!CPUMIsGuestInSvmNestedHwVirtMode((a_pCtx))) 136 #else 137 # define HMSVM_ASSERT_NOT_IN_NESTED_GUEST(a_pCtx) do { NOREF((a_pCtx)); } while (0) 138 #endif 139 140 /** Assert that we're executing a nested-guest. */ 141 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM 142 # define HMSVM_ASSERT_IN_NESTED_GUEST(a_pCtx) Assert(CPUMIsGuestInSvmNestedHwVirtMode((a_pCtx))) 143 #else 144 # define HMSVM_ASSERT_IN_NESTED_GUEST(a_pCtx) do { NOREF((a_pCtx)); } while (0) 145 #endif 121 146 122 147 /** Macro for checking and returning from the using function for … … 167 192 (a_rc) = VINF_EM_DBG_STEPPED; \ 168 193 } while (0) 169 170 /** Assert that preemption is disabled or covered by thread-context hooks. */171 #define HMSVM_ASSERT_PREEMPT_SAFE() Assert( VMMR0ThreadCtxHookIsEnabled(pVCpu) \172 || !RTThreadPreemptIsEnabled(NIL_RTTHREAD));173 174 /** Assert that we haven't migrated CPUs when thread-context hooks are not175 * used. */176 #define HMSVM_ASSERT_CPU_SAFE() AssertMsg( VMMR0ThreadCtxHookIsEnabled(pVCpu) \177 || pVCpu->hm.s.idEnteredCpu == RTMpCpuId(), \178 ("Illegal migration! Entered on CPU %u Current %u\n", \179 pVCpu->hm.s.idEnteredCpu, RTMpCpuId()));180 181 /** Assert that we're not executing a nested-guest. */182 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM183 # define HMSVM_ASSERT_NOT_IN_NESTED_GUEST(a_pCtx) Assert(!CPUMIsGuestInSvmNestedHwVirtMode((a_pCtx)))184 #else185 # define HMSVM_ASSERT_NOT_IN_NESTED_GUEST(a_pCtx) do { NOREF((a_pCtx)); } while (0)186 #endif187 188 /** Assert that we're executing a nested-guest. */189 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM190 # define HMSVM_ASSERT_IN_NESTED_GUEST(a_pCtx) Assert(CPUMIsGuestInSvmNestedHwVirtMode((a_pCtx)))191 #else192 # define HMSVM_ASSERT_IN_NESTED_GUEST(a_pCtx) do { NOREF((a_pCtx)); } while (0)193 #endif194 194 195 195 /** Validate segment descriptor granularity bit. */ … … 816 816 if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 817 817 { 818 return 819 &&pVM->cpum.ro.GuestFeatures.fSvmVmcbClean;818 return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_VMCB_CLEAN) 819 && pVM->cpum.ro.GuestFeatures.fSvmVmcbClean; 820 820 } 821 821 #else … … 839 839 if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 840 840 { 841 return 842 841 return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSISTS) 842 && pVM->cpum.ro.GuestFeatures.fSvmDecodeAssists; 843 843 } 844 844 #else … … 862 862 if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 863 863 { 864 return 865 864 return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE) 865 && pVM->cpum.ro.GuestFeatures.fSvmNextRipSave; 866 866 } 867 867 #else … … 3232 3232 Assert(pvUser); 3233 3233 Assert(VMMRZCallRing3IsEnabled(pVCpu)); 3234 HMSVM_ASSERT_PREEMPT_SAFE( );3234 HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); 3235 3235 3236 3236 VMMRZCallRing3Disable(pVCpu); … … 3263 3263 Assert(pVCpu); 3264 3264 Assert(pCtx); 3265 HMSVM_ASSERT_PREEMPT_SAFE( );3265 HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); 3266 3266 3267 3267 /* Please, no longjumps here (any logging shouldn't flush jump back to ring-3). NO LOGGING BEFORE THIS POINT! */ … … 4084 4084 static void hmR0SvmReportWorldSwitchError(PVMCPU pVCpu, int rcVMRun, PCPUMCTX pCtx) 4085 4085 { 4086 HMSVM_ASSERT_PREEMPT_SAFE( );4086 HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); 4087 4087 HMSVM_ASSERT_NOT_IN_NESTED_GUEST(pCtx); 4088 4088 HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL); … … 4328 4328 static int hmR0SvmPreRunGuestNested(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient) 4329 4329 { 4330 HMSVM_ASSERT_PREEMPT_SAFE( );4330 HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); 4331 4331 HMSVM_ASSERT_IN_NESTED_GUEST(pCtx); 4332 4332 … … 4447 4447 static int hmR0SvmPreRunGuest(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient) 4448 4448 { 4449 HMSVM_ASSERT_PREEMPT_SAFE( );4449 HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); 4450 4450 HMSVM_ASSERT_NOT_IN_NESTED_GUEST(pCtx); 4451 4451 … … 4877 4877 { 4878 4878 Assert(!HMR0SuspendPending()); 4879 HMSVM_ASSERT_CPU_SAFE( );4879 HMSVM_ASSERT_CPU_SAFE(pVCpu); 4880 4880 4881 4881 /* Preparatory work for running nested-guest code, this may force us to return to … … 5061 5061 { 5062 5062 Assert(!HMR0SuspendPending()); 5063 HMSVM_ASSERT_CPU_SAFE( );5063 HMSVM_ASSERT_CPU_SAFE(pVCpu); 5064 5064 5065 5065 /* Preparatory work for running nested-guest code, this may force us to return to … … 5138 5138 { 5139 5139 Assert(VMMRZCallRing3IsEnabled(pVCpu)); 5140 HMSVM_ASSERT_PREEMPT_SAFE( );5140 HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); 5141 5141 VMMRZCallRing3SetNotification(pVCpu, hmR0SvmCallRing3Callback, pCtx); 5142 5142 … … 5843 5843 AssertPtr(pSvmTransient); \ 5844 5844 Assert(ASMIntAreEnabled()); \ 5845 HMSVM_ASSERT_PREEMPT_SAFE( ); \5845 HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); \ 5846 5846 HMSVM_ASSERT_PREEMPT_CPUID_VAR(); \ 5847 5847 Log4Func(("vcpu[%u] -v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-\n", (uint32_t)pVCpu->idCpu)); \ 5848 HMSVM_ASSERT_PREEMPT_SAFE( ); \5848 HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); \ 5849 5849 if (VMMR0IsLogFlushDisabled(pVCpu)) \ 5850 5850 HMSVM_ASSERT_PREEMPT_CPUID(); \
Note:
See TracChangeset
for help on using the changeset viewer.