Index: /trunk/src/recompiler/VBoxRecompiler.c
===================================================================
--- /trunk/src/recompiler/VBoxRecompiler.c	(revision 20078)
+++ /trunk/src/recompiler/VBoxRecompiler.c	(revision 20079)
@@ -2839,6 +2839,8 @@
     Assert(RT_ALIGN_Z(cb, PAGE_SIZE) == cb);
     AssertMsg(fFlags == REM_NOTIFY_PHYS_RAM_FLAGS_RAM || fFlags == REM_NOTIFY_PHYS_RAM_FLAGS_MMIO2, ("#x\n", fFlags));
+#ifdef VBOX_WITH_REM_LOCKING
     Assert(!PGMIsLockOwner(pVM));
-
+    EMR3RemLock(pVM);
+#endif
     /*
      * Base ram? Update GCPhysLastRam.
@@ -2862,5 +2864,7 @@
     Assert(pVM->rem.s.fIgnoreAll);
     pVM->rem.s.fIgnoreAll = false;
+#ifdef VBOX_WITH_REM_LOCKING
     EMR3RemUnlock(pVM);
+#endif
 }
 
@@ -2889,5 +2893,7 @@
     Assert(RT_ALIGN_Z(cb, PAGE_SIZE) == cb);
 
+#ifdef VBOX_WITH_REM_LOCKING
     EMR3RemLock(pVM);
+#endif
     /*
      * Register the rom.
@@ -2900,5 +2906,7 @@
     Assert(pVM->rem.s.fIgnoreAll);
     pVM->rem.s.fIgnoreAll = false;
+#ifdef VBOX_WITH_REM_LOCKING
     EMR3RemUnlock(pVM);
+#endif
 }
 
@@ -2923,6 +2931,7 @@
     Assert(RT_ALIGN_Z(cb, PAGE_SIZE) == cb);
 
+#ifdef VBOX_WITH_REM_LOCKING
     EMR3RemLock(pVM);
-
+#endif
     /*
      * Unassigning the memory.
@@ -2935,5 +2944,7 @@
     Assert(pVM->rem.s.fIgnoreAll);
     pVM->rem.s.fIgnoreAll = false;
+#ifdef VBOX_WITH_REM_LOCKING
     EMR3RemUnlock(pVM);
+#endif
 }
 
@@ -2959,5 +2970,7 @@
     Assert(RT_ALIGN_T(cb, PAGE_SIZE, RTGCPHYS) == cb);
 
+#ifdef VBOX_WITH_REM_LOCKING
     EMR3RemLock(pVM);
+#endif
     if (pVM->rem.s.cHandlerNotifications)
         REMR3ReplayHandlerNotifications(pVM);
@@ -2973,5 +2986,7 @@
     Assert(pVM->rem.s.fIgnoreAll);
     pVM->rem.s.fIgnoreAll = false;
+#ifdef VBOX_WITH_REM_LOCKING
     EMR3RemUnlock(pVM);
+#endif
 }
 
@@ -2993,6 +3008,7 @@
     VM_ASSERT_EMT(pVM);
 
+#ifdef VBOX_WITH_REM_LOCKING
     EMR3RemLock(pVM);
-
+#endif
     if (pVM->rem.s.cHandlerNotifications)
         REMR3ReplayHandlerNotifications(pVM);
@@ -3021,5 +3037,7 @@
     Assert(pVM->rem.s.fIgnoreAll);
     pVM->rem.s.fIgnoreAll = false;
+#ifdef VBOX_WITH_REM_LOCKING
     EMR3RemUnlock(pVM);
+#endif
 }
 
@@ -3043,6 +3061,7 @@
     AssertReleaseMsg(enmType != PGMPHYSHANDLERTYPE_MMIO, ("enmType=%d\n", enmType));
 
+#ifdef VBOX_WITH_REM_LOCKING
     EMR3RemLock(pVM);
-
+#endif
     if (pVM->rem.s.cHandlerNotifications)
         REMR3ReplayHandlerNotifications(pVM);
@@ -3076,5 +3095,7 @@
         pVM->rem.s.fIgnoreAll = false;
     }
+#ifdef VBOX_WITH_REM_LOCKING
     EMR3RemUnlock(pVM);
+#endif
 }
 
