Index: /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp	(revision 54079)
+++ /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp	(revision 54080)
@@ -149,9 +149,10 @@
  *
  * We need to intercept all exceptions manually except:
- * - #NM, #MF handled separately, see hmR0VmxLoadSharedCR0().
+ * - #NM, #MF handled in hmR0VmxLoadSharedCR0().
+ * - #DB handled in hmR0VmxLoadSharedDebugState().
  * - #PF need not be intercepted even in real-mode if we have Nested Paging
  * support.
  */
-#define HMVMX_REAL_MODE_XCPT_MASK    (  RT_BIT(X86_XCPT_DE)             | RT_BIT(X86_XCPT_DB)    | RT_BIT(X86_XCPT_NMI)   \
+#define HMVMX_REAL_MODE_XCPT_MASK    (  RT_BIT(X86_XCPT_DE)            /* RT_BIT(X86_XCPT_DB) */ | RT_BIT(X86_XCPT_NMI)   \
                                       | RT_BIT(X86_XCPT_BP)             | RT_BIT(X86_XCPT_OF)    | RT_BIT(X86_XCPT_BR)    \
                                       | RT_BIT(X86_XCPT_UD)            /* RT_BIT(X86_XCPT_NM) */ | RT_BIT(X86_XCPT_DF)    \
@@ -3773,4 +3774,6 @@
             fInterceptMF = true;
         }
+        else
+            pVCpu->hm.s.vmx.u32XcptBitmap &= ~HMVMX_REAL_MODE_XCPT_MASK;
 
         if (fInterceptNM)
@@ -4212,7 +4215,8 @@
      * Update the exception bitmap regarding intercepting #DB generated by the guest.
      */
-    if (fInterceptDB)
+    if (   fInterceptDB
+        || pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
         pVCpu->hm.s.vmx.u32XcptBitmap |= RT_BIT(X86_XCPT_DB);
-    else if (!pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
+    else
     {
 #ifndef HMVMX_ALWAYS_TRAP_ALL_XCPTS
@@ -10979,13 +10983,4 @@
         AssertRCReturn(rc2, rc2);
     }
-    else if (rc == VINF_PGM_CHANGE_MODE)
-    {
-        /*
-         * Clear the exception-mask here rather than messing with it in hmR0VmxLoadSharedCR0(). Since the fRealOnV86Active
-         * state may be changed now. Re-evaluate the necessary intercepts when we return to VT-x execution via
-         * hmR0VmxLoadSharedCR0() and hmR0VmxLoadSharedDebugState(), see @bugref{7626}.
-         */
-        hmR0VmxInitXcptBitmap(pVM, pVCpu);
-    }
 
     STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitMovCRx, y2);
