Index: /trunk/include/VBox/iom.h
===================================================================
--- /trunk/include/VBox/iom.h	(revision 19806)
+++ /trunk/include/VBox/iom.h	(revision 19807)
@@ -216,4 +216,5 @@
 VMMDECL(int)  IOMMMIOMapMMIO2Page(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysRemapped, uint64_t fPageFlags);
 VMMDECL(int)  IOMMMIOResetRegion(PVM pVM, RTGCPHYS GCPhys);
+VMMDECL(bool) IOMIsLockOwner(PVM pVM);
 
 #ifdef IN_RC
Index: /trunk/src/VBox/VMM/PGMPhys.cpp
===================================================================
--- /trunk/src/VBox/VMM/PGMPhys.cpp	(revision 19806)
+++ /trunk/src/VBox/VMM/PGMPhys.cpp	(revision 19807)
@@ -1101,4 +1101,5 @@
 int pgmR3PhysRamReset(PVM pVM)
 {
+    Assert(PGMIsLockOwner(pVM));
     /*
      * We batch up pages before freeing them.
Index: /trunk/src/VBox/VMM/VMMAll/IOMAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/IOMAll.cpp	(revision 19806)
+++ /trunk/src/VBox/VMM/VMMAll/IOMAll.cpp	(revision 19807)
@@ -81,4 +81,16 @@
 }
 
+
+/**
+ * Check if this VCPU currently owns the IOM lock.
+ *
+ * @returns bool owner/not owner
+ * @param   pVM         The VM to operate on.
+ */
+VMMDECL(bool) IOMIsLockOwner(PVM pVM)
+{
+    return PDMCritSectIsOwner(&pVM->iom.s.EmtLock);
+}
+
 /**
  * Returns the contents of register or immediate data of instruction's parameter.
Index: /trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp	(revision 19806)
+++ /trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp	(revision 19807)
@@ -977,4 +977,6 @@
 VMMDECL(int)  PGMHandlerPhysicalPageAlias(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage, RTGCPHYS GCPhysPageRemap)
 {
+///    Assert(!IOMIsLockOwner(pVM)); /* We mustn't own any other locks when calling this */
+
     /*
      * Lookup and validate the range.
