Index: /trunk/src/VBox/VMM/VMMR0/GMMR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/GMMR0.cpp	(revision 31365)
+++ /trunk/src/VBox/VMM/VMMR0/GMMR0.cpp	(revision 31366)
@@ -4097,4 +4097,5 @@
 #endif
 
+#ifdef DEBUG_sandervl
 /**
  * Setup for a GMMR0CheckSharedModules call (to allow log flush jumps back to ring 3)
@@ -4141,4 +4142,5 @@
     return VINF_SUCCESS;
 }
+#endif
 
 /**
@@ -4162,4 +4164,11 @@
         return rc;
 
+# ifndef DEBUG_sandervl
+    /*
+     * Take the sempahore and do some more validations.
+     */
+    int rc = RTSemFastMutexRequest(pGMM->Mtx);
+    AssertRC(rc);
+# endif
     if (GMM_CHECK_SANITY_UPON_ENTERING(pGMM))
     {
@@ -4182,4 +4191,7 @@
         rc = VERR_INTERNAL_ERROR_5;
 
+# ifndef DEBUG_sandervl
+        RTSemFastMutexRelease(pGMM->Mtx);
+# endif
     return rc;
 #else
Index: /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp	(revision 31365)
+++ /trunk/src/VBox/VMM/VMMR0/VMMR0.cpp	(revision 31366)
@@ -970,4 +970,5 @@
 
             /* Make sure that log flushes can jump back to ring-3; annoying to get an incomplete log (this is risky though as the code doesn't take this into account). */
+# ifdef DEBUG_sandervl
             int rc = GMMR0CheckSharedModulesStart(pVM);
             if (rc == VINF_SUCCESS)
@@ -978,4 +979,7 @@
                 GMMR0CheckSharedModulesEnd(pVM);
             }
+# else
+            rc = GMMR0CheckSharedModules(pVM, pVCpu);
+# endif
             return rc;
         }
