Changeset 92392 in vbox for trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
- Timestamp:
- Nov 12, 2021 10:39:56 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 148246
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r91587 r92392 3043 3043 3044 3044 /** 3045 * Does the necessary state syncing before doing a longjmp to ring-3.3046 *3047 * @returns VBox status code.3048 * @param pVCpu The cross context virtual CPU structure.3049 *3050 * @remarks No-long-jmp zone!!!3051 */3052 static int hmR0SvmLongJmpToRing3(PVMCPUCC pVCpu)3053 {3054 return hmR0SvmLeaveSession(pVCpu);3055 }3056 3057 3058 /**3059 3045 * VMMRZCallRing3() callback wrapper which saves the guest state (or restores 3060 * any remaining host state) before we longjump to ring-3 and possibly get 3061 * preempted. 3046 * any remaining host state) before we go back to ring-3 due to an assertion. 3062 3047 * 3063 3048 * @param pVCpu The cross context virtual CPU structure. 3064 * @param enmOperation The operation causing the ring-3 longjump. 3065 */ 3066 VMMR0DECL(int) SVMR0CallRing3Callback(PVMCPUCC pVCpu, VMMCALLRING3 enmOperation) 3067 { 3068 if (enmOperation == VMMCALLRING3_VM_R0_ASSERTION) 3069 { 3070 /* 3071 * !!! IMPORTANT !!! 3072 * If you modify code here, make sure to check whether hmR0SvmLeave() and hmR0SvmLeaveSession() needs 3073 * to be updated too. This is a stripped down version which gets out ASAP trying to not trigger any assertion. 3074 */ 3075 VMMRZCallRing3RemoveNotification(pVCpu); 3076 VMMRZCallRing3Disable(pVCpu); 3077 HM_DISABLE_PREEMPT(pVCpu); 3078 3079 /* Import the entire guest state. */ 3080 hmR0SvmImportGuestState(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL); 3081 3082 /* Restore host FPU state if necessary and resync on next R0 reentry. */ 3083 CPUMR0FpuStateMaybeSaveGuestAndRestoreHost(pVCpu); 3084 3085 /* Restore host debug registers if necessary and resync on next R0 reentry. */ 3086 CPUMR0DebugStateMaybeSaveGuestAndRestoreHost(pVCpu, false /* save DR6 */); 3087 3088 /* Deregister the hook now that we've left HM context before re-enabling preemption. */ 3089 /** @todo eliminate the need for calling VMMR0ThreadCtxHookDisable here! */ 3090 VMMR0ThreadCtxHookDisable(pVCpu); 3091 3092 /* Leave HM context. This takes care of local init (term). */ 3093 HMR0LeaveCpu(pVCpu); 3094 3095 HM_RESTORE_PREEMPT(); 3096 return VINF_SUCCESS; 3097 } 3098 3099 Assert(pVCpu); 3100 Assert(VMMRZCallRing3IsEnabled(pVCpu)); 3101 HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); 3102 3049 */ 3050 VMMR0DECL(int) SVMR0AssertionCallback(PVMCPUCC pVCpu) 3051 { 3052 /* 3053 * !!! IMPORTANT !!! 3054 * If you modify code here, make sure to check whether hmR0SvmLeave() and hmR0SvmLeaveSession() needs 3055 * to be updated too. This is a stripped down version which gets out ASAP trying to not trigger any assertion. 3056 */ 3057 VMMR0AssertionRemoveNotification(pVCpu); 3103 3058 VMMRZCallRing3Disable(pVCpu); 3104 3105 Log4Func(("Calling hmR0SvmLongJmpToRing3\n")); 3106 int rc = hmR0SvmLongJmpToRing3(pVCpu); 3107 AssertRCReturn(rc, rc); 3108 3109 VMMRZCallRing3Enable(pVCpu); 3059 HM_DISABLE_PREEMPT(pVCpu); 3060 3061 /* Import the entire guest state. */ 3062 hmR0SvmImportGuestState(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL); 3063 3064 /* Restore host FPU state if necessary and resync on next R0 reentry. */ 3065 CPUMR0FpuStateMaybeSaveGuestAndRestoreHost(pVCpu); 3066 3067 /* Restore host debug registers if necessary and resync on next R0 reentry. */ 3068 CPUMR0DebugStateMaybeSaveGuestAndRestoreHost(pVCpu, false /* save DR6 */); 3069 3070 /* Deregister the hook now that we've left HM context before re-enabling preemption. */ 3071 /** @todo eliminate the need for calling VMMR0ThreadCtxHookDisable here! */ 3072 VMMR0ThreadCtxHookDisable(pVCpu); 3073 3074 /* Leave HM context. This takes care of local init (term). */ 3075 HMR0LeaveCpu(pVCpu); 3076 3077 HM_RESTORE_PREEMPT(); 3110 3078 return VINF_SUCCESS; 3111 3079 } … … 4814 4782 rc = hmR0SvmExitToRing3(pVCpu, rc); 4815 4783 Assert(!ASMAtomicUoReadU64(&pCtx->fExtrn)); 4816 Assert(!VMMR ZCallRing3IsNotificationSet(pVCpu));4784 Assert(!VMMR0AssertionIsNotificationSet(pVCpu)); 4817 4785 return rc; 4818 4786 }
Note:
See TracChangeset
for help on using the changeset viewer.