Index: /trunk/include/VBox/vmm/em.h
===================================================================
--- /trunk/include/VBox/vmm/em.h	(revision 81152)
+++ /trunk/include/VBox/vmm/em.h	(revision 81153)
@@ -274,13 +274,4 @@
 
 
-/** @name REM locking routines
- * @{ */
-VMMDECL(void)                   EMRemUnlock(PVM pVM);
-VMMDECL(void)                   EMRemLock(PVM pVM);
-VMMDECL(bool)                   EMRemIsLockOwner(PVM pVM);
-VMM_INT_DECL(int)               EMRemTryLock(PVM pVM);
-/** @} */
-
-
 /** @name EM_ONE_INS_FLAGS_XXX - flags for EMR3HmSingleInstruction (et al).
  * @{ */
Index: /trunk/include/VBox/vmm/vm.h
===================================================================
--- /trunk/include/VBox/vmm/vm.h	(revision 81152)
+++ /trunk/include/VBox/vmm/vm.h	(revision 81153)
@@ -82,6 +82,4 @@
     /** Executing guest code and can be poked (RC or STI bits of HM). */
     VMCPUSTATE_STARTED_EXEC,
-    /** Executing guest code in the recompiler. */
-    VMCPUSTATE_STARTED_EXEC_REM,
     /** Executing guest code using NEM. */
     VMCPUSTATE_STARTED_EXEC_NEM,
@@ -368,5 +366,5 @@
  *
  * Available VM bits:
- *      0, 1, 5, 6, 7, 13, 14, 15, 16, 17, 21, 22, 23, 24, 25, 26, 27, 28, 30
+ *      0, 1, 5, 6, 7, 13, 14, 15, 16, 17, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
  *
  *
@@ -426,8 +424,4 @@
 #define VM_FF_PGM_POOL_FLUSH_PENDING        RT_BIT_32(VM_FF_PGM_POOL_FLUSH_PENDING_BIT)
 #define VM_FF_PGM_POOL_FLUSH_PENDING_BIT    20
-/** REM needs to be informed about handler changes. */
-#define VM_FF_REM_HANDLER_NOTIFY            RT_BIT_32(VM_FF_REM_HANDLER_NOTIFY_BIT)
-/** The bit number for VM_FF_REM_HANDLER_NOTIFY. */
-#define VM_FF_REM_HANDLER_NOTIFY_BIT        29
 /** Suspend the VM - debug only. */
 #define VM_FF_DEBUG_SUSPEND                 RT_BIT_32(VM_FF_DEBUG_SUSPEND_BIT)
@@ -589,6 +583,5 @@
 
 /** Normal priority VM actions. */
-#define VM_FF_NORMAL_PRIORITY_MASK              (  VM_FF_REQUEST            | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA \
-                                                 | VM_FF_REM_HANDLER_NOTIFY | VM_FF_EMT_RENDEZVOUS)
+#define VM_FF_NORMAL_PRIORITY_MASK              (  VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA | VM_FF_EMT_RENDEZVOUS)
 /** Normal priority VMCPU actions. */
 #define VMCPU_FF_NORMAL_PRIORITY_MASK           (  VMCPU_FF_REQUEST )
@@ -1402,15 +1395,4 @@
     } ssm;
 
-#ifdef VBOX_WITH_REM
-    /** REM part. */
-    union
-    {
-# ifdef VMM_INCLUDED_SRC_include_REMInternal_h
-        struct REM  s;
-# endif
-        uint8_t     padding[0x11100];   /* multiple of 64 */
-    } rem;
-#endif
-
     union
     {
@@ -1450,9 +1432,5 @@
 
     /** Padding for aligning the structure size on a page boundrary. */
-#ifdef VBOX_WITH_REM
-    uint8_t         abAlignment2[2968       - sizeof(PVMCPUR3) * VMM_MAX_CPU_COUNT];
-#else
     uint8_t         abAlignment2[2968 + 256 - sizeof(PVMCPUR3) * VMM_MAX_CPU_COUNT];
-#endif
 
     /* ---- end small stuff ---- */
Index: /trunk/include/VBox/vmm/vm.mac
===================================================================
--- /trunk/include/VBox/vmm/vm.mac	(revision 81152)
+++ /trunk/include/VBox/vmm/vm.mac	(revision 81153)
@@ -133,7 +133,4 @@
     .dbgf                   resb 2432
     .ssm                    resb 128
-%ifdef VBOX_WITH_REM
-    .rem                    resb 0x11100
-%endif
     .gim                    resb 448
     .apic                   resb 128
@@ -141,9 +138,5 @@
     .cfgm                   resb 8
 
-%ifdef VBOX_WITH_REM
-    .abAlignment2           resb 2968       - RTR0PTR_CB * VMM_MAX_CPU_COUNT
-%else
     .abAlignment2           resb 2968 + 256 - RTR0PTR_CB * VMM_MAX_CPU_COUNT
-%endif
 
     alignb RTR0PTR_CB * VMM_MAX_CPU_COUNT ; ASSUMES VMM_MAX_CPU_COUNT is a power of two.
Index: /trunk/include/VBox/vmm/vmm.h
===================================================================
--- /trunk/include/VBox/vmm/vmm.h	(revision 81152)
+++ /trunk/include/VBox/vmm/vmm.h	(revision 81153)
@@ -75,6 +75,4 @@
     /** Acquire the MM hypervisor heap lock. */
     VMMCALLRING3_MMHYPER_LOCK,
-    /** Replay the REM handler notifications. */
-    VMMCALLRING3_REM_REPLAY_HANDLER_NOTIFICATIONS,
     /** Flush the GC/R0 logger. */
     VMMCALLRING3_VMM_LOGGER_FLUSH,
Index: /trunk/src/VBox/VMM/Config.kmk
===================================================================
--- /trunk/src/VBox/VMM/Config.kmk	(revision 81152)
+++ /trunk/src/VBox/VMM/Config.kmk	(revision 81153)
@@ -46,7 +46,4 @@
 #endif
 # part of global DEFS
-#ifdef VBOX_WITH_REM
-# VMM_COMMON_DEFS += VBOX_WITH_REM
-#endif
 ifdef VBOX_WITH_MULTI_CORE
  VMM_COMMON_DEFS += VBOX_WITH_MULTI_CORE
Index: /trunk/src/VBox/VMM/Makefile.kmk
===================================================================
--- /trunk/src/VBox/VMM/Makefile.kmk	(revision 81152)
+++ /trunk/src/VBox/VMM/Makefile.kmk	(revision 81153)
@@ -225,8 +225,4 @@
 	VMMAll/PDMAllNetShaper.cpp
 endif
-ifdef VBOX_WITH_REM
-VBoxVMM_SOURCES += \
-	VMMAll/REMAll.cpp
-endif
 
 ifdef VBOX_WITH_NATIVE_NEM
@@ -545,8 +541,4 @@
 	VMMAll/PDMAllNetShaper.cpp
  endif
- ifdef VBOX_WITH_REM
-VMMR0_SOURCES += \
-	VMMAll/REMAll.cpp
- endif
 VMMR0_SOURCES.amd64 = \
 	VMMR0/VMMR0JmpA-amd64.asm
Index: /trunk/src/VBox/VMM/VMMAll/APICAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/APICAll.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMAll/APICAll.cpp	(revision 81153)
@@ -3026,7 +3026,4 @@
     }
 #elif defined(IN_RING3)
-# ifdef VBOX_WITH_REM
-    REMR3NotifyInterruptSet(pVCpu->CTX_SUFF(pVM), pVCpu);
-# endif
     if (enmType != PDMAPICIRQ_HARDWARE)
         VMR3NotifyCpuFFU(pVCpu->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM | VMNOTIFYFF_FLAGS_POKE);
@@ -3057,8 +3054,4 @@
             break;
     }
-
-#if defined(IN_RING3) && defined(VBOX_WITH_REM)
-    REMR3NotifyInterruptClear(pVCpu->CTX_SUFF(pVM), pVCpu);
-#endif
 }
 
Index: /trunk/src/VBox/VMM/VMMAll/EMAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/EMAll.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMAll/EMAll.cpp	(revision 81153)
@@ -888,83 +888,4 @@
 
 /**
- * Locks REM execution to a single VCPU.
- *
- * @param   pVM         The cross context VM structure.
- */
-VMMDECL(void) EMRemLock(PVM pVM)
-{
-#ifdef VBOX_WITH_REM
-    if (!PDMCritSectIsInitialized(&pVM->em.s.CritSectREM))
-        return;     /* early init */
-
-    Assert(!PGMIsLockOwner(pVM));
-    Assert(!IOMIsLockWriteOwner(pVM));
-    int rc = PDMCritSectEnter(&pVM->em.s.CritSectREM, VERR_SEM_BUSY);
-    AssertRCSuccess(rc);
-#else
-    RT_NOREF(pVM);
-#endif
-}
-
-
-/**
- * Unlocks REM execution
- *
- * @param   pVM         The cross context VM structure.
- */
-VMMDECL(void) EMRemUnlock(PVM pVM)
-{
-#ifdef VBOX_WITH_REM
-    if (!PDMCritSectIsInitialized(&pVM->em.s.CritSectREM))
-        return;     /* early init */
-
-    PDMCritSectLeave(&pVM->em.s.CritSectREM);
-#else
-    RT_NOREF(pVM);
-#endif
-}
-
-
-/**
- * Check if this VCPU currently owns the REM lock.
- *
- * @returns bool owner/not owner
- * @param   pVM         The cross context VM structure.
- */
-VMMDECL(bool) EMRemIsLockOwner(PVM pVM)
-{
-#ifdef VBOX_WITH_REM
-    if (!PDMCritSectIsInitialized(&pVM->em.s.CritSectREM))
-        return true;   /* early init */
-
-    return PDMCritSectIsOwner(&pVM->em.s.CritSectREM);
-#else
-    RT_NOREF(pVM);
-    return true;
-#endif
-}
-
-
-/**
- * Try to acquire the REM lock.
- *
- * @returns VBox status code
- * @param   pVM         The cross context VM structure.
- */
-VMM_INT_DECL(int) EMRemTryLock(PVM pVM)
-{
-#ifdef VBOX_WITH_REM
-    if (!PDMCritSectIsInitialized(&pVM->em.s.CritSectREM))
-        return VINF_SUCCESS; /* early init */
-
-    return PDMCritSectTryEnter(&pVM->em.s.CritSectREM);
-#else
-    RT_NOREF(pVM);
-    return VINF_SUCCESS;
-#endif
-}
-
-
-/**
  * @callback_method_impl{FNDISREADBYTES}
  */
@@ -1012,5 +933,4 @@
 
 
-
 /**
  * Disassembles the current instruction.
Index: /trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp	(revision 81153)
@@ -850,242 +850,4 @@
 
 
-#if defined(IN_RING3) && defined(VBOX_WITH_REM) /* Only used by REM. */
-
-/**
- * Reads a MMIO register.
- *
- * @returns VBox status code.
- *
- * @param   pVM         The cross context VM structure.
- * @param   pVCpu       The cross context virtual CPU structure of the calling EMT.
- * @param   GCPhys      The physical address to read.
- * @param   pu32Value   Where to store the value read.
- * @param   cbValue     The size of the register to read in bytes. 1, 2 or 4 bytes.
- */
-VMMDECL(VBOXSTRICTRC) IOMMMIORead(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, uint32_t *pu32Value, size_t cbValue)
-{
-    Assert(pVCpu->iom.s.PendingMmioWrite.cbValue == 0);
-    /* Take the IOM lock before performing any MMIO. */
-    VBOXSTRICTRC rc = IOM_LOCK_SHARED(pVM);
-#ifndef IN_RING3
-    if (rc == VERR_SEM_BUSY)
-        return VINF_IOM_R3_MMIO_WRITE;
-#endif
-    AssertRC(VBOXSTRICTRC_VAL(rc));
-
-    /*
-     * Lookup the current context range node and statistics.
-     */
-    PIOMMMIORANGE pRange = iomMmioGetRange(pVM, pVCpu, GCPhys);
-    if (!pRange)
-    {
-        AssertMsgFailed(("Handlers and page tables are out of sync or something! GCPhys=%RGp cbValue=%d\n", GCPhys, cbValue));
-        IOM_UNLOCK_SHARED(pVM);
-        return VERR_IOM_MMIO_RANGE_NOT_FOUND;
-    }
-    iomMmioRetainRange(pRange);
-#ifndef VBOX_WITH_STATISTICS
-    IOM_UNLOCK_SHARED(pVM);
-
-#else  /* VBOX_WITH_STATISTICS */
-    PIOMMMIOSTATS pStats = iomMmioGetStats(pVM, pVCpu, GCPhys, pRange);
-    if (!pStats)
-    {
-        iomMmioReleaseRange(pVM, pRange);
-# ifdef IN_RING3
-        return VERR_NO_MEMORY;
-# else
-        return VINF_IOM_R3_MMIO_READ;
-# endif
-    }
-    STAM_COUNTER_INC(&pStats->Accesses);
-#endif /* VBOX_WITH_STATISTICS */
-
-    if (pRange->CTX_SUFF(pfnReadCallback))
-    {
-        /*
-         * Perform locking.
-         */
-        PPDMDEVINS pDevIns = pRange->CTX_SUFF(pDevIns);
-        rc = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_MMIO_WRITE);
-        if (rc != VINF_SUCCESS)
-        {
-            iomMmioReleaseRange(pVM, pRange);
-            return rc;
-        }
-
-        /*
-         * Perform the read and deal with the result.
-         */
-        STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfRead), a);
-        if (   (cbValue == 4 && !(GCPhys & 3))
-            || (pRange->fFlags & IOMMMIO_FLAGS_READ_MODE) == IOMMMIO_FLAGS_READ_PASSTHRU
-            || (cbValue == 8 && !(GCPhys & 7)) )
-            rc = pRange->CTX_SUFF(pfnReadCallback)(pRange->CTX_SUFF(pDevIns), pRange->CTX_SUFF(pvUser), GCPhys,
-                                                   pu32Value, (unsigned)cbValue);
-        else
-            rc = iomMMIODoComplicatedRead(pVM, pRange, GCPhys, pu32Value, (unsigned)cbValue);
-        STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfRead), a);
-        switch (VBOXSTRICTRC_VAL(rc))
-        {
-            case VINF_SUCCESS:
-                Log4(("IOMMMIORead: GCPhys=%RGp *pu32=%08RX32 cb=%d rc=VINF_SUCCESS\n", GCPhys, *pu32Value, cbValue));
-                PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
-                iomMmioReleaseRange(pVM, pRange);
-                return rc;
-#ifndef IN_RING3
-            case VINF_IOM_R3_MMIO_READ:
-            case VINF_IOM_R3_MMIO_READ_WRITE:
-                STAM_COUNTER_INC(&pStats->CTX_MID_Z(Read,ToR3));
-#endif
-            default:
-                Log4(("IOMMMIORead: GCPhys=%RGp *pu32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, *pu32Value, cbValue, VBOXSTRICTRC_VAL(rc)));
-                PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
-                iomMmioReleaseRange(pVM, pRange);
-                return rc;
-
-            case VINF_IOM_MMIO_UNUSED_00:
-                iomMMIODoRead00s(pu32Value, cbValue);
-                Log4(("IOMMMIORead: GCPhys=%RGp *pu32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, *pu32Value, cbValue, VBOXSTRICTRC_VAL(rc)));
-                PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
-                iomMmioReleaseRange(pVM, pRange);
-                return VINF_SUCCESS;
-
-            case VINF_IOM_MMIO_UNUSED_FF:
-                iomMMIODoReadFFs(pu32Value, cbValue);
-                Log4(("IOMMMIORead: GCPhys=%RGp *pu32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, *pu32Value, cbValue, VBOXSTRICTRC_VAL(rc)));
-                PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
-                iomMmioReleaseRange(pVM, pRange);
-                return VINF_SUCCESS;
-        }
-        /* not reached */
-    }
-#ifndef IN_RING3
-    if (pRange->pfnReadCallbackR3)
-    {
-        STAM_COUNTER_INC(&pStats->CTX_MID_Z(Read,ToR3));
-        iomMmioReleaseRange(pVM, pRange);
-        return VINF_IOM_R3_MMIO_READ;
-    }
-#endif
-
-    /*
-     * Unassigned memory - this is actually not supposed t happen...
-     */
-    STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfRead), a); /** @todo STAM_PROFILE_ADD_ZERO_PERIOD */
-    STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfRead), a);
-    iomMMIODoReadFFs(pu32Value, cbValue);
-    Log4(("IOMMMIORead: GCPhys=%RGp *pu32=%08RX32 cb=%d rc=VINF_SUCCESS\n", GCPhys, *pu32Value, cbValue));
-    iomMmioReleaseRange(pVM, pRange);
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Writes to a MMIO register.
- *
- * @returns VBox status code.
- *
- * @param   pVM         The cross context VM structure.
- * @param   pVCpu       The cross context virtual CPU structure of the calling EMT.
- * @param   GCPhys      The physical address to write to.
- * @param   u32Value    The value to write.
- * @param   cbValue     The size of the register to read in bytes. 1, 2 or 4 bytes.
- */
-VMMDECL(VBOXSTRICTRC) IOMMMIOWrite(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, uint32_t u32Value, size_t cbValue)
-{
-    Assert(pVCpu->iom.s.PendingMmioWrite.cbValue == 0);
-    /* Take the IOM lock before performing any MMIO. */
-    VBOXSTRICTRC rc = IOM_LOCK_SHARED(pVM);
-#ifndef IN_RING3
-    if (rc == VERR_SEM_BUSY)
-        return VINF_IOM_R3_MMIO_WRITE;
-#endif
-    AssertRC(VBOXSTRICTRC_VAL(rc));
-
-    /*
-     * Lookup the current context range node.
-     */
-    PIOMMMIORANGE pRange = iomMmioGetRange(pVM, pVCpu, GCPhys);
-    if (!pRange)
-    {
-        AssertMsgFailed(("Handlers and page tables are out of sync or something! GCPhys=%RGp cbValue=%d\n", GCPhys, cbValue));
-        IOM_UNLOCK_SHARED(pVM);
-        return VERR_IOM_MMIO_RANGE_NOT_FOUND;
-    }
-    iomMmioRetainRange(pRange);
-#ifndef VBOX_WITH_STATISTICS
-    IOM_UNLOCK_SHARED(pVM);
-
-#else  /* VBOX_WITH_STATISTICS */
-    PIOMMMIOSTATS pStats = iomMmioGetStats(pVM, pVCpu, GCPhys, pRange);
-    if (!pStats)
-    {
-        iomMmioReleaseRange(pVM, pRange);
-# ifdef IN_RING3
-        return VERR_NO_MEMORY;
-# else
-        return VINF_IOM_R3_MMIO_WRITE;
-# endif
-    }
-    STAM_COUNTER_INC(&pStats->Accesses);
-#endif /* VBOX_WITH_STATISTICS */
-
-    if (pRange->CTX_SUFF(pfnWriteCallback))
-    {
-        /*
-         * Perform locking.
-         */
-        PPDMDEVINS pDevIns = pRange->CTX_SUFF(pDevIns);
-        rc = PDMCritSectEnter(pDevIns->CTX_SUFF(pCritSectRo), VINF_IOM_R3_MMIO_READ);
-        if (rc != VINF_SUCCESS)
-        {
-            iomMmioReleaseRange(pVM, pRange);
-            return rc;
-        }
-
-        /*
-         * Perform the write.
-         */
-        STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfWrite), a);
-        if (   (cbValue == 4 && !(GCPhys & 3))
-            || (pRange->fFlags & IOMMMIO_FLAGS_WRITE_MODE) == IOMMMIO_FLAGS_WRITE_PASSTHRU
-            || (cbValue == 8 && !(GCPhys & 7)) )
-            rc = pRange->CTX_SUFF(pfnWriteCallback)(pRange->CTX_SUFF(pDevIns), pRange->CTX_SUFF(pvUser),
-                                                    GCPhys, &u32Value, (unsigned)cbValue);
-        else
-            rc = iomMMIODoComplicatedWrite(pVM, pVCpu, pRange, GCPhys, &u32Value, (unsigned)cbValue);
-        STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfWrite), a);
-#ifndef IN_RING3
-        if (    rc == VINF_IOM_R3_MMIO_WRITE
-            ||  rc == VINF_IOM_R3_MMIO_READ_WRITE)
-            STAM_COUNTER_INC(&pStats->CTX_MID_Z(Write,ToR3));
-#endif
-        Log4(("IOMMMIOWrite: GCPhys=%RGp u32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, u32Value, cbValue, VBOXSTRICTRC_VAL(rc)));
-        iomMmioReleaseRange(pVM, pRange);
-        PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
-        return rc;
-    }
-#ifndef IN_RING3
-    if (pRange->pfnWriteCallbackR3)
-    {
-        STAM_COUNTER_INC(&pStats->CTX_MID_Z(Write,ToR3));
-        iomMmioReleaseRange(pVM, pRange);
-        return VINF_IOM_R3_MMIO_WRITE;
-    }
-#endif
-
-    /*
-     * No write handler, nothing to do.
-     */
-    STAM_PROFILE_START(&pStats->CTX_SUFF_Z(ProfWrite), a);
-    STAM_PROFILE_STOP(&pStats->CTX_SUFF_Z(ProfWrite), a);
-    Log4(("IOMMMIOWrite: GCPhys=%RGp u32=%08RX32 cb=%d rc=%Rrc\n", GCPhys, u32Value, cbValue, VINF_SUCCESS));
-    iomMmioReleaseRange(pVM, pRange);
-    return VINF_SUCCESS;
-}
-
-#endif /* IN_RING3 - only used by REM. */
-
 /**
  * Mapping an MMIO2 page in place of an MMIO page for direct access.
Index: /trunk/src/VBox/VMM/VMMAll/PDMAllQueue.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PDMAllQueue.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMAll/PDMAllQueue.cpp	(revision 81153)
@@ -76,7 +76,4 @@
     ASMAtomicBitSet(&pVM->pdm.s.fQueueFlushing, PDM_QUEUE_FLUSH_FLAG_PENDING_BIT);
 #ifdef IN_RING3
-# ifdef VBOX_WITH_REM
-    REMR3NotifyQueuePending(pVM); /** @todo r=bird: we can remove REMR3NotifyQueuePending and let VMR3NotifyFF do the work. */
-# endif
     VMR3NotifyGlobalFFU(pVM->pUVM, VMNOTIFYFF_FLAGS_DONE_REM);
 #endif
Index: /trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PGMAll.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMAll/PGMAll.cpp	(revision 81153)
@@ -1218,10 +1218,4 @@
     Log3(("PGMInvalidatePage: GCPtrPage=%RGv\n", GCPtrPage));
 
-#if !defined(IN_RING3) && defined(VBOX_WITH_REM)
-    /*
-     * Notify the recompiler so it can record this instruction.
-     */
-    REMNotifyInvalidatePage(pVM, GCPtrPage);
-#endif
     IEMTlbInvalidatePage(pVCpu, GCPtrPage);
 
Index: /trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp	(revision 81153)
@@ -287,11 +287,4 @@
         pgmUnlock(pVM);
 
-#ifdef VBOX_WITH_REM
-# ifndef IN_RING3
-        REMNotifyHandlerPhysicalRegister(pVM, pType->enmKind, GCPhys, GCPhysLast - GCPhys + 1, !!pType->pfnHandlerR3);
-# else
-        REMR3NotifyHandlerPhysicalRegister(pVM, pType->enmKind, GCPhys, GCPhysLast - GCPhys + 1, !!pType->pfnHandlerR3);
-# endif
-#endif
         if (rc != VINF_SUCCESS)
             Log(("PGMHandlerPhysicalRegisterEx: returns %Rrc (%RGp-%RGp)\n", rc, GCPhys, GCPhysLast));
@@ -611,13 +604,4 @@
     const bool fRestoreAsRAM2 = pCurType->pfnHandlerR3
                              && pCurType->enmKind != PGMPHYSHANDLERKIND_MMIO; /** @todo this isn't entirely correct. */
-#ifdef VBOX_WITH_REM
-# ifndef IN_RING3
-    REMNotifyHandlerPhysicalDeregister(pVM, pCurType->enmKind, GCPhysStart, GCPhysLast - GCPhysStart + 1,
-                                       !!pCurType->pfnHandlerR3, fRestoreAsRAM2);
-# else
-    REMR3NotifyHandlerPhysicalDeregister(pVM, pCurType->enmKind, GCPhysStart, GCPhysLast - GCPhysStart + 1,
-                                         !!pCurType->pfnHandlerR3, fRestoreAsRAM2);
-# endif
-#endif
     /** @todo do we need this notification? */
     NEMHCNotifyHandlerPhysicalDeregister(pVM, pCurType->enmKind, GCPhysStart, GCPhysLast - GCPhysStart + 1,
@@ -883,7 +867,4 @@
                     RTGCPHYS            const cb            = GCPhysLast - GCPhys + 1;
                     PGMPHYSHANDLERKIND  const enmKind       = pCurType->enmKind;
-#ifdef VBOX_WITH_REM
-                    bool                const fHasHCHandler = !!pCurType->pfnHandlerR3;
-#endif
 
                     /*
@@ -897,13 +878,4 @@
                     pgmUnlock(pVM);
 
-#ifdef VBOX_WITH_REM
-# ifndef IN_RING3
-                    REMNotifyHandlerPhysicalModify(pVM, enmKind, GCPhysCurrent, GCPhys, cb,
-                                                   fHasHCHandler, fRestoreAsRAM);
-# else
-                    REMR3NotifyHandlerPhysicalModify(pVM, enmKind, GCPhysCurrent, GCPhys, cb,
-                                                     fHasHCHandler, fRestoreAsRAM);
-# endif
-#endif
                     PGM_INVL_ALL_VCPU_TLBS(pVM);
                     Log(("PGMHandlerPhysicalModify: GCPhysCurrent=%RGp -> GCPhys=%RGp GCPhysLast=%RGp\n",
@@ -1712,18 +1684,4 @@
                             State.cErrors++;
                         }
-
-# ifdef VBOX_WITH_REM
-#  ifdef IN_RING3
-                        /* validate that REM is handling it. */
-                        if (    !REMR3IsPageAccessHandled(pVM, State.GCPhys)
-                                /* ignore shadowed ROM for the time being. */
-                            &&  PGM_PAGE_GET_TYPE(pPage) != PGMPAGETYPE_ROM_SHADOW)
-                        {
-                            AssertMsgFailed(("ram range vs phys handler REM mismatch. GCPhys=%RGp state=%d %s\n",
-                                             State.GCPhys, PGM_PAGE_GET_HNDL_PHYS_STATE(pPage), pPhysType->pszDesc));
-                            State.cErrors++;
-                        }
-#  endif
-# endif
                     }
                     else
Index: /trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp	(revision 81153)
@@ -670,9 +670,5 @@
                 Assert(VM_FF_IS_SET(pVM, VM_FF_PGM_NEED_HANDY_PAGES));
                 Assert(VM_FF_IS_SET(pVM, VM_FF_PGM_NO_MEMORY));
-#ifdef IN_RING3
-# ifdef VBOX_WITH_REM
-                 REMR3NotifyFF(pVM);
-# endif
-#else
+#ifndef IN_RING3
                 VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_TO_R3); /* paranoia */
 #endif
Index: /trunk/src/VBox/VMM/VMMAll/TMAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/TMAll.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMAll/TMAll.cpp	(revision 81153)
@@ -291,7 +291,4 @@
         VMCPU_FF_SET(pVCpuDst, VMCPU_FF_TIMER);
 #ifdef IN_RING3
-# ifdef VBOX_WITH_REM
-        REMR3NotifyTimerPending(pVM, pVCpuDst);
-# endif
         VMR3NotifyCpuFFU(pVCpuDst->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM);
 #endif
@@ -833,7 +830,4 @@
             Log5(("TMAll(%u): FF: %d -> 1\n", __LINE__, VMCPU_FF_IS_SET(pVCpuDst, VMCPU_FF_TIMER)));
             VMCPU_FF_SET(pVCpuDst, VMCPU_FF_TIMER);
-#if defined(IN_RING3) && defined(VBOX_WITH_REM)
-            REMR3NotifyTimerPending(pVM, pVCpuDst);
-#endif
         }
         LogFlow(("TMTimerPoll: expire1=%'RU64 <= now=%'RU64\n", u64Expire1, u64Now));
@@ -879,7 +873,4 @@
                     Log5(("TMAll(%u): FF: %d -> 1\n", __LINE__, VMCPU_FF_IS_SET(pVCpuDst, VMCPU_FF_TIMER)));
                     VMCPU_FF_SET(pVCpuDst, VMCPU_FF_TIMER);
-#if defined(IN_RING3) && defined(VBOX_WITH_REM)
-                    REMR3NotifyTimerPending(pVM, pVCpuDst);
-#endif
                 }
 
@@ -978,7 +969,4 @@
             Log5(("TMAll(%u): FF: %d -> 1\n", __LINE__, VMCPU_FF_IS_SET(pVCpuDst, VMCPU_FF_TIMER)));
             VMCPU_FF_SET(pVCpuDst, VMCPU_FF_TIMER);
-#if defined(IN_RING3) && defined(VBOX_WITH_REM)
-            REMR3NotifyTimerPending(pVM, pVCpuDst);
-#endif
         }
         STAM_COUNTER_INC(&pVM->tm.s.StatPollVirtualSync);
Index: /trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp	(revision 81153)
@@ -251,7 +251,4 @@
                 VMCPU_FF_SET(pVCpuDst, VMCPU_FF_TIMER);
 #ifdef IN_RING3
-# ifdef VBOX_WITH_REM
-                REMR3NotifyTimerPending(pVM, pVCpuDst);
-# endif
                 VMR3NotifyCpuFFU(pVCpuDst->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM);
 #endif
@@ -412,7 +409,4 @@
             *pcNsToDeadline = 0;
 #ifdef IN_RING3
-# ifdef VBOX_WITH_REM
-        REMR3NotifyTimerPending(pVM, pVCpuDst);
-# endif
         VMR3NotifyCpuFFU(pVCpuDst->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM);
 #endif
@@ -498,7 +492,4 @@
 
 #ifdef IN_RING3
-# ifdef VBOX_WITH_REM
-        REMR3NotifyTimerPending(pVM, pVCpuDst);
-# endif
         VMR3NotifyCpuFFU(pVCpuDst->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM);
 #endif
@@ -554,7 +545,4 @@
             VMCPU_FF_SET(pVCpuDst, VMCPU_FF_TIMER);
 #ifdef IN_RING3
-# ifdef VBOX_WITH_REM
-            REMR3NotifyTimerPending(pVM, pVCpuDst);
-# endif
             VMR3NotifyCpuFFU(pVCpuDst->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM /** @todo |VMNOTIFYFF_FLAGS_POKE*/);
 #endif
@@ -724,7 +712,4 @@
             VMCPU_FF_SET(pVCpuDst, VMCPU_FF_TIMER);
 #ifdef IN_RING3
-# ifdef VBOX_WITH_REM
-            REMR3NotifyTimerPending(pVM, pVCpuDst);
-# endif
             VMR3NotifyCpuFFU(pVCpuDst->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM);
 #endif
Index: /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp	(revision 81153)
@@ -6167,23 +6167,4 @@
     if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_GUEST_SREG_MASK)
     {
-#ifdef VBOX_WITH_REM
-        if (!pVM->hm.s.vmx.fUnrestrictedGuest)
-        {
-            Assert(!pVmxTransient->fIsNestedGuest);
-            Assert(pVM->hm.s.vmx.pRealModeTSS);
-            AssertCompile(PGMMODE_REAL < PGMMODE_PROTECTED);
-            if (   pVmcsInfo->fWasInRealMode
-                && PGMGetGuestMode(pVCpu) >= PGMMODE_PROTECTED)
-            {
-                /*
-                 * Notify the recompiler must flush its code-cache as the guest -may-
-                 * rewrite code it in real-mode (e.g. OpenBSD 4.0).
-                 */
-                REMFlushTBs(pVM);
-                Log4Func(("Switch to protected mode detected!\n"));
-                pVmcsInfo->fWasInRealMode = false;
-            }
-        }
-#endif
         if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_GUEST_CS)
         {
Index: /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp	(revision 81153)
@@ -741,5 +741,5 @@
                            | VM_FF_DBGF                       | VM_FF_REQUEST                 | VM_FF_CHECK_VM_STATE
                            | VM_FF_RESET                      | VM_FF_EMT_RENDEZVOUS          | VM_FF_PGM_NEED_HANDY_PAGES
-                           | VM_FF_PGM_NO_MEMORY              | VM_FF_REM_HANDLER_NOTIFY      | VM_FF_DEBUG_SUSPEND;
+                           | VM_FF_PGM_NO_MEMORY              | VM_FF_DEBUG_SUSPEND;
     uint64_t const fCpuFFs = VMCPU_FF_TIMER                   | VMCPU_FF_PDM_CRITSECT         | VMCPU_FF_IEM
                            | VMCPU_FF_REQUEST                 | VMCPU_FF_DBGF                 | VMCPU_FF_HM_UPDATE_CR3
@@ -1228,7 +1228,4 @@
                     STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallPGMAllocHandy);
                     break;
-                case VMMCALLRING3_REM_REPLAY_HANDLER_NOTIFICATIONS:
-                    STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallRemReplay);
-                    break;
                 case VMMCALLRING3_VMM_LOGGER_FLUSH:
                     STAM_COUNTER_INC(&pVM->vmm.s.StatRZCallLogFlush);
Index: /trunk/src/VBox/VMM/VMMR3/DBGF.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/DBGF.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR3/DBGF.cpp	(revision 81153)
@@ -550,11 +550,7 @@
 
     /*
-     * Sync back the state from the REM.
+     * Set flag.
      */
     dbgfR3EventSetStoppedInHyperFlag(pVM, enmEvent);
-#ifdef VBOX_WITH_REM
-    if (!pVM->dbgf.s.fStoppedInHyper)
-        REMR3StateUpdate(pVM, pVCpu);
-#endif
 
     /*
Index: /trunk/src/VBox/VMM/VMMR3/DBGFBp.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/DBGFBp.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR3/DBGFBp.cpp	(revision 81153)
@@ -821,9 +821,5 @@
         int rc = VINF_SUCCESS;
         if (!pBp->fEnabled)
-#ifdef VBOX_WITH_REM
-            rc = REMR3BreakpointSet(pVM, pBp->u.Rem.GCPtr);
-#else
             rc = IEMBreakpointSet(pVM, pBp->u.Rem.GCPtr);
-#endif
         if (RT_SUCCESS(rc))
         {
@@ -850,9 +846,5 @@
      * Now ask REM to set the breakpoint.
      */
-#ifdef VBOX_WITH_REM
-    int rc = REMR3BreakpointSet(pVM, pAddress->FlatPtr);
-#else
     int rc = IEMBreakpointSet(pVM, pAddress->FlatPtr);
-#endif
     if (RT_SUCCESS(rc))
     {
@@ -1171,9 +1163,5 @@
 
             case DBGFBPTYPE_REM:
-#ifdef VBOX_WITH_REM
-                rc = REMR3BreakpointClear(pVM, pBp->u.Rem.GCPtr);
-#else
                 rc = IEMBreakpointClear(pVM, pBp->u.Rem.GCPtr);
-#endif
                 break;
 
@@ -1258,9 +1246,5 @@
 
         case DBGFBPTYPE_REM:
-#ifdef VBOX_WITH_REM
-            rc = REMR3BreakpointSet(pVM, pBp->u.Rem.GCPtr);
-#else
             rc = IEMBreakpointSet(pVM, pBp->u.Rem.GCPtr);
-#endif
             break;
 
@@ -1341,9 +1325,5 @@
 
         case DBGFBPTYPE_REM:
-#ifdef VBOX_WITH_REM
-            rc = REMR3BreakpointClear(pVM, pBp->u.Rem.GCPtr);
-#else
             rc = IEMBreakpointClear(pVM, pBp->u.Rem.GCPtr);
-#endif
             break;
 
Index: /trunk/src/VBox/VMM/VMMR3/EM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/EM.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR3/EM.cpp	(revision 81153)
@@ -190,13 +190,4 @@
     }
 
-#ifdef VBOX_WITH_REM
-    /*
-     * Initialize the REM critical section.
-     */
-    AssertCompileMemberAlignment(EM, CritSectREM, sizeof(uintptr_t));
-    rc = PDMR3CritSectInit(pVM, &pVM->em.s.CritSectREM, RT_SRC_POS, "EM-REM");
-    AssertRCReturn(rc, rc);
-#endif
-
     /*
      * Saved state.
@@ -424,9 +415,5 @@
 VMMR3_INT_DECL(int) EMR3Term(PVM pVM)
 {
-#ifdef VBOX_WITH_REM
-    PDMR3CritSectDelete(&pVM->em.s.CritSectREM);
-#else
     RT_NOREF(pVM);
-#endif
     return VINF_SUCCESS;
 }
@@ -834,5 +821,5 @@
                 else if (pVCpu->em.s.enmState == EMSTATE_DEBUG_GUEST_NEM)
                     rc = VBOXSTRICTRC_TODO(emR3NemSingleInstruction(pVM, pVCpu, 0 /*fFlags*/));
-#ifdef VBOX_WITH_REM
+#ifdef VBOX_WITH_REM /** @todo fix me? */
                 else if (pVCpu->em.s.enmState == EMSTATE_DEBUG_GUEST_REM)
                     rc = emR3RemStep(pVM, pVCpu);
@@ -1005,21 +992,5 @@
     Log3(("emR3RemStep: cs:eip=%04x:%08x\n", CPUMGetGuestCS(pVCpu),  CPUMGetGuestEIP(pVCpu)));
 
-# ifdef VBOX_WITH_REM
-    EMRemLock(pVM);
-
-    /*
-     * Switch to REM, step instruction, switch back.
-     */
-    int rc = REMR3State(pVM, pVCpu);
-    if (RT_SUCCESS(rc))
-    {
-        rc = REMR3Step(pVM, pVCpu);
-        REMR3StateBack(pVM, pVCpu);
-    }
-    EMRemUnlock(pVM);
-
-# else
     int rc = VBOXSTRICTRC_TODO(IEMExecOne(pVCpu)); NOREF(pVM);
-# endif
 
     Log3(("emR3RemStep: returns %Rrc cs:eip=%04x:%08x\n", rc, CPUMGetGuestCS(pVCpu),  CPUMGetGuestEIP(pVCpu)));
@@ -1027,25 +998,4 @@
 }
 #endif /* VBOX_WITH_REM || DEBUG */
-
-
-#ifdef VBOX_WITH_REM
-/**
- * emR3RemExecute helper that syncs the state back from REM and leave the REM
- * critical section.
- *
- * @returns false - new fInREMState value.
- * @param   pVM         The cross context VM structure.
- * @param   pVCpu       The cross context virtual CPU structure.
- */
-DECLINLINE(bool) emR3RemExecuteSyncBack(PVM pVM, PVMCPU pVCpu)
-{
-    STAM_PROFILE_START(&pVCpu->em.s.StatREMSync, a);
-    REMR3StateBack(pVM, pVCpu);
-    STAM_PROFILE_STOP(&pVCpu->em.s.StatREMSync, a);
-
-    EMRemUnlock(pVM);
-    return false;
-}
-#endif
 
 
@@ -1088,53 +1038,8 @@
      */
     *pfFFDone = false;
-#ifdef VBOX_WITH_REM
-    bool    fInREMState = false;
-#else
     uint32_t cLoops     = 0;
-#endif
     int     rc          = VINF_SUCCESS;
     for (;;)
     {
-#ifdef VBOX_WITH_REM
-        /*
-         * Lock REM and update the state if not already in sync.
-         *
-         * Note! Big lock, but you are not supposed to own any lock when
-         *       coming in here.
-         */
-        if (!fInREMState)
-        {
-            EMRemLock(pVM);
-            STAM_PROFILE_START(&pVCpu->em.s.StatREMSync, b);
-
-            /* Flush the recompiler translation blocks if the VCPU has changed,
-               also force a full CPU state resync. */
-            if (pVM->em.s.idLastRemCpu != pVCpu->idCpu)
-            {
-                REMFlushTBs(pVM);
-                CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_ALL);
-            }
-            pVM->em.s.idLastRemCpu = pVCpu->idCpu;
-
-            rc = REMR3State(pVM, pVCpu);
-
-            STAM_PROFILE_STOP(&pVCpu->em.s.StatREMSync, b);
-            if (RT_FAILURE(rc))
-                break;
-            fInREMState = true;
-
-            /*
-             * We might have missed the raising of VMREQ, TIMER and some other
-             * important FFs while we were busy switching the state. So, check again.
-             */
-            if (    VM_FF_IS_ANY_SET(pVM, VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_DBGF | VM_FF_CHECK_VM_STATE | VM_FF_RESET)
-                ||  VMCPU_FF_IS_ANY_SET(pVCpu, VMCPU_FF_TIMER | VMCPU_FF_REQUEST))
-            {
-                LogFlow(("emR3RemExecute: Skipping run, because FF is set. %#x\n", pVM->fGlobalForcedActions));
-                goto l_REMDoForcedActions;
-            }
-        }
-#endif
-
         /*
          * Execute REM.
@@ -1143,9 +1048,5 @@
         {
             STAM_PROFILE_START(&pVCpu->em.s.StatREMExec, c);
-#ifdef VBOX_WITH_REM
-            rc = REMR3Run(pVM, pVCpu);
-#else
             rc = VBOXSTRICTRC_TODO(IEMExecLots(pVCpu, 8192 /*cMaxInstructions*/, 4095 /*cPollRate*/, NULL /*pcInstructions*/));
-#endif
             STAM_PROFILE_STOP(&pVCpu->em.s.StatREMExec, c);
         }
@@ -1165,10 +1066,5 @@
         if (    VM_FF_IS_ANY_SET(pVM, VM_FF_HIGH_PRIORITY_POST_MASK)
             ||  VMCPU_FF_IS_ANY_SET(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK))
-        {
-#ifdef VBOX_WITH_REM
-            fInREMState = emR3RemExecuteSyncBack(pVM, pVCpu);
-#endif
             rc = VBOXSTRICTRC_TODO(emR3HighPriorityPostForcedActions(pVM, pVCpu, rc));
-        }
 
         /*
@@ -1181,5 +1077,4 @@
             if (rc != VINF_REM_INTERRUPED_FF)
             {
-#ifndef VBOX_WITH_REM
                 /* Try dodge unimplemented IEM trouble by reschduling. */
                 if (   rc == VERR_IEM_ASPECT_NOT_IMPLEMENTED
@@ -1193,5 +1088,4 @@
                     }
                 }
-#endif
 
                 /*
@@ -1218,9 +1112,4 @@
             ||  VMCPU_FF_IS_ANY_SET(pVCpu, VMCPU_FF_ALL_REM_MASK) )
         {
-#ifdef VBOX_WITH_REM
-l_REMDoForcedActions:
-            if (fInREMState)
-                fInREMState = emR3RemExecuteSyncBack(pVM, pVCpu);
-#endif
             STAM_REL_PROFILE_ADV_SUSPEND(&pVCpu->em.s.StatREMTotal, a);
             rc = emR3ForcedActions(pVM, pVCpu, rc);
@@ -1235,5 +1124,4 @@
         }
 
-#ifndef VBOX_WITH_REM
         /*
          * Have to check if we can get back to fast execution mode every so often.
@@ -1246,16 +1134,6 @@
                 return VINF_EM_RESCHEDULE;
         }
-#endif
 
     } /* The Inner Loop, recompiled execution mode version. */
-
-
-#ifdef VBOX_WITH_REM
-    /*
-     * Returning. Sync back the VM state if required.
-     */
-    if (fInREMState)
-        fInREMState = emR3RemExecuteSyncBack(pVM, pVCpu);
-#endif
 
     STAM_REL_PROFILE_ADV_STOP(&pVCpu->em.s.StatREMTotal, a);
@@ -1894,23 +1772,6 @@
         }
 
-#ifdef VBOX_WITH_REM
-        /* Replay the handler notification changes. */
-        if (VM_FF_IS_PENDING_EXCEPT(pVM, VM_FF_REM_HANDLER_NOTIFY, VM_FF_PGM_NO_MEMORY))
-        {
-            /* Try not to cause deadlocks. */
-            if (    pVM->cCpus == 1
-                ||  (   !PGMIsLockOwner(pVM)
-                     && !IOMIsLockWriteOwner(pVM))
-               )
-            {
-                EMRemLock(pVM);
-                REMR3ReplayHandlerNotifications(pVM);
-                EMRemUnlock(pVM);
-            }
-        }
-#endif
-
         /* check that we got them all  */
-        AssertCompile(VM_FF_NORMAL_PRIORITY_MASK == (VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA | VM_FF_REM_HANDLER_NOTIFY | VM_FF_EMT_RENDEZVOUS));
+        AssertCompile(VM_FF_NORMAL_PRIORITY_MASK == (VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA | VM_FF_EMT_RENDEZVOUS));
     }
 
Index: /trunk/src/VBox/VMM/VMMR3/EMHM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/EMHM.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR3/EMHM.cpp	(revision 81153)
@@ -198,23 +198,4 @@
     STAM_PROFILE_STOP(&pVCpu->em.s.StatIEMEmu, a);
 
-    if (   rcStrict == VERR_IEM_ASPECT_NOT_IMPLEMENTED
-        || rcStrict == VERR_IEM_INSTR_NOT_IMPLEMENTED)
-    {
-#ifdef VBOX_WITH_REM
-        STAM_PROFILE_START(&pVCpu->em.s.StatREMEmu, b);
-        EMRemLock(pVM);
-        /* Flush the recompiler TLB if the VCPU has changed. */
-        if (pVM->em.s.idLastRemCpu != pVCpu->idCpu)
-            CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_ALL);
-        pVM->em.s.idLastRemCpu = pVCpu->idCpu;
-
-        rcStrict = REMR3EmulateInstruction(pVM, pVCpu);
-        EMRemUnlock(pVM);
-        STAM_PROFILE_STOP(&pVCpu->em.s.StatREMEmu, b);
-#else  /* !VBOX_WITH_REM */
-        NOREF(pVM);
-#endif /* !VBOX_WITH_REM */
-    }
-
     return VBOXSTRICTRC_TODO(rcStrict);
 }
Index: /trunk/src/VBox/VMM/VMMR3/EMR3Nem.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/EMR3Nem.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR3/EMR3Nem.cpp	(revision 81153)
@@ -202,23 +202,5 @@
     STAM_PROFILE_STOP(&pVCpu->em.s.StatIEMEmu, a);
 
-    if (   rcStrict == VERR_IEM_ASPECT_NOT_IMPLEMENTED
-        || rcStrict == VERR_IEM_INSTR_NOT_IMPLEMENTED)
-    {
-#ifdef VBOX_WITH_REM
-        STAM_PROFILE_START(&pVCpu->em.s.StatREMEmu, b);
-        CPUM_IMPORT_EXTRN_RET(pVCpu, ~CPUMCTX_EXTRN_KEEPER_MASK);
-        EMRemLock(pVM);
-        /* Flush the recompiler TLB if the VCPU has changed. */
-        if (pVM->em.s.idLastRemCpu != pVCpu->idCpu)
-            CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_ALL);
-        pVM->em.s.idLastRemCpu = pVCpu->idCpu;
-
-        rcStrict = REMR3EmulateInstruction(pVM, pVCpu);
-        EMRemUnlock(pVM);
-        STAM_PROFILE_STOP(&pVCpu->em.s.StatREMEmu, b);
-#else  /* !VBOX_WITH_REM */
-        NOREF(pVM);
-#endif /* !VBOX_WITH_REM */
-    }
+    NOREF(pVM);
     return VBOXSTRICTRC_TODO(rcStrict);
 }
Index: /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp	(revision 81153)
@@ -2867,7 +2867,4 @@
     AssertMsg(pVM->pdm.s.pDmac, ("Configuration error: No DMAC controller available. This could be related to init order too!\n"));
     VM_FF_SET(pVM, VM_FF_PDM_DMA);
-#ifdef VBOX_WITH_REM
-    REMR3NotifyDmaPending(pVM);
-#endif
     VMR3NotifyGlobalFFU(pVM->pUVM, VMNOTIFYFF_FLAGS_DONE_REM);
 }
Index: /trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp	(revision 81153)
@@ -1909,7 +1909,4 @@
     rc = NEMR3NotifyPhysRamRegister(pVM, GCPhys, cb);
     pgmUnlock(pVM);
-#ifdef VBOX_WITH_REM
-    REMR3NotifyPhysRamRegister(pVM, GCPhys, cb, REM_NOTIFY_PHYS_RAM_FLAGS_RAM);
-#endif
     return rc;
 }
@@ -3628,8 +3625,4 @@
     pgmUnlock(pVM);
 
-#ifdef VBOX_WITH_REM
-    if (!fRamExists && (pFirstMmio->fFlags & PGMREGMMIORANGE_F_MMIO2)) /** @todo this doesn't look right. */
-        REMR3NotifyPhysRamRegister(pVM, GCPhys, cbRange, REM_NOTIFY_PHYS_RAM_FLAGS_MMIO2);
-#endif
     return rc;
 }
@@ -3775,8 +3768,4 @@
     rc = NEMR3NotifyPhysMmioExUnmap(pVM, GCPhysRangeNotify, cbRange, fNemFlags);
     pgmUnlock(pVM);
-#ifdef VBOX_WITH_REM
-    if ((fOldFlags & (PGMREGMMIORANGE_F_OVERLAPPING | PGMREGMMIORANGE_F_MMIO2)) == PGMREGMMIORANGE_F_MMIO2)
-        REMR3NotifyPhysRamDeregister(pVM, GCPhysRangeNotify, cbRange);
-#endif
     return rc;
 }
@@ -4258,7 +4247,4 @@
             if (fFlags & PGMPHYS_ROM_FLAGS_SHADOWED)
             {
-#ifdef VBOX_WITH_REM
-                REMR3NotifyPhysRomRegister(pVM, GCPhys, cb, NULL, true /* fShadowed */);
-#endif
                 if (RT_SUCCESS(rc))
                     rc = PGMHandlerPhysicalRegister(pVM, GCPhys, GCPhysLast, pVM->pgm.s.hRomPhysHandlerType,
@@ -4272,7 +4258,4 @@
                                                     pRomNew, MMHyperCCToR0(pVM, pRomNew), MMHyperCCToRC(pVM, pRomNew),
                                                     pszDesc);
-#ifdef VBOX_WITH_REM
-                REMR3NotifyPhysRomRegister(pVM, GCPhys, cb, NULL, false /* fShadowed */);
-#endif
             }
             if (RT_SUCCESS(rc))
@@ -4709,7 +4692,4 @@
         pVCpu->pgm.s.fA20Enabled = fEnable;
         pVCpu->pgm.s.GCPhysA20Mask = ~((RTGCPHYS)!fEnable << 20);
-#ifdef VBOX_WITH_REM
-        REMR3A20Set(pVCpu->pVMR3, pVCpu, fEnable);
-#endif
         NEMR3NotifySetA20(pVCpu, fEnable);
 #ifdef PGM_WITH_A20
@@ -4926,8 +4906,4 @@
                     CPUMSetChangedFlags(pVM->apCpusR3[idCpu], CPUM_CHANGED_GLOBAL_TLB_FLUSH);
                 }
-#ifdef VBOX_WITH_REM
-                /* Flush REM translation blocks. */
-                REMFlushTBs(pVM);
-#endif
             }
         }
Index: /trunk/src/VBox/VMM/VMMR3/TM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/TM.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR3/TM.cpp	(revision 81153)
@@ -2106,7 +2106,4 @@
         Log5(("TM(%u): FF: 0 -> 1\n", __LINE__));
         VMCPU_FF_SET(pVCpuDst, VMCPU_FF_TIMER);
-#ifdef VBOX_WITH_REM
-        REMR3NotifyTimerPending(pVM, pVCpuDst);
-#endif
         VMR3NotifyCpuFFU(pVCpuDst->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM | VMNOTIFYFF_FLAGS_POKE);
         STAM_COUNTER_INC(&pVM->tm.s.StatTimerCallbackSetFF);
Index: /trunk/src/VBox/VMM/VMMR3/VM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/VM.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR3/VM.cpp	(revision 81153)
@@ -860,109 +860,95 @@
                 if (RT_SUCCESS(rc))
                 {
-#ifdef VBOX_WITH_REM
-                    rc = REMR3Init(pVM);
-#endif
+                    rc = MMR3InitPaging(pVM);
+                    if (RT_SUCCESS(rc))
+                        rc = TMR3Init(pVM);
                     if (RT_SUCCESS(rc))
                     {
-                        rc = MMR3InitPaging(pVM);
-                        if (RT_SUCCESS(rc))
-                            rc = TMR3Init(pVM);
+                        rc = VMMR3Init(pVM);
                         if (RT_SUCCESS(rc))
                         {
-                            rc = VMMR3Init(pVM);
+                            rc = SELMR3Init(pVM);
                             if (RT_SUCCESS(rc))
                             {
-                                rc = SELMR3Init(pVM);
+                                rc = TRPMR3Init(pVM);
                                 if (RT_SUCCESS(rc))
                                 {
-                                    rc = TRPMR3Init(pVM);
+                                    rc = SSMR3RegisterStub(pVM, "CSAM", 0);
                                     if (RT_SUCCESS(rc))
                                     {
-                                        rc = SSMR3RegisterStub(pVM, "CSAM", 0);
+                                        rc = SSMR3RegisterStub(pVM, "PATM", 0);
                                         if (RT_SUCCESS(rc))
                                         {
-                                            rc = SSMR3RegisterStub(pVM, "PATM", 0);
+                                            rc = IOMR3Init(pVM);
                                             if (RT_SUCCESS(rc))
                                             {
-                                                rc = IOMR3Init(pVM);
+                                                rc = EMR3Init(pVM);
                                                 if (RT_SUCCESS(rc))
                                                 {
-                                                    rc = EMR3Init(pVM);
+                                                    rc = IEMR3Init(pVM);
                                                     if (RT_SUCCESS(rc))
                                                     {
-                                                        rc = IEMR3Init(pVM);
+                                                        rc = DBGFR3Init(pVM);
                                                         if (RT_SUCCESS(rc))
                                                         {
-                                                            rc = DBGFR3Init(pVM);
+                                                            /* GIM must be init'd before PDM, gimdevR3Construct()
+                                                               requires GIM provider to be setup. */
+                                                            rc = GIMR3Init(pVM);
                                                             if (RT_SUCCESS(rc))
                                                             {
-                                                                /* GIM must be init'd before PDM, gimdevR3Construct()
-                                                                   requires GIM provider to be setup. */
-                                                                rc = GIMR3Init(pVM);
+                                                                rc = PDMR3Init(pVM);
                                                                 if (RT_SUCCESS(rc))
                                                                 {
-                                                                    rc = PDMR3Init(pVM);
+                                                                    rc = PGMR3InitDynMap(pVM);
+                                                                    if (RT_SUCCESS(rc))
+                                                                        rc = MMR3HyperInitFinalize(pVM);
+                                                                    if (RT_SUCCESS(rc))
+                                                                        rc = PGMR3InitFinalize(pVM);
+                                                                    if (RT_SUCCESS(rc))
+                                                                        rc = TMR3InitFinalize(pVM);
                                                                     if (RT_SUCCESS(rc))
                                                                     {
-                                                                        rc = PGMR3InitDynMap(pVM);
-                                                                        if (RT_SUCCESS(rc))
-                                                                            rc = MMR3HyperInitFinalize(pVM);
-                                                                        if (RT_SUCCESS(rc))
-                                                                            rc = PGMR3InitFinalize(pVM);
-                                                                        if (RT_SUCCESS(rc))
-                                                                            rc = TMR3InitFinalize(pVM);
-#ifdef VBOX_WITH_REM
-                                                                        if (RT_SUCCESS(rc))
-                                                                            rc = REMR3InitFinalize(pVM);
-#endif
-                                                                        if (RT_SUCCESS(rc))
-                                                                        {
-                                                                            PGMR3MemSetup(pVM, false /*fAtReset*/);
-                                                                            PDMR3MemSetup(pVM, false /*fAtReset*/);
-                                                                        }
-                                                                        if (RT_SUCCESS(rc))
-                                                                            rc = vmR3InitDoCompleted(pVM, VMINITCOMPLETED_RING3);
-                                                                        if (RT_SUCCESS(rc))
-                                                                        {
-                                                                            LogFlow(("vmR3InitRing3: returns %Rrc\n", VINF_SUCCESS));
-                                                                            return VINF_SUCCESS;
-                                                                        }
-
-                                                                        int rc2 = PDMR3Term(pVM);
-                                                                        AssertRC(rc2);
+                                                                        PGMR3MemSetup(pVM, false /*fAtReset*/);
+                                                                        PDMR3MemSetup(pVM, false /*fAtReset*/);
                                                                     }
-                                                                    int rc2 = GIMR3Term(pVM);
+                                                                    if (RT_SUCCESS(rc))
+                                                                        rc = vmR3InitDoCompleted(pVM, VMINITCOMPLETED_RING3);
+                                                                    if (RT_SUCCESS(rc))
+                                                                    {
+                                                                        LogFlow(("vmR3InitRing3: returns %Rrc\n", VINF_SUCCESS));
+                                                                        return VINF_SUCCESS;
+                                                                    }
+
+                                                                    int rc2 = PDMR3Term(pVM);
                                                                     AssertRC(rc2);
                                                                 }
-                                                                int rc2 = DBGFR3Term(pVM);
+                                                                int rc2 = GIMR3Term(pVM);
                                                                 AssertRC(rc2);
                                                             }
-                                                            int rc2 = IEMR3Term(pVM);
+                                                            int rc2 = DBGFR3Term(pVM);
                                                             AssertRC(rc2);
                                                         }
-                                                        int rc2 = EMR3Term(pVM);
+                                                        int rc2 = IEMR3Term(pVM);
                                                         AssertRC(rc2);
                                                     }
-                                                    int rc2 = IOMR3Term(pVM);
+                                                    int rc2 = EMR3Term(pVM);
                                                     AssertRC(rc2);
                                                 }
+                                                int rc2 = IOMR3Term(pVM);
+                                                AssertRC(rc2);
                                             }
                                         }
-                                        int rc2 = TRPMR3Term(pVM);
-                                        AssertRC(rc2);
                                     }
-                                    int rc2 = SELMR3Term(pVM);
+                                    int rc2 = TRPMR3Term(pVM);
                                     AssertRC(rc2);
                                 }
-                                int rc2 = VMMR3Term(pVM);
+                                int rc2 = SELMR3Term(pVM);
                                 AssertRC(rc2);
                             }
-                            int rc2 = TMR3Term(pVM);
+                            int rc2 = VMMR3Term(pVM);
                             AssertRC(rc2);
                         }
-#ifdef VBOX_WITH_REM
-                        int rc2 = REMR3Term(pVM);
+                        int rc2 = TMR3Term(pVM);
                         AssertRC(rc2);
-#endif
                     }
                     int rc2 = PGMR3Term(pVM);
@@ -1043,8 +1029,6 @@
     if (enmWhat == VMINITCOMPLETED_RING3)
     {
-#ifndef VBOX_WITH_REM
         if (RT_SUCCESS(rc))
             rc = SSMR3RegisterStub(pVM, "rem", 1);
-#endif
     }
     if (RT_SUCCESS(rc))
@@ -2222,8 +2206,4 @@
         rc = SELMR3Term(pVM);
         AssertRC(rc);
-#ifdef VBOX_WITH_REM
-        rc = REMR3Term(pVM);
-        AssertRC(rc);
-#endif
         rc = HMR3Term(pVM);
         AssertRC(rc);
@@ -2509,7 +2489,4 @@
     if (pVCpu->idCpu == 0)
     {
-#ifdef VBOX_WITH_REM
-        REMR3Reset(pVM);
-#endif
         PDMR3SoftReset(pVM, fResetFlags);
         TRPMR3Reset(pVM);
@@ -2611,7 +2588,4 @@
         SELMR3Reset(pVM);
         TRPMR3Reset(pVM);
-#ifdef VBOX_WITH_REM
-        REMR3Reset(pVM);
-#endif
         IOMR3Reset(pVM);
         CPUMR3Reset(pVM);               /* This must come *after* PDM (due to APIC base MSR caching). */
Index: /trunk/src/VBox/VMM/VMMR3/VMEmt.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/VMEmt.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR3/VMEmt.cpp	(revision 81153)
@@ -868,11 +868,4 @@
                      || enmState == VMCPUSTATE_STARTED_EXEC_NEM_WAIT)
                 NEMR3NotifyFF(pUVCpu->pVM, pVCpu, fFlags);
-#ifdef VBOX_WITH_REM
-            else if (enmState == VMCPUSTATE_STARTED_EXEC_REM)
-            {
-                if (!(fFlags & VMNOTIFYFF_FLAGS_DONE_REM))
-                    REMR3NotifyFF(pUVCpu->pVM);
-            }
-#endif
         }
     }
@@ -1017,9 +1010,4 @@
                 || enmState == VMCPUSTATE_STARTED_EXEC_NEM_WAIT)
                 NEMR3NotifyFF(pUVCpu->pVM, pVCpu, fFlags);
-#ifdef VBOX_WITH_REM
-            else if (   !(fFlags & VMNOTIFYFF_FLAGS_DONE_REM)
-                     && enmState == VMCPUSTATE_STARTED_EXEC_REM)
-                REMR3NotifyFF(pUVCpu->pVM);
-#endif
         }
     }
Index: /trunk/src/VBox/VMM/VMMR3/VMM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/VMM.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/VMMR3/VMM.cpp	(revision 81153)
@@ -514,5 +514,4 @@
     STAM_REG(pVM, &pVM->vmm.s.StatRZCallPGMMapChunk,        STAMTYPE_COUNTER, "/VMM/RZCallR3/PGMMapChunk",      STAMUNIT_OCCURENCES, "Number of VMMCALLRING3_PGM_MAP_CHUNK calls.");
     STAM_REG(pVM, &pVM->vmm.s.StatRZCallPGMAllocHandy,      STAMTYPE_COUNTER, "/VMM/RZCallR3/PGMAllocHandy",    STAMUNIT_OCCURENCES, "Number of VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES calls.");
-    STAM_REG(pVM, &pVM->vmm.s.StatRZCallRemReplay,          STAMTYPE_COUNTER, "/VMM/RZCallR3/REMReplay",        STAMUNIT_OCCURENCES, "Number of VMMCALLRING3_REM_REPLAY_HANDLER_NOTIFICATIONS calls.");
     STAM_REG(pVM, &pVM->vmm.s.StatRZCallLogFlush,           STAMTYPE_COUNTER, "/VMM/RZCallR3/VMMLogFlush",      STAMUNIT_OCCURENCES, "Number of VMMCALLRING3_VMM_LOGGER_FLUSH calls.");
     STAM_REG(pVM, &pVM->vmm.s.StatRZCallVMSetError,         STAMTYPE_COUNTER, "/VMM/RZCallR3/VMSetError",       STAMUNIT_OCCURENCES, "Number of VMMCALLRING3_VM_SET_ERROR calls.");
@@ -2443,16 +2442,4 @@
         }
 
-#ifdef VBOX_WITH_REM
-        /*
-         * Flush REM handler notifications.
-         */
-        case VMMCALLRING3_REM_REPLAY_HANDLER_NOTIFICATIONS:
-        {
-            REMR3ReplayHandlerNotifications(pVM);
-            pVCpu->vmm.s.rcCallRing3 = VINF_SUCCESS;
-            break;
-        }
-#endif
-
         /*
          * This is a noop. We just take this route to avoid unnecessary
@@ -2573,5 +2560,4 @@
     PRINT_FLAG(VM_FF_,PGM_NO_MEMORY);
     PRINT_FLAG(VM_FF_,PGM_POOL_FLUSH_PENDING);
-    PRINT_FLAG(VM_FF_,REM_HANDLER_NOTIFY);
     PRINT_FLAG(VM_FF_,DEBUG_SUSPEND);
     if (f)
Index: /trunk/src/VBox/VMM/include/EMInternal.h
===================================================================
--- /trunk/src/VBox/VMM/include/EMInternal.h	(revision 81152)
+++ /trunk/src/VBox/VMM/include/EMInternal.h	(revision 81153)
@@ -160,11 +160,4 @@
     /** Id of the VCPU that last executed code in the recompiler. */
     VMCPUID                 idLastRemCpu;
-
-#ifdef VBOX_WITH_REM
-    /** REM critical section.
-     * This protects recompiler usage
-     */
-    PDMCRITSECT             CritSectREM;
-#endif
 } EM;
 /** Pointer to EM VM instance data. */
Index: /trunk/src/VBox/VMM/include/VMMInternal.h
===================================================================
--- /trunk/src/VBox/VMM/include/VMMInternal.h	(revision 81152)
+++ /trunk/src/VBox/VMM/include/VMMInternal.h	(revision 81153)
@@ -331,5 +331,4 @@
     STAMCOUNTER                 StatRZCallPGMMapChunk;
     STAMCOUNTER                 StatRZCallPGMAllocHandy;
-    STAMCOUNTER                 StatRZCallRemReplay;
     STAMCOUNTER                 StatRZCallVMSetError;
     STAMCOUNTER                 StatRZCallVMSetRuntimeError;
Index: /trunk/src/VBox/VMM/testcase/tstAnimate.cpp
===================================================================
--- /trunk/src/VBox/VMM/testcase/tstAnimate.cpp	(revision 81152)
+++ /trunk/src/VBox/VMM/testcase/tstAnimate.cpp	(revision 81153)
@@ -870,9 +870,5 @@
                     RTPrintf("info: powering on the VM...\n");
                     RTLogGroupSettings(NULL, "+REM_DISAS.e.l.f");
-#ifdef VBOX_WITH_REM
-                    rc = REMR3DisasEnableStepping(pVM, true);
-#else
-                    rc = VERR_NOT_IMPLEMENTED; /** @todo need some EM single-step indicator */
-#endif
+                    rc = VERR_NOT_IMPLEMENTED; /** @todo need some EM single-step indicator (was REMR3DisasEnableStepping) */
                     if (RT_SUCCESS(rc))
                     {
Index: /trunk/src/VBox/VMM/testcase/tstVMStruct.h
===================================================================
--- /trunk/src/VBox/VMM/testcase/tstVMStruct.h	(revision 81152)
+++ /trunk/src/VBox/VMM/testcase/tstVMStruct.h	(revision 81153)
@@ -1452,7 +1452,4 @@
     GEN_CHECK_OFF(VM, dbgf);
     GEN_CHECK_OFF(VM, ssm);
-#ifdef VBOX_WITH_REM
-    GEN_CHECK_OFF(VM, rem);
-#endif
     GEN_CHECK_OFF(VM, gim);
     GEN_CHECK_OFF(VM, vm);
