Index: /trunk/include/VBox/vmm/pdmdev.h
===================================================================
--- /trunk/include/VBox/vmm/pdmdev.h	(revision 82328)
+++ /trunk/include/VBox/vmm/pdmdev.h	(revision 82329)
@@ -1964,5 +1964,5 @@
 
 /** Current PDMDEVHLPR3 version number. */
-#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE_PP(0xffe7, 40, 0)
+#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE_PP(0xffe7, 41, 0)
 
 /**
@@ -2467,5 +2467,7 @@
     DECLR3CALLBACKMEMBER(bool,     pfnTimerIsActive,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer));
     DECLR3CALLBACKMEMBER(bool,     pfnTimerIsLockOwner,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer));
-    DECLR3CALLBACKMEMBER(int,      pfnTimerLock,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy));
+    DECLR3CALLBACKMEMBER(VBOXSTRICTRC, pfnTimerLockClock,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy));
+    /** Takes the clock lock then enters the specified critical section. */
+    DECLR3CALLBACKMEMBER(VBOXSTRICTRC, pfnTimerLockClock2,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect, int rcBusy));
     DECLR3CALLBACKMEMBER(int,      pfnTimerSet,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t uExpire));
     DECLR3CALLBACKMEMBER(int,      pfnTimerSetFrequencyHint,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint32_t uHz));
@@ -2475,5 +2477,6 @@
     DECLR3CALLBACKMEMBER(int,      pfnTimerSetRelative,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cTicksToNext, uint64_t *pu64Now));
     DECLR3CALLBACKMEMBER(int,      pfnTimerStop,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer));
-    DECLR3CALLBACKMEMBER(void,     pfnTimerUnlock,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer));
+    DECLR3CALLBACKMEMBER(void,     pfnTimerUnlockClock,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer));
+    DECLR3CALLBACKMEMBER(void,     pfnTimerUnlockClock2,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect));
     DECLR3CALLBACKMEMBER(int,      pfnTimerSetCritSect,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect));
     DECLR3CALLBACKMEMBER(int,      pfnTimerSave,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PSSMHANDLE pSSM));
@@ -4709,5 +4712,7 @@
     DECLR0CALLBACKMEMBER(bool,     pfnTimerIsActive,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer));
     DECLR0CALLBACKMEMBER(bool,     pfnTimerIsLockOwner,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer));
-    DECLR0CALLBACKMEMBER(int,      pfnTimerLock,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy));
+    DECLR0CALLBACKMEMBER(VBOXSTRICTRC, pfnTimerLockClock,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy));
+    /** Takes the clock lock then enters the specified critical section. */
+    DECLR0CALLBACKMEMBER(VBOXSTRICTRC, pfnTimerLockClock2,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect, int rcBusy));
     DECLR0CALLBACKMEMBER(int,      pfnTimerSet,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t uExpire));
     DECLR0CALLBACKMEMBER(int,      pfnTimerSetFrequencyHint,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint32_t uHz));
@@ -4717,5 +4722,6 @@
     DECLR0CALLBACKMEMBER(int,      pfnTimerSetRelative,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, uint64_t cTicksToNext, uint64_t *pu64Now));
     DECLR0CALLBACKMEMBER(int,      pfnTimerStop,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer));
-    DECLR0CALLBACKMEMBER(void,     pfnTimerUnlock,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer));
+    DECLR0CALLBACKMEMBER(void,     pfnTimerUnlockClock,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer));
+    DECLR0CALLBACKMEMBER(void,     pfnTimerUnlockClock2,(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect));
     /** @} */
 
@@ -4937,5 +4943,5 @@
 
 /** Current PDMDEVHLP version number. */
-#define PDM_DEVHLPR0_VERSION                    PDM_VERSION_MAKE(0xffe5, 15, 0)
+#define PDM_DEVHLPR0_VERSION                    PDM_VERSION_MAKE(0xffe5, 16, 0)
 
 
@@ -5862,7 +5868,15 @@
  * @copydoc PDMDEVHLPR3::pfnTimerLock
  */
-DECLINLINE(int)      PDMDevHlpTimerLock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy)
-{
-    return pDevIns->CTX_SUFF(pHlp)->pfnTimerLock(pDevIns, hTimer, rcBusy);
+DECLINLINE(VBOXSTRICTRC) PDMDevHlpTimerLockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy)
+{
+    return pDevIns->CTX_SUFF(pHlp)->pfnTimerLockClock(pDevIns, hTimer, rcBusy);
+}
+
+/**
+ * @copydoc PDMDEVHLPR3::pfnTimerLock2
+ */
+DECLINLINE(VBOXSTRICTRC) PDMDevHlpTimerLockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect, int rcBusy)
+{
+    return pDevIns->CTX_SUFF(pHlp)->pfnTimerLockClock2(pDevIns, hTimer, pCritSect, rcBusy);
 }
 
@@ -5924,9 +5938,17 @@
 
 /**
- * @copydoc PDMDEVHLPR3::pfnTimerUnlock
- */
-DECLINLINE(void)     PDMDevHlpTimerUnlock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
-{
-    pDevIns->CTX_SUFF(pHlp)->pfnTimerUnlock(pDevIns, hTimer);
+ * @copydoc PDMDEVHLPR3::pfnTimerUnlockClock
+ */
+DECLINLINE(void)     PDMDevHlpTimerUnlockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
+{
+    pDevIns->CTX_SUFF(pHlp)->pfnTimerUnlockClock(pDevIns, hTimer);
+}
+
+/**
+ * @copydoc PDMDEVHLPR3::pfnTimerUnlockClock2
+ */
+DECLINLINE(void)     PDMDevHlpTimerUnlockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
+{
+    pDevIns->CTX_SUFF(pHlp)->pfnTimerUnlockClock2(pDevIns, hTimer, pCritSect);
 }
 
Index: /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 82328)
+++ /trunk/src/VBox/Devices/Audio/DevIchAc97.cpp	(revision 82329)
@@ -578,14 +578,13 @@
 #define DEVAC97_LOCK_BOTH_RETURN(a_pDevIns, a_pThis, a_SD, a_rcBusy) \
     do { \
-        int rcLock = PDMDevHlpTimerLock((a_pDevIns), RT_SAFE_SUBSCRIPT8((a_pThis)->ahTimers, (a_SD)), (a_rcBusy)); \
-        if (rcLock == VINF_SUCCESS) \
+        VBOXSTRICTRC rcLock = PDMDevHlpTimerLockClock2((a_pDevIns), RT_SAFE_SUBSCRIPT8((a_pThis)->ahTimers, (a_SD)), \
+                                                       &(a_pThis)->CritSect, (a_rcBusy)); \
+        if (RT_LIKELY(rcLock == VINF_SUCCESS)) \
+        { /* likely */ } \
+        else \
         { \
-            rcLock = PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, (a_rcBusy)); \
-            if (rcLock == VINF_SUCCESS) \
-                break; \
-            PDMDevHlpTimerUnlock((a_pDevIns), RT_SAFE_SUBSCRIPT8((a_pThis)->ahTimers, (a_SD))); \
+            AssertRC(VBOXSTRICTRC_VAL(rcLock)); \
+            return rcLock; \
         } \
-        AssertRC(rcLock); \
-        return rcLock; \
     } while (0)
 
@@ -594,8 +593,5 @@
  */
 #define DEVAC97_UNLOCK_BOTH(a_pDevIns, a_pThis, a_SD) \
-    do { \
-        PDMDevHlpCritSectLeave((a_pDevIns), &(a_pThis)->CritSect); \
-        PDMDevHlpTimerUnlock((a_pDevIns), RT_SAFE_SUBSCRIPT8((a_pThis)->ahTimers, (a_SD))); \
-    } while (0)
+    PDMDevHlpTimerUnlockClock2((a_pDevIns), RT_SAFE_SUBSCRIPT8((a_pThis)->ahTimers, (a_SD)), &(a_pThis)->CritSect)
 
 #ifdef VBOX_WITH_STATISTICS
Index: /trunk/src/VBox/Devices/PC/DevACPI.cpp
===================================================================
--- /trunk/src/VBox/Devices/PC/DevACPI.cpp	(revision 82328)
+++ /trunk/src/VBox/Devices/PC/DevACPI.cpp	(revision 82329)
@@ -1801,37 +1801,30 @@
      */
     PACPISTATE pThis = PDMDEVINS_2_DATA(pDevIns, PACPISTATE);
-    VBOXSTRICTRC rc = PDMDevHlpTimerLock(pDevIns, pThis->hPmTimer, VINF_IOM_R3_IOPORT_READ);
+    VBOXSTRICTRC rc = PDMDevHlpTimerLockClock2(pDevIns, pThis->hPmTimer, &pThis->CritSect, VINF_IOM_R3_IOPORT_READ);
     if (rc == VINF_SUCCESS)
     {
-        rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->CritSect, VINF_IOM_R3_IOPORT_READ);
-        if (rc == VINF_SUCCESS)
+        uint64_t u64Now = PDMDevHlpTimerGet(pDevIns, pThis->hPmTimer);
+        acpiPmTimerUpdate(pDevIns, pThis, u64Now);
+        *pu32 = pThis->uPmTimerVal;
+
+        PDMDevHlpTimerUnlockClock2(pDevIns, pThis->hPmTimer, &pThis->CritSect);
+
+        DBGFTRACE_PDM_U64_TAG(pDevIns, u64Now, "acpi");
+        Log(("acpi: acpiPMTmrRead -> %#x\n", *pu32));
+
+#if 0
+        /** @todo temporary: sanity check against running backwards */
+        uint32_t uOld = ASMAtomicXchgU32(&pThis->uPmTimeOld, *pu32);
+        if (*pu32 - uOld >= 0x10000000)
         {
-            uint64_t u64Now = PDMDevHlpTimerGet(pDevIns, pThis->hPmTimer);
-            acpiPmTimerUpdate(pDevIns, pThis, u64Now);
-            *pu32 = pThis->uPmTimerVal;
-
-            DEVACPI_UNLOCK(pDevIns, pThis);
-            PDMDevHlpTimerUnlock(pDevIns, pThis->hPmTimer);
-
-            DBGFTRACE_PDM_U64_TAG(pDevIns, u64Now, "acpi");
-            Log(("acpi: acpiPMTmrRead -> %#x\n", *pu32));
-
-#if 0
-            /** @todo temporary: sanity check against running backwards */
-            uint32_t uOld = ASMAtomicXchgU32(&pThis->uPmTimeOld, *pu32);
-            if (*pu32 - uOld >= 0x10000000)
-            {
 # if defined(IN_RING0)
-                pThis->uPmTimeA = uOld;
-                pThis->uPmTimeB = *pu32;
-                return VERR_TM_TIMER_BAD_CLOCK;
+            pThis->uPmTimeA = uOld;
+            pThis->uPmTimeB = *pu32;
+            return VERR_TM_TIMER_BAD_CLOCK;
 # elif defined(IN_RING3)
-                AssertReleaseMsgFailed(("acpiPMTmrRead: old=%08RX32, current=%08RX32\n", uOld, *pu32));
+            AssertReleaseMsgFailed(("acpiPMTmrRead: old=%08RX32, current=%08RX32\n", uOld, *pu32));
 # endif
-            }
+        }
 #endif
-        }
-        else
-            PDMDevHlpTimerUnlock(pDevIns, pThis->hPmTimer);
     }
     return rc;
@@ -2607,5 +2600,5 @@
         AssertRCReturn(rc, rc);
 
-        PDMDevHlpTimerLock(pDevIns, pThis->hPmTimer, VERR_IGNORED);
+        PDMDevHlpTimerLockClock(pDevIns, pThis->hPmTimer, VERR_IGNORED);
         DEVACPI_LOCK_R3(pDevIns, pThis);
         uint64_t u64Now = PDMDevHlpTimerGet(pDevIns, pThis->hPmTimer);
@@ -2614,5 +2607,5 @@
         acpiR3PmTimerReset(pDevIns, pThis, u64Now);
         DEVACPI_UNLOCK(pDevIns, pThis);
-        PDMDevHlpTimerUnlock(pDevIns, pThis->hPmTimer);
+        PDMDevHlpTimerUnlockClock(pDevIns, pThis->hPmTimer);
     }
     return rc;
@@ -3585,5 +3578,5 @@
     acpiSetIrq(pDevIns, 0);
 
-    PDMDevHlpTimerLock(pDevIns, pThis->hPmTimer, VERR_IGNORED);
+    PDMDevHlpTimerLockClock(pDevIns, pThis->hPmTimer, VERR_IGNORED);
     pThis->pm1a_en           = 0;
     pThis->pm1a_sts          = 0;
@@ -3598,5 +3591,5 @@
     pThis->gpe0_sts          = 0;
     pThis->uSleepState       = 0;
-    PDMDevHlpTimerUnlock(pDevIns, pThis->hPmTimer);
+    PDMDevHlpTimerUnlockClock(pDevIns, pThis->hPmTimer);
 
     /* Real device behavior is resetting only the PM controller state,
@@ -4093,9 +4086,8 @@
     AssertRCReturn(rc, rc);
 
-    rc = PDMDevHlpTimerLock(pDevIns, pThis->hPmTimer, VERR_IGNORED);
-    AssertRCReturn(rc, rc);
+    PDMDevHlpTimerLockClock(pDevIns, pThis->hPmTimer, VERR_IGNORED);
     pThis->u64PmTimerInitial = PDMDevHlpTimerGet(pDevIns, pThis->hPmTimer);
     acpiR3PmTimerReset(pDevIns, pThis, pThis->u64PmTimerInitial);
-    PDMDevHlpTimerUnlock(pDevIns, pThis->hPmTimer);
+    PDMDevHlpTimerUnlockClock(pDevIns, pThis->hPmTimer);
 
     /*
Index: /trunk/src/VBox/Devices/PC/DevHPET.cpp
===================================================================
--- /trunk/src/VBox/Devices/PC/DevHPET.cpp	(revision 82328)
+++ /trunk/src/VBox/Devices/PC/DevHPET.cpp	(revision 82329)
@@ -175,13 +175,9 @@
 #define DEVHPET_LOCK_BOTH_RETURN(a_pDevIns, a_pThis, a_rcBusy)  \
     do { \
-        int rcLock = PDMDevHlpTimerLock((a_pDevIns), (a_pThis)->aTimers[0].hTimer, (a_rcBusy)); \
+        VBOXSTRICTRC rcLock = PDMDevHlpTimerLockClock2((a_pDevIns), (a_pThis)->aTimers[0].hTimer, &(a_pThis)->CritSect, (a_rcBusy)); \
         if (RT_LIKELY(rcLock == VINF_SUCCESS)) \
-        { \
-            rcLock = PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, (a_rcBusy)); \
-            if (RT_LIKELY(rcLock == VINF_SUCCESS)) \
-                break; /* likely */ \
-            PDMDevHlpTimerUnlock((a_pDevIns), (a_pThis)->aTimers[0].hTimer); \
-        } \
-        return rcLock; \
+        { /* likely */ } \
+        else \
+            return rcLock; \
     } while (0)
 
@@ -191,8 +187,5 @@
  */
 #define DEVHPET_UNLOCK_BOTH(a_pDevIns, a_pThis) \
-    do { \
-        PDMDevHlpCritSectLeave((a_pDevIns), &(a_pThis)->CritSect); \
-        PDMDevHlpTimerUnlock((a_pDevIns), (a_pThis)->aTimers[0].hTimer); \
-    } while (0)
+        PDMDevHlpTimerUnlockClock2((a_pDevIns), (a_pThis)->aTimers[0].hTimer, &(a_pThis)->CritSect)
 
 
@@ -685,5 +678,5 @@
  * @remarks The caller must not own the device lock if HPET_COUNTER is read.
  */
-static int hpetConfigRegRead32(PPDMDEVINS pDevIns, PHPET pThis, uint32_t idxReg, uint32_t *pu32Value)
+static VBOXSTRICTRC hpetConfigRegRead32(PPDMDEVINS pDevIns, PHPET pThis, uint32_t idxReg, uint32_t *pu32Value)
 {
     Assert(!PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect) || (idxReg != HPET_COUNTER && idxReg != HPET_COUNTER + 4));
@@ -1342,5 +1335,5 @@
      * The timers first.
      */
-    PDMDevHlpTimerLock(pDevIns, pThis->aTimers[0].hTimer, VERR_IGNORED);
+    PDMDevHlpTimerLockClock(pDevIns, pThis->aTimers[0].hTimer, VERR_IGNORED);
     for (unsigned i = 0; i < RT_ELEMENTS(pThis->aTimers); i++)
     {
@@ -1364,5 +1357,5 @@
         pHpetTimer->u64Cmp     = hpetInvalidValue(pHpetTimer);
     }
-    PDMDevHlpTimerUnlock(pDevIns, pThis->aTimers[0].hTimer);
+    PDMDevHlpTimerUnlockClock(pDevIns, pThis->aTimers[0].hTimer);
 
     /*
Index: /trunk/src/VBox/Devices/PC/DevPit-i8254.cpp
===================================================================
--- /trunk/src/VBox/Devices/PC/DevPit-i8254.cpp	(revision 82328)
+++ /trunk/src/VBox/Devices/PC/DevPit-i8254.cpp	(revision 82329)
@@ -124,13 +124,10 @@
 #define DEVPIT_LOCK_BOTH_RETURN(a_pDevIns, a_pThis, a_rcBusy)  \
     do { \
-        int rcLock = PDMDevHlpTimerLock((a_pDevIns), (a_pThis)->channels[0].hTimer, (a_rcBusy)); \
-        if (rcLock != VINF_SUCCESS) \
+        VBOXSTRICTRC rcLock = PDMDevHlpTimerLockClock2((a_pDevIns), (a_pThis)->channels[0].hTimer, \
+                                                       &(a_pThis)->CritSect, (a_rcBusy)); \
+        if (RT_LIKELY(rcLock == VINF_SUCCESS)) \
+        { /* likely */ } \
+        else \
             return rcLock; \
-        rcLock = PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, (a_rcBusy)); \
-        if (rcLock != VINF_SUCCESS) \
-        { \
-            PDMDevHlpTimerUnlock((a_pDevIns), (a_pThis)->channels[0].hTimer); \
-            return rcLock; \
-        } \
     } while (0)
 
@@ -139,9 +136,6 @@
  * Acquires the TM lock and PIT lock, ignores failures.
  */
-# define DEVPIT_R3_LOCK_BOTH(a_pDevIns, a_pThis)  \
-    do { \
-        PDMDevHlpTimerLock((a_pDevIns), (a_pThis)->channels[0].hTimer, VERR_IGNORED); \
-        PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, VERR_IGNORED); \
-    } while (0)
+# define DEVPIT_R3_LOCK_BOTH(a_pDevIns, a_pThis) \
+    PDMDevHlpTimerLockClock2((a_pDevIns), (a_pThis)->channels[0].hTimer, &(a_pThis)->CritSect, VERR_IGNORED)
 #endif /* IN_RING3 */
 
@@ -150,8 +144,5 @@
  */
 #define DEVPIT_UNLOCK_BOTH(a_pDevIns, a_pThis) \
-    do { \
-        PDMDevHlpCritSectLeave((a_pDevIns), &(a_pThis)->CritSect); \
-        PDMDevHlpTimerUnlock((a_pDevIns), (a_pThis)->channels[0].hTimer); \
-    } while (0)
+    PDMDevHlpTimerUnlockClock2((a_pDevIns), (a_pThis)->channels[0].hTimer, &(a_pThis)->CritSect)
 
 
Index: /trunk/src/VBox/Devices/PC/DevRTC.cpp
===================================================================
--- /trunk/src/VBox/Devices/PC/DevRTC.cpp	(revision 82328)
+++ /trunk/src/VBox/Devices/PC/DevRTC.cpp	(revision 82329)
@@ -450,8 +450,7 @@
                    holding the device lock.*/
                 PDMDevHlpCritSectLeave(pDevIns, pDevIns->CTX_SUFF(pCritSectRo));
-                int rc1 = PDMDevHlpTimerLock(pDevIns, pThis->hPeriodicTimer, VINF_SUCCESS /* must get it */);
-                int rc2 = PDMDevHlpCritSectEnter(pDevIns, pDevIns->CTX_SUFF(pCritSectRo), VINF_SUCCESS /* must get it */);
-                AssertRCReturn(rc1, rc1);
-                AssertRCReturnStmt(rc2, PDMDevHlpTimerUnlock(pDevIns, pThis->hPeriodicTimer), rc2);
+                VBOXSTRICTRC rc1 = PDMDevHlpTimerLockClock2(pDevIns, pThis->hPeriodicTimer, pDevIns->CTX_SUFF(pCritSectRo),
+                                                            VINF_SUCCESS /* must get it */);
+                AssertRCReturn(VBOXSTRICTRC_VAL(rc1), rc1);
 
                 if (idx == RTC_REG_A)
@@ -482,5 +481,5 @@
                 rtc_timer_update(pDevIns, pThis, PDMDevHlpTimerGet(pDevIns, pThis->hPeriodicTimer));
 
-                PDMDevHlpTimerUnlock(pDevIns, pThis->hPeriodicTimer);
+                PDMDevHlpTimerUnlockClock(pDevIns, pThis->hPeriodicTimer);
                 /* the caller leaves the other lock. */
                 break;
@@ -1175,8 +1174,7 @@
     pThis->next_second_time = PDMDevHlpTimerGet(pDevIns, pThis->hSecondTimer2)
                             + (PDMDevHlpTimerGetFreq(pDevIns, pThis->hSecondTimer2) * 99) / 100;
-    rc = PDMDevHlpTimerLock(pDevIns, pThis->hSecondTimer2, VERR_IGNORED);
-    AssertRCReturn(rc, rc);
+    PDMDevHlpTimerLockClock(pDevIns, pThis->hSecondTimer2, VERR_IGNORED);
     rc = PDMDevHlpTimerSet(pDevIns, pThis->hSecondTimer2, pThis->next_second_time);
-    PDMDevHlpTimerUnlock(pDevIns, pThis->hSecondTimer2);
+    PDMDevHlpTimerUnlockClock(pDevIns, pThis->hSecondTimer2);
     AssertRCReturn(rc, rc);
 
Index: /trunk/src/VBox/VMM/VMMAll/APICAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/APICAll.cpp	(revision 82328)
+++ /trunk/src/VBox/VMM/VMMAll/APICAll.cpp	(revision 82329)
@@ -1415,5 +1415,5 @@
     TMTIMERHANDLE   hTimer   = pApicCpu->hTimer;
 
-    int rc = PDMDevHlpTimerLock(pDevIns, hTimer, rcBusy);
+    VBOXSTRICTRC rc = PDMDevHlpTimerLockClock(pDevIns, hTimer, rcBusy);
     if (rc == VINF_SUCCESS)
     {
@@ -1423,5 +1423,5 @@
         {
             uint64_t const cTicksElapsed = PDMDevHlpTimerGet(pDevIns, hTimer) - pApicCpu->u64TimerInitial;
-            PDMDevHlpTimerUnlock(pDevIns, hTimer);
+            PDMDevHlpTimerUnlockClock(pDevIns, hTimer);
             uint8_t  const uTimerShift   = apicGetTimerShift(pXApicPage);
             uint64_t const uDelta        = cTicksElapsed >> uTimerShift;
@@ -1430,5 +1430,5 @@
         }
         else
-            PDMDevHlpTimerUnlock(pDevIns, hTimer);
+            PDMDevHlpTimerUnlockClock(pDevIns, hTimer);
     }
     return rc;
@@ -1467,5 +1467,5 @@
      */
     TMTIMERHANDLE hTimer = pApicCpu->hTimer;
-    int rc = PDMDevHlpTimerLock(pDevIns, hTimer, rcBusy);
+    VBOXSTRICTRC rc = PDMDevHlpTimerLockClock(pDevIns, hTimer, rcBusy);
     if (rc == VINF_SUCCESS)
     {
@@ -1476,5 +1476,5 @@
         else
             apicStopTimer(pVCpu);
-        PDMDevHlpTimerUnlock(pDevIns, hTimer);
+        PDMDevHlpTimerUnlockClock(pDevIns, hTimer);
     }
     return rc;
Index: /trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp	(revision 82328)
+++ /trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp	(revision 82329)
@@ -605,8 +605,27 @@
 
 
-/** @interface_method_impl{PDMDEVHLPR0,pfnTimerLock} */
-static DECLCALLBACK(int) pdmR0DevHlp_TimerLock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy)
+/** @interface_method_impl{PDMDEVHLPR0,pfnTimerLockClock} */
+static DECLCALLBACK(VBOXSTRICTRC) pdmR0DevHlp_TimerLockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy)
 {
     return TMTimerLock(pdmR0DevHlp_TimerToPtr(pDevIns, hTimer), rcBusy);
+}
+
+
+/** @interface_method_impl{PDMDEVHLPR0,pfnTimerLockClock2} */
+static DECLCALLBACK(VBOXSTRICTRC) pdmR0DevHlp_TimerLockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer,
+                                                              PPDMCRITSECT pCritSect, int rcBusy)
+{
+    VBOXSTRICTRC rc = TMTimerLock(pdmR0DevHlp_TimerToPtr(pDevIns, hTimer), rcBusy);
+    if (rc == VINF_SUCCESS)
+    {
+        rc = PDMCritSectEnter(pCritSect, rcBusy);
+        if (rc == VINF_SUCCESS)
+            return rc;
+        AssertRC(VBOXSTRICTRC_VAL(rc));
+        TMTimerUnlock(pdmR0DevHlp_TimerToPtr(pDevIns, hTimer));
+    }
+    else
+        AssertRC(VBOXSTRICTRC_VAL(rc));
+    return rc;
 }
 
@@ -661,8 +680,17 @@
 
 
-/** @interface_method_impl{PDMDEVHLPR0,pfnTimerUnlock} */
-static DECLCALLBACK(void) pdmR0DevHlp_TimerUnlock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
+/** @interface_method_impl{PDMDEVHLPR0,pfnTimerUnlockClock} */
+static DECLCALLBACK(void) pdmR0DevHlp_TimerUnlockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
 {
     TMTimerUnlock(pdmR0DevHlp_TimerToPtr(pDevIns, hTimer));
+}
+
+
+/** @interface_method_impl{PDMDEVHLPR0,pfnTimerUnlockClock2} */
+static DECLCALLBACK(void) pdmR0DevHlp_TimerUnlockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
+{
+    TMTimerUnlock(pdmR0DevHlp_TimerToPtr(pDevIns, hTimer));
+    int rc = PDMCritSectLeave(pCritSect);
+    AssertRC(rc);
 }
 
@@ -1299,5 +1327,6 @@
     pdmR0DevHlp_TimerIsActive,
     pdmR0DevHlp_TimerIsLockOwner,
-    pdmR0DevHlp_TimerLock,
+    pdmR0DevHlp_TimerLockClock,
+    pdmR0DevHlp_TimerLockClock2,
     pdmR0DevHlp_TimerSet,
     pdmR0DevHlp_TimerSetFrequencyHint,
@@ -1307,5 +1336,6 @@
     pdmR0DevHlp_TimerSetRelative,
     pdmR0DevHlp_TimerStop,
-    pdmR0DevHlp_TimerUnlock,
+    pdmR0DevHlp_TimerUnlockClock,
+    pdmR0DevHlp_TimerUnlockClock2,
     pdmR0DevHlp_TMTimeVirtGet,
     pdmR0DevHlp_TMTimeVirtGetFreq,
Index: /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp	(revision 82328)
+++ /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp	(revision 82329)
@@ -518,8 +518,27 @@
 
 
+/** @interface_method_impl{PDMDEVHLPR3,pfnTimerLockClock} */
+static DECLCALLBACK(VBOXSTRICTRC) pdmR3DevHlp_TimerLockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy)
+{
+    return TMTimerLock(pdmR3DevHlp_TimerToPtr(pDevIns, hTimer), rcBusy);
+}
+
+
 /** @interface_method_impl{PDMDEVHLPR3,pfnTimerLock} */
-static DECLCALLBACK(int) pdmR3DevHlp_TimerLock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, int rcBusy)
-{
-    return TMTimerLock(pdmR3DevHlp_TimerToPtr(pDevIns, hTimer), rcBusy);
+static DECLCALLBACK(VBOXSTRICTRC) pdmR3DevHlp_TimerLockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer,
+                                                              PPDMCRITSECT pCritSect, int rcBusy)
+{
+    VBOXSTRICTRC rc = TMTimerLock(pdmR3DevHlp_TimerToPtr(pDevIns, hTimer), rcBusy);
+    if (rc == VINF_SUCCESS)
+    {
+        rc = PDMCritSectEnter(pCritSect, rcBusy);
+        if (rc == VINF_SUCCESS)
+            return rc;
+        AssertRC(VBOXSTRICTRC_VAL(rc));
+        TMTimerUnlock(pdmR3DevHlp_TimerToPtr(pDevIns, hTimer));
+    }
+    else
+        AssertRC(VBOXSTRICTRC_VAL(rc));
+    return rc;
 }
 
@@ -574,8 +593,17 @@
 
 
+/** @interface_method_impl{PDMDEVHLPR3,pfnTimerUnlockClock} */
+static DECLCALLBACK(void) pdmR3DevHlp_TimerUnlockClock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
+{
+    TMTimerUnlock(pdmR3DevHlp_TimerToPtr(pDevIns, hTimer));
+}
+
+
 /** @interface_method_impl{PDMDEVHLPR3,pfnTimerUnlock} */
-static DECLCALLBACK(void) pdmR3DevHlp_TimerUnlock(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer)
+static DECLCALLBACK(void) pdmR3DevHlp_TimerUnlockClock2(PPDMDEVINS pDevIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
 {
     TMTimerUnlock(pdmR3DevHlp_TimerToPtr(pDevIns, hTimer));
+    int rc = PDMCritSectLeave(pCritSect);
+    AssertRC(rc);
 }
 
@@ -3923,5 +3951,6 @@
     pdmR3DevHlp_TimerIsActive,
     pdmR3DevHlp_TimerIsLockOwner,
-    pdmR3DevHlp_TimerLock,
+    pdmR3DevHlp_TimerLockClock,
+    pdmR3DevHlp_TimerLockClock2,
     pdmR3DevHlp_TimerSet,
     pdmR3DevHlp_TimerSetFrequencyHint,
@@ -3931,5 +3960,6 @@
     pdmR3DevHlp_TimerSetRelative,
     pdmR3DevHlp_TimerStop,
-    pdmR3DevHlp_TimerUnlock,
+    pdmR3DevHlp_TimerUnlockClock,
+    pdmR3DevHlp_TimerUnlockClock2,
     pdmR3DevHlp_TimerSetCritSect,
     pdmR3DevHlp_TimerSave,
@@ -4405,5 +4435,6 @@
     pdmR3DevHlp_TimerIsActive,
     pdmR3DevHlp_TimerIsLockOwner,
-    pdmR3DevHlp_TimerLock,
+    pdmR3DevHlp_TimerLockClock,
+    pdmR3DevHlp_TimerLockClock2,
     pdmR3DevHlp_TimerSet,
     pdmR3DevHlp_TimerSetFrequencyHint,
@@ -4413,5 +4444,6 @@
     pdmR3DevHlp_TimerSetRelative,
     pdmR3DevHlp_TimerStop,
-    pdmR3DevHlp_TimerUnlock,
+    pdmR3DevHlp_TimerUnlockClock,
+    pdmR3DevHlp_TimerUnlockClock2,
     pdmR3DevHlp_TimerSetCritSect,
     pdmR3DevHlp_TimerSave,
