Index: trunk/src/VBox/Devices/Makefile.kmk
===================================================================
--- trunk/src/VBox/Devices/Makefile.kmk	(revision 25994)
+++ trunk/src/VBox/Devices/Makefile.kmk	(revision 25995)
@@ -676,6 +676,6 @@
 
 ifdef VBOX_WITH_HPET
-VBoxDDR0_DEFS          += VBOX_WITH_HPET
-VBoxDDR0_SOURCES       += PC/DevHPET.cpp
+ VBoxDDR0_DEFS          += VBOX_WITH_HPET
+ VBoxDDR0_SOURCES       += PC/DevHPET.cpp
 endif
 
Index: trunk/src/VBox/VMM/PDMDevHlp.cpp
===================================================================
--- trunk/src/VBox/VMM/PDMDevHlp.cpp	(revision 25994)
+++ trunk/src/VBox/VMM/PDMDevHlp.cpp	(revision 25995)
@@ -1955,5 +1955,33 @@
     return VINF_SUCCESS;
 }
-
+/** @copydoc PDMDEVHLPR3::pfnHPETRegister */
+static DECLCALLBACK(int) pdmR3DevHlp_HPETRegister(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR3 *ppHpetHlpR3)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
+    LogFlow(("pdmR3DevHlp_HPETRegister: caller='%s'/%d:\n"));
+
+    /*
+     * Validate input.
+     */
+    if (pHpetReg->u32Version != PDM_HPETREG_VERSION)
+    {
+        AssertMsgFailed(("u32Version=%#x expected %#x\n", pHpetReg->u32Version, PDM_HPETREG_VERSION));
+        LogFlow(("pdmR3DevHlp_HPETRegister: caller='%s'/%d: returns %Rrc (version)\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VERR_INVALID_PARAMETER));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    if (!ppHpetHlpR3)
+    {
+        Assert(ppHpetHlpR3);
+        LogFlow(("pdmR3DevHlp_HPETRegister: caller='%s'/%d: returns %Rrc (ppApicHlpR3)\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VERR_INVALID_PARAMETER));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    /* set the helper pointer and return. */
+    *ppHpetHlpR3 = &g_pdmR3DevHpetHlp;
+    LogFlow(("pdmR3DevHlp_HPETRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, VINF_SUCCESS));
+    return VINF_SUCCESS;
+}
 
 /** @copydoc PDMDEVHLPR3::pfnDMACRegister */
@@ -2809,4 +2837,5 @@
     pdmR3DevHlp_APICRegister,
     pdmR3DevHlp_IOAPICRegister,
+    pdmR3DevHlp_HPETRegister,
     pdmR3DevHlp_DMACRegister,
     pdmR3DevHlp_PhysRead,
@@ -2899,4 +2928,13 @@
 }
 
+/** @copydoc PDMDEVHLPR3::pfnHPETRegister */
+static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_HPETRegister(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR3 *ppHpetHlpR3)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    AssertReleaseMsgFailed(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
+    NOREF(pHpetReg);
+    NOREF(ppHpetHlpR3);
+    return VERR_ACCESS_DENIED;
+}
 
 /** @copydoc PDMDEVHLPR3::pfnDMACRegister */
@@ -3276,4 +3314,5 @@
     pdmR3DevHlp_Untrusted_APICRegister,
     pdmR3DevHlp_Untrusted_IOAPICRegister,
+    pdmR3DevHlp_Untrusted_HPETRegister,
     pdmR3DevHlp_Untrusted_DMACRegister,
     pdmR3DevHlp_Untrusted_PhysRead,
@@ -3347,3 +3386,2 @@
 
 /** @} */
-
Index: trunk/src/VBox/VMM/PDMDevMiscHlp.cpp
===================================================================
--- trunk/src/VBox/VMM/PDMDevMiscHlp.cpp	(revision 25994)
+++ trunk/src/VBox/VMM/PDMDevMiscHlp.cpp	(revision 25995)
@@ -57,5 +57,5 @@
         return;
     }
- 
+
     PVMCPU pVCpu = &pVM->aCpus[0];  /* for PIC we always deliver to CPU 0, MP use APIC */
 
@@ -531,4 +531,57 @@
 
 
+/** @copydoc PDMHPETHLPR3::pfnSetLegacyMode */
+static DECLCALLBACK(int) pdmR3HpetHlp_SetLegacyMode(PPDMDEVINS pDevIns, bool fActivate)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    LogFlow(("pdmR3HpetHlp_SetLegacyMode: caller='%s'/%d: fActivate=%d\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, fActivate));
+    return 0;
+}
+
+/** @copydoc PDMHPETHLPR3::pfnLock */
+static DECLCALLBACK(int) pdmR3HpetHlp_Lock(PPDMDEVINS pDevIns, int rc)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    LogFlow(("pdmR3HpetHlp_Lock: caller='%s'/%d: rc=%Rrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
+    return pdmLockEx(pDevIns->Internal.s.pVMR3, rc);
+}
+
+
+/** @copydoc PDMHPETHLPR3::pfnUnlock */
+static DECLCALLBACK(void) pdmR3HpetHlp_Unlock(PPDMDEVINS pDevIns)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    LogFlow(("pdmR3HpetHlp_Unlock: caller='%s'/%d:\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
+    pdmUnlock(pDevIns->Internal.s.pVMR3);
+}
+
+/** @copydoc PDMHPETHLPR3::pfnGetRCHelpers */
+static DECLCALLBACK(PCPDMHPETHLPRC) pdmR3HpetHlp_GetRCHelpers(PPDMDEVINS pDevIns)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
+    RTRCPTR pRCHelpers = 0;
+    int rc = PDMR3LdrGetSymbolRC(pDevIns->Internal.s.pVMR3, NULL, "g_pdmRCHpetHlp", &pRCHelpers);
+    AssertReleaseRC(rc);
+    AssertRelease(pRCHelpers);
+    LogFlow(("pdmR3HpetHlp_GetGCHelpers: caller='%s'/%d: returns %RRv\n",
+             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pRCHelpers));
+    return pRCHelpers;
+}
+
+/** @copydoc PDMHPETHLPR3::pfnGetR0Helpers */
+static DECLCALLBACK(PCPDMHPETHLPR0) pdmR3HpetHlp_GetR0Helpers(PPDMDEVINS pDevIns)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
+    PCPDMHPETHLPR0 pR0Helpers = 0;
+    int rc = PDMR3LdrGetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0HpetHlp", &pR0Helpers);
+    AssertReleaseRC(rc);
+    AssertRelease(pR0Helpers);
+    LogFlow(("pdmR3HpetHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
+             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pR0Helpers));
+    return pR0Helpers;
+}
+
 /**
  * PCI Bus Device Helpers.
@@ -549,4 +602,20 @@
 /** @} */
 
+/**
+ * HPET Device Helpers.
+ */
+const PDMHPETHLPR3 g_pdmR3DevHpetHlp =
+{
+    PDM_HPETHLPR3_VERSION,
+    pdmR3HpetHlp_SetLegacyMode,    
+    pdmR3HpetHlp_Lock,
+    pdmR3HpetHlp_Unlock,
+    pdmR3HpetHlp_GetRCHelpers,
+    pdmR3HpetHlp_GetR0Helpers,
+    PDM_HPETHLPR3_VERSION, /* the end */
+};
+
+/** @} */
+
 
 
@@ -573,4 +642,2 @@
     PDM_RTCHLP_VERSION
 };
-
-
Index: trunk/src/VBox/VMM/PDMInternal.h
===================================================================
--- trunk/src/VBox/VMM/PDMInternal.h	(revision 25994)
+++ trunk/src/VBox/VMM/PDMInternal.h	(revision 25995)
@@ -1055,4 +1055,5 @@
 extern const PDMDMACHLP     g_pdmR3DevDmacHlp;
 extern const PDMRTCHLP      g_pdmR3DevRtcHlp;
+extern const PDMHPETHLPR3   g_pdmR3DevHpetHlp;
 #endif
 
Index: trunk/src/VBox/VMM/VMMGC/PDMGCDevice.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMGC/PDMGCDevice.cpp	(revision 25994)
+++ trunk/src/VBox/VMM/VMMGC/PDMGCDevice.cpp	(revision 25995)
@@ -49,4 +49,5 @@
 extern DECLEXPORT(const PDMIOAPICHLPRC) g_pdmRCIoApicHlp;
 extern DECLEXPORT(const PDMPCIHLPRC)    g_pdmRCPciHlp;
+extern DECLEXPORT(const PDMHPETHLPRC)   g_pdmRCHpetHlp;
 RT_C_DECLS_END
 
@@ -112,4 +113,12 @@
 static DECLCALLBACK(int) pdmRCPciHlp_Lock(PPDMDEVINS pDevIns, int rc);
 static DECLCALLBACK(void) pdmRCPciHlp_Unlock(PPDMDEVINS pDevIns);
+/** @} */
+
+
+/** @name HPET RC Helpers
+ * @{
+ */
+static DECLCALLBACK(int) pdmRCHpetHlp_Lock(PPDMDEVINS pDevIns, int rc);
+static DECLCALLBACK(void) pdmRCHpetHlp_Unlock(PPDMDEVINS pDevIns);
 /** @} */
 
@@ -197,5 +206,14 @@
 };
 
-
+/**
+ * The Raw-Mode Context HPET Helper Callbacks.
+ */
+extern DECLEXPORT(const PDMHPETHLPRC) g_pdmRCHpetHlp =
+{
+    PDM_HPETHLPRC_VERSION,
+    pdmRCHpetHlp_Lock,
+    pdmRCHpetHlp_Unlock,
+    PDM_HPETHLPRC_VERSION, /* the end */
+};
 
 
@@ -683,2 +701,18 @@
     }
 }
+
+
+/** @copydoc PDMHPETHLPRC::pfnLock */
+static DECLCALLBACK(int) pdmRCHpetHlp_Lock(PPDMDEVINS pDevIns, int rc)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    return pdmLockEx(pDevIns->Internal.s.pVMRC, rc);
+}
+
+
+/** @copydoc PDMHPETHLPRC::pfnUnlock */
+static DECLCALLBACK(void) pdmRCHpetHlp_Unlock(PPDMDEVINS pDevIns)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    pdmUnlock(pDevIns->Internal.s.pVMRC);
+}
Index: trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp	(revision 25994)
+++ trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp	(revision 25995)
@@ -51,4 +51,5 @@
 extern DECLEXPORT(const PDMIOAPICHLPR0) g_pdmR0IoApicHlp;
 extern DECLEXPORT(const PDMPCIHLPR0)    g_pdmR0PciHlp;
+extern DECLEXPORT(const PDMHPETHLPR0)   g_pdmR0HpetHlp;
 RT_C_DECLS_END
 
@@ -115,4 +116,11 @@
 static DECLCALLBACK(int) pdmR0PciHlp_Lock(PPDMDEVINS pDevIns, int rc);
 static DECLCALLBACK(void) pdmR0PciHlp_Unlock(PPDMDEVINS pDevIns);
+/** @} */
+
+/** @name HPET GC Helpers
+ * @{
+ */
+static DECLCALLBACK(int) pdmR0HpetHlp_Lock(PPDMDEVINS pDevIns, int rc);
+static DECLCALLBACK(void) pdmR0HpetHlp_Unlock(PPDMDEVINS pDevIns);
 /** @} */
 
@@ -201,5 +209,14 @@
 };
 
-
+/**
+ * The Guest Context HPET Helper Callbacks.
+ */
+extern DECLEXPORT(const PDMHPETHLPR0) g_pdmR0HpetHlp =
+{
+    PDM_HPETHLPR0_VERSION,
+    pdmR0HpetHlp_Lock,
+    pdmR0HpetHlp_Unlock,
+    PDM_HPETHLPR0_VERSION, /* the end */
+};
 
 
@@ -720,2 +737,17 @@
     }
 }
+
+/** @copydoc PDMHPETHLPR0::pfnLock */
+static DECLCALLBACK(int) pdmR0HpetHlp_Lock(PPDMDEVINS pDevIns, int rc)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    return pdmLockEx(pDevIns->Internal.s.pVMR0, rc);
+}
+
+
+/** @copydoc PDMHPETHLPR0::pfnUnlock */
+static DECLCALLBACK(void) pdmR0HpetHlp_Unlock(PPDMDEVINS pDevIns)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    pdmUnlock(pDevIns->Internal.s.pVMR0);
+}
