Index: /trunk/Makefile.kmk
===================================================================
--- /trunk/Makefile.kmk	(revision 30723)
+++ /trunk/Makefile.kmk	(revision 30724)
@@ -1106,9 +1106,10 @@
 #
 incs:
-	$(SED) -f include/VBox/err.sed     --output include/VBox/err.mac   include/VBox/err.h
+	$(SED) -f include/VBox/err.sed     --output include/VBox/err.mac           include/VBox/err.h
 	$(APPEND) include/VBox/err.mac '%include "iprt/err.mac"'
-	$(SED) -f include/VBox/err.sed     --output include/iprt/err.mac   include/iprt/err.h
-	$(SED) -f include/VBox/various.sed --output include/VBox/x86.mac   include/VBox/x86.h
-	$(SED) -f include/VBox/various.sed --output include/VBox/param.mac include/VBox/param.h
+	$(SED) -f include/VBox/err.sed     --output include/iprt/err.mac           include/iprt/err.h
+	$(SED) -f include/VBox/various.sed --output include/VBox/x86.mac           include/VBox/x86.h
+	$(SED) -f include/VBox/various.sed --output include/VBox/param.mac         include/VBox/param.h
+	$(SED) -f include/VBox/various.sed --output include/VBox/VMMDevTesting.mac include/VBox/VMMDevTesting.h
 
 
Index: /trunk/include/VBox/VMMDevTesting.h
===================================================================
--- /trunk/include/VBox/VMMDevTesting.h	(revision 30724)
+++ /trunk/include/VBox/VMMDevTesting.h	(revision 30724)
@@ -0,0 +1,50 @@
+/* $Id$ */
+/** @file
+ * VMMDev - Testing Extensions.
+ */
+
+/*
+ * Copyright (C) 2010 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+#ifndef ___VBox_VMMDevTesting_h
+#define ___VBox_VMMDevTesting_h
+
+#include <VBox/types.h>
+
+/** The base address of the MMIO range used for testing.
+ * This is intentionally put at the 2nd page above 1M so that it can be
+ * accessed from both real (!A20) and protected mode. */
+#define VMMDEV_TESTING_MMIO_BASE        UINT32_C(0x00101000)
+/** The size of the MMIO range used for testing.  */
+#define VMMDEV_TESTING_MMIO_SIZE        UINT32_C(0x00001000)
+/** The NOP MMIO register - 124 RW. */
+#define VMMDEV_TESTING_MMIO_NOP         (VMMDEV_TESTING_MMIO_BASE + 0x000)
+/** The XXX MMIO register - 124 RW. */
+#define VMMDEV_TESTING_MMIO_TODO        (VMMDEV_TESTING_MMIO_BASE + 0x004)
+
+/** The base port of the I/O range used for testing. */
+#define VMMDEV_TESTING_IOPORT_BASE      0x0510
+/** The number of I/O ports reserved for testing. */
+#define VMMDEV_TESTING_IOPORT_COUNT     0x0010
+/** The NOP I/O port - 124 RW. */
+#define VMMDEV_TESTING_IOPORT_NOP       (VMMDEV_TESTING_IOPORT_BASE + 0)
+/** The low nanosecond timestamp - 4 RO.  */
+#define VMMDEV_TESTING_IOPORT_TS_LOW    (VMMDEV_TESTING_IOPORT_BASE + 1)
+/** The high nanosecond timestamp - 4 RO.  Read this after the low one!  */
+#define VMMDEV_TESTING_IOPORT_TS_HIGH   (VMMDEV_TESTING_IOPORT_BASE + 2)
+
+/** What the NOP accesses returns. */
+#define VMMDEV_TESTING_NOP_RET          UINT32_C(0x64726962) /* bird */
+
+#endif
+
Index: /trunk/include/VBox/VMMDevTesting.mac
===================================================================
--- /trunk/include/VBox/VMMDevTesting.mac	(revision 30724)
+++ /trunk/include/VBox/VMMDevTesting.mac	(revision 30724)
@@ -0,0 +1,13 @@
+%ifndef ___VBox_VMMDevTesting_h
+%define ___VBox_VMMDevTesting_h
+%define VMMDEV_TESTING_MMIO_BASE        UINT32_C(0x00101000)
+%define VMMDEV_TESTING_MMIO_SIZE        UINT32_C(0x00001000)
+%define VMMDEV_TESTING_MMIO_NOP         (VMMDEV_TESTING_MMIO_BASE + 0x000)
+%define VMMDEV_TESTING_MMIO_TODO        (VMMDEV_TESTING_MMIO_BASE + 0x004)
+%define VMMDEV_TESTING_IOPORT_BASE      0x0510
+%define VMMDEV_TESTING_IOPORT_COUNT     0x0010
+%define VMMDEV_TESTING_IOPORT_NOP       (VMMDEV_TESTING_IOPORT_BASE + 0)
+%define VMMDEV_TESTING_IOPORT_TS_LOW    (VMMDEV_TESTING_IOPORT_BASE + 1)
+%define VMMDEV_TESTING_IOPORT_TS_HIGH   (VMMDEV_TESTING_IOPORT_BASE + 2)
+%define VMMDEV_TESTING_NOP_RET          UINT32_C(0x64726962)
+%endif
Index: /trunk/include/VBox/err.mac
===================================================================
--- /trunk/include/VBox/err.mac	(revision 30723)
+++ /trunk/include/VBox/err.mac	(revision 30724)
@@ -19,4 +19,5 @@
 %define VERR_INVALID_CPU_ID    (-1018)
 %define VERR_TOO_MANY_CPUS    (-1019)
+%define VERR_SERVICE_DISABLED    (-1020)
 %define VINF_EM_FIRST    1100
 %define VINF_EM_TERMINATE    1100
@@ -157,4 +158,9 @@
 %define VERR_PGM_INVALID_LARGE_PAGE_RANGE    (-1645)
 %define VERR_PGM_PHYS_PAGE_BALLOONED    (-1646)
+%define VINF_PGM_SHARED_MODULE_ALREADY_REGISTERED    (1647)
+%define VERR_PGM_SHARED_MODULE_NOT_FOUND    (-1648)
+%define VINF_PGM_SHARED_MODULE_COLLISION    (1649)
+%define VERR_PGM_SHARED_MODULE_REGISTRATION_INCONSISTENCY    (-1650)
+%define VERR_PGM_SHARED_MODULE_FIRST_CHECK    (-1651)
 %define VERR_MM_RAM_CONFLICT    (-1700)
 %define VERR_MM_HYPER_NO_MEMORY    (-1701)
@@ -216,4 +222,5 @@
 %define VERR_SSM_FIELD_INVALID_PADDING_SIZE    (-1869)
 %define VERR_SSM_FIELD_INVALID_VALUE    (-1870)
+%define VERR_SSM_STREAM_ERROR    (-1871)
 %define VERR_VM_ATRESET_NOT_FOUND    (-1900)
 %define VERR_VM_REQUEST_INVALID_TYPE    (-1901)
@@ -230,4 +237,5 @@
 %define VERR_VM_DRIVER_VERSION_MISMATCH    (-1912)
 %define VERR_VM_SAVE_STATE_NOT_ALLOWED    (-1913)
+%define VERR_VM_THREAD_IS_EMT    (-1914)
 %define VINF_VRDP_SUCCESS    VINF_SUCCESS
 %define VERR_VRDP_TIMEOUT    VERR_TIMEOUT
@@ -428,4 +436,5 @@
 %define VERR_VD_RAW_INVALID_TYPE    (-3271)
 %define VERR_VD_NOT_ENOUGH_METADATA    (-3272)
+%define VERR_VD_IOCTX_HALT    (-3273)
 %define VERR_VBGL_NOT_INITIALIZED    (-3300)
 %define VERR_VBGL_INVALID_ADDR    (-3301)
@@ -446,4 +455,5 @@
 %define VERR_INTNET_INCOMPATIBLE_TRUNK    (-3603)
 %define VERR_INTNET_INCOMPATIBLE_FLAGS    (-3604)
+%define VERR_INTNET_FLT_VNIC_CREATE_FAILED    (-3605)
 %define VERR_SUPDRV_COMPONENT_NOT_FOUND    (-3700)
 %define VERR_SUPDRV_INTERFACE_NOT_SUPPORTED    (-3701)
@@ -487,4 +497,5 @@
 %define VERR_VMX_UNEXPECTED_EXCEPTION    (-4016)
 %define VERR_VMX_UNEXPECTED_INTERRUPTION_EXIT_CODE    (-4017)
+%define VERR_VMX_NOT_IN_VMX_ROOT_MODE    (-4018)
 %define VERR_SVM_UNABLE_TO_START_VM    (-4050)
 %define VERR_SVM_ILLEGAL_EFER_MSR    (-4051)
@@ -505,16 +516,19 @@
 %define VINF_PARAV_SWITCH_TO_HOST    4400
 %define VINF_VHWA_CMD_PENDING    4500
-%define VERR_COM_OBJECT_NOT_FOUND    (-4601)
-%define VERR_COM_INVALID_VM_STATE    (-4602)
-%define VERR_COM_VM_ERROR    (-4603)
-%define VERR_COM_FILE_ERROR    (-4604)
-%define VERR_COM_IPRT_ERROR    (-4605)
-%define VERR_COM_PDM_ERROR    (-4606)
-%define VERR_COM_INVALID_OBJECT_STATE    (-4607)
-%define VERR_COM_HOST_ERROR    (-4608)
-%define VERR_COM_NOT_SUPPORTED    (-4609)
-%define VERR_COM_XML_ERROR    (-4610)
-%define VERR_COM_INVALID_SESSION_STATE    (-4611)
-%define VERR_COM_OBJECT_IN_USE    (-4612)
+%define VERR_COM_UNEXPECTED    (-4600)
+%define VERR_COM_VBOX_LOWEST    (-4699)
+%define VERR_COM_OBJECT_NOT_FOUND    (VERR_COM_VBOX_LOWEST + 1)
+%define VERR_COM_INVALID_VM_STATE    (VERR_COM_VBOX_LOWEST + 2)
+%define VERR_COM_VM_ERROR    (VERR_COM_VBOX_LOWEST + 3)
+%define VERR_COM_FILE_ERROR    (VERR_COM_VBOX_LOWEST + 4)
+%define VERR_COM_IPRT_ERROR    (VERR_COM_VBOX_LOWEST + 5)
+%define VERR_COM_PDM_ERROR    (VERR_COM_VBOX_LOWEST + 6)
+%define VERR_COM_INVALID_OBJECT_STATE    (VERR_COM_VBOX_LOWEST + 7)
+%define VERR_COM_HOST_ERROR    (VERR_COM_VBOX_LOWEST + 8)
+%define VERR_COM_NOT_SUPPORTED    (VERR_COM_VBOX_LOWEST + 9)
+%define VERR_COM_XML_ERROR    (VERR_COM_VBOX_LOWEST + 10)
+%define VERR_COM_INVALID_SESSION_STATE    (VERR_COM_VBOX_LOWEST + 11)
+%define VERR_COM_OBJECT_IN_USE    (VERR_COM_VBOX_LOWEST + 12)
+%define VERR_COM_DONT_CALL_AGAIN    (VERR_COM_VBOX_LOWEST + 13)
 %define VERR_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST    (-4700)
 %define VINF_AIO_TASK_PENDING    4800
Index: /trunk/include/VBox/iom.h
===================================================================
--- /trunk/include/VBox/iom.h	(revision 30723)
+++ /trunk/include/VBox/iom.h	(revision 30724)
@@ -91,5 +91,6 @@
  * @param   pvUser      User argument.
  * @param   uPort       Port number used for the IN operation.
- * @param   pu32        Where to store the result.
+ * @param   pu32        Where to store the result.  This is always a 32-bit
+ *                      variable regardless of what @a cb might say.
  * @param   cb          Number of bytes read.
  */
Index: /trunk/include/iprt/err.mac
===================================================================
--- /trunk/include/iprt/err.mac	(revision 30723)
+++ /trunk/include/iprt/err.mac	(revision 30724)
@@ -104,5 +104,7 @@
 %define VERR_CONCURRENT_ACCESS    (-92)
 %define VERR_CALLER_NO_REFERENCE    (-93)
-%define VERR_LOGON_FAILURE    (-94)
+%define VERR_NO_CHANGE    (-95)
+%define VINF_NO_CHANGE    95
+%define VERR_NO_EXEC_MEMORY    (-96)
 %define VERR_FILE_IO_ERROR    (-100)
 %define VERR_OPEN_FAILED    (-101)
Index: /trunk/src/VBox/Devices/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Devices/Makefile.kmk	(revision 30723)
+++ /trunk/src/VBox/Devices/Makefile.kmk	(revision 30724)
@@ -310,4 +310,5 @@
 	VMMDev/VMMDev.cpp \
 	VMMDev/VMMDevHGCM.cpp \
+	VMMDev/VMMDevTesting.cpp \
 	Network/DevPCNet.cpp \
 	Audio/DevIchAc97.cpp \
@@ -539,5 +540,4 @@
  #
  VBoxDDGC_TEMPLATE       = VBoxRc
- VBoxDDGC_SYSSUFF        = .gc
  ifeq ($(KBUILD_TARGET_ARCH),x86)
   VBoxDDGC_DEFS.darwin   = VBOX_WITH_2X_4GB_ADDR_SPACE
@@ -557,5 +557,6 @@
  	Network/DevPCNet.cpp \
  	Serial/DevSerial.cpp \
- 	Parallel/DevParallel.cpp
+ 	Parallel/DevParallel.cpp \
+	VMMDev/VMMDevTesting.cpp
 
  ifdef VBOX_DYNAMIC_NET_ATTACH
@@ -652,5 +653,4 @@
 #
 VBoxDDR0_TEMPLATE       = VBoxR0
-VBoxDDR0_SYSSUFF        = .r0
 VBoxDDR0_DEFS.darwin.x86= VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 VBOX_WITH_2X_4GB_ADDR_SPACE
 VBoxDDR0_DEFS           = IN_RT_R0
@@ -669,4 +669,5 @@
 	Serial/DevSerial.cpp \
 	Parallel/DevParallel.cpp \
+	VMMDev/VMMDevTesting.cpp \
 	\
 	Network/DrvIntNet.cpp \
@@ -766,5 +767,4 @@
  VBoxDD2GC_TEMPLATE       = VBoxRc
  VBoxDD2GC_DEFS           =
- VBoxDD2GC_SYSSUFF        = .gc
  VBoxDD2GC_INCS          := \
  	$(PATH_SUB_CURRENT)
@@ -783,5 +783,4 @@
 VBoxDD2R0_TEMPLATE       = VBoxR0
 VBoxDD2R0_DEFS           = IN_RT_R0
-VBoxDD2R0_SYSSUFF        = .r0
 VBoxDD2R0_INCS          := \
 	$(PATH_SUB_CURRENT)
Index: /trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
===================================================================
--- /trunk/src/VBox/Devices/VMMDev/VMMDev.cpp	(revision 30723)
+++ /trunk/src/VBox/Devices/VMMDev/VMMDev.cpp	(revision 30724)
@@ -27,5 +27,4 @@
 #include <VBox/log.h>
 #include <VBox/param.h>
-#include <VBox/mm.h>
 #include <VBox/pgm.h>
 #include <VBox/err.h>
@@ -48,4 +47,7 @@
 #ifdef VBOX_WITH_HGCM
 # include "VMMDevHGCM.h"
+#endif
+#ifndef VBOX_WITHOUT_TESTING_FEATURES
+# include "VMMDevTesting.h"
 #endif
 
@@ -2728,8 +2730,18 @@
         pThis->pDrv->pfnUpdateGuestCapabilities(pThis->pDrv, pThis->guestCaps);
 
-    /* Generate a unique session id for this VM; it will be changed for each start, reset or restore. 
+    /* Generate a unique session id for this VM; it will be changed for each start, reset or restore.
      * This can be used for restore detection inside the guest.
      */
     pThis->idSession = ASMReadTSC();
+}
+
+
+/**
+ * @interface_method_impl{PDMDEVREG,pfnRelocate}
+ */
+static DECLCALLBACK(void) vmmdevRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
+{
+    NOREF(pDevIns);
+    NOREF(offDelta);
 }
 
@@ -2745,35 +2757,4 @@
     Assert(iInstance == 0);
     PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
-
-    /*
-     * Validate and read the configuration.
-     */
-    if (!CFGMR3AreValuesValid(pCfg,
-                              "GetHostTimeDisabled\0"
-                              "BackdoorLogDisabled\0"
-                              "KeepCredentials\0"
-                              "HeapEnabled\0"
-                              ))
-        return VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES;
-
-    rc = CFGMR3QueryBoolDef(pCfg, "GetHostTimeDisabled", &pThis->fGetHostTimeDisabled, false);
-    if (RT_FAILURE(rc))
-        return PDMDEV_SET_ERROR(pDevIns, rc,
-                                N_("Configuration error: Failed querying \"GetHostTimeDisabled\" as a boolean"));
-
-    rc = CFGMR3QueryBoolDef(pCfg, "BackdoorLogDisabled", &pThis->fBackdoorLogDisabled, false);
-    if (RT_FAILURE(rc))
-        return PDMDEV_SET_ERROR(pDevIns, rc,
-                                N_("Configuration error: Failed querying \"BackdoorLogDisabled\" as a boolean"));
-
-    rc = CFGMR3QueryBoolDef(pCfg, "KeepCredentials", &pThis->fKeepCredentials, false);
-    if (RT_FAILURE(rc))
-        return PDMDEV_SET_ERROR(pDevIns, rc,
-                                N_("Configuration error: Failed querying \"KeepCredentials\" as a boolean"));
-
-    rc = CFGMR3QueryBoolDef(pCfg, "HeapEnabled", &pThis->fHeapEnabled, true);
-    if (RT_FAILURE(rc))
-        return PDMDEV_SET_ERROR(pDevIns, rc,
-                                N_("Configuration error: Failed querying \"HeapEnabled\" as a boolean"));
 
     /*
@@ -2828,6 +2809,57 @@
 #endif
 
-    /** @todo convert this into a config parameter like we do everywhere else! */
-    pThis->cbGuestRAM = MMR3PhysGetRamSize(PDMDevHlpGetVM(pDevIns));
+    /*
+     * Validate and read the configuration.
+     */
+    PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns,
+                                  "GetHostTimeDisabled|"
+                                  "BackdoorLogDisabled|"
+                                  "KeepCredentials|"
+                                  "HeapEnabled|"
+                                  "RamSize|"
+                                  "TestingEnabled"
+                                  ,
+                                  "");
+
+    rc = CFGMR3QueryU64(pCfg, "RamSize", &pThis->cbGuestRAM);
+    if (RT_FAILURE(rc))
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("Configuration error: Failed querying \"RamSize\" as a 64-bit unsigned integer"));
+
+    rc = CFGMR3QueryBoolDef(pCfg, "GetHostTimeDisabled", &pThis->fGetHostTimeDisabled, false);
+    if (RT_FAILURE(rc))
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("Configuration error: Failed querying \"GetHostTimeDisabled\" as a boolean"));
+
+    rc = CFGMR3QueryBoolDef(pCfg, "BackdoorLogDisabled", &pThis->fBackdoorLogDisabled, false);
+    if (RT_FAILURE(rc))
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("Configuration error: Failed querying \"BackdoorLogDisabled\" as a boolean"));
+
+    rc = CFGMR3QueryBoolDef(pCfg, "KeepCredentials", &pThis->fKeepCredentials, false);
+    if (RT_FAILURE(rc))
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("Configuration error: Failed querying \"KeepCredentials\" as a boolean"));
+
+    rc = CFGMR3QueryBoolDef(pCfg, "HeapEnabled", &pThis->fHeapEnabled, true);
+    if (RT_FAILURE(rc))
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("Configuration error: Failed querying \"HeapEnabled\" as a boolean"));
+
+    rc = CFGMR3QueryBoolDef(pCfg, "RZEnabled", &pThis->fRZEnabled, true);
+    if (RT_FAILURE(rc))
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("Configuration error: Failed querying \"RZEnabled\" as a boolean"));
+
+#ifndef VBOX_WITHOUT_TESTING_FEATURES
+    rc = CFGMR3QueryBoolDef(pCfg, "TestingEnabled", &pThis->fTestingEnabled, false);
+    if (RT_FAILURE(rc))
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("Configuration error: Failed querying \"TestingEnabled\" as a boolean"));
+# ifdef DEBUG_bird /* lazy bird */
+    pThis->fTestingEnabled = true;
+# endif
+    /** @todo image-to-load-filename? */
+#endif
 
     /*
@@ -2890,4 +2922,13 @@
     }
 
+#ifndef VBOX_WITHOUT_TESTING_FEATURES
+    /*
+     * Initialize testing.
+     */
+    rc = vmmdevTestingInitialize(pDevIns);
+    if (RT_FAILURE(rc))
+        return rc;
+#endif
+
     /*
      * Get the corresponding connector interface
@@ -2949,4 +2990,5 @@
     pThis->u32HGCMEnabled = 0;
 #endif /* VBOX_WITH_HGCM */
+
     /* In this version of VirtualBox the GUI checks whether "needs host cursor"
      * changes. */
@@ -2955,5 +2997,5 @@
     PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatMemBalloonChunks, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Memory balloon size", "/Devices/VMMDev/BalloonChunks");
 
-    /* Generate a unique session id for this VM; it will be changed for each start, reset or restore. 
+    /* Generate a unique session id for this VM; it will be changed for each start, reset or restore.
      * This can be used for restore detection inside the guest.
      */
@@ -2972,11 +3014,11 @@
     "VMMDev",
     /* szRCMod */
-    "",
+    "VBoxDDGC.gc",
     /* szR0Mod */
-    "",
+    "VBoxDDR0.r0",
     /* pszDescription */
     "VirtualBox VMM Device\n",
     /* fFlags */
-    PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT | PDM_DEVREG_FLAGS_GUEST_BITS_DEFAULT,
+    PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT | PDM_DEVREG_FLAGS_GUEST_BITS_DEFAULT | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0,
     /* fClass */
     PDM_DEVREG_CLASS_VMM_DEV,
@@ -2990,5 +3032,5 @@
     NULL,
     /* pfnRelocate */
-    NULL,
+    vmmdevRelocate,
     /* pfnIOCtl */
     NULL,
Index: /trunk/src/VBox/Devices/VMMDev/VMMDevState.h
===================================================================
--- /trunk/src/VBox/Devices/VMMDev/VMMDevState.h	(revision 30723)
+++ /trunk/src/VBox/Devices/VMMDev/VMMDevState.h	(revision 30724)
@@ -164,5 +164,5 @@
     /* guest ram size */
     uint64_t    cbGuestRAM;
-    
+
     /* unique session id; the id will be different after each start, reset or restore of the VM. */
     uint64_t    idSession;
@@ -215,13 +215,21 @@
 
     /** FLag whether CPU hotplug events are monitored */
-    bool                 fCpuHotPlugEventsEnabled;
+    bool                fCpuHotPlugEventsEnabled;
     /** CPU hotplug event */
-    VMMDevCpuEventType   enmCpuHotPlugEvent;
+    VMMDevCpuEventType  enmCpuHotPlugEvent;
     /** Core id of the CPU to change */
-    uint32_t             idCpuCore;
+    uint32_t            idCpuCore;
     /** Package id of the CPU to changhe */
-    uint32_t             idCpuPackage;
-
-    uint32_t             StatMemBalloonChunks;
+    uint32_t            idCpuPackage;
+
+    uint32_t            StatMemBalloonChunks;
+
+    /** Set if RC/R0 is enabled. */
+    bool                fRZEnabled;
+    /** Set if testing is enabled. */
+    bool                fTestingEnabled;
+    /** The high timestamp value. */
+    uint32_t            u32TestingHighTimestamp;
+
 } VMMDevState;
 AssertCompileMemberAlignment(VMMDevState, CritSect, 8);
Index: /trunk/src/VBox/Devices/VMMDev/VMMDevTesting.cpp
===================================================================
--- /trunk/src/VBox/Devices/VMMDev/VMMDevTesting.cpp	(revision 30724)
+++ /trunk/src/VBox/Devices/VMMDev/VMMDevTesting.cpp	(revision 30724)
@@ -0,0 +1,258 @@
+/* $Id$ */
+/** @file
+ * VMMDev - Testing Extensions.
+ */
+
+/*
+ * Copyright (C) 2010 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_DEV_VMM
+#include <VBox/VMMDev.h>
+#include <VBox/log.h>
+#include <VBox/err.h>
+
+#include <iprt/asm.h>
+#include <iprt/assert.h>
+#include <iprt/string.h>
+#include <iprt/time.h>
+
+#include "VMMDevState.h"
+#include "VMMDevTesting.h"
+
+
+#ifndef VBOX_WITHOUT_TESTING_FEATURES
+
+/**
+ * @callback_method_impl{FNIOMMMIOWRITE}
+ */
+PDMBOTHCBDECL(int) vmmdevTestingMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb)
+{
+    switch (GCPhysAddr)
+    {
+        case VMMDEV_TESTING_MMIO_NOP:
+            switch (cb)
+            {
+                case 8:
+                case 4:
+                case 2:
+                case 1:
+                    break;
+                default:
+                    AssertFailed();
+                    return VERR_INTERNAL_ERROR_5;
+            }
+            return VINF_SUCCESS;
+
+        default:
+            break;
+    }
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * @callback_method_impl{FNIOMMMIOREAD}
+ */
+PDMBOTHCBDECL(int) vmmdevTestingMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb)
+{
+    switch (GCPhysAddr)
+    {
+        case VMMDEV_TESTING_MMIO_NOP:
+            switch (cb)
+            {
+                case 8:
+                    *(uint64_t *)pv = VMMDEV_TESTING_NOP_RET | ((uint64_t)VMMDEV_TESTING_NOP_RET << 32);
+                    break;
+                case 4:
+                    *(uint32_t *)pv = VMMDEV_TESTING_NOP_RET;
+                    break;
+                case 2:
+                    *(uint16_t *)pv = (uint16_t)VMMDEV_TESTING_NOP_RET;
+                    break;
+                case 1:
+                    *(uint8_t *)pv  = (uint8_t)VMMDEV_TESTING_NOP_RET;
+                    break;
+                default:
+                    AssertFailed();
+                    return VERR_INTERNAL_ERROR_5;
+            }
+            return VINF_SUCCESS;
+
+
+        default:
+            break;
+    }
+
+    return VINF_IOM_MMIO_UNUSED_FF;
+}
+
+
+/**
+ * @callback_method_impl{FNIOMIOPORTOUT}
+ */
+PDMBOTHCBDECL(int) vmmdevTestingIoWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
+{
+    switch (Port)
+    {
+        case VMMDEV_TESTING_IOPORT_NOP:
+            switch (cb)
+            {
+                case 4:
+                case 2:
+                case 1:
+                    break;
+                default:
+                    AssertFailed();
+                    return VERR_INTERNAL_ERROR_2;
+            }
+            return VINF_SUCCESS;
+
+        case VMMDEV_TESTING_IOPORT_TS_LOW:
+            break;
+
+        case VMMDEV_TESTING_IOPORT_TS_HIGH:
+            break;
+
+        default:
+            break;
+    }
+
+    return VERR_IOM_IOPORT_UNUSED;
+}
+
+
+/**
+ * @callback_method_impl{FNIOMIOPORTIN}
+ */
+PDMBOTHCBDECL(int) vmmdevTestingIoRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
+{
+    VMMDevState *pThis = PDMINS_2_DATA(pDevIns, VMMDevState *);
+
+    switch (Port)
+    {
+        case VMMDEV_TESTING_IOPORT_NOP:
+            switch (cb)
+            {
+                case 4:
+                case 2:
+                case 1:
+                    break;
+                default:
+                    AssertFailed();
+                    return VERR_INTERNAL_ERROR_2;
+            }
+            *pu32 = VMMDEV_TESTING_NOP_RET;
+            return VINF_SUCCESS;
+
+        case VMMDEV_TESTING_IOPORT_TS_LOW:
+            if (cb == 4)
+            {
+                uint64_t NowTS = RTTimeNanoTS();
+                *pu32 = (uint32_t)NowTS;
+                pThis->u32TestingHighTimestamp = (uint32_t)(NowTS >> 32);
+                return VINF_SUCCESS;
+            }
+            break;
+
+        case VMMDEV_TESTING_IOPORT_TS_HIGH:
+            if (cb == 4)
+            {
+                *pu32 = pThis->u32TestingHighTimestamp;
+                return VINF_SUCCESS;
+            }
+            break;
+
+        default:
+            break;
+    }
+
+    return VERR_IOM_IOPORT_UNUSED;
+}
+
+
+#ifdef IN_RING3
+
+/**
+ * Initializes the testing part of the VMMDev if enabled.
+ *
+ * @returns VBox status code.
+ * @param   pDevIns             The VMMDev device instance.
+ */
+int vmmdevTestingInitialize(PPDMDEVINS pDevIns)
+{
+    VMMDevState *pThis = PDMINS_2_DATA(pDevIns, VMMDevState *);
+    if (!pThis->fTestingEnabled)
+        return VINF_SUCCESS;
+
+    /*
+     * Register a chunk of MMIO memory that we'll use for various
+     * tests interfaces.
+     */
+    int rc = PDMDevHlpMMIORegister(pDevIns, VMMDEV_TESTING_MMIO_BASE, VMMDEV_TESTING_MMIO_SIZE, NULL /*pvUser*/,
+                                   vmmdevTestingMmioWrite,
+                                   vmmdevTestingMmioRead,
+                                   NULL /*pfnFill*/,
+                                   "VMMDev Testing");
+    AssertRCReturn(rc, rc);
+    if (pThis->fRZEnabled)
+    {
+        rc = PDMDevHlpMMIORegisterR0(pDevIns, VMMDEV_TESTING_MMIO_BASE, VMMDEV_TESTING_MMIO_SIZE, NIL_RTR0PTR /*pvUser*/,
+                                     "vmmdevTestingMmioWrite",
+                                     "vmmdevTestingMmioRead",
+                                     NULL /*pszFill*/);
+        AssertRCReturn(rc, rc);
+        rc = PDMDevHlpMMIORegisterRC(pDevIns, VMMDEV_TESTING_MMIO_BASE, VMMDEV_TESTING_MMIO_SIZE, NIL_RTRCPTR /*pvUser*/,
+                                     "vmmdevTestingMmioWrite",
+                                     "vmmdevTestingMmioRead",
+                                     NULL /*pszFill*/);
+        AssertRCReturn(rc, rc);
+    }
+
+
+    /*
+     * Register the I/O ports used for testing.
+     */
+    rc = PDMDevHlpIOPortRegister(pDevIns, VMMDEV_TESTING_IOPORT_BASE, VMMDEV_TESTING_IOPORT_COUNT, NULL,
+                                 vmmdevTestingIoWrite,
+                                 vmmdevTestingIoRead,
+                                 NULL /*pfnOutStr*/,
+                                 NULL /*pfnInStr*/,
+                                 "VMMDev Testing");
+    AssertRCReturn(rc, rc);
+    if (pThis->fRZEnabled)
+    {
+        rc = PDMDevHlpIOPortRegisterR0(pDevIns, VMMDEV_TESTING_IOPORT_BASE, VMMDEV_TESTING_IOPORT_COUNT, NIL_RTR0PTR /*pvUser*/,
+                                       "vmmdevTestingIoWrite",
+                                       "vmmdevTestingIoRead",
+                                       NULL /*pszOutStr*/,
+                                       NULL /*pszInStr*/,
+                                       "VMMDev Testing");
+        AssertRCReturn(rc, rc);
+        rc = PDMDevHlpIOPortRegisterRC(pDevIns, VMMDEV_TESTING_IOPORT_BASE, VMMDEV_TESTING_IOPORT_COUNT, NIL_RTRCPTR /*pvUser*/,
+                                       "vmmdevTestingIoWrite",
+                                       "vmmdevTestingIoRead",
+                                       NULL /*pszOutStr*/,
+                                       NULL /*pszInStr*/,
+                                       "VMMDev Testing");
+        AssertRCReturn(rc, rc);
+    }
+
+    return VINF_SUCCESS;
+}
+
+#endif /* IN_RING3 */
+#endif /* !VBOX_WITHOUT_TESTING_FEATURES */
+
Index: /trunk/src/VBox/Devices/VMMDev/VMMDevTesting.h
===================================================================
--- /trunk/src/VBox/Devices/VMMDev/VMMDevTesting.h	(revision 30724)
+++ /trunk/src/VBox/Devices/VMMDev/VMMDevTesting.h	(revision 30724)
@@ -0,0 +1,32 @@
+/* $Id$ */
+/** @file
+ * VMMDev - Guest <-> VMM/Host communication device, internal header.
+ */
+
+/*
+ * Copyright (C) 2010 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+#ifndef ___VMMDev_VMMDevTesting_h
+#define ___VMMDev_VMMDevTesting_h
+
+#include <VBox/types.h>
+#include <VBox/VMMDevTesting.h>
+
+RT_C_DECLS_BEGIN
+
+int vmmdevTestingInitialize(PPDMDEVINS pDevIns);
+
+RT_C_DECLS_END
+
+#endif
+
Index: /trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp	(revision 30723)
+++ /trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp	(revision 30724)
@@ -1898,4 +1898,5 @@
     rc = CFGMR3InsertInteger(pInst, "PCIDeviceNo",    4);                           UPDATE_RC();
     rc = CFGMR3InsertInteger(pInst, "PCIFunctionNo",  0);                           UPDATE_RC();
+    rc = CFGMR3InsertInteger(pCfg,  "RamSize",        g_u32MemorySizeMB * _1M);     UPDATE_RC();
 
     /* the VMM device's Main driver */
Index: /trunk/src/VBox/Main/ConsoleImpl2.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 30723)
+++ /trunk/src/VBox/Main/ConsoleImpl2.cpp	(revision 30724)
@@ -1616,4 +1616,5 @@
     Bstr hwVersion;
     hrc = pMachine->COMGETTER(HardwareVersion)(hwVersion.asOutParam());                 H();
+    rc = CFGMR3InsertInteger(pCfg,  "RamSize",              cbRam);                     RC_CHECK();
     if (hwVersion.compare(Bstr("1")) == 0) /* <= 2.0.x */
     {
Index: /trunk/src/VBox/VMM/VMMGC/VMMGC.def
===================================================================
--- /trunk/src/VBox/VMM/VMMGC/VMMGC.def	(revision 30723)
+++ /trunk/src/VBox/VMM/VMMGC/VMMGC.def	(revision 30724)
@@ -91,4 +91,5 @@
     RTTimeNanoTSLFenceSync
     RTTimeNanoTSLFenceAsync
+    RTTimeNanoTS
     RTCrc32
     ASMMultU64ByU32DivByU32             ; not-os2
Index: /trunk/src/VBox/VMM/VMMR0/VMMR0.def
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/VMMR0.def	(revision 30723)
+++ /trunk/src/VBox/VMM/VMMR0/VMMR0.def	(revision 30724)
@@ -83,4 +83,5 @@
     RTTimeNanoTSLFenceAsync
     RTTimeSystemNanoTS
+    RTTimeNanoTS
     ASMMultU64ByU32DivByU32             ; not-os2
     ASMAtomicXchgU8                     ; not-x86
