Changeset 72488 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Jun 9, 2018 12:24:35 PM (6 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/EM.cpp
r72461 r72488 37 37 *********************************************************************************************************************************/ 38 38 #define LOG_GROUP LOG_GROUP_EM 39 #define VMCPU_INCL_CPUM_GST_CTX /* for CPUM_IMPORT_GUEST_STATE_RET */ 39 40 #include <VBox/vmm/em.h> 40 41 #include <VBox/vmm/vmm.h> … … 95 96 #endif 96 97 static int emR3RemExecute(PVM pVM, PVMCPU pVCpu, bool *pfFFDone); 97 int emR3HighPriorityPostForcedActions(PVM pVM, PVMCPU pVCpu, int rc);98 98 99 99 … … 1198 1198 fInREMState = emR3RemExecuteSyncBack(pVM, pVCpu); 1199 1199 #endif 1200 rc = emR3HighPriorityPostForcedActions(pVM, pVCpu, rc);1200 rc = VBOXSTRICTRC_TODO(emR3HighPriorityPostForcedActions(pVM, pVCpu, rc)); 1201 1201 } 1202 1202 … … 1610 1610 * Executes all high priority post execution force actions. 1611 1611 * 1612 * @returns rc or a fatal status code. 1612 * @returns Strict VBox status code. Typically @a rc, but may be upgraded to 1613 * fatal error status code. 1613 1614 * 1614 1615 * @param pVM The cross context VM structure. 1615 1616 * @param pVCpu The cross context virtual CPU structure. 1616 * @param rc The current rc.1617 * @param rc The current strict VBox status code rc. 1617 1618 */ 1618 int emR3HighPriorityPostForcedActions(PVM pVM, PVMCPU pVCpu, intrc)1619 VBOXSTRICTRC emR3HighPriorityPostForcedActions(PVM pVM, PVMCPU pVCpu, VBOXSTRICTRC rc) 1619 1620 { 1620 1621 VBOXVMM_EM_FF_HIGH(pVCpu, pVM->fGlobalForcedActions, pVCpu->fLocalForcedActions, rc); … … 1626 1627 if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_UPDATE_CR3)) 1627 1628 { 1629 CPUM_IMPORT_EXTRN_RCSTRICT(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_CR3 | CPUMCTX_EXTRN_CR4 | CPUMCTX_EXTRN_EFER, rc); 1628 1630 int rc2 = PGMUpdateCR3(pVCpu, CPUMGetGuestCR3(pVCpu)); 1629 1631 if (RT_FAILURE(rc2)) … … 1635 1637 if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_UPDATE_PAE_PDPES)) 1636 1638 { 1639 CPUM_IMPORT_EXTRN_RCSTRICT(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_CR3 | CPUMCTX_EXTRN_CR4 | CPUMCTX_EXTRN_EFER, rc); 1637 1640 if (CPUMIsGuestInPAEMode(pVCpu)) 1638 1641 { … … 1649 1652 /* IEM has pending work (typically memory write after INS instruction). */ 1650 1653 if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_IEM)) 1651 rc = VBOXSTRICTRC_TODO(IEMR3ProcessForceFlag(pVM, pVCpu, rc));1654 rc = IEMR3ProcessForceFlag(pVM, pVCpu, rc); 1652 1655 1653 1656 /* IOM has pending work (comitting an I/O or MMIO write). */ 1654 1657 if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_IOM)) 1655 rc = VBOXSTRICTRC_TODO(IOMR3ProcessForceFlag(pVM, pVCpu, rc));1658 rc = IOMR3ProcessForceFlag(pVM, pVCpu, rc); 1656 1659 1657 1660 #ifdef VBOX_WITH_RAW_MODE … … 1829 1832 if (VM_FF_IS_PENDING(pVM, VM_FF_EMT_RENDEZVOUS)) 1830 1833 { 1834 CPUM_IMPORT_EXTRN_RCSTRICT(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK, rc); 1831 1835 rc2 = VMMR3EmtRendezvousFF(pVM, pVCpu); 1832 1836 UPDATE_RC(); … … 1876 1880 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_DBGF) ) 1877 1881 { 1882 CPUM_IMPORT_EXTRN_RCSTRICT(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK, rc); 1878 1883 rc2 = DBGFR3VMMForcedAction(pVM, pVCpu); 1879 1884 UPDATE_RC(); … … 1885 1890 if (VM_FF_TEST_AND_CLEAR(pVM, VM_FF_RESET)) 1886 1891 { 1892 CPUM_IMPORT_EXTRN_RCSTRICT(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK, rc); 1887 1893 rc2 = VBOXSTRICTRC_TODO(VMR3ResetFF(pVM)); 1888 1894 UPDATE_RC(); … … 1896 1902 && VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_CSAM_SCAN_PAGE)) 1897 1903 { 1898 PCPUMCTX pCtx = pVCpu->em.s.pCtx;1899 1900 1904 /** @todo check for 16 or 32 bits code! (D bit in the code selector) */ 1901 1905 Log(("Forced action VMCPU_FF_CSAM_SCAN_PAGE\n")); 1902 1906 CPUM_IMPORT_EXTRN_RCSTRICT(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK, rc); 1907 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 1903 1908 CSAMR3CheckCodeEx(pVM, pCtx, pCtx->eip); 1904 1909 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_CSAM_SCAN_PAGE); … … 1945 1950 if (VM_FF_IS_PENDING(pVM, VM_FF_EMT_RENDEZVOUS)) 1946 1951 { 1952 CPUM_IMPORT_EXTRN_RCSTRICT(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK, rc); 1947 1953 rc2 = VMMR3EmtRendezvousFF(pVM, pVCpu); 1948 1954 UPDATE_RC(); … … 1965 1971 if (VM_FF_IS_PENDING_EXCEPT(pVM, VM_FF_REQUEST, VM_FF_PGM_NO_MEMORY)) 1966 1972 { 1973 CPUM_IMPORT_EXTRN_RCSTRICT(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK, rc); 1967 1974 rc2 = VMR3ReqProcessU(pVM->pUVM, VMCPUID_ANY, false /*fPriorityOnly*/); 1968 1975 if (rc2 == VINF_EM_OFF || rc2 == VINF_EM_TERMINATE) /** @todo this shouldn't be necessary */ … … 2019 2026 if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_REQUEST)) 2020 2027 { 2028 CPUM_IMPORT_EXTRN_RCSTRICT(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK, rc); 2021 2029 rc2 = VMR3ReqProcessU(pVM->pUVM, pVCpu->idCpu, false /*fPriorityOnly*/); 2022 2030 if (rc2 == VINF_EM_OFF || rc2 == VINF_EM_TERMINATE || rc2 == VINF_EM_RESET) … … 2079 2087 && !VM_FF_IS_PENDING(pVM, VM_FF_PGM_NO_MEMORY)) 2080 2088 { 2089 CPUM_ASSERT_NOT_EXTRN(pVCpu, CPUMCTX_EXTRN_RIP); 2081 2090 if (CPUMGetGuestRIP(pVCpu) != EMGetInhibitInterruptsPC(pVCpu)) 2082 2091 { … … 2108 2117 { 2109 2118 fWakeupPending = true; 2110 # ifdef VBOX_STRICT2119 # ifdef VBOX_STRICT 2111 2120 rcIrq = rc2; 2112 # endif2121 # endif 2113 2122 } 2114 2123 if (fResched) … … 2118 2127 #endif 2119 2128 { 2129 CPUM_ASSERT_NOT_EXTRN(pVCpu, CPUMCTX_EXTRN_RFLAGS); 2120 2130 if ( VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC) 2121 2131 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM … … 2130 2140 /* Note: it's important to make sure the return code from TRPMR3InjectEvent isn't ignored! */ 2131 2141 /** @todo this really isn't nice, should properly handle this */ 2142 CPUM_IMPORT_EXTRN_RET(pVCpu, IEM_CPUMCTX_EXTRN_XCPT_MASK); 2132 2143 rc2 = TRPMR3InjectEvent(pVM, pVCpu, TRPM_HARDWARE_INT); 2133 2144 Log(("EM: TRPMR3InjectEvent -> %d\n", rc2)); … … 2165 2176 && !VM_FF_IS_PENDING(pVM, VM_FF_PGM_NO_MEMORY) ) 2166 2177 { 2178 CPUM_IMPORT_EXTRN_RCSTRICT(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK, rc); 2167 2179 rc2 = DBGFR3VMMForcedAction(pVM, pVCpu); 2168 2180 UPDATE_RC(); … … 2175 2187 && VM_FF_IS_PENDING(pVM, VM_FF_EMT_RENDEZVOUS)) 2176 2188 { 2189 CPUM_IMPORT_EXTRN_RCSTRICT(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK, rc); 2177 2190 rc2 = VMMR3EmtRendezvousFF(pVM, pVCpu); 2178 2191 UPDATE_RC(); -
trunk/src/VBox/VMM/VMMR3/EMHM.cpp
r70979 r72488 21 21 *********************************************************************************************************************************/ 22 22 #define LOG_GROUP LOG_GROUP_EM 23 #define VMCPU_INCL_CPUM_GST_CTX 23 24 #include <VBox/vmm/em.h> 24 25 #include <VBox/vmm/vmm.h> … … 129 130 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK)) 130 131 { 131 rcStrict = emR3HighPriorityPostForcedActions(pVM, pVCpu, VBOXSTRICTRC_TODO(rcStrict));132 rcStrict = emR3HighPriorityPostForcedActions(pVM, pVCpu, rcStrict); 132 133 LogFlow(("EMR3HmSingleInstruction: FFs after -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 133 134 } … … 468 469 if ( VM_FF_IS_PENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK) 469 470 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK)) 470 rc = emR3HighPriorityPostForcedActions(pVM, pVCpu, rc);471 rc = VBOXSTRICTRC_TODO(emR3HighPriorityPostForcedActions(pVM, pVCpu, rc)); 471 472 472 473 /* -
trunk/src/VBox/VMM/VMMR3/EMR3Nem.cpp
r72207 r72488 21 21 *********************************************************************************************************************************/ 22 22 #define LOG_GROUP LOG_GROUP_EM 23 #define VMCPU_INCL_CPUM_GST_CTX 23 24 #include <VBox/vmm/em.h> 24 25 #include <VBox/vmm/vmm.h> … … 74 75 75 76 /** 76 * Executes instruction in HM mode if we can.77 * Executes instruction in NEM mode if we can. 77 78 * 78 79 * This is somewhat comparable to REMR3EmulateInstruction. … … 90 91 VBOXSTRICTRC emR3NemSingleInstruction(PVM pVM, PVMCPU pVCpu, uint32_t fFlags) 91 92 { 92 PCPUMCTX pCtx = pVCpu->em.s.pCtx;93 Assert(pVCpu->em.s.pCtx == &pVCpu->cpum.GstCtx); 93 94 Assert(!(fFlags & ~EM_ONE_INS_FLAGS_MASK)); 94 95 95 if (!NEMR3CanExecuteGuest(pVM, pVCpu, pCtx))96 if (!NEMR3CanExecuteGuest(pVM, pVCpu, &pVCpu->cpum.GstCtx)) 96 97 return VINF_EM_RESCHEDULE; 97 98 98 uint64_t const uOldRip = p Ctx->rip;99 uint64_t const uOldRip = pVCpu->cpum.GstCtx.rip; 99 100 for (;;) 100 101 { … … 105 106 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK)) 106 107 { 107 VBOXSTRICTRC rcStrict = emR3NemForcedActions(pVM, pVCpu, pCtx);108 VBOXSTRICTRC rcStrict = emR3NemForcedActions(pVM, pVCpu, &pVCpu->cpum.GstCtx); 108 109 if (rcStrict != VINF_SUCCESS) 109 110 { … … 129 130 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK)) 130 131 { 131 rcStrict = emR3HighPriorityPostForcedActions(pVM, pVCpu, VBOXSTRICTRC_TODO(rcStrict));132 rcStrict = emR3HighPriorityPostForcedActions(pVM, pVCpu, rcStrict); 132 133 LogFlow(("emR3NemSingleInstruction: FFs after -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 133 134 } … … 135 136 if (rcStrict != VINF_SUCCESS && (rcStrict < VINF_EM_FIRST || rcStrict > VINF_EM_LAST)) 136 137 { 137 rcStrict = emR3NemHandleRC(pVM, pVCpu, pCtx, VBOXSTRICTRC_TODO(rcStrict));138 rcStrict = emR3NemHandleRC(pVM, pVCpu, &pVCpu->cpum.GstCtx, VBOXSTRICTRC_TODO(rcStrict)); 138 139 Log(("emR3NemSingleInstruction: emR3NemHandleRC -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 139 140 } … … 142 143 * Done? 143 144 */ 145 CPUM_ASSERT_NOT_EXTRN(pVCpu, CPUMCTX_EXTRN_RIP); 144 146 if ( (rcStrict != VINF_SUCCESS && rcStrict != VINF_EM_DBG_STEPPED) 145 147 || !(fFlags & EM_ONE_INS_FLAGS_RIP_CHANGE) 146 || p Ctx->rip != uOldRip)147 { 148 if (rcStrict == VINF_SUCCESS && p Ctx->rip != uOldRip)148 || pVCpu->cpum.GstCtx.rip != uOldRip) 149 { 150 if (rcStrict == VINF_SUCCESS && pVCpu->cpum.GstCtx.rip != uOldRip) 149 151 rcStrict = VINF_EM_DBG_STEPPED; 150 Log(("emR3NemSingleInstruction: returns %Rrc (rip %llx -> %llx)\n", VBOXSTRICTRC_VAL(rcStrict), uOldRip, pCtx->rip)); 152 Log(("emR3NemSingleInstruction: returns %Rrc (rip %llx -> %llx)\n", 153 VBOXSTRICTRC_VAL(rcStrict), uOldRip, pVCpu->cpum.GstCtx.rip)); 154 CPUM_IMPORT_EXTRN_RET(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK); 151 155 return rcStrict; 152 156 } … … 172 176 #endif 173 177 { 174 #if def LOG_ENABLED178 #if defined(LOG_ENABLED) 175 179 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 176 180 #endif … … 195 199 */ 196 200 STAM_PROFILE_START(&pVCpu->em.s.StatIEMEmu, a); 201 CPUM_IMPORT_EXTRN_RET(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK); 197 202 rc = VBOXSTRICTRC_TODO(IEMExecOne(pVCpu)); 198 203 STAM_PROFILE_STOP(&pVCpu->em.s.StatIEMEmu, a); … … 203 208 #ifdef VBOX_WITH_REM 204 209 STAM_PROFILE_START(&pVCpu->em.s.StatREMEmu, b); 210 CPUM_IMPORT_EXTRN_RET(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK); 205 211 EMRemLock(pVM); 206 212 /* Flush the recompiler TLB if the VCPU has changed. */ … … 216 222 #endif /* !VBOX_WITH_REM */ 217 223 } 218 219 #ifdef EM_NOTIFY_HM220 if (pVCpu->em.s.enmState == EMSTATE_DEBUG_GUEST_HM)221 HMR3NotifyEmulated(pVCpu);222 #endif223 224 return rc; 224 225 } … … 278 279 * Hand it over to the interpreter. 279 280 */ 281 CPUM_IMPORT_EXTRN_RET(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK); 280 282 VBOXSTRICTRC rcStrict = IEMExecOne(pVCpu); 281 283 LogFlow(("emR3NemExecuteIOInstruction: %Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); … … 443 445 */ 444 446 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK); 445 if ( 446 || 447 rcStrict = emR3HighPriorityPostForcedActions(pVM, pVCpu, VBOXSTRICTRC_TODO(rcStrict));447 if ( VM_FF_IS_PENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK) 448 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK)) 449 rcStrict = emR3HighPriorityPostForcedActions(pVM, pVCpu, rcStrict); 448 450 449 451 /* … … 478 480 479 481 /* 480 * Return to outer loop. 481 */ 482 * Return to outer loop, making sure the fetch all state as we leave. 483 * 484 * Note! Not using CPUM_IMPORT_EXTRN_RET here, to prioritize an rcStrict error 485 * status over import errors. 486 */ 487 if (pCtx->fExtrn) 488 { 489 int rcImport = NEMImportStateOnDemand(pVCpu, pCtx, pCtx->fExtrn); 490 AssertReturn(RT_SUCCESS(rcImport) || RT_FAILURE_NP(rcStrict), rcImport); 491 } 482 492 #if defined(LOG_ENABLED) && defined(DEBUG) 483 493 RTLogFlush(NULL); -
trunk/src/VBox/VMM/VMMR3/EMRaw.cpp
r69111 r72488 21 21 *********************************************************************************************************************************/ 22 22 #define LOG_GROUP LOG_GROUP_EM 23 #define VMCPU_INCL_CPUM_GST_CTX 23 24 #include <VBox/vmm/em.h> 24 25 #include <VBox/vmm/vmm.h> … … 140 141 * Deal with the return code. 141 142 */ 142 rc = emR3HighPriorityPostForcedActions(pVM, pVCpu, rc);143 rc = VBOXSTRICTRC_TODO(emR3HighPriorityPostForcedActions(pVM, pVCpu, rc)); 143 144 rc = emR3RawHandleRC(pVM, pVCpu, pCtx, rc); 144 145 rc = emR3RawUpdateForceFlag(pVM, pVCpu, pCtx, rc); … … 220 221 * Deal with the return codes. 221 222 */ 222 rc = emR3HighPriorityPostForcedActions(pVM, pVCpu, rc);223 rc = VBOXSTRICTRC_TODO(emR3HighPriorityPostForcedActions(pVM, pVCpu, rc)); 223 224 rc = emR3RawHandleRC(pVM, pVCpu, pCtx, rc); 224 225 rc = emR3RawUpdateForceFlag(pVM, pVCpu, pCtx, rc); … … 1426 1427 if ( VM_FF_IS_PENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK) 1427 1428 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK)) 1428 rc = emR3HighPriorityPostForcedActions(pVM, pVCpu, rc);1429 rc = VBOXSTRICTRC_TODO(emR3HighPriorityPostForcedActions(pVM, pVCpu, rc)); 1429 1430 1430 1431 #ifdef VBOX_STRICT -
trunk/src/VBox/VMM/VMMR3/NEMR3Native-win.cpp
r72484 r72488 1235 1235 STAMR3RegisterF(pVM, &pNemCpu->StatBreakOnStatus, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of status code breaks", "/NEM/CPU%u/BreakOnStatus", iCpu); 1236 1236 STAMR3RegisterF(pVM, &pNemCpu->StatImportOnDemand, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of on-demand state imports", "/NEM/CPU%u/ImportOnDemand", iCpu); 1237 STAMR3RegisterF(pVM, &pNemCpu->StatImportOnReturn, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of state imports on loop return", "/NEM/CPU%u/ImportOnReturn", iCpu); 1238 STAMR3RegisterF(pVM, &pNemCpu->StatImportOnReturnSkipped, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Number of skipped state imports on loop return", "/NEM/CPU%u/ImportOnReturnSkipped", iCpu); 1237 1239 } 1238 1240
Note:
See TracChangeset
for help on using the changeset viewer.