- Timestamp:
- Sep 2, 2013 2:52:50 PM (11 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMR0.cpp
r48218 r48230 1074 1074 { 1075 1075 rc = g_HvmR0.pfnDisableCpu(pCpu, pvCpuPage, HCPhysCpuPage); 1076 AssertRC (rc);1076 AssertRCReturn(rc, rc); 1077 1077 } 1078 1078 else -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r48227 r48230 1961 1961 * @param pCtx Pointer to the guest-CPU context. 1962 1962 */ 1963 static voidhmR0SvmLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)1963 static int hmR0SvmLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx) 1964 1964 { 1965 1965 HM_DISABLE_PREEMPT_IF_NEEDED(); … … 1981 1981 /* Leave HM context. This takes care of local init (term). */ 1982 1982 int rc = HMR0LeaveCpu(pVCpu); 1983 AssertRC(rc); NOREF(rc);1984 1983 1985 1984 HM_RESTORE_PREEMPT_IF_NEEDED(); 1985 return rc; 1986 1986 } 1987 1987 … … 1990 1990 * Does the necessary state syncing before doing a longjmp to ring-3. 1991 1991 * 1992 * @returns VBox status code. 1992 1993 * @param pVM Pointer to the VM. 1993 1994 * @param pVCpu Pointer to the VMCPU. … … 1996 1997 * @remarks No-long-jmp zone!!! 1997 1998 */ 1998 static voidhmR0SvmLongJmpToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)1999 { 2000 hmR0SvmLeaveSession(pVM, pVCpu, pCtx);1999 static int hmR0SvmLongJmpToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx) 2000 { 2001 return hmR0SvmLeaveSession(pVM, pVCpu, pCtx); 2001 2002 } 2002 2003 … … 2013 2014 * 2014 2015 * @remarks Must never be called with @a enmOperation == 2015 * VMMCALLRING3_VM_R0_ASSERTION. 2016 */ 2017 DECLCALLBACK(void) hmR0SvmCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperation, void *pvUser) 2016 * VMMCALLRING3_VM_R0_ASSERTION. We can't assert it here because if it 2017 * it -does- get called with VMMCALLRING3_VM_R0_ASSERTION, we'll end up 2018 * with an infinite recursion. 2019 */ 2020 DECLCALLBACK(int) hmR0SvmCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperation, void *pvUser) 2018 2021 { 2019 2022 /* VMMRZCallRing3() already makes sure we never get called as a result of an longjmp due to an assertion, */ … … 2027 2030 2028 2031 Log4(("hmR0SvmCallRing3Callback->hmR0SvmLongJmpToRing3\n")); 2029 hmR0SvmLongJmpToRing3(pVCpu->CTX_SUFF(pVM), pVCpu, (PCPUMCTX)pvUser); 2032 int rc = hmR0SvmLongJmpToRing3(pVCpu->CTX_SUFF(pVM), pVCpu, (PCPUMCTX)pvUser); 2033 AssertRCReturn(rc, rc); 2030 2034 2031 2035 VMMRZCallRing3Enable(pVCpu); 2036 return VINF_SUCCESS; 2032 2037 } 2033 2038 -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r48227 r48230 6085 6085 * (longjmp, preemption, voluntary exits to ring-3) from VT-x. 6086 6086 * 6087 * @returns VBox status code. 6087 6088 * @param pVM Pointer to the VM. 6088 6089 * @param pVCpu Pointer to the VMCPU. … … 6093 6094 * @remarks No-long-jmp zone!!! 6094 6095 */ 6095 static voidhmR0VmxLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)6096 static int hmR0VmxLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx) 6096 6097 { 6097 6098 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD)); … … 6105 6106 { 6106 6107 int rc = hmR0VmxSaveGuestState(pVCpu, pMixedCtx); 6107 AssertRC (rc);6108 AssertRCReturn(rc, rc); 6108 6109 Assert(pVCpu->hm.s.vmx.fUpdatedGuestState == HMVMX_UPDATED_GUEST_ALL); 6109 6110 } … … 6155 6156 { 6156 6157 int rc = VMXClearVmcs(pVCpu->hm.s.vmx.HCPhysVmcs); 6157 AssertRC(rc); 6158 AssertRCReturn(rc, rc); 6159 6158 6160 pVCpu->hm.s.vmx.uVmcsState = HMVMX_VMCS_STATE_CLEAR; 6159 6161 Log4Func(("Cleared Vmcs. HostCpuId=%u\n", idCpu)); … … 6161 6163 Assert(!(pVCpu->hm.s.vmx.uVmcsState & HMVMX_VMCS_STATE_LAUNCHED)); 6162 6164 NOREF(idCpu); 6165 6166 return VINF_SUCCESS; 6163 6167 } 6164 6168 … … 6167 6171 * Leaves the VT-x session. 6168 6172 * 6173 * @returns VBox status code. 6169 6174 * @param pVM Pointer to the VM. 6170 6175 * @param pVCpu Pointer to the VMCPU. … … 6175 6180 * @remarks No-long-jmp zone!!! 6176 6181 */ 6177 DECLINLINE( void) hmR0VmxLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)6182 DECLINLINE(int) hmR0VmxLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx) 6178 6183 { 6179 6184 HM_DISABLE_PREEMPT_IF_NEEDED(); … … 6186 6191 if (!pVCpu->hm.s.fLeaveDone) 6187 6192 { 6188 hmR0VmxLeave(pVM, pVCpu, pMixedCtx); 6193 int rc2 = hmR0VmxLeave(pVM, pVCpu, pMixedCtx); 6194 AssertRCReturn(rc2, rc2); 6189 6195 pVCpu->hm.s.fLeaveDone = true; 6190 6196 } … … 6198 6204 /* Leave HM context. This takes care of local init (term). */ 6199 6205 int rc = HMR0LeaveCpu(pVCpu); 6200 AssertRC(rc); NOREF(rc);6201 6206 6202 6207 HM_RESTORE_PREEMPT_IF_NEEDED(); 6208 6209 return rc; 6203 6210 } 6204 6211 … … 6207 6214 * Does the necessary state syncing before doing a longjmp to ring-3. 6208 6215 * 6216 * @returns VBox status code. 6209 6217 * @param pVM Pointer to the VM. 6210 6218 * @param pVCpu Pointer to the VMCPU. … … 6215 6223 * @remarks No-long-jmp zone!!! 6216 6224 */ 6217 DECLINLINE( void) hmR0VmxLongJmpToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)6218 { 6219 hmR0VmxLeaveSession(pVM, pVCpu, pMixedCtx);6225 DECLINLINE(int) hmR0VmxLongJmpToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx) 6226 { 6227 return hmR0VmxLeaveSession(pVM, pVCpu, pMixedCtx); 6220 6228 } 6221 6229 … … 6229 6237 * executing outside HM (recompiler/IEM). 6230 6238 * 6239 * @returns VBox status code. 6231 6240 * @param pVM Pointer to the VM. 6232 6241 * @param pVCpu Pointer to the VMCPU. … … 6237 6246 * VINF_VMM_UNKNOWN_RING3_CALL. 6238 6247 */ 6239 static voidhmR0VmxExitToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, int rcExit)6248 static int hmR0VmxExitToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, int rcExit) 6240 6249 { 6241 6250 Assert(pVM); … … 6247 6256 { 6248 6257 /* We've done what is required in hmR0VmxExitErrInvalidGuestState(). We're not going to continue guest execution... */ 6249 return ;6258 return VINF_SUCCESS; 6250 6259 } 6251 6260 else if (RT_UNLIKELY(rcExit == VERR_VMX_INVALID_VMCS_PTR)) … … 6255 6264 pVCpu->hm.s.vmx.LastError.idEnteredCpu = pVCpu->hm.s.idEnteredCpu; 6256 6265 /* LastError.idCurrentCpu was updated in hmR0VmxPreRunGuestCommitted(). */ 6257 return ;6266 return VINF_SUCCESS; 6258 6267 } 6259 6268 … … 6270 6279 6271 6280 /* Save guest state and restore host state bits. */ 6272 hmR0VmxLeaveSession(pVM, pVCpu, pMixedCtx);6281 int rc = hmR0VmxLeaveSession(pVM, pVCpu, pMixedCtx); 6273 6282 STAM_COUNTER_DEC(&pVCpu->hm.s.StatSwitchLongJmpToR3); 6274 6283 … … 6282 6291 | CPUM_CHANGED_HIDDEN_SEL_REGS); 6283 6292 Assert(pVCpu->hm.s.vmx.fUpdatedGuestState & HMVMX_UPDATED_GUEST_CR0); 6284 if ( 6285 && 6293 if ( pVM->hm.s.fNestedPaging 6294 && CPUMIsGuestPagingEnabledEx(pMixedCtx)) 6286 6295 { 6287 6296 CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_GLOBAL_TLB_FLUSH); … … 6310 6319 VMMRZCallRing3RemoveNotification(pVCpu); 6311 6320 VMMRZCallRing3Enable(pVCpu); 6321 6322 return rc; 6312 6323 } 6313 6324 … … 6317 6328 * longjump to ring-3 and possibly get preempted. 6318 6329 * 6330 * @returns VBox status code. 6319 6331 * @param pVCpu Pointer to the VMCPU. 6320 6332 * @param enmOperation The operation causing the ring-3 longjump. 6321 * @param pvUser The user argument (pointer to the possibly 6322 * out-of-date guest-CPU context). 6333 * @param pvUser Opaque pointer to the guest-CPU context. The data 6334 * may be out-of-sync. Make sure to update the required 6335 * fields before using them. 6323 6336 * 6324 6337 * @remarks Must never be called with @a enmOperation == 6325 * VMMCALLRING3_VM_R0_ASSERTION. 6326 */ 6327 DECLCALLBACK(void) hmR0VmxCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperation, void *pvUser) 6338 * VMMCALLRING3_VM_R0_ASSERTION. We can't assert it here because if it 6339 * it -does- get called with VMMCALLRING3_VM_R0_ASSERTION, we'll end up 6340 * with an infinite recursion. 6341 */ 6342 DECLCALLBACK(int) hmR0VmxCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperation, void *pvUser) 6328 6343 { 6329 6344 /* VMMRZCallRing3() already makes sure we never get called as a result of an longjmp due to an assertion. */ … … 6337 6352 6338 6353 Log4(("hmR0VmxCallRing3Callback->hmR0VmxLongJmpToRing3 pVCpu=%p idCpu=%RU32\n", pVCpu, pVCpu->idCpu)); 6339 hmR0VmxLongJmpToRing3(pVCpu->CTX_SUFF(pVM), pVCpu, (PCPUMCTX)pvUser); 6354 int rc = hmR0VmxLongJmpToRing3(pVCpu->CTX_SUFF(pVM), pVCpu, (PCPUMCTX)pvUser); 6355 AssertRCReturn(rc, rc); 6340 6356 6341 6357 VMMRZCallRing3Enable(pVCpu); 6358 return VINF_SUCCESS; 6342 6359 } 6343 6360 … … 7748 7765 rc = VINF_EM_TRIPLE_FAULT; 7749 7766 7750 hmR0VmxExitToRing3(pVM, pVCpu, pCtx, rc); 7767 int rc2 = hmR0VmxExitToRing3(pVM, pVCpu, pCtx, rc); 7768 if (RT_FAILURE(rc2)) 7769 { 7770 pVCpu->hm.s.u32HMError = rc; 7771 rc = rc2; 7772 } 7751 7773 Assert(!VMMRZCallRing3IsNotificationSet(pVCpu)); 7752 7774 return rc; -
trunk/src/VBox/VMM/VMMRZ/VMMRZ.cpp
r48228 r48230 86 86 pVM->vmm.s.pfnRCToHost(VINF_VMM_CALL_HOST); 87 87 #else 88 int rc; 88 89 if ( pVCpu->vmm.s.pfnCallRing3CallbackR0 89 90 && enmOperation != VMMCALLRING3_VM_R0_ASSERTION) 90 91 { 91 pVCpu->vmm.s.pfnCallRing3CallbackR0(pVCpu, enmOperation, pVCpu->vmm.s.pvCallRing3CallbackUserR0); 92 } 93 int rc = vmmR0CallRing3LongJmp(&pVCpu->vmm.s.CallRing3JmpBufR0, VINF_VMM_CALL_HOST); 92 rc = pVCpu->vmm.s.pfnCallRing3CallbackR0(pVCpu, enmOperation, pVCpu->vmm.s.pvCallRing3CallbackUserR0); 93 if (RT_FAILURE(rc)) 94 return rc; 95 } 96 rc = vmmR0CallRing3LongJmp(&pVCpu->vmm.s.CallRing3JmpBufR0, VINF_VMM_CALL_HOST); 94 97 if (RT_FAILURE(rc)) 95 98 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.