Changeset 57109 in vbox
- Timestamp:
- Jul 28, 2015 11:50:17 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101837
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/err.h
r57055 r57109 1173 1173 /** HM returned in the wrong state. */ 1174 1174 #define VERR_VMM_WRONG_HM_VMCPU_STATE (-2716) 1175 /** SMAP enabled, but the AC flag was found to be clear - check the kernel 1176 * log for details. */ 1177 #define VERR_VMM_SMAP_BUT_AC_CLEAR (-2717) 1175 1178 /** @} */ 1176 1179 -
trunk/src/VBox/VMM/VMMR0/HMR0.cpp
r56706 r57109 1236 1236 } 1237 1237 1238 pVM->hm.s. uHostKernelFeatures = SUPR0GetKernelFeatures();1238 pVM->hm.s.fHostKernelFeatures = SUPR0GetKernelFeatures(); 1239 1239 1240 1240 /* -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r56837 r57109 3111 3111 pVCpu->hm.s.vmx.fRestoreHostFlags |= VMX_RESTORE_HOST_SEL_TR; 3112 3112 /* If the host has made GDT read-only, we would need to temporarily toggle CR0.WP before writing the GDT. */ 3113 if (pVM->hm.s. uHostKernelFeatures & SUPKERNELFEATURES_GDT_READ_ONLY)3113 if (pVM->hm.s.fHostKernelFeatures & SUPKERNELFEATURES_GDT_READ_ONLY) 3114 3114 pVCpu->hm.s.vmx.fRestoreHostFlags |= VMX_RESTORE_HOST_GDT_READ_ONLY; 3115 3115 pVCpu->hm.s.vmx.RestoreHost.uHostSelTR = uSelTR; -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r56766 r57109 63 63 64 64 /******************************************************************************* 65 * Defined Constants And Macros * 66 *******************************************************************************/ 67 /** SMAP check setup. */ 68 #define VMM_CHECK_SMAP_SETUP() uint32_t const fKernelFeatures = SUPR0GetKernelFeatures() 69 /** Checks that the AC flag is set if SMAP is enabled. If AC is not set, it 70 * will be logged and @a a_BadExpr is executed. */ 71 #define VMM_CHECK_SMAP_CHECK(a_BadExpr) \ 72 do { \ 73 if (fKernelFeatures & SUPKERNELFEATURES_SMAP) \ 74 { \ 75 RTCCUINTREG uEFlags = ASMGetFlags(); \ 76 if (RT_LIKELY(uEFlags & X86_EFL_AC)) \ 77 { /* likely */ } \ 78 else \ 79 { \ 80 SUPR0Printf("%s, line %d: EFLAGS.AC is clear! (%#x)\n", __FUNCTION__, __LINE__, (uint32_t)uEFlags); \ 81 a_BadExpr; \ 82 } \ 83 } \ 84 } while (0) 85 /** Checks that the AC flag is set if SMAP is enabled. If AC is not set, it 86 * will be logged, written to the VMs assertion text buffer, and @a a_BadExpr is 87 * executed. */ 88 #define VMM_CHECK_SMAP_CHECK2(a_pVM, a_BadExpr) \ 89 VMM_CHECK_SMAP_CHECK( \ 90 RTStrPrintf(pVM->vmm.s.szRing0AssertMsg1, sizeof(pVM->vmm.s.szRing0AssertMsg1), \ 91 "%s, line %d: EFLAGS.AC is clear! (%#x)\n", __FUNCTION__, __LINE__, (uint32_t)uEFlags); \ 92 a_BadExpr) 93 94 95 /******************************************************************************* 65 96 * Internal Functions * 66 97 *******************************************************************************/ … … 106 137 DECLEXPORT(int) ModuleInit(void *hMod) 107 138 { 139 VMM_CHECK_SMAP_SETUP(); 140 VMM_CHECK_SMAP_CHECK(RT_NOTHING); 141 108 142 #ifdef VBOX_WITH_DTRACE_R0 109 143 /* … … 133 167 if (RT_SUCCESS(rc)) 134 168 { 169 VMM_CHECK_SMAP_CHECK(RT_NOTHING); 135 170 rc = GVMMR0Init(); 136 171 if (RT_SUCCESS(rc)) 137 172 { 173 VMM_CHECK_SMAP_CHECK(RT_NOTHING); 138 174 rc = GMMR0Init(); 139 175 if (RT_SUCCESS(rc)) 140 176 { 177 VMM_CHECK_SMAP_CHECK(RT_NOTHING); 141 178 rc = HMR0Init(); 142 179 if (RT_SUCCESS(rc)) 143 180 { 181 VMM_CHECK_SMAP_CHECK(RT_NOTHING); 144 182 rc = PGMRegisterStringFormatTypes(); 145 183 if (RT_SUCCESS(rc)) 146 184 { 185 VMM_CHECK_SMAP_CHECK(RT_NOTHING); 147 186 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 148 187 rc = PGMR0DynMapInit(); … … 150 189 if (RT_SUCCESS(rc)) 151 190 { 191 VMM_CHECK_SMAP_CHECK(RT_NOTHING); 152 192 rc = IntNetR0Init(); 153 193 if (RT_SUCCESS(rc)) 154 194 { 155 195 #ifdef VBOX_WITH_PCI_PASSTHROUGH 196 VMM_CHECK_SMAP_CHECK(RT_NOTHING); 156 197 rc = PciRawR0Init(); 157 198 #endif 158 199 if (RT_SUCCESS(rc)) 159 200 { 201 VMM_CHECK_SMAP_CHECK(RT_NOTHING); 160 202 rc = CPUMR0ModuleInit(); 161 203 if (RT_SUCCESS(rc)) 162 204 { 163 205 #ifdef VBOX_WITH_TRIPLE_FAULT_HACK 206 VMM_CHECK_SMAP_CHECK(RT_NOTHING); 164 207 rc = vmmR0TripleFaultHackInit(); 165 208 if (RT_SUCCESS(rc)) 166 209 #endif 167 210 { 168 LogFlow(("ModuleInit: returns success.\n")); 169 return VINF_SUCCESS; 211 VMM_CHECK_SMAP_CHECK(rc = VERR_VMM_SMAP_BUT_AC_CLEAR); 212 if (RT_SUCCESS(rc)) 213 { 214 LogFlow(("ModuleInit: returns success.\n")); 215 return VINF_SUCCESS; 216 } 170 217 } 171 218 … … 281 328 static int vmmR0InitVM(PVM pVM, uint32_t uSvnRev, uint32_t uBuildType) 282 329 { 330 VMM_CHECK_SMAP_SETUP(); 331 VMM_CHECK_SMAP_CHECK(return VERR_VMM_SMAP_BUT_AC_CLEAR); 332 283 333 /* 284 334 * Match the SVN revisions and build type. … … 356 406 * Initialize the per VM data for GVMM and GMM. 357 407 */ 408 VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING); 358 409 int rc = GVMMR0InitVM(pVM); 359 410 // if (RT_SUCCESS(rc)) … … 364 415 * Init HM, CPUM and PGM (Darwin only). 365 416 */ 417 VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING); 366 418 rc = HMR0InitVM(pVM); 419 if (RT_SUCCESS(rc)) 420 VMM_CHECK_SMAP_CHECK2(pVM, rc = VERR_VMM_RING0_ASSERTION); /* CPUR0InitVM will otherwise panic the host */ 367 421 if (RT_SUCCESS(rc)) 368 422 { … … 370 424 if (RT_SUCCESS(rc)) 371 425 { 426 VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING); 372 427 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 373 428 rc = PGMR0DynMapInitVM(pVM); … … 375 430 if (RT_SUCCESS(rc)) 376 431 { 432 VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING); 377 433 #ifdef VBOX_WITH_PCI_PASSTHROUGH 378 434 rc = PciRawR0InitVM(pVM); … … 380 436 if (RT_SUCCESS(rc)) 381 437 { 438 VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING); 382 439 rc = GIMR0InitVM(pVM); 383 440 if (RT_SUCCESS(rc)) 384 441 { 385 GVMMR0DoneInitVM(pVM); 386 return rc; 442 VMM_CHECK_SMAP_CHECK2(pVM, rc = VERR_VMM_RING0_ASSERTION); 443 if (RT_SUCCESS(rc)) 444 { 445 GVMMR0DoneInitVM(pVM); 446 VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING); 447 return rc; 448 } 449 450 /* bail out*/ 451 GIMR0TermVM(pVM); 387 452 } 388 389 /* bail out*/390 453 #ifdef VBOX_WITH_PCI_PASSTHROUGH 391 454 PciRawR0TermVM(pVM); … … 397 460 } 398 461 } 399 400 462 401 463 RTLogSetDefaultInstanceThread(NULL, (uintptr_t)pVM->pSession); -
trunk/src/VBox/VMM/include/HMInternal.h
r56716 r57109 369 369 370 370 /** Host kernel flags that HM might need to know (SUPKERNELFEATURES_XXX). */ 371 uint32_t uHostKernelFeatures;371 uint32_t fHostKernelFeatures; 372 372 373 373 /** Maximum ASID allowed. */
Note:
See TracChangeset
for help on using the changeset viewer.