Index: trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompBltIn.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompBltIn.cpp	(revision 104796)
+++ trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompBltIn.cpp	(revision 104797)
@@ -215,6 +215,4 @@
                                                           UINT32_MAX, pReNative->uCheckIrqSeqNo++);
 
-    uint32_t const idxLabelReturnBreakFF = iemNativeLabelCreate(pReNative, kIemNativeLabelType_ReturnBreakFF);
-
     /* Again, we need to load the extended EFLAGS before we actually need them
        in case we jump.  We couldn't use iemNativeRegAllocTmpForGuestReg if we
@@ -250,11 +248,11 @@
                                    ~(VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC), true /*fSetFlags*/);
     /* Return VINF_IEM_REEXEC_BREAK if other FFs are set. */
-    off = iemNativeEmitJnzToLabel(pReNative, off, idxLabelReturnBreakFF);
+    off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeExitReason_ReturnBreakFF);
 
     /* So, it's only interrupt releated FFs and we need to see if IRQs are being
        suppressed by the CPU or not. */
     off = iemNativeEmitTestBitInGprAndJmpToLabelIfNotSet(pReNative, off, idxEflReg, X86_EFL_IF_BIT, idxLabelVmCheck);
-    off = iemNativeEmitTestAnyBitsInGprAndJmpToLabelIfNoneSet(pReNative, off, idxEflReg, CPUMCTX_INHIBIT_SHADOW,
-                                                              idxLabelReturnBreakFF);
+    off = iemNativeEmitTestAnyBitsInGprAndTbExitIfNoneSet(pReNative, off, idxEflReg, CPUMCTX_INHIBIT_SHADOW,
+                                                          kIemNativeExitReason_ReturnBreakFF);
 
     /* We've got shadow flags set, so we must check that the PC they are valid
@@ -263,5 +261,6 @@
      *        a register. */
     off = iemNativeEmitLoadGprFromVCpuU64(pReNative, off, idxTmpReg, RT_UOFFSETOF(VMCPUCC, cpum.GstCtx.uRipInhibitInt));
-    off = iemNativeEmitTestIfGprNotEqualGprAndJmpToLabel(pReNative, off, idxTmpReg, idxPcReg, idxLabelReturnBreakFF);
+    off = iemNativeEmitTestIfGprNotEqualGprAndTbExit(pReNative, off, idxTmpReg, idxPcReg,
+                                                     kIemNativeExitReason_ReturnBreakFF);
 
     /*
@@ -273,5 +272,5 @@
     off = iemNativeEmitLoadGprByGprU32(pReNative, off, idxTmpReg, idxTmpReg, RT_UOFFSETOF(VMCC, fGlobalForcedActions));
     off = iemNativeEmitAndGpr32ByImm(pReNative, off, idxTmpReg, VM_FF_ALL_MASK, true /*fSetFlags*/);
-    off = iemNativeEmitJnzToLabel(pReNative, off, idxLabelReturnBreakFF);
+    off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeExitReason_ReturnBreakFF);
 
     /** @todo STAM_REL_COUNTER_INC(&pVCpu->iem.s.StatCheckIrqBreaks); */
@@ -315,6 +314,6 @@
     off = iemNativeEmitLoadGprFromVCpuU32(pReNative, off, idxTmpReg, RT_UOFFSETOF(VMCPUCC, iem.s.fExec));
     off = iemNativeEmitAndGpr32ByImm(pReNative, off, idxTmpReg, IEMTB_F_KEY_MASK);
-    off = iemNativeEmitTestIfGpr32NotEqualImmAndJmpToNewLabel(pReNative, off, idxTmpReg, fExpectedExec & IEMTB_F_KEY_MASK,
-                                                              kIemNativeLabelType_ReturnBreak);
+    off = iemNativeEmitTestIfGpr32NotEqualImmAndTbExit(pReNative, off, idxTmpReg, fExpectedExec & IEMTB_F_KEY_MASK,
+                                                       kIemNativeExitReason_ReturnBreak);
     iemNativeRegFreeTmp(pReNative, idxTmpReg);
 
@@ -445,5 +444,5 @@
 
     /* 3. Jump if greater. */
-    off = iemNativeEmitJaToNewLabel(pReNative, off, kIemNativeLabelType_RaiseGp0);
+    off = iemNativeEmitJaTbExit(pReNative, off, kIemNativeExitReason_RaiseGp0);
 
     iemNativeRegFreeTmp(pReNative, idxRegCsLim);
@@ -533,5 +532,5 @@
     /* Compare the two and jump out if we're too close to the limit. */
     off = iemNativeEmitCmpGprWithGpr(pReNative, off, idxRegLeft, idxRegRight);
-    off = iemNativeEmitJlToNewLabel(pReNative, off, kIemNativeLabelType_NeedCsLimChecking);
+    off = iemNativeEmitJlTbExit(pReNative, off, kIemNativeExitReason_NeedCsLimChecking);
 
     iemNativeRegFreeTmp(pReNative, idxRegRight);
@@ -566,6 +565,4 @@
     off = iemNativeEmitMarker(pReNative, off, 0x80000003);
 #endif
-
-    uint32_t const      idxLabelObsoleteTb = iemNativeLabelCreate(pReNative, kIemNativeLabelType_ObsoleteTb);
 
     /*
@@ -605,14 +602,9 @@
             else \
             { \
-                pbCodeBuf[off++] = 0x74; /* jz near +5 */ \
-                pbCodeBuf[off++] = 0x05 + BP_ON_OBSOLETION; \
+                pbCodeBuf[off++] = 0x74; /* jz near +6 */ \
+                pbCodeBuf[off++] = 0x06 + BP_ON_OBSOLETION; \
                 offConsolidatedJump = off; \
                 if (BP_ON_OBSOLETION) pbCodeBuf[off++] = 0xcc; \
-                pbCodeBuf[off++] = 0xe9; /* jmp rel32 */ \
-                iemNativeAddFixup(pReNative, off, idxLabelObsoleteTb, kIemNativeFixupType_Rel32, -4); \
-                pbCodeBuf[off++] = 0x00; \
-                pbCodeBuf[off++] = 0x00; \
-                pbCodeBuf[off++] = 0x00; \
-                pbCodeBuf[off++] = 0x00; \
+                off = iemNativeEmitTbExitEx(pReNative, pCodeBuf, off, kIemNativeExitReason_ObsoleteTb); \
             } \
         } while (0)
@@ -680,5 +672,5 @@
         }
 
-        uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 5 + 14 + 54 + 8 + 6 + BP_ON_OBSOLETION /* = 87 */);
+        uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 6 + 14 + 54 + 8 + 6 + BP_ON_OBSOLETION /* = 88 */);
 
         if (cbLeft > 8)
@@ -724,5 +716,5 @@
         uint8_t const idxRegCx = iemNativeRegAllocTmpEx(pReNative, &off, RT_BIT_32(X86_GREG_xCX));
 
-        uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 5 + 10 + 5 + 5 + 3 + 4 + 3 + BP_ON_OBSOLETION /*= 35*/);
+        uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 6 + 10 + 5 + 5 + 3 + 4 + 3 + BP_ON_OBSOLETION /*= 36*/);
 
         /** @todo profile and optimize this further.  Maybe an idea to align by
@@ -858,6 +850,6 @@
                 if (fPendingJmp)
                 {
-                    iemNativeAddFixup(pReNative, off, idxLabelObsoleteTb, kIemNativeFixupType_RelImm19At5);
-                    pu32CodeBuf[off++] = Armv8A64MkInstrBCond(kArmv8InstrCond_Ne, 0);
+                    off = iemNativeEmitJccTbExitEx(pReNative, pu32CodeBuf, off, kIemNativeExitReason_ObsoleteTb,
+                                                   kArmv8InstrCond_Ne);
                     fPendingJmp = false;
                 }
@@ -895,6 +887,6 @@
                                                             ARMA64_NZCV_F_N0_Z0_C0_V0, kArmv8InstrCond_Eq);
 
-                iemNativeAddFixup(pReNative, off, idxLabelObsoleteTb, kIemNativeFixupType_RelImm19At5);
-                pu32CodeBuf[off++] = Armv8A64MkInstrBCond(kArmv8InstrCond_Ne, 0);
+                off = iemNativeEmitJccTbExitEx(pReNative, pu32CodeBuf, off, kIemNativeExitReason_ObsoleteTb,
+                                               kArmv8InstrCond_Ne);
 
                 /* Advance and loop. */
@@ -1029,9 +1021,7 @@
      */
     if (fPendingJmp)
-    {
-        iemNativeAddFixup(pReNative, off, idxLabelObsoleteTb, kIemNativeFixupType_RelImm19At5);
-        pu32CodeBuf[off++] = Armv8A64MkInstrBCond(kArmv8InstrCond_Ne, 0);
-    }
-    RT_NOREF(pu32CodeBuf, cbLeft, offPage, pbOpcodes, offConsolidatedJump, idxLabelObsoleteTb);
+        off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeExitReason_ObsoleteTb);
+
+    RT_NOREF(pu32CodeBuf, cbLeft, offPage, pbOpcodes, offConsolidatedJump);
 
     /* max costs: memcmp-loop=54; memcmp-no-loop=41; only-src1-ptr=32 */
@@ -1192,5 +1182,5 @@
     /* 3. Check that off is less than X86_PAGE_SIZE/cbInstrBufTotal. */
     off = iemNativeEmitCmpGprWithImm(pReNative, off, idxRegTmp, X86_PAGE_SIZE - 1);
-    off = iemNativeEmitJaToNewLabel(pReNative, off, kIemNativeLabelType_CheckBranchMiss);
+    off = iemNativeEmitJaTbExit(pReNative, off, kIemNativeExitReason_CheckBranchMiss);
 
     /* 4. Add iem.s.GCPhysInstrBuf and compare with GCPhysRangePageWithOffset. */
@@ -1223,6 +1213,6 @@
                                                 | pTb->aRanges[idxRange].offPhysPage)
                                              + offRange;
-    off = iemNativeEmitTestIfGprNotEqualImmAndJmpToNewLabel(pReNative, off, idxRegTmp, GCPhysRangePageWithOffset,
-                                                            kIemNativeLabelType_CheckBranchMiss);
+    off = iemNativeEmitTestIfGprNotEqualImmAndTbExit(pReNative, off, idxRegTmp, GCPhysRangePageWithOffset,
+                                                     kIemNativeExitReason_CheckBranchMiss);
 
     iemNativeRegFreeTmp(pReNative, idxRegTmp);
@@ -1333,6 +1323,6 @@
      */
     RTGCPHYS const GCPhysNewPage = iemTbGetRangePhysPageAddr(pTb, idxRange);
-    off = iemNativeEmitTestIfGprNotEqualImmAndJmpToNewLabel(pReNative, off, idxRegGCPhys, GCPhysNewPage,
-                                                            kIemNativeLabelType_ObsoleteTb);
+    off = iemNativeEmitTestIfGprNotEqualImmAndTbExit(pReNative, off, idxRegGCPhys, GCPhysNewPage,
+                                                     kIemNativeExitReason_ObsoleteTb);
 
     iemNativeRegFreeTmp(pReNative, idxRegGCPhys);
@@ -1371,5 +1361,4 @@
      * Define labels and allocate the register for holding the GCPhys of the new page.
      */
-    uint32_t const idxLabelCheckBranchMiss   = iemNativeLabelCreate(pReNative, kIemNativeLabelType_CheckBranchMiss);
     uint16_t const uTlbSeqNo                 = pReNative->uTlbSeqNo++;
     RTGCPHYS const GCPhysRangePageWithOffset = iemTbGetRangePhysPageAddr(pTb, idxRange)
@@ -1546,5 +1535,5 @@
     off = iemNativeEmitLoadGprImm64(pReNative, off, idxRegTmp2, GCPhysRangePageWithOffset);
     off = iemNativeEmitCmpGprWithGpr(pReNative, off, idxRegTmp, idxRegTmp2);
-    off = iemNativeEmitJnzToLabel(pReNative, off, idxLabelCheckBranchMiss);
+    off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeExitReason_CheckBranchMiss);
     uint32_t const offFixedJumpToEnd = off;
     off = iemNativeEmitJmpToFixed(pReNative, off, off + 512 /* force rel32 */);
@@ -1558,5 +1547,6 @@
 
     /* Check that we haven't been here before. */
-    off = iemNativeEmitTestIfGprIsNotZeroAndJmpToLabel(pReNative, off, idxRegTmp2,  false /*f64Bit*/, idxLabelCheckBranchMiss);
+    off = iemNativeEmitTestIfGprIsNotZeroAndTbExit(pReNative, off, idxRegTmp2,  false /*f64Bit*/,
+                                                   kIemNativeExitReason_CheckBranchMiss);
 
     /* Jump to the TLB lookup code. */
Index: trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h
===================================================================
--- trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h	(revision 104796)
+++ trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h	(revision 104797)
@@ -332,7 +332,7 @@
                                                               kIemNativeGstRegUse_ForUpdate, false /*fNoVolatileRegs*/,
                                                               true /*fSkipLivenessAssert*/);
-    off = iemNativeEmitTestAnyBitsInGprAndJmpToLabelIfAnySet(pReNative, off, idxEflReg,
-                                                             X86_EFL_TF | CPUMCTX_DBG_HIT_DRX_MASK | CPUMCTX_DBG_DBGF_MASK,
-                                                             iemNativeLabelCreate(pReNative, kIemNativeLabelType_ReturnWithFlags));
+    off = iemNativeEmitTestAnyBitsInGprAndTbExitIfAnySet(pReNative, off, idxEflReg,
+                                                         X86_EFL_TF | CPUMCTX_DBG_HIT_DRX_MASK | CPUMCTX_DBG_DBGF_MASK,
+                                                         kIemNativeExitReason_ReturnWithFlags);
     off = iemNativeEmitAndGpr32ByImm(pReNative, off, idxEflReg, ~(uint32_t)(X86_EFL_RF | CPUMCTX_INHIBIT_SHADOW));
     off = iemNativeEmitStoreGprToVCpuU32(pReNative, off, idxEflReg, RT_UOFFSETOF(VMCPU, cpum.GstCtx.eflags));
@@ -394,5 +394,5 @@
                                              RT_UOFFSETOF(VMCPU, iem.s.ppTbLookupEntryR3));
 
-        return iemNativeEmitJmpToNewLabel(pReNative, off, kIemNativeLabelType_ReturnBreak);
+        return iemNativeEmitTbExit(pReNative, off, kIemNativeExitReason_ReturnBreak);
 
 #else
@@ -437,11 +437,11 @@
 
                 if (pReNative->idxLastCheckIrqCallNo != UINT32_MAX)
-                    return iemNativeEmitJmpToNewLabel(pReNative, off, kIemNativeLabelType_ReturnBreakViaLookup);
-                return iemNativeEmitJmpToNewLabel(pReNative, off, kIemNativeLabelType_ReturnBreakViaLookupWithIrq);
+                    return iemNativeEmitTbExit(pReNative, off, kIemNativeExitReason_ReturnBreakViaLookup);
+                return iemNativeEmitTbExit(pReNative, off, kIemNativeExitReason_ReturnBreakViaLookupWithIrq);
             }
         }
         if (pReNative->idxLastCheckIrqCallNo != UINT32_MAX)
-            return iemNativeEmitJmpToNewLabel(pReNative, off, kIemNativeLabelType_ReturnBreakViaLookupWithTlb);
-        return iemNativeEmitJmpToNewLabel(pReNative, off, kIemNativeLabelType_ReturnBreakViaLookupWithTlbAndIrq);
+            return iemNativeEmitTbExit(pReNative, off, kIemNativeExitReason_ReturnBreakViaLookupWithTlb);
+        return iemNativeEmitTbExit(pReNative, off, kIemNativeExitReason_ReturnBreakViaLookupWithTlbAndIrq);
 #endif
     }
@@ -1954,5 +1954,4 @@
         /* Allocate a temporary CR0 register. */
         uint8_t const idxCr0Reg       = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr0, kIemNativeGstRegUse_ReadOnly);
-        uint8_t const idxLabelRaiseNm = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseNm);
 
         /*
@@ -1961,5 +1960,5 @@
          */
         /* Test and jump. */
-        off = iemNativeEmitTestAnyBitsInGprAndJmpToLabelIfAnySet(pReNative, off, idxCr0Reg, X86_CR0_EM | X86_CR0_TS, idxLabelRaiseNm);
+        off = iemNativeEmitTestAnyBitsInGprAndTbExitIfAnySet(pReNative, off, idxCr0Reg, X86_CR0_EM | X86_CR0_TS, kIemNativeExitReason_RaiseNm);
 
         /* Free but don't flush the CR0 register. */
@@ -2019,5 +2018,5 @@
         off = iemNativeEmitAndGpr32ByImm(pReNative, off, idxCr0Reg, X86_CR0_MP | X86_CR0_TS);
         /* Test and jump. */
-        off = iemNativeEmitTestIfGpr32EqualsImmAndJmpToNewLabel(pReNative, off, idxCr0Reg, X86_CR0_MP | X86_CR0_TS, kIemNativeLabelType_RaiseNm);
+        off = iemNativeEmitTestIfGpr32EqualsImmAndTbExit(pReNative, off, idxCr0Reg, X86_CR0_MP | X86_CR0_TS, kIemNativeExitReason_RaiseNm);
 
         /* Free the CR0 register. */
@@ -2064,5 +2063,4 @@
     /* Allocate a temporary FSW register. */
     uint8_t const idxFpuFswReg    = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_FpuFsw, kIemNativeGstRegUse_ReadOnly);
-    uint8_t const idxLabelRaiseMf = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseMf);
 
     /*
@@ -2071,5 +2069,5 @@
      */
     /* Test and jump. */
-    off = iemNativeEmitTestBitInGprAndJmpToLabelIfSet(pReNative, off, idxFpuFswReg, X86_FSW_ES_BIT, idxLabelRaiseMf);
+    off = iemNativeEmitTestBitInGprAndTbExitIfSet(pReNative, off, idxFpuFswReg, X86_FSW_ES_BIT, kIemNativeExitReason_RaiseMf);
 
     /* Free but don't flush the FSW register. */
@@ -2114,5 +2112,4 @@
 
         /* Allocate a temporary CR0 and CR4 register. */
-        uint8_t const idxLabelRaiseSseRelated = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseSseRelated);
         uint8_t const idxCr0Reg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr0);
         uint8_t const idxCr4Reg = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr4);
@@ -2136,5 +2133,5 @@
         off = iemNativeEmitAndGpr32ByImmEx(pCodeBuf, off,   idxTmpReg, X86_CR0_EM | X86_CR0_TS | X86_CR4_OSFXSR);
         off = iemNativeEmitXorGpr32ByImmEx(pCodeBuf, off,   idxTmpReg, X86_CR4_OSFXSR);
-        off = iemNativeEmitJccToLabelEx(pReNative, pCodeBuf, off, idxLabelRaiseSseRelated, kIemNativeInstrCond_ne);
+        off = iemNativeEmitJccTbExitEx(pReNative, pCodeBuf, off, kIemNativeExitReason_RaiseSseRelated, kIemNativeInstrCond_ne);
 
 #elif defined(RT_ARCH_ARM64)
@@ -2153,6 +2150,6 @@
         pCodeBuf[off++] = Armv8A64MkInstrEorImm(idxTmpReg, idxTmpReg, 0, 0, false /*f64Bit*/);
         /* -> idxTmpReg[0]=~OSFXSR; idxTmpReg[2]=EM; idxTmpReg[3]=TS; (the rest is zero) */
-        off = iemNativeEmitTestIfGprIsNotZeroAndJmpToLabelEx(pReNative, pCodeBuf, off, idxTmpReg, false /*f64Bit*/,
-                                                             idxLabelRaiseSseRelated);
+        off = iemNativeEmitTestIfGprIsNotZeroAndTbExitEx(pReNative, pCodeBuf, off, idxTmpReg, false /*f64Bit*/,
+                                                         kIemNativeExitReason_RaiseSseRelated);
 
 #else
@@ -2210,5 +2207,4 @@
 
         /* Allocate a temporary CR0, CR4 and XCR0 register. */
-        uint8_t const idxLabelRaiseAvxRelated = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseAvxRelated);
         uint8_t const idxCr0Reg  = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr0);
         uint8_t const idxCr4Reg  = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_Cr4);
@@ -2243,5 +2239,5 @@
         off = iemNativeEmitXorGpr32ByImmEx(pCodeBuf, off,                idxTmpReg, ((XSAVE_C_YMM | XSAVE_C_SSE) << 2) | 2);
         /* -> idxTmpReg[0]=CR0.TS idxTmpReg[1]=~CR4.OSXSAVE; idxTmpReg[2]=0; idxTmpReg[3]=~SSE; idxTmpReg[4]=~YMM; */
-        off = iemNativeEmitJccToLabelEx(pReNative, pCodeBuf, off, idxLabelRaiseAvxRelated, kIemNativeInstrCond_ne);
+        off = iemNativeEmitJccTbExitEx(pReNative, pCodeBuf, off, kIemNativeExitReason_RaiseAvxRelated, kIemNativeInstrCond_ne);
 
 #elif defined(RT_ARCH_ARM64)
@@ -2261,6 +2257,6 @@
         pCodeBuf[off++] = Armv8A64MkInstrBfxil(idxTmpReg, idxCr0Reg, X86_CR0_TS_BIT, 1, false /*f64Bit*/);
         /* -> idxTmpReg[0]=CR0.TS; idxTmpReg[1]=~CR4.OSXSAVE; idxTmpReg[2]=~SSE; idxTmpReg[3]=~YMM; (the rest is zero) */
-        off = iemNativeEmitTestIfGprIsNotZeroAndJmpToLabelEx(pReNative, pCodeBuf, off, idxTmpReg, false /*f64Bit*/,
-                                                             idxLabelRaiseAvxRelated);
+        off = iemNativeEmitTestIfGprIsNotZeroAndTbExitEx(pReNative, pCodeBuf, off, idxTmpReg, false /*f64Bit*/,
+                                                         kIemNativeExitReason_RaiseAvxRelated);
 
 #else
@@ -2303,5 +2299,4 @@
 #endif
 
-    uint8_t const idxLabelRaiseSseAvxFpRelated = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseSseAvxFpRelated);
     uint8_t const idxRegMxCsr = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_MxCsr, kIemNativeGstRegUse_ReadOnly);
     uint8_t const idxRegTmp   = iemNativeRegAllocTmp(pReNative, &off);
@@ -2317,6 +2312,6 @@
     /* tmp &= mxcsr */
     off = iemNativeEmitAndGpr32ByGpr32(pReNative, off, idxRegTmp, idxRegMxCsr);
-    off = iemNativeEmitTestAnyBitsInGprAndJmpToLabelIfAnySet(pReNative, off, idxRegTmp, X86_MXCSR_XCPT_FLAGS,
-                                                             idxLabelRaiseSseAvxFpRelated);
+    off = iemNativeEmitTestAnyBitsInGprAndTbExitIfAnySet(pReNative, off, idxRegTmp, X86_MXCSR_XCPT_FLAGS,
+                                                         kIemNativeExitReason_RaiseSseAvxFpRelated);
 
     /* Free but don't flush the MXCSR register. */
@@ -2354,10 +2349,6 @@
 #endif
 
-    uint8_t const idxLabelRaiseDe = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseDe);
-
     /* raise \#DE exception unconditionally. */
-    off = iemNativeEmitJmpToLabel(pReNative, off, idxLabelRaiseDe);
-
-    return off;
+    return iemNativeEmitTbExit(pReNative, off, kIemNativeExitReason_RaiseDe);
 }
 
@@ -2393,8 +2384,8 @@
 #endif
 
-    uint8_t const idxLabelRaiseGp0 = iemNativeLabelCreate(pReNative, kIemNativeLabelType_RaiseGp0);
-    uint8_t const idxVarReg        = iemNativeVarRegisterAcquire(pReNative, idxVarEffAddr, &off);
-
-    off = iemNativeEmitTestAnyBitsInGprAndJmpToLabelIfAnySet(pReNative, off, idxVarReg, cbAlign - 1, idxLabelRaiseGp0);
+    uint8_t const idxVarReg = iemNativeVarRegisterAcquire(pReNative, idxVarEffAddr, &off);
+
+    off = iemNativeEmitTestAnyBitsInGprAndTbExitIfAnySet(pReNative, off, idxVarReg, cbAlign - 1,
+                                                         kIemNativeExitReason_RaiseGp0);
 
     iemNativeVarRegisterRelease(pReNative, idxVarEffAddr);
Index: trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp	(revision 104796)
+++ trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp	(revision 104797)
@@ -6221,5 +6221,5 @@
     off = iemNativeEmitAddGpr32Imm(pReNative, off, iTmpReg, (int32_t)0x8000);
     off = iemNativeEmitShiftGprRight(pReNative, off, iTmpReg, 16);
-    off = iemNativeEmitJnzToNewLabel(pReNative, off, kIemNativeLabelType_RaiseGp0);
+    off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeExitReason_RaiseGp0);
 
     iemNativeRegFreeTmp(pReNative, iTmpReg);
@@ -6240,5 +6240,5 @@
     off = iemNativeEmitAddTwoGprs(pReNative, off, iTmpReg, idxAddrReg);
     off = iemNativeEmitCmpArm64(pReNative, off, ARMV8_A64_REG_XZR, iTmpReg, true /*f64Bit*/, 48 /*cShift*/, kArmv8A64InstrShift_Lsr);
-    off = iemNativeEmitJnzToNewLabel(pReNative, off, kIemNativeLabelType_RaiseGp0);
+    off = iemNativeEmitJnzTbExit(pReNative, off, kIemNativeExitReason_RaiseGp0);
 
     iemNativeRegFreeTmp(pReNative, iTmpReg);
Index: trunk/src/VBox/VMM/include/IEMN8veRecompiler.h
===================================================================
--- trunk/src/VBox/VMM/include/IEMN8veRecompiler.h	(revision 104796)
+++ trunk/src/VBox/VMM/include/IEMN8veRecompiler.h	(revision 104797)
@@ -445,4 +445,32 @@
 
 
+/** TB exit reasons. */
+typedef enum 
+{
+    kIemNativeExitReason_Invalid = 0,
+    kIemNativeExitReason_RaiseDe,                /**< Raise (throw) X86_XCPT_DE (00h). */
+    kIemNativeExitReason_RaiseUd,                /**< Raise (throw) X86_XCPT_UD (06h). */
+    kIemNativeExitReason_RaiseSseRelated,        /**< Raise (throw) X86_XCPT_UD or X86_XCPT_NM according to cr0 & cr4. */
+    kIemNativeExitReason_RaiseAvxRelated,        /**< Raise (throw) X86_XCPT_UD or X86_XCPT_NM according to xcr0, cr0 & cr4. */
+    kIemNativeExitReason_RaiseSseAvxFpRelated,   /**< Raise (throw) X86_XCPT_UD or X86_XCPT_XF according to c4. */
+    kIemNativeExitReason_RaiseNm,                /**< Raise (throw) X86_XCPT_NM (07h). */
+    kIemNativeExitReason_RaiseGp0,               /**< Raise (throw) X86_XCPT_GP (0dh) w/ errcd=0. */
+    kIemNativeExitReason_RaiseMf,                /**< Raise (throw) X86_XCPT_MF (10h). */
+    kIemNativeExitReason_RaiseXf,                /**< Raise (throw) X86_XCPT_XF (13h). */
+    kIemNativeExitReason_ObsoleteTb,
+    kIemNativeExitReason_NeedCsLimChecking,
+    kIemNativeExitReason_CheckBranchMiss,
+    kIemNativeExitReason_Return, /** @todo Eliminate (needed for the compile assertion below). */
+    kIemNativeExitReason_ReturnBreak,
+    kIemNativeExitReason_ReturnBreakFF,
+    kIemNativeExitReason_ReturnBreakViaLookup,
+    kIemNativeExitReason_ReturnBreakViaLookupWithIrq,
+    kIemNativeExitReason_ReturnBreakViaLookupWithTlb,
+    kIemNativeExitReason_ReturnBreakViaLookupWithTlbAndIrq,
+    kIemNativeExitReason_ReturnWithFlags,
+    kIemNativeExitReason_NonZeroRetOrPassUp,
+} IEMNATIVEEXITREASON;
+
+
 /** Native code generator label types. */
 typedef enum
@@ -498,4 +526,31 @@
 } IEMNATIVELABELTYPE;
 
+/* Temporary kludge until all jumps to TB exit labels are converted to the new TB exiting style,
+ * see @bugref{10677}. */
+#define IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(a_Reason) \
+    ((int)kIemNativeLabelType_ ## a_Reason == (int)kIemNativeExitReason_ ## a_Reason)
+AssertCompile(   IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseDe)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseUd)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseSseRelated)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseAvxRelated)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseSseAvxFpRelated)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseNm)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseGp0)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseMf)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(RaiseXf)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ObsoleteTb)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(NeedCsLimChecking)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(CheckBranchMiss)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(Return)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreak)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreakFF)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreakViaLookup)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreakViaLookupWithIrq)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreakViaLookupWithTlb)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnBreakViaLookupWithTlbAndIrq)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(ReturnWithFlags)
+              && IEM_N8VE_RECOMP_LABELTYPE_EQ_EXITREASON(NonZeroRetOrPassUp));
+
+
 /** Native code generator label definition. */
 typedef struct IEMNATIVELABEL
Index: trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h
===================================================================
--- trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h	(revision 104796)
+++ trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h	(revision 104797)
@@ -7790,5 +7790,248 @@
 
 
+/*********************************************************************************************************************************
+*   TB exiting helpers.                                                                                                          *
+*********************************************************************************************************************************/
+
+
+/**
+ * Emits a Jcc rel32 / B.cc imm19 to the epilog.
+ */
+DECL_INLINE_THROW(uint32_t)
+iemNativeEmitJccTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                       IEMNATIVEEXITREASON enmExitReason, IEMNATIVEINSTRCOND enmCond)
+{
+    return iemNativeEmitJccToNewLabel(pReNative, off, (IEMNATIVELABELTYPE)enmExitReason, 0 /*uData*/, enmCond);
+}
+
+
+/**
+ * Emits a JNZ/JNE rel32 / B.NE imm19 to the TB exit routine with the given reason.
+ */
+DECL_INLINE_THROW(uint32_t) iemNativeEmitJnzTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                                   IEMNATIVEEXITREASON enmExitReason)
+{
+#ifdef RT_ARCH_AMD64
+    return iemNativeEmitJccTbExit(pReNative, off, enmExitReason, kIemNativeInstrCond_ne);
+#elif defined(RT_ARCH_ARM64)
+    return iemNativeEmitJccTbExit(pReNative, off, enmExitReason, kArmv8InstrCond_Ne);
+#else
+# error "Port me!"
+#endif
+}
+
+
+/**
+ * Emits a JZ/JE rel32 / B.EQ imm19 to the TB exit routine with the given reason.
+ */
+DECL_INLINE_THROW(uint32_t) iemNativeEmitJzTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                                   IEMNATIVEEXITREASON enmExitReason)
+{
+#ifdef RT_ARCH_AMD64
+    return iemNativeEmitJccTbExit(pReNative, off, enmExitReason, kIemNativeInstrCond_e);
+#elif defined(RT_ARCH_ARM64)
+    return iemNativeEmitJccTbExit(pReNative, off, enmExitReason, kArmv8InstrCond_Eq);
+#else
+# error "Port me!"
+#endif
+}
+
+
+/**
+ * Emits a JA/JNBE rel32 / B.HI imm19 to the TB exit.
+ */
+DECL_INLINE_THROW(uint32_t) iemNativeEmitJaTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                                  IEMNATIVEEXITREASON enmExitReason)
+{
+#ifdef RT_ARCH_AMD64
+    return iemNativeEmitJccTbExit(pReNative, off, enmExitReason, kIemNativeInstrCond_nbe);
+#elif defined(RT_ARCH_ARM64)
+    return iemNativeEmitJccTbExit(pReNative, off, enmExitReason, kArmv8InstrCond_Hi);
+#else
+# error "Port me!"
+#endif
+}
+
+
+/**
+ * Emits a JL/JNGE rel32 / B.LT imm19 to the TB exit with the given reason.
+ */
+DECL_INLINE_THROW(uint32_t) iemNativeEmitJlTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                                  IEMNATIVEEXITREASON enmExitReason)
+{
+#ifdef RT_ARCH_AMD64
+    return iemNativeEmitJccTbExit(pReNative, off, enmExitReason, kIemNativeInstrCond_l);
+#elif defined(RT_ARCH_ARM64)
+    return iemNativeEmitJccTbExit(pReNative, off, enmExitReason, kArmv8InstrCond_Lt);
+#else
+# error "Port me!"
+#endif
+}
+
+
+DECL_INLINE_THROW(uint32_t)
+iemNativeEmitTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off, IEMNATIVEEXITREASON enmExitReason)
+{
+    return iemNativeEmitJmpToNewLabel(pReNative, off, (IEMNATIVELABELTYPE)enmExitReason);
+}
+
+
+DECL_INLINE_THROW(uint32_t)
+iemNativeEmitTbExitEx(PIEMRECOMPILERSTATE pReNative, PIEMNATIVEINSTR pCodeBuf, uint32_t off, IEMNATIVEEXITREASON enmExitReason)
+{
+    uint32_t const idxLabel = iemNativeLabelCreate(pReNative, (IEMNATIVELABELTYPE)enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/);
+    return iemNativeEmitJmpToLabelEx(pReNative, pCodeBuf, off, idxLabel);
+}
+
+
+/**
+ * Emits a jump to the TB exit with @a enmExitReason on the condition _any_ of the bits in @a fBits
+ * are set in @a iGprSrc.
+ */
+DECL_INLINE_THROW(uint32_t)
+iemNativeEmitTestAnyBitsInGprAndTbExitIfAnySet(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                               uint8_t iGprSrc, uint64_t fBits, IEMNATIVEEXITREASON enmExitReason)
+{
+    Assert(fBits); Assert(!RT_IS_POWER_OF_TWO(fBits));
+
+    off = iemNativeEmitTestAnyBitsInGpr(pReNative, off, iGprSrc, fBits);
+    return iemNativeEmitJnzTbExit(pReNative, off, enmExitReason);
+}
+
+
+/**
+ * Emits a jump to @a idxLabel on the condition _none_ of the bits in @a fBits
+ * are set in @a iGprSrc.
+ */
+DECL_INLINE_THROW(uint32_t)
+iemNativeEmitTestAnyBitsInGprAndTbExitIfNoneSet(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                                uint8_t iGprSrc, uint64_t fBits, IEMNATIVEEXITREASON enmExitReason)
+{
+    Assert(fBits); Assert(!RT_IS_POWER_OF_TWO(fBits));
+
+    off = iemNativeEmitTestAnyBitsInGpr(pReNative, off, iGprSrc, fBits);
+    return iemNativeEmitJzTbExit(pReNative, off, enmExitReason);
+}
+
+
+/**
+ * Emits code that exits the TB with the given reason if @a iGprLeft and @a iGprRight
+ * differs.
+ */
+DECL_INLINE_THROW(uint32_t)
+iemNativeEmitTestIfGprNotEqualGprAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                           uint8_t iGprLeft, uint8_t iGprRight, IEMNATIVEEXITREASON enmExitReason)
+{
+    off = iemNativeEmitCmpGprWithGpr(pReNative, off, iGprLeft, iGprRight);
+    off = iemNativeEmitJnzTbExit(pReNative, off, enmExitReason);
+    return off;
+}
+
+
+/**
+ * Emits code that jumps to the given label if 32-bit @a iGprSrc differs from
+ * @a uImm.
+ */
+DECL_INLINE_THROW(uint32_t) iemNativeEmitTestIfGpr32NotEqualImmAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                                                         uint8_t iGprSrc, uint32_t uImm, IEMNATIVEEXITREASON enmExitReason)
+{
+    off = iemNativeEmitCmpGpr32WithImm(pReNative, off, iGprSrc, uImm);
+    off = iemNativeEmitJnzTbExit(pReNative, off, enmExitReason);
+    return off;
+}
+
+
+/**
+ * Emits code that exits the current TB if @a iGprSrc differs from @a uImm.
+ */
+DECL_INLINE_THROW(uint32_t)
+iemNativeEmitTestIfGprNotEqualImmAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                           uint8_t iGprSrc, uint64_t uImm, IEMNATIVEEXITREASON enmExitReason)
+{
+    off = iemNativeEmitCmpGprWithImm(pReNative, off, iGprSrc, uImm);
+    off = iemNativeEmitJnzTbExit(pReNative, off, enmExitReason);
+    return off;
+}
+
+
+/**
+ * Emits code that exits the current TB with the given reason if 32-bit @a iGprSrc equals @a uImm.
+ */
+DECL_INLINE_THROW(uint32_t) iemNativeEmitTestIfGpr32EqualsImmAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                                                       uint8_t iGprSrc, uint32_t uImm, IEMNATIVEEXITREASON enmExitReason)
+{
+    off = iemNativeEmitCmpGpr32WithImm(pReNative, off, iGprSrc, uImm);
+    off = iemNativeEmitJzTbExit(pReNative, off, enmExitReason);
+    return off;
+}
+
+
+/**
+ * Emits code to exit the current TB with the reason @a enmExitReason on the condition that bit @a iBitNo _is_ _set_ in
+ * @a iGprSrc.
+ *
+ * @note On ARM64 the range is only +/-8191 instructions.
+ */
+DECL_INLINE_THROW(uint32_t) iemNativeEmitTestBitInGprAndTbExitIfSet(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                                                    uint8_t iGprSrc, uint8_t iBitNo, IEMNATIVEEXITREASON enmExitReason)
+{
+    uint32_t const idxLabel = iemNativeLabelCreate(pReNative, (IEMNATIVELABELTYPE)enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/);
+    return iemNativeEmitTestBitInGprAndJmpToLabelIfCc(pReNative, off, iGprSrc, iBitNo, idxLabel, true /*fJmpIfSet*/);
+}
+
+
+/**
+ * Emits code that exits the current TB with @a enmExitReason if @a iGprSrc is not zero.
+ *
+ * The operand size is given by @a f64Bit.
+ */
+DECL_FORCE_INLINE_THROW(uint32_t)
+iemNativeEmitTestIfGprIsNotZeroAndTbExitEx(PIEMRECOMPILERSTATE pReNative, PIEMNATIVEINSTR pCodeBuf, uint32_t off,
+                                           uint8_t iGprSrc, bool f64Bit, IEMNATIVEEXITREASON enmExitReason)
+{
+    uint32_t const idxLabel = iemNativeLabelCreate(pReNative, (IEMNATIVELABELTYPE)enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/);
+    return iemNativeEmitTestIfGprIsZeroOrNotZeroAndJmpToLabelEx(pReNative, pCodeBuf, off, iGprSrc,
+                                                                f64Bit, true /*fJmpIfNotZero*/, idxLabel);
+}
+
+
+/**
+ * Emits code to exit the current TB on the given condition.
+ */
+DECL_INLINE_THROW(uint32_t)
+iemNativeEmitJccTbExitEx(PIEMRECOMPILERSTATE pReNative, PIEMNATIVEINSTR pCodeBuf, uint32_t off, IEMNATIVEEXITREASON enmExitReason, IEMNATIVEINSTRCOND enmCond)
+{
+    uint32_t const idxLabel = iemNativeLabelCreate(pReNative, (IEMNATIVELABELTYPE)enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/);
+#ifdef RT_ARCH_AMD64
+    off = iemNativeEmitJccToLabelEx(pReNative, pCodeBuf, off, idxLabel, enmCond);
+#elif defined(RT_ARCH_ARM64)
+    off = iemNativeEmitJccToLabelEx(pReNative, pCodeBuf, off, idxLabel, enmCond);
+#else
+# error "Port me!"
+#endif
+    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
+    return off;
+}
+
+
+/**
+ * Emits code to exit the current TB with the given reason @a enmExitReason if @a iGprSrc is not zero.
+ *
+ * The operand size is given by @a f64Bit.
+ */
+DECL_INLINE_THROW(uint32_t) iemNativeEmitTestIfGprIsNotZeroAndTbExit(PIEMRECOMPILERSTATE pReNative, uint32_t off,
+                                                                     uint8_t iGprSrc, bool f64Bit, IEMNATIVEEXITREASON enmExitReason)
+{
+    uint32_t const idxLabel = iemNativeLabelCreate(pReNative, (IEMNATIVELABELTYPE)enmExitReason, UINT32_MAX /*offWhere*/, 0 /*uData*/);
+    return iemNativeEmitTestIfGprIsZeroOrNotZeroAndJmpToLabel(pReNative, off, iGprSrc, f64Bit, true /*fJmpIfNotZero*/, idxLabel);
+}
+
+
 #ifdef IEMNATIVE_WITH_SIMD_REG_ALLOCATOR
+/*********************************************************************************************************************************
+*   SIMD helpers.                                                                                                                *
+*********************************************************************************************************************************/
+
+
 /**
  * Emits code to load the variable address into an argument GPR.
