Changeset 46423 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jun 6, 2013 7:48:27 PM (12 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/Makefile.kmk
r46167 r46423 128 128 VMMR3/DBGFR3Trace.cpp \ 129 129 VMMR3/EM.cpp \ 130 VMMR3/EMR3Dbg.cpp \ 130 131 $(if $(VBOX_WITH_RAW_MODE),VMMR3/EMRaw.cpp) \ 131 132 VMMR3/EMHM.cpp \ -
trunk/src/VBox/VMM/VMMR3/EM.cpp
r46420 r46423 42 42 #include <VBox/vmm/selm.h> 43 43 #include <VBox/vmm/trpm.h> 44 #include <VBox/vmm/iem.h> 44 45 #include <VBox/vmm/iom.h> 45 46 #include <VBox/vmm/dbgf.h> … … 47 48 #ifdef VBOX_WITH_REM 48 49 # include <VBox/vmm/rem.h> 49 #else50 # include <VBox/vmm/iem.h>51 50 #endif 52 51 #include <VBox/vmm/tm.h> … … 118 117 */ 119 118 pVM->em.s.offVM = RT_OFFSETOF(VM, em.s); 119 PCFGMNODE pCfgRoot = CFGMR3GetRoot(pVM); 120 PCFGMNODE pCfgEM = CFGMR3GetChild(pCfgRoot, "EM"); 121 120 122 bool fEnabled; 121 int rc = CFGMR3QueryBool(CFGMR3GetRoot(pVM), "RawR3Enabled", &fEnabled); 122 pVM->fRecompileUser = RT_SUCCESS(rc) ? !fEnabled : false; 123 rc = CFGMR3QueryBool(CFGMR3GetRoot(pVM), "RawR0Enabled", &fEnabled); 124 pVM->fRecompileSupervisor = RT_SUCCESS(rc) ? !fEnabled : false; 125 Log(("EMR3Init: fRecompileUser=%RTbool fRecompileSupervisor=%RTbool\n", pVM->fRecompileUser, pVM->fRecompileSupervisor)); 123 int rc = CFGMR3QueryBoolDef(pCfgRoot, "RawR3Enabled", &fEnabled, true); 124 AssertLogRelRCReturn(rc, rc); 125 pVM->fRecompileUser = !fEnabled; 126 127 rc = CFGMR3QueryBoolDef(pCfgRoot, "RawR0Enabled", &fEnabled, true); 128 AssertLogRelRCReturn(rc, rc); 129 pVM->fRecompileSupervisor = !fEnabled; 126 130 127 131 #ifdef VBOX_WITH_RAW_RING1 128 rc = CFGMR3QueryBool(CFGMR3GetRoot(pVM), "RawR1Enabled", &fEnabled); 129 pVM->fRawRing1Enabled = RT_SUCCESS(rc) ? fEnabled : false; 130 Log(("EMR3Init: fRawRing1Enabled=%RTbool\n", pVM->fRawRing1Enabled)); 132 rc = CFGMR3QueryBoolDef(pCfgRoot, "RawR1Enabled", &pVM->fRawRing1Enabled, false); 133 AssertLogRelRCReturn(rc, rc); 131 134 #else 132 pVM->fRawRing1Enabled = false; /* disabled by default. */ 133 #endif 135 pVM->fRawRing1Enabled = false; /* Disabled by default. */ 136 #endif 137 138 rc = CFGMR3QueryBoolDef(pCfgEM, "IemExecutesAll", &pVM->em.s.fIemExecutesAll, false); 139 AssertLogRelRCReturn(rc, rc); 140 141 Log(("EMR3Init: fRecompileUser=%RTbool fRecompileSupervisor=%RTbool fRawRing1Enabled=%RTbool fIemExecutesAll=%RTbool\n", 142 pVM->fRecompileUser, pVM->fRecompileSupervisor, pVM->fRawRing1Enabled, pVM->em.s.fIemExecutesAll)); 134 143 135 144 #ifdef VBOX_WITH_REM … … 428 437 } 429 438 439 emR3InitDbg(pVM); 430 440 return VINF_SUCCESS; 431 441 } … … 559 569 * Validate version. 560 570 */ 561 if ( uVersion != EM_SAVED_STATE_VERSION 562 && uVersion != EM_SAVED_STATE_VERSION_PRE_MWAIT 563 && uVersion != EM_SAVED_STATE_VERSION_PRE_SMP) 571 if ( uVersion > EM_SAVED_STATE_VERSION 572 || uVersion < EM_SAVED_STATE_VERSION_PRE_SMP) 564 573 { 565 574 AssertMsgFailed(("emR3Load: Invalid version uVersion=%d (current %d)!\n", uVersion, EM_SAVED_STATE_VERSION)); … … 641 650 pVM->fRecompileUser = pArgs->fEnforce; 642 651 break; 652 case EMEXECPOLICY_IEM_ALL: 653 pVM->em.s.fIemExecutesAll = pArgs->fEnforce; 654 break; 643 655 default: 644 656 AssertFailedReturn(VERR_INVALID_PARAMETER); 645 657 } 646 Log(("emR3SetExecutionPolicy: fRecompileUser=%RTbool fRecompileSupervisor=%RTbool \n",647 pVM->fRecompileUser, pVM->fRecompileSupervisor ));658 Log(("emR3SetExecutionPolicy: fRecompileUser=%RTbool fRecompileSupervisor=%RTbool fIemExecutesAll=%RTbool\n", 659 pVM->fRecompileUser, pVM->fRecompileSupervisor, pVM->em.s.fIemExecutesAll)); 648 660 } 649 661 650 662 /* 651 * Force rescheduling if in RAW, HM or REM.663 * Force rescheduling if in RAW, HM, IEM, or REM. 652 664 */ 653 665 return pVCpu->em.s.enmState == EMSTATE_RAW 654 666 || pVCpu->em.s.enmState == EMSTATE_HM 667 || pVCpu->em.s.enmState == EMSTATE_IEM 655 668 || pVCpu->em.s.enmState == EMSTATE_REM 656 669 ? VINF_EM_RESCHEDULE … … 660 673 661 674 /** 662 * Changes a the execution scheduling policy.675 * Changes an execution scheduling policy parameter. 663 676 * 664 677 * This is used to enable or disable raw-mode / hardware-virtualization … … 685 698 686 699 /** 687 * Checks if raw ring-3 execute mode is enabled.688 * 689 * @returns true if enabled, false if disabled.700 * Queries an execution scheduling policy parameter. 701 * 702 * @returns VBox status code 690 703 * @param pUVM The user mode VM handle. 691 */ 692 VMMR3DECL(bool) EMR3IsRawRing3Enabled(PUVM pUVM) 704 * @param enmPolicy The scheduling policy to query. 705 * @param pfEnforced Where to return the current value. 706 */ 707 VMMR3DECL(int) EMR3QueryExecutionPolicy(PUVM pUVM, EMEXECPOLICY enmPolicy, bool *pfEnforced) 693 708 { 694 UVM_ASSERT_VALID_EXT_RETURN(pUVM, false); 709 AssertReturn(enmPolicy > EMEXECPOLICY_INVALID && enmPolicy < EMEXECPOLICY_END, VERR_INVALID_PARAMETER); 710 AssertPtrReturn(pfEnforced, VERR_INVALID_POINTER); 711 UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE); 695 712 PVM pVM = pUVM->pVM; 696 VM_ASSERT_VALID_EXT_RETURN(pVM, false); 697 return EMIsRawRing3Enabled(pVM); 698 } 699 700 701 /** 702 * Checks if raw ring-0 execute mode is enabled. 703 * 704 * @returns true if enabled, false if disabled. 705 * @param pUVM The user mode VM handle. 706 */ 707 VMMR3DECL(bool) EMR3IsRawRing0Enabled(PUVM pUVM) 708 { 709 UVM_ASSERT_VALID_EXT_RETURN(pUVM, false); 710 PVM pVM = pUVM->pVM; 711 VM_ASSERT_VALID_EXT_RETURN(pVM, false); 712 return EMIsRawRing0Enabled(pVM); 713 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 714 715 /* No need to bother EMTs with a query. */ 716 switch (enmPolicy) 717 { 718 case EMEXECPOLICY_RECOMPILE_RING0: 719 *pfEnforced = pVM->fRecompileSupervisor; 720 break; 721 case EMEXECPOLICY_RECOMPILE_RING3: 722 *pfEnforced = pVM->fRecompileUser; 723 break; 724 case EMEXECPOLICY_IEM_ALL: 725 *pfEnforced = pVM->em.s.fIemExecutesAll; 726 break; 727 default: 728 AssertFailedReturn(VERR_INTERNAL_ERROR_2); 729 } 730 731 return VINF_SUCCESS; 713 732 } 714 733 … … 744 763 case EMSTATE_NONE: return "EMSTATE_NONE"; 745 764 case EMSTATE_RAW: return "EMSTATE_RAW"; 746 case EMSTATE_HM: return "EMSTATE_HM"; 765 case EMSTATE_HM: return "EMSTATE_HM"; 766 case EMSTATE_IEM: return "EMSTATE_IEM"; 747 767 case EMSTATE_REM: return "EMSTATE_REM"; 748 768 case EMSTATE_HALTED: return "EMSTATE_HALTED"; … … 944 964 } 945 965 966 946 967 /** 947 968 * Steps recompiled code. … … 1090 1111 * Execute REM. 1091 1112 */ 1092 if (RT_LIKELY( EMR3IsExecutionAllowed(pVM, pVCpu)))1113 if (RT_LIKELY(emR3IsExecutionAllowed(pVM, pVCpu))) 1093 1114 { 1094 1115 STAM_PROFILE_START(&pVCpu->em.s.StatREMExec, c); … … 1240 1261 if (pVCpu->em.s.enmState == EMSTATE_WAIT_SIPI) 1241 1262 return EMSTATE_WAIT_SIPI; 1263 1264 /* 1265 * Execute everything in IEM? 1266 */ 1267 if (pVM->em.s.fIemExecutesAll) 1268 return EMSTATE_IEM; 1242 1269 1243 1270 /* !!! THIS MUST BE IN SYNC WITH remR3CanExecuteRaw !!! */ … … 1942 1969 * @param pVM Pointer to the VM. 1943 1970 * @param pVCpu Pointer to the VMCPU. 1944 * 1945 */ 1946 VMMR3_INT_DECL(bool) EMR3IsExecutionAllowed(PVM pVM, PVMCPU pVCpu) 1971 */ 1972 bool emR3IsExecutionAllowed(PVM pVM, PVMCPU pVCpu) 1947 1973 { 1948 1974 uint64_t u64UserTime, u64KernelTime; … … 2342 2368 2343 2369 /* 2370 * Execute in the interpreter. 2371 */ 2372 case EMSTATE_IEM: 2373 rc = VBOXSTRICTRC_TODO(IEMExecLots(pVCpu)); 2374 fFFDone = false; 2375 break; 2376 2377 /* 2344 2378 * Application processor execution halted until SIPI. 2345 2379 */ -
trunk/src/VBox/VMM/VMMR3/EMHM.cpp
r46420 r46423 545 545 STAM_PROFILE_ADV_STOP(&pVCpu->em.s.StatHmEntry, a); 546 546 547 if (RT_LIKELY( EMR3IsExecutionAllowed(pVM, pVCpu)))547 if (RT_LIKELY(emR3IsExecutionAllowed(pVM, pVCpu))) 548 548 { 549 549 STAM_PROFILE_START(&pVCpu->em.s.StatHmExec, x); -
trunk/src/VBox/VMM/VMMR3/EMRaw.cpp
r46420 r46423 1448 1448 */ 1449 1449 STAM_PROFILE_ADV_STOP(&pVCpu->em.s.StatRAWEntry, b); 1450 if (RT_LIKELY( EMR3IsExecutionAllowed(pVM, pVCpu)))1450 if (RT_LIKELY(emR3IsExecutionAllowed(pVM, pVCpu))) 1451 1451 { 1452 1452 STAM_PROFILE_START(&pVCpu->em.s.StatRAWExec, c); -
trunk/src/VBox/VMM/include/EMInternal.h
r45528 r46423 39 39 40 40 /** The saved state version. */ 41 #define EM_SAVED_STATE_VERSION 4 41 #define EM_SAVED_STATE_VERSION 5 42 #define EM_SAVED_STATE_VERSION_PRE_IEM 4 42 43 #define EM_SAVED_STATE_VERSION_PRE_MWAIT 3 43 44 #define EM_SAVED_STATE_VERSION_PRE_SMP 2 … … 308 309 RTUINT offVM; 309 310 311 /** Whether IEM executes everything. */ 312 bool fIemExecutesAll; 313 /** Alignment padding. */ 314 bool afPadding[7]; 315 310 316 /** Id of the VCPU that last executed code in the recompiler. */ 311 317 VMCPUID idLastRemCpu; … … 443 449 /** @} */ 444 450 451 int emR3InitDbg(PVM pVM); 445 452 446 453 int emR3HmExecute(PVM pVM, PVMCPU pVCpu, bool *pfFFDone); … … 455 462 int emR3RawStep(PVM pVM, PVMCPU pVCpu); 456 463 int emR3SingleStepExecRem(PVM pVM, PVMCPU pVCpu, uint32_t cIterations); 464 bool emR3IsExecutionAllowed(PVM pVM, PVMCPU pVCpu); 457 465 458 466 RT_C_DECLS_END
Note:
See TracChangeset
for help on using the changeset viewer.