Changeset 80080 in vbox for trunk/src/VBox/VMM/VMMR3/HM.cpp
- Timestamp:
- Jul 31, 2019 4:12:31 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 132520
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/HM.cpp
r80052 r80080 219 219 */ 220 220 rc = CFGMR3ValidateConfig(pCfgHm, "/HM/", 221 "HMForced" 221 "HMForced" /* implied 'true' these days */ 222 222 "|UseNEMInstead" 223 223 "|FallbackToNEM" … … 253 253 * enabled, i.e. /HMEnabled must be true. */ 254 254 bool fHMForced; 255 #ifdef VBOX_WITH_RAW_MODE256 rc = CFGMR3QueryBoolDef(pCfgHm, "HMForced", &fHMForced, false);257 AssertRCReturn(rc, rc);258 AssertLogRelMsgReturn(!fHMForced || pVM->fHMEnabled, ("Configuration error: HM forced but not enabled!\n"),259 VERR_INVALID_PARAMETER);260 # if defined(RT_OS_DARWIN)261 if (pVM->fHMEnabled)262 fHMForced = true;263 # endif264 AssertLogRelMsgReturn(pVM->cCpus == 1 || pVM->fHMEnabled, ("Configuration error: SMP requires HM to be enabled!\n"),265 VERR_INVALID_PARAMETER);266 if (pVM->cCpus > 1)267 fHMForced = true;268 #else /* !VBOX_WITH_RAW_MODE */269 255 AssertRelease(pVM->fHMEnabled); 270 256 fHMForced = true; 271 #endif /* !VBOX_WITH_RAW_MODE */272 257 273 258 /** @cfgm{/HM/UseNEMInstead, bool, true} … … 318 303 * On 32-bit hosts this isn't default and require host CPU support. 64-bit hosts 319 304 * already have the support. */ 320 #ifdef VBOX_ ENABLE_64_BITS_GUESTS305 #ifdef VBOX_WITH_64_BITS_GUESTS 321 306 rc = CFGMR3QueryBoolDef(pCfgHm, "64bitEnabled", &pVM->hm.s.fAllow64BitGuests, HC_ARCH_BITS == 64); 322 307 AssertLogRelRCReturn(rc, rc); … … 516 501 } 517 502 if (RT_FAILURE(rc)) 518 { 519 if (fHMForced) 520 return VMSetError(pVM, rc, RT_SRC_POS, "The host kernel does not support VT-x: %s\n", pszWhy); 521 522 /* Fall back to raw-mode. */ 523 LogRel(("HM: HMR3Init: Falling back to raw-mode: The host kernel does not support VT-x - %s\n", pszWhy)); 524 VM_SET_MAIN_EXECUTION_ENGINE(pVM, VM_EXEC_ENGINE_RAW_MODE); 525 } 503 return VMSetError(pVM, rc, RT_SRC_POS, "The host kernel does not support VT-x: %s\n", pszWhy); 526 504 } 527 505 } … … 529 507 AssertLogRelMsgFailedReturn(("SUPR3QueryVTCaps didn't return either AMD-V or VT-x flag set (%#x)!\n", fCaps), 530 508 VERR_INTERNAL_ERROR_5); 531 532 /*533 * Do we require a little bit or raw-mode for 64-bit guest execution?534 */535 pVM->fHMNeedRawModeCtx = HC_ARCH_BITS == 32536 && pVM->fHMEnabled537 && pVM->hm.s.fAllow64BitGuests;538 509 539 510 /* … … 593 564 } 594 565 if (RT_FAILURE(rc)) 595 { 596 if (fHMForced) 597 return VM_SET_ERROR(pVM, rc, pszMsg); 598 599 LogRel(("HM: HMR3Init: Falling back to raw-mode: %s\n", pszMsg)); 600 VM_SET_MAIN_EXECUTION_ENGINE(pVM, VM_EXEC_ENGINE_RAW_MODE); 601 } 566 return VM_SET_ERROR(pVM, rc, pszMsg); 602 567 } 603 568 } … … 607 572 * Disabled HM mean raw-mode, unless NEM is supposed to be used. 608 573 */ 609 if (!fUseNEMInstead) 610 VM_SET_MAIN_EXECUTION_ENGINE(pVM, VM_EXEC_ENGINE_RAW_MODE); 611 else 574 if (fUseNEMInstead) 612 575 { 613 576 rc = NEMR3Init(pVM, false /*fFallback*/, true); … … 616 579 return rc; 617 580 } 618 } 619 581 if ( pVM->bMainExecutionEngine == VM_EXEC_ENGINE_NOT_SET 582 || pVM->bMainExecutionEngine == VM_EXEC_ENGINE_RAW_MODE 583 || pVM->bMainExecutionEngine == VM_EXEC_ENGINE_HW_VIRT /* paranoia */) 584 return VM_SET_ERROR(pVM, rc, "Misconfigured VM: No guest execution engine available!"); 585 } 586 587 Assert(pVM->bMainExecutionEngine != VM_EXEC_ENGINE_NOT_SET); 588 Assert(pVM->bMainExecutionEngine != VM_EXEC_ENGINE_RAW_MODE); 620 589 return VINF_SUCCESS; 621 590 } … … 716 685 "/PROF/CPU%d/HM/InGC", i); 717 686 AssertRC(rc); 718 719 # if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS)720 rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatWorldSwitch3264, STAMTYPE_PROFILE, STAMVISIBILITY_USED,721 STAMUNIT_TICKS_PER_CALL, "Profiling of the 32/64 switcher.",722 "/PROF/CPU%d/HM/Switcher3264", i);723 AssertRC(rc);724 # endif725 687 726 688 # ifdef HM_PROFILE_EXIT_DISPATCH … … 857 819 HM_REG_COUNTER(&pVCpu->hm.s.StatVmxCheckPmOk, "/HM/CPU%d/VMXCheck/VMX_PM", "VMX execution in protected mode OK."); 858 820 859 #if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS)860 HM_REG_COUNTER(&pVCpu->hm.s.StatFpu64SwitchBack, "/HM/CPU%d/Switch64/Fpu", "Saving guest FPU/XMM state.");861 HM_REG_COUNTER(&pVCpu->hm.s.StatDebug64SwitchBack, "/HM/CPU%d/Switch64/Debug", "Saving guest debug state.");862 #endif863 864 821 #undef HM_REG_COUNTER 865 822 … … 1750 1707 LogRel(("HM: Enabled unrestricted guest execution\n")); 1751 1708 1752 #if HC_ARCH_BITS == 641753 1709 if (pVM->hm.s.fLargePages) 1754 1710 { … … 1757 1713 LogRel(("HM: Enabled large page support\n")); 1758 1714 } 1759 #endif1760 1715 } 1761 1716 else … … 1892 1847 * Enable large pages (2 MB) if applicable. 1893 1848 */ 1894 #if HC_ARCH_BITS == 641895 1849 if (pVM->hm.s.fLargePages) 1896 1850 { … … 1898 1852 LogRel(("HM: Enabled large page support\n")); 1899 1853 } 1900 #endif1901 1854 } 1902 1855 … … 1954 1907 } 1955 1908 } 1956 #if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS)1957 if (HMIsEnabled(pVM))1958 {1959 switch (PGMGetHostMode(pVM))1960 {1961 case PGMMODE_32_BIT:1962 pVM->hm.s.pfnHost32ToGuest64R0 = VMMR3GetHostToGuestSwitcher(pVM, VMMSWITCHER_32_TO_AMD64);1963 break;1964 1965 case PGMMODE_PAE:1966 case PGMMODE_PAE_NX:1967 pVM->hm.s.pfnHost32ToGuest64R0 = VMMR3GetHostToGuestSwitcher(pVM, VMMSWITCHER_PAE_TO_AMD64);1968 break;1969 1970 default:1971 AssertFailed();1972 break;1973 }1974 }1975 #endif1976 return;1977 1909 } 1978 1910
Note:
See TracChangeset
for help on using the changeset viewer.