Index: trunk/src/VBox/VMM/VMMRZ/DBGFRZ.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMRZ/DBGFRZ.cpp	(revision 86726)
+++ trunk/src/VBox/VMM/VMMRZ/DBGFRZ.cpp	(revision 86729)
@@ -23,7 +23,4 @@
 #include <VBox/vmm/dbgf.h>
 #include <VBox/vmm/selm.h>
-#ifdef IN_RC
-# include <VBox/vmm/trpm.h>
-#endif
 #include <VBox/log.h>
 #include "DBGFInternal.h"
@@ -32,7 +29,148 @@
 #include <iprt/assert.h>
 
+
 #ifdef IN_RC
-DECLASM(void) TRPMRCHandlerAsmTrap03(void);
+# error "You lucky person have the pleasure to implement the raw mode part for this!"
 #endif
+
+
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
+
+#ifdef VBOX_WITH_LOTS_OF_DBGF_BPS
+# ifdef IN_RING0
+/**
+ * Returns the internal breakpoint state for the given handle.
+ *
+ * @returns Pointer to the internal breakpoint state or NULL if the handle is invalid.
+ * @param   pVM                 The ring-0 VM structure pointer.
+ * @param   hBp                 The breakpoint handle to resolve.
+ * @param   ppBpR0              Where to store the pointer to the ring-0 only part of the breakpoint
+ *                              on success, optional.
+ */
+DECLINLINE(PDBGFBPINT) dbgfR0BpGetByHnd(PVMCC pVM, DBGFBP hBp, PDBGFBPINTR0 *ppBpR0)
+{
+    uint32_t idChunk  = DBGF_BP_HND_GET_CHUNK_ID(hBp);
+    uint32_t idxEntry = DBGF_BP_HND_GET_ENTRY(hBp);
+
+    AssertReturn(idChunk < DBGF_BP_CHUNK_COUNT, NULL);
+    AssertReturn(idxEntry < DBGF_BP_COUNT_PER_CHUNK, NULL);
+
+    PDBGFBPCHUNKR0 pBpChunk = &pVM->dbgfr0.s.aBpChunks[idChunk];
+    AssertPtrReturn(pBpChunk->paBpBaseSharedR0, NULL);
+
+    if (ppBpR0)
+        *ppBpR0 = &pBpChunk->paBpBaseR0Only[idxEntry];
+    return &pBpChunk->paBpBaseSharedR0[idxEntry];
+}
+# endif
+
+
+/**
+ * Executes the actions associated with the given breakpoint.
+ *
+ * @returns VBox status code.
+ * @param   pVM         The cross context VM structure.
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pRegFrame   Pointer to the register frame for the trap.
+ * @param   hBp         The breakpoint handle which hit.
+ * @param   pBp         The shared breakpoint state.
+ * @param   pBpR0       The ring-0 only breakpoint state.
+ */
+DECLINLINE(int) dbgfRZBpHit(PVMCC pVM, PVMCPUCC pVCpu, PCPUMCTXCORE pRegFrame,
+                            DBGFBP hBp, PDBGFBPINT pBp, PDBGFBPINTR0 pBpR0)
+{
+    uint64_t cHits = ASMAtomicIncU64(&pBp->Pub.cHits);
+    pVCpu->dbgf.s.hBpActive = hBp;
+
+    /** @todo Owner handling. */
+    RT_NOREF(pVM, pRegFrame, pBpR0);
+
+    LogFlow(("dbgfRZBpHit: hit breakpoint %u at %04x:%RGv cHits=0x%RX64\n",
+             hBp, pRegFrame->cs.Sel, pRegFrame->rip, cHits));
+    return VINF_EM_DBG_BREAKPOINT;
+}
+
+
+/**
+ * Returns the pointer to the L2 table entry from the given index.
+ *
+ * @returns Current context pointer to the L2 table entry or NULL if the provided index value is invalid.
+ * @param   pVM         The cross context VM structure.
+ * @param   idxL2       The L2 table index to resolve.
+ *
+ * @note The content of the resolved L2 table entry is not validated!.
+ */
+DECLINLINE(PCDBGFBPL2ENTRY) dbgfRZBpL2GetByIdx(PVMCC pVM, uint32_t idxL2)
+{
+    uint32_t idChunk  = DBGF_BP_L2_IDX_GET_CHUNK_ID(idxL2);
+    uint32_t idxEntry = DBGF_BP_L2_IDX_GET_ENTRY(idxL2);
+
+    AssertReturn(idChunk < DBGF_BP_L2_TBL_CHUNK_COUNT, NULL);
+    AssertReturn(idxEntry < DBGF_BP_L2_TBL_ENTRIES_PER_CHUNK, NULL);
+
+    PDBGFBPL2TBLCHUNKR0 pL2Chunk = &pVM->dbgfr0.s.aBpL2TblChunks[idChunk];
+    AssertPtrReturn(pL2Chunk->paBpL2TblBaseSharedR0, NULL);
+
+    return &pL2Chunk->CTX_SUFF(paBpL2TblBaseShared)[idxEntry];
+}
+
+
+/**
+ * Walks the L2 table starting at the given root index searching for the given key.
+ *
+ * @returns VBox status code.
+ * @param   pVM         The cross context VM structure.
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pRegFrame   Pointer to the register frame for the trap.
+ * @param   idxL2Root   L2 table index of the table root.
+ * @param   GCPtrKey    The key to search for.
+ */
+static int dbgfRZBpL2Walk(PVMCC pVM, PVMCPUCC pVCpu, PCPUMCTXCORE pRegFrame,
+                          uint32_t idxL2Root, RTGCUINTPTR GCPtrKey)
+{
+    /** @todo We don't use the depth right now but abort the walking after a fixed amount of levels. */
+    uint8_t iDepth = 32;
+    PCDBGFBPL2ENTRY pL2Entry = dbgfRZBpL2GetByIdx(pVM, idxL2Root);
+
+    while (RT_LIKELY(   iDepth-- > 0
+                     && pL2Entry))
+    {
+        /* Make a copy of the entry before verification. */
+        DBGFBPL2ENTRY L2Entry;
+        L2Entry.u64GCPtrKeyAndBpHnd1       = ASMAtomicReadU64((volatile uint64_t *)&pL2Entry->u64GCPtrKeyAndBpHnd1);
+        L2Entry.u64LeftRightIdxDepthBpHnd2 = ASMAtomicReadU64((volatile uint64_t *)&pL2Entry->u64LeftRightIdxDepthBpHnd2);
+
+        RTGCUINTPTR GCPtrL2Entry = DBGF_BP_L2_ENTRY_GET_GCPTR(L2Entry.u64GCPtrKeyAndBpHnd1);
+        if (GCPtrKey == GCPtrL2Entry)
+        {
+            DBGFBP hBp = DBGF_BP_L2_ENTRY_GET_BP_HND(L2Entry.u64GCPtrKeyAndBpHnd1, L2Entry.u64LeftRightIdxDepthBpHnd2);
+
+            /* Query the internal breakpoint state from the handle. */
+            PDBGFBPINTR0 pBpR0 = NULL;
+            PDBGFBPINT pBp = dbgfR0BpGetByHnd(pVM, hBp, &pBpR0);
+            if (   pBp
+                && DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType) == DBGFBPTYPE_INT3)
+                return dbgfRZBpHit(pVM, pVCpu, pRegFrame, hBp, pBp, pBpR0);
+
+            /* The entry got corrupted, just abort. */
+            return VERR_DBGF_BP_L2_LOOKUP_FAILED;
+        }
+
+        /* Not found, get to the next level. */
+        uint32_t idxL2Next =   (GCPtrKey < GCPtrL2Entry)
+                             ? DBGF_BP_L2_ENTRY_GET_IDX_LEFT(L2Entry.u64LeftRightIdxDepthBpHnd2)
+                             : DBGF_BP_L2_ENTRY_GET_IDX_RIGHT(L2Entry.u64LeftRightIdxDepthBpHnd2);
+        /* It is genuine guest trap or we hit some assertion if we are at the end. */
+        if (idxL2Next == DBGF_BP_L2_ENTRY_IDX_END)
+            return VINF_EM_RAW_GUEST_TRAP;
+
+        pL2Entry = dbgfRZBpL2GetByIdx(pVM, idxL2Next);
+    }
+
+    return VERR_DBGF_BP_L2_LOOKUP_FAILED;
+}
+#endif /* !VBOX_WITH_LOTS_OF_DBGF_BPS */
 
 
@@ -52,12 +190,7 @@
 VMMRZ_INT_DECL(int) DBGFRZTrap01Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCUINTREG uDr6, bool fAltStepping)
 {
-#ifdef IN_RC
-    const bool fInHyper = !(pRegFrame->ss.Sel & X86_SEL_RPL) && !pRegFrame->eflags.Bits.u1VM;
-#else
-    NOREF(pRegFrame);
-    const bool fInHyper = false;
-#endif
-
     /** @todo Intel docs say that X86_DR6_BS has the highest priority... */
+    RT_NOREF(pRegFrame);
+
     /*
      * A breakpoint?
@@ -78,5 +211,5 @@
                          pVM->dbgf.s.aHwBreakpoints[iBp].iBp, pRegFrame->cs.Sel, pRegFrame->rip));
 
-                return fInHyper ? VINF_EM_DBG_HYPER_BREAKPOINT : VINF_EM_DBG_BREAKPOINT;
+                return VINF_EM_DBG_BREAKPOINT;
             }
 #else
@@ -89,5 +222,5 @@
                          pVM->dbgf.s.aHwBreakpoints[iBp].hBp, pRegFrame->cs.Sel, pRegFrame->rip));
 
-                return fInHyper ? VINF_EM_DBG_HYPER_BREAKPOINT : VINF_EM_DBG_BREAKPOINT;
+                return VINF_EM_DBG_BREAKPOINT;
             }
 #endif
@@ -100,89 +233,10 @@
      */
     if (    (uDr6 & X86_DR6_BS)
-        &&  (fInHyper || pVCpu->dbgf.s.fSingleSteppingRaw || fAltStepping))
+        &&  (pVCpu->dbgf.s.fSingleSteppingRaw || fAltStepping))
     {
         pVCpu->dbgf.s.fSingleSteppingRaw = false;
         LogFlow(("DBGFRZTrap01Handler: single step at %04x:%RGv\n", pRegFrame->cs.Sel, pRegFrame->rip));
-        return fInHyper ? VINF_EM_DBG_HYPER_STEPPED : VINF_EM_DBG_STEPPED;
-    }
-
-#ifdef IN_RC
-    /*
-     * Either an ICEBP in hypervisor code or a guest related debug exception
-     * of sorts.
-     */
-    if (RT_UNLIKELY(fInHyper))
-    {
-        /*
-         * Is this a guest debug event that was delayed past a ring transition?
-         *
-         * Since we do no allow sysenter/syscall in raw-mode, the  only
-         * non-trap/fault type transitions that can occur are thru interrupt gates.
-         * Of those, only INT3 (#BP) has a DPL other than 0 with a CS.RPL of 0.
-         * See bugref:9171 and bs3-cpu-weird-1 for more details.
-         *
-         * We need to reconstruct the guest register state from the hypervisor one
-         * here, so here is the layout of the IRET frame on the stack:
-         *    20:[8] GS          (V86 only)
-         *    1C:[7] FS          (V86 only)
-         *    18:[6] DS          (V86 only)
-         *    14:[5] ES          (V86 only)
-         *    10:[4] SS
-         *    0c:[3] ESP
-         *    08:[2] EFLAGS
-         *    04:[1] CS
-         *    00:[0] EIP
-         */
-        if (pRegFrame->rip == (uintptr_t)TRPMRCHandlerAsmTrap03)
-        {
-            uint32_t const *pu32Stack = (uint32_t const *)pRegFrame->esp;
-            if (   (pu32Stack[2] & X86_EFL_VM)
-                || (pu32Stack[1] & X86_SEL_RPL))
-            {
-                LogFlow(("DBGFRZTrap01Handler: Detected guest #DB delayed past ring transition %04x:%RX32 %#x\n",
-                         pu32Stack[1] & 0xffff, pu32Stack[0], pu32Stack[2]));
-                PCPUMCTX pGstCtx = CPUMQueryGuestCtxPtr(pVCpu);
-                pGstCtx->rip      = pu32Stack[0];
-                pGstCtx->cs.Sel   = pu32Stack[1];
-                pGstCtx->eflags.u = pu32Stack[2];
-                pGstCtx->rsp      = pu32Stack[3];
-                pGstCtx->ss.Sel   = pu32Stack[4];
-                if (pu32Stack[2] & X86_EFL_VM)
-                {
-                    pGstCtx->es.Sel = pu32Stack[5];
-                    pGstCtx->ds.Sel = pu32Stack[6];
-                    pGstCtx->fs.Sel = pu32Stack[7];
-                    pGstCtx->gs.Sel = pu32Stack[8];
-                }
-                else
-                {
-                    pGstCtx->es.Sel = pRegFrame->es.Sel;
-                    pGstCtx->ds.Sel = pRegFrame->ds.Sel;
-                    pGstCtx->fs.Sel = pRegFrame->fs.Sel;
-                    pGstCtx->gs.Sel = pRegFrame->gs.Sel;
-                }
-                pGstCtx->rax      = pRegFrame->rax;
-                pGstCtx->rcx      = pRegFrame->rcx;
-                pGstCtx->rdx      = pRegFrame->rdx;
-                pGstCtx->rbx      = pRegFrame->rbx;
-                pGstCtx->rsi      = pRegFrame->rsi;
-                pGstCtx->rdi      = pRegFrame->rdi;
-                pGstCtx->rbp      = pRegFrame->rbp;
-
-                /*
-                 * We should assert a #BP followed by a #DB here, but TRPM cannot
-                 * do that.  So, we'll just assert the #BP and ignore the #DB, even
-                 * if that isn't strictly correct.
-                 */
-                TRPMResetTrap(pVCpu);
-                TRPMAssertTrap(pVCpu, X86_XCPT_BP, TRPM_SOFTWARE_INT);
-                return VINF_EM_RAW_GUEST_TRAP;
-            }
-        }
-
-        LogFlow(("DBGFRZTrap01Handler: Unknown bp at %04x:%RGv\n", pRegFrame->cs.Sel, pRegFrame->rip));
-        return VERR_DBGF_HYPER_DB_XCPT;
-    }
-#endif
+        return VINF_EM_DBG_STEPPED;
+    }
 
     LogFlow(("DBGFRZTrap01Handler: guest debug event %#x at %04x:%RGv!\n", (uint32_t)uDr6, pRegFrame->cs.Sel, pRegFrame->rip));
@@ -190,164 +244,18 @@
 }
 
-#ifdef VBOX_WITH_LOTS_OF_DBGF_BPS
-# ifdef IN_RING0
-/**
- * Returns the internal breakpoint state for the given handle.
- *
- * @returns Pointer to the internal breakpoint state or NULL if the handle is invalid.
- * @param   pVM                 The ring-0 VM structure pointer.
- * @param   hBp                 The breakpoint handle to resolve.
- * @param   ppBpR0              Where to store the pointer to the ring-0 only part of the breakpoint
- *                              on success, optional.
- */
-DECLINLINE(PDBGFBPINT) dbgfR0BpGetByHnd(PVMCC pVM, DBGFBP hBp, PDBGFBPINTR0 *ppBpR0)
-{
-    uint32_t idChunk  = DBGF_BP_HND_GET_CHUNK_ID(hBp);
-    uint32_t idxEntry = DBGF_BP_HND_GET_ENTRY(hBp);
-
-    AssertReturn(idChunk < DBGF_BP_CHUNK_COUNT, NULL);
-    AssertReturn(idxEntry < DBGF_BP_COUNT_PER_CHUNK, NULL);
-
-    PDBGFBPCHUNKR0 pBpChunk = &pVM->dbgfr0.s.aBpChunks[idChunk];
-    AssertPtrReturn(pBpChunk->paBpBaseSharedR0, NULL);
-
-    if (ppBpR0)
-        *ppBpR0 = &pBpChunk->paBpBaseR0Only[idxEntry];
-    return &pBpChunk->paBpBaseSharedR0[idxEntry];
-}
-# endif
-
-
-/**
- * Executes the actions associated with the given breakpoint.
+
+/**
+ * \#BP (Breakpoint) handler.
  *
  * @returns VBox status code.
+ *          VINF_SUCCESS means we completely handled this trap,
+ *          other codes are passed execution to host context.
+ *
  * @param   pVM         The cross context VM structure.
  * @param   pVCpu       The cross context virtual CPU structure.
  * @param   pRegFrame   Pointer to the register frame for the trap.
- * @param   hBp         The breakpoint handle which hit.
- * @param   pBp         The shared breakpoint state.
- * @param   pBpR0       The ring-0 only breakpoint state.
- * @param   fInHyper    Flag whether the breakpoint triggered in hypervisor code.
- */
-DECLINLINE(int) dbgfRZBpHit(PVMCC pVM, PVMCPUCC pVCpu, PCPUMCTXCORE pRegFrame,
-                            DBGFBP hBp, PDBGFBPINT pBp, PDBGFBPINTR0 pBpR0, bool fInHyper)
-{
-    uint64_t cHits = ASMAtomicIncU64(&pBp->Pub.cHits);
-    pVCpu->dbgf.s.hBpActive = hBp;
-
-    /** @todo Owner handling. */
-    RT_NOREF(pVM, pRegFrame, pBpR0);
-
-    LogFlow(("dbgfRZBpHit: hit breakpoint %u at %04x:%RGv cHits=0x%RX64\n",
-             hBp, pRegFrame->cs.Sel, pRegFrame->rip, cHits));
-    return fInHyper
-         ? VINF_EM_DBG_HYPER_BREAKPOINT
-         : VINF_EM_DBG_BREAKPOINT;
-}
-
-
-/**
- * Returns the pointer to the L2 table entry from the given index.
- *
- * @returns Current context pointer to the L2 table entry or NULL if the provided index value is invalid.
- * @param   pVM         The cross context VM structure.
- * @param   idxL2       The L2 table index to resolve.
- *
- * @note The content of the resolved L2 table entry is not validated!.
- */
-DECLINLINE(PCDBGFBPL2ENTRY) dbgfRZBpL2GetByIdx(PVMCC pVM, uint32_t idxL2)
-{
-    uint32_t idChunk  = DBGF_BP_L2_IDX_GET_CHUNK_ID(idxL2);
-    uint32_t idxEntry = DBGF_BP_L2_IDX_GET_ENTRY(idxL2);
-
-    AssertReturn(idChunk < DBGF_BP_L2_TBL_CHUNK_COUNT, NULL);
-    AssertReturn(idxEntry < DBGF_BP_L2_TBL_ENTRIES_PER_CHUNK, NULL);
-
-    PDBGFBPL2TBLCHUNKR0 pL2Chunk = &pVM->dbgfr0.s.aBpL2TblChunks[idChunk];
-    AssertPtrReturn(pL2Chunk->paBpL2TblBaseSharedR0, NULL);
-
-    return &pL2Chunk->CTX_SUFF(paBpL2TblBaseShared)[idxEntry];
-}
-
-
-/**
- * Walks the L2 table starting at the given root index searching for the given key.
- *
- * @returns VBox status code.
- * @param   pVM         The cross context VM structure.
- * @param   pVCpu       The cross context virtual CPU structure.
- * @param   pRegFrame   Pointer to the register frame for the trap.
- * @param   fInHyper    Flag whether the breakpoint triggered in hypervisor code.
- * @param   idxL2Root   L2 table index of the table root.
- * @param   GCPtrKey    The key to search for.
- */
-static int dbgfRZBpL2Walk(PVMCC pVM, PVMCPUCC pVCpu, PCPUMCTXCORE pRegFrame, bool fInHyper,
-                          uint32_t idxL2Root, RTGCUINTPTR GCPtrKey)
-{
-    /** @todo We don't use the depth right now but abort the walking after a fixed amount of levels. */
-    uint8_t iDepth = 32;
-    PCDBGFBPL2ENTRY pL2Entry = dbgfRZBpL2GetByIdx(pVM, idxL2Root);
-
-    while (RT_LIKELY(   iDepth-- > 0
-                     && pL2Entry))
-    {
-        /* Make a copy of the entry before verification. */
-        DBGFBPL2ENTRY L2Entry;
-        L2Entry.u64GCPtrKeyAndBpHnd1       = ASMAtomicReadU64((volatile uint64_t *)&pL2Entry->u64GCPtrKeyAndBpHnd1);
-        L2Entry.u64LeftRightIdxDepthBpHnd2 = ASMAtomicReadU64((volatile uint64_t *)&pL2Entry->u64LeftRightIdxDepthBpHnd2);
-
-        RTGCUINTPTR GCPtrL2Entry = DBGF_BP_L2_ENTRY_GET_GCPTR(L2Entry.u64GCPtrKeyAndBpHnd1);
-        if (GCPtrKey == GCPtrL2Entry)
-        {
-            DBGFBP hBp = DBGF_BP_L2_ENTRY_GET_BP_HND(L2Entry.u64GCPtrKeyAndBpHnd1, L2Entry.u64LeftRightIdxDepthBpHnd2);
-
-            /* Query the internal breakpoint state from the handle. */
-            PDBGFBPINTR0 pBpR0 = NULL;
-            PDBGFBPINT pBp = dbgfR0BpGetByHnd(pVM, hBp, &pBpR0);
-            if (   pBp
-                && DBGF_BP_PUB_GET_TYPE(pBp->Pub.fFlagsAndType) == DBGFBPTYPE_INT3)
-                return dbgfRZBpHit(pVM, pVCpu, pRegFrame, hBp, pBp, pBpR0, fInHyper);
-
-            /* The entry got corrupted, just abort. */
-            return VERR_DBGF_BP_L2_LOOKUP_FAILED;
-        }
-
-        /* Not found, get to the next level. */
-        uint32_t idxL2Next =   (GCPtrKey < GCPtrL2Entry)
-                             ? DBGF_BP_L2_ENTRY_GET_IDX_LEFT(L2Entry.u64LeftRightIdxDepthBpHnd2)
-                             : DBGF_BP_L2_ENTRY_GET_IDX_RIGHT(L2Entry.u64LeftRightIdxDepthBpHnd2);
-        /* It is genuine guest trap or we hit some assertion if we are at the end. */
-        if (idxL2Next == DBGF_BP_L2_ENTRY_IDX_END)
-            return fInHyper
-                 ? VINF_EM_DBG_HYPER_ASSERTION
-                 : VINF_EM_RAW_GUEST_TRAP;
-
-        pL2Entry = dbgfRZBpL2GetByIdx(pVM, idxL2Next);
-    }
-
-    return VERR_DBGF_BP_L2_LOOKUP_FAILED;
-}
-#endif /* !VBOX_WITH_LOTS_OF_DBGF_BPS */
-
-/**
- * \#BP (Breakpoint) handler.
- *
- * @returns VBox status code.
- *          VINF_SUCCESS means we completely handled this trap,
- *          other codes are passed execution to host context.
- *
- * @param   pVM         The cross context VM structure.
- * @param   pVCpu       The cross context virtual CPU structure.
- * @param   pRegFrame   Pointer to the register frame for the trap.
  */
 VMMRZ_INT_DECL(int) DBGFRZTrap03Handler(PVMCC pVM, PVMCPUCC pVCpu, PCPUMCTXCORE pRegFrame)
 {
-#ifdef IN_RC
-    const bool fInHyper = !(pRegFrame->ss.Sel & X86_SEL_RPL) && !pRegFrame->eflags.Bits.u1VM;
-#else
-    const bool fInHyper = false;
-#endif
-
 #ifndef VBOX_WITH_LOTS_OF_DBGF_BPS
     /*
@@ -360,9 +268,5 @@
         RTGCPTR pPc;
         int rc = SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss.Sel, pRegFrame->cs.Sel, &pRegFrame->cs,
-# ifdef IN_RC
-                                              pRegFrame->eip - 1,
-# else
                                               pRegFrame->rip /* no -1 in R0 */,
-# endif
                                               &pPc);
         AssertRCReturn(rc, rc);
@@ -380,7 +284,5 @@
                          pVM->dbgf.s.aBreakpoints[iBp].iBp, pPc, pRegFrame->cs.Sel, pRegFrame->rip,
                          pVM->dbgf.s.aBreakpoints[iBp].cHits));
-                return fInHyper
-                     ? VINF_EM_DBG_HYPER_BREAKPOINT
-                     : VINF_EM_DBG_BREAKPOINT;
+                return VINF_EM_DBG_BREAKPOINT;
             }
             iBp++;
@@ -388,17 +290,9 @@
     }
 #else
-# ifdef IN_RC
-# error "You lucky person have the pleasure to implement the raw mode part for this!"
-# endif
-
     if (pVM->dbgfr0.s.CTX_SUFF(paBpLocL1))
     {
         RTGCPTR GCPtrBp;
         int rc = SELMValidateAndConvertCSAddr(pVCpu, pRegFrame->eflags, pRegFrame->ss.Sel, pRegFrame->cs.Sel, &pRegFrame->cs,
-# ifdef IN_RC
-                                              pRegFrame->eip - 1,
-# else
                                               pRegFrame->rip /* no -1 in R0 */,
-# endif
                                               &GCPtrBp);
         AssertRCReturn(rc, rc);
@@ -408,4 +302,5 @@
 
         LogFlowFunc(("GCPtrBp=%RGv idxL1=%u u32L1Entry=%#x\n", GCPtrBp, idxL1, u32L1Entry));
+        rc = VINF_EM_RAW_GUEST_TRAP;
         if (u32L1Entry != DBGF_BP_INT3_L1_ENTRY_TYPE_NULL)
         {
@@ -422,23 +317,21 @@
                 {
                     if (pBp->Pub.u.Int3.GCPtr == (RTGCUINTPTR)GCPtrBp)
-                        return dbgfRZBpHit(pVM, pVCpu, pRegFrame, hBp, pBp, pBpR0, fInHyper);
-                    /* else Genuine guest trap. */
+                        rc = dbgfRZBpHit(pVM, pVCpu, pRegFrame, hBp, pBp, pBpR0);
+                    /* else: Genuine guest trap. */
                 }
-
-                return VERR_DBGF_BP_L1_LOOKUP_FAILED;
+                else /* Invalid breakpoint handle or not an int3 breakpoint. */
+                    rc = VERR_DBGF_BP_L1_LOOKUP_FAILED;
             }
             else if (u8Type == DBGF_BP_INT3_L1_ENTRY_TYPE_L2_IDX)
-                return dbgfRZBpL2Walk(pVM, pVCpu, pRegFrame, fInHyper, DBGF_BP_INT3_L1_ENTRY_GET_L2_IDX(u32L1Entry),
-                                      DBGF_BP_INT3_L2_KEY_EXTRACT_FROM_ADDR((RTGCUINTPTR)GCPtrBp));
-
-            /* Some invalid type. */
-            return VERR_DBGF_BP_L1_LOOKUP_FAILED;
+                rc = dbgfRZBpL2Walk(pVM, pVCpu, pRegFrame, DBGF_BP_INT3_L1_ENTRY_GET_L2_IDX(u32L1Entry),
+                                    DBGF_BP_INT3_L2_KEY_EXTRACT_FROM_ADDR((RTGCUINTPTR)GCPtrBp));
+            else /* Some invalid type. */
+                rc = VERR_DBGF_BP_L1_LOOKUP_FAILED;
         }
+        /* else: Genuine guest trap. */
     }
 #endif /* !VBOX_WITH_LOTS_OF_DBGF_BPS */
 
-    return fInHyper
-         ? VINF_EM_DBG_HYPER_ASSERTION
-         : VINF_EM_RAW_GUEST_TRAP;
-}
-
+    return VINF_EM_RAW_GUEST_TRAP;
+}
+
