diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:01:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:01:46 +0000 |
commit | f8fe689a81f906d1b91bb3220acde2a4ecb14c5b (patch) | |
tree | 26484e9d7e2c67806c2d1760196ff01aaa858e8c /src/VBox/Devices/testcase | |
parent | Initial commit. (diff) | |
download | virtualbox-upstream.tar.xz virtualbox-upstream.zip |
Adding upstream version 6.0.4-dfsg.upstream/6.0.4-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/Devices/testcase')
-rw-r--r-- | src/VBox/Devices/testcase/Makefile.kmk | 130 | ||||
-rw-r--r-- | src/VBox/Devices/testcase/tstDevice.cpp | 918 | ||||
-rw-r--r-- | src/VBox/Devices/testcase/tstDeviceInternal.h | 241 | ||||
-rw-r--r-- | src/VBox/Devices/testcase/tstDevicePdmDevHlp.cpp | 1917 | ||||
-rw-r--r-- | src/VBox/Devices/testcase/tstDevicePlugin.h | 128 | ||||
-rw-r--r-- | src/VBox/Devices/testcase/tstDeviceSUP.cpp | 251 | ||||
-rw-r--r-- | src/VBox/Devices/testcase/tstDeviceStructSize.cpp | 437 | ||||
-rw-r--r-- | src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp | 2138 | ||||
-rw-r--r-- | src/VBox/Devices/testcase/tstDeviceVMM.cpp | 1108 | ||||
-rw-r--r-- | src/VBox/Devices/testcase/tstDeviceVMMInternal.h | 364 | ||||
-rw-r--r-- | src/VBox/Devices/testcase/tstDeviceVMMStubs.cpp | 991 |
11 files changed, 8623 insertions, 0 deletions
diff --git a/src/VBox/Devices/testcase/Makefile.kmk b/src/VBox/Devices/testcase/Makefile.kmk new file mode 100644 index 00000000..3449006b --- /dev/null +++ b/src/VBox/Devices/testcase/Makefile.kmk @@ -0,0 +1,130 @@ +# $Id: Makefile.kmk $ +## @file +# Sub-Makefile for the device testcases. +# + +# +# Copyright (C) 2006-2019 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. +# + +SUB_DEPTH = ../../../.. +include $(KBUILD_PATH)/subheader.kmk + +# +# Globals +# +VBOX_PATH_DEVICES_SRC ?= $(PATH_ROOT)/src/VBox/Devices +VBOX_PATH_VMM_DEVICES_SRC ?= $(PATH_ROOT)/src/VBox/VMM/include +VBOX_DEVICES_TEST_OUT_DIR := $(PATH_TARGET)/Devices/testcase +BLDDIRS += $(VBOX_DEVICES_TEST_OUT_DIR) + +VBOX_DEVICES_TESTS_FEATURES = \ + $(if $(VBOX_WITH_AHCI),VBOX_WITH_AHCI,) \ + $(if $(VBOX_WITH_BUSLOGIC),VBOX_WITH_BUSLOGIC,) \ + $(if $(VBOX_WITH_CRHGSMI),VBOX_WITH_CRHGSMI,) \ + $(if $(VBOX_WITH_E1000),VBOX_WITH_E1000,) \ + $(if $(VBOX_WITH_EHCI_IMPL),VBOX_WITH_EHCI_IMPL,) \ + $(if $(VBOX_WITH_HGSMI),VBOX_WITH_HGSMI,) \ + $(if $(VBOX_WITH_HP_HDA),VBOX_WITH_HP_HDA,) \ + $(if $(VBOX_WITH_INTEL_HDA),VBOX_WITH_INTEL_HDA,) \ + $(if $(VBOX_WITH_NVIDIA_HDA),VBOX_WITH_NVIDIA_HDA,) \ + $(if $(VBOX_WITH_LSILOGIC),VBOX_WITH_LSILOGIC,) \ + $(if $(VBOX_WITH_NVME_IMPL),VBOX_WITH_NVME_IMPL,) \ + $(if $(VBOX_WITH_PCI_PASSTHROUGH_IMPL),VBOX_WITH_PCI_PASSTHROUGH_IMPL,) \ + $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \ + $(if $(VBOX_WITH_SCSI),VBOX_WITH_SCSI,) \ + $(if $(VBOX_WITH_USB),VBOX_WITH_USB,) \ + $(if $(VBOX_WITH_VDMA),VBOX_WITH_VDMA,) \ + $(if $(VBOX_WITH_VIDEOHWACCEL),VBOX_WITH_VIDEOHWACCEL,) \ + $(if $(VBOX_WITH_VIRTIO),VBOX_WITH_VIRTIO,) \ + $(if $(VBOX_WITH_VMSVGA),VBOX_WITH_VMSVGA,) \ + $(if $(VBOX_WITH_WDDM),VBOX_WITH_WDDM,) \ + $(if $(VBOX_WITH_XHCI_IMPL),VBOX_WITH_XHCI_IMPL,) \ + $(VBOX_AUDIO_DEFS) + +# +# We setup one 'other' target for executing the structure & alignment +# validation testcases. Perhaps a bit hackish, but extremely useful. +# +ifeq ($(KBUILD_TARGET),$(KBUILD_HOST)) + ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH)),) + OTHERS += \ + $(VBOX_DEVICES_TEST_OUT_DIR)/tstDeviceStructSize.run + endif +endif + +# The normal testing pass. +TESTING += \ + $(VBOX_DEVICES_TEST_OUT_DIR)/tstDeviceStructSize.run + +ifdef VBOX_WITH_RAW_MODE + # + # The testcase generator. + # + PROGRAMS += tstDeviceStructSizeRC + tstDeviceStructSizeRC_TEMPLATE = VBoxRcExe + tstDeviceStructSizeRC_DEFS = $(VBOX_DEVICES_TESTS_FEATURES) + tstDeviceStructSizeRC_SOURCES = tstDeviceStructSizeRC.cpp + tstDeviceStructSizeRC_INCS = \ + $(VBOX_PATH_DEVICES_SRC)/build \ + $(VBOX_PATH_DEVICES_SRC)/Bus \ + $(VBOX_DEVICES_TEST_OUT_DIR) \ + $(VBOX_GRAPHICS_INCS) + tstDeviceStructSizeRC_INCS += $(VBOX_PATH_VMM_DEVICES_SRC) +endif # VBOX_WITH_RAW_MODE + +# +# The testcase it self. +# +PROGRAMS += tstDeviceStructSize +tstDeviceStructSize_TEMPLATE = VBOXR3AUTOTST +tstDeviceStructSize_DEFS = $(VBOX_DEVICES_TESTS_FEATURES) +tstDeviceStructSize_INCS = \ + $(VBOX_PATH_DEVICES_SRC)/build \ + $(VBOX_PATH_DEVICES_SRC)/Bus \ + $(VBOX_DEVICES_TEST_OUT_DIR) \ + $(VBOX_GRAPHICS_INCS) +tstDeviceStructSize_SOURCES = tstDeviceStructSize.cpp +tstDeviceStructSize_CLEAN = \ + $(VBOX_DEVICES_TEST_OUT_DIR)/tstDeviceStructSizeRC.h \ + $(VBOX_DEVICES_TEST_OUT_DIR)/tstDeviceStructSize.run +ifdef VBOX_WITH_RAW_MODE + tstDeviceStructSize.cpp_DEPS = $(VBOX_DEVICES_TEST_OUT_DIR)/tstDeviceStructSizeRC.h +endif + tstDeviceStructSize_INCS += $(VBOX_PATH_VMM_DEVICES_SRC) + +# +# Run rule for tstDeviceStructSize. +# + +# 1. Dump selected structure in the VMMRC.rc debug info. +# 2. Generate a testcase from the dump +## future + +ifdef VBOX_WITH_RAW_MODE +# 1&2. Manually dump selected structures and members. +$(VBOX_DEVICES_TEST_OUT_DIR)/tstDeviceStructSizeRC.h: $$(tstDeviceStructSizeRC_1_STAGE_TARGET) | $$(dir $$@) + $(call MSG_GENERATE,,$@) + $(QUIET)$(REDIRECT) -wo $@ -- $^ +endif + +# 3. run it. +$(VBOX_DEVICES_TEST_OUT_DIR)/tstDeviceStructSize.run: $$(tstDeviceStructSize_1_STAGE_TARGET) | $$(dir $$@) + $(QUIET)$(RM) -f $@ + $^ + $(QUIET)$(APPEND) "$@" "done" + +# alias for the struct test. +run-struct-tests: $(VBOX_DEVICES_TEST_OUT_DIR)/tstDeviceStructSize.run + + +include $(FILE_KBUILD_SUB_FOOTER) + diff --git a/src/VBox/Devices/testcase/tstDevice.cpp b/src/VBox/Devices/testcase/tstDevice.cpp new file mode 100644 index 00000000..530dbeb5 --- /dev/null +++ b/src/VBox/Devices/testcase/tstDevice.cpp @@ -0,0 +1,918 @@ +/* $Id: tstDevice.cpp $ */ +/** @file + * tstDevice - Test framework for PDM devices/drivers + */ + +/* + * Copyright (C) 2017-2019 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_DEFAULT /** @todo */ +#include <VBox/types.h> +#include <VBox/sup.h> +#include <VBox/version.h> +#include <iprt/assert.h> +#include <iprt/ctype.h> +#include <iprt/getopt.h> +#include <iprt/initterm.h> +#include <iprt/ldr.h> +#include <iprt/log.h> +#include <iprt/list.h> +#include <iprt/mem.h> +#include <iprt/once.h> +#include <iprt/path.h> +#include <iprt/string.h> +#include <iprt/stream.h> +#include <iprt/trace.h> + +#include "tstDeviceInternal.h" + + +/********************************************************************************************************************************* +* Defined Constants And Macros * +*********************************************************************************************************************************/ + + +/********************************************************************************************************************************* +* Structures and Typedefs * +*********************************************************************************************************************************/ + + +/** + * Testcase plugin descriptor. + */ +typedef struct TSTDEVPLUGIN +{ + /** Node for the plugin list. */ + RTLISTNODE NdPlugins; + /** Copy of the filename. */ + char *pszFilename; + /** Loader handle. */ + RTLDRMOD hMod; + /** Number of references to this plugin. */ + volatile uint32_t cRefs; +} TSTDEVPLUGIN; +/** Pointer to a device plugin descriptor. */ +typedef TSTDEVPLUGIN *PTSTDEVPLUGIN; +/** Pointer to a const plugin descriptor. */ +typedef const TSTDEVPLUGIN *PCTSTDEVPLUGIN; + + +/** + * Testcase descriptor. + */ +typedef struct TSTDEVTESTCASE +{ + /** Node for the list of registered testcases. */ + RTLISTNODE NdTestcases; + /** Pointer to the plugin the testcase belongs to. */ + PCTSTDEVPLUGIN pPlugin; + /** Pointer to the testcase descriptor. */ + PCTSTDEVTESTCASEREG pTestcaseReg; +} TSTDEVTESTCASE; +/** Pointer to a testcase descriptor. */ +typedef TSTDEVTESTCASE *PTSTDEVTESTCASE; +/** Pointer to a constant testcase descriptor. */ +typedef const TSTDEVTESTCASE *PCTSTDEVTESTCASE; + + +/** + * PDM R0/RC module trampoline descriptor. + */ +#pragma pack(1) +typedef struct TSTDEVPDMMODTRAMPOLINE +{ + /** Jump instruction. */ + uint8_t abJmp[6]; + /** Address to jump to. */ + uintptr_t AddrTarget; + /** Padding to get a 16byte aligned structure. */ + uint8_t abPadding[HC_ARCH_BITS == 64 ? 2 : 5]; +} TSTDEVPDMMODTRAMPOLINE; +#pragma pack() +AssertCompileSize(TSTDEVPDMMODTRAMPOLINE, 16); +/** Pointer to a trampoline descriptor. */ +typedef TSTDEVPDMMODTRAMPOLINE *PTSTDEVPDMMODTRAMPOLINE; + +/** + * PDM module descriptor. + */ +typedef struct TSTDEVPDMMOD +{ + /** Node for the module list. */ + RTLISTNODE NdPdmMods; + /** Type of module (R3/R0/RC). */ + TSTDEVPDMMODTYPE enmType; + /** Copy of the filename. */ + char *pszFilename; + /** Loader handle. */ + RTLDRMOD hLdrMod; + /** Number of references to this plugin. */ + volatile uint32_t cRefs; + /** R0/RC Module type dependent data. */ + struct + { + /** The exectuable image bits. */ + void *pvBits; + /** Size of the memory buffer. */ + size_t cbBits; + /** Pointer to the executable memory containing the trampoline code. */ + uint8_t *pbTrampoline; + /** Number of trampoline entries supported. */ + uint32_t cTrampolinesMax; + /** Number of trampoline entries used. */ + uint32_t cTrampolines; + /** Pointer to the next unused trampoline entry. */ + PTSTDEVPDMMODTRAMPOLINE pTrampolineNext; + } R0Rc; +} TSTDEVPDMMOD; +/** Pointer to a PDM module descriptor. */ +typedef TSTDEVPDMMOD *PTSTDEVPDMMOD; +/** Pointer to a const PDM module descriptor. */ +typedef const TSTDEVPDMMOD *PCTSTDEVPDMMOD; + +/** + * PDM device descriptor. + */ +typedef struct TSTDEVPDMDEV +{ + /** Node for the known device list. */ + RTLISTNODE NdPdmDevs; + /** Pointer to the PDM module containing the device. */ + PCTSTDEVPDMMOD pPdmMod; + /** Device registration structure. */ + const struct PDMDEVREG *pReg; +} TSTDEVPDMDEV; +/** Pointer to a PDM device descriptor .*/ +typedef TSTDEVPDMDEV *PTSTDEVPDMDEV; +/** Pointer to a constant PDM device descriptor .*/ +typedef const TSTDEVPDMDEV *PCTSTDEVPDMDEV; + + +/** + * Internal callback structure pointer. + * The main purpose is to define the extra data we associate + * with PDMDEVREGCB so we can find the plugin the device is associated with etc. + */ +typedef struct TSTDEVPDMDEVREGCBINT +{ + /** The callback structure. */ + PDMDEVREGCB Core; + /** A bit of padding. */ + uint32_t u32[4]; + /** Pointer to plugin. */ + PTSTDEVPDMMOD pMod; +} TSTDEVPDMDEVREGCBINT; +/** Pointer to a PDMDEVREGCBINT structure. */ +typedef TSTDEVPDMDEVREGCBINT *PTSTDEVPDMDEVREGCBINT; +/** Pointer to a const PDMDEVREGCBINT structure. */ +typedef const TSTDEVPDMDEVREGCBINT *PCTSTDEVPDMDEVREGCBINT; + + +typedef struct TSTDEVPDMR0IMPORTS +{ + /** The symbol name. */ + const char *pszSymbol; + /** The pointer. */ + PFNRT pfn; +} TSTDEVPDMR0IMPORTS; +typedef const TSTDEVPDMR0IMPORTS *PCTSTDEVPDMR0IMPORTS; + + +/********************************************************************************************************************************* +* Global Variables * +*********************************************************************************************************************************/ +/** List of registered testcase plugins. */ +RTLISTANCHOR g_LstPlugins; +/** List of registered testcases. */ +RTLISTANCHOR g_LstTestcases; +/** List of registered PDM modules. */ +RTLISTANCHOR g_LstPdmMods; +/** List of registered PDM devices. */ +RTLISTANCHOR g_LstPdmDevs; + +extern const TSTDEVVMMCALLBACKS g_tstDevVmmCallbacks; + +/** + * PDM R0 imports we implement. + */ +static const TSTDEVPDMR0IMPORTS g_aPdmR0Imports[] = +{ + {"IOMMMIOMapMMIO2Page", (PFNRT)IOMMMIOMapMMIO2Page}, + {"IOMMMIOResetRegion", (PFNRT)IOMMMIOResetRegion}, + {"IntNetR0IfSend", (PFNRT)/*IntNetR0IfSend*/NULL}, + {"IntNetR0IfSetPromiscuousMode", (PFNRT)/*IntNetR0IfSetPromiscuousMode*/NULL}, + {"PDMCritSectEnterDebug", (PFNRT)PDMCritSectEnterDebug}, + {"PDMCritSectIsOwner", (PFNRT)PDMCritSectIsOwner}, + {"PDMCritSectLeave", (PFNRT)PDMCritSectLeave}, + {"PDMCritSectTryEnterDebug", (PFNRT)PDMCritSectTryEnterDebug}, + {"PDMHCCritSectScheduleExitEvent", (PFNRT)PDMHCCritSectScheduleExitEvent}, + {"PDMNsAllocateBandwidth", (PFNRT)PDMNsAllocateBandwidth}, + {"PDMQueueAlloc", (PFNRT)PDMQueueAlloc}, + {"PDMQueueInsert", (PFNRT)PDMQueueInsert}, + {"PGMHandlerPhysicalPageTempOff", (PFNRT)PGMHandlerPhysicalPageTempOff}, + {"PGMShwMakePageWritable", (PFNRT)PGMShwMakePageWritable}, + {"RTAssertMsg1Weak", (PFNRT)RTAssertMsg1Weak}, + {"RTAssertMsg2Weak", (PFNRT)RTAssertMsg2Weak}, + {"RTAssertShouldPanic", (PFNRT)RTAssertShouldPanic}, + {"RTLogDefaultInstanceEx", (PFNRT)RTLogDefaultInstanceEx}, + {"RTLogLoggerEx", (PFNRT)RTLogLoggerEx}, + {"RTLogRelGetDefaultInstanceEx", (PFNRT)RTLogRelGetDefaultInstanceEx}, + {"RTOnceSlow", (PFNRT)RTOnceSlow}, + {"RTR0AssertPanicSystem", (PFNRT)0x10101010}, + {"RTThreadSleep", (PFNRT)RTThreadSleep}, + {"RTTimeMilliTS", (PFNRT)RTTimeMilliTS}, + {"RTTimeNanoTS", (PFNRT)RTTimeNanoTS}, + {"RTTraceBufAddMsgF", (PFNRT)RTTraceBufAddMsgF}, + {"SUPSemEventSignal", (PFNRT)SUPSemEventSignal}, + {"TMTimerGet", (PFNRT)TMTimerGet}, + {"TMTimerGetFreq", (PFNRT)TMTimerGetFreq}, + {"TMTimerIsActive", (PFNRT)TMTimerIsActive}, + {"TMTimerIsLockOwner", (PFNRT)TMTimerIsLockOwner}, + {"TMTimerLock", (PFNRT)TMTimerLock}, + {"TMTimerSet", (PFNRT)TMTimerSet}, + {"TMTimerSetFrequencyHint", (PFNRT)TMTimerSetFrequencyHint}, + {"TMTimerSetMicro", (PFNRT)TMTimerSetMicro}, + {"TMTimerSetMillies", (PFNRT)TMTimerSetMillies}, + {"TMTimerSetNano", (PFNRT)TMTimerSetNano}, + {"TMTimerStop", (PFNRT)TMTimerStop}, + {"TMTimerUnlock", (PFNRT)TMTimerUnlock}, + {"nocrt_memcmp", (PFNRT)memcmp}, + {"nocrt_memcpy", (PFNRT)memcpy}, + {"nocrt_memmove", (PFNRT)memmove}, + {"nocrt_memset", (PFNRT)memset}, + {"nocrt_strlen", (PFNRT)strlen}, +}; + + +/********************************************************************************************************************************* +* Internal Functions * +*********************************************************************************************************************************/ + +#if 0 +/** + * Parses the options given to the testcase. + * + * @returns Process status code. + * @param cArgs Number of arguments given. + * @param paszArgs Pointer to the argument vector. + */ +static RTEXITCODE tstDevParseOptions(int cArgs, char *paszArgs[]) +{ + static RTGETOPTDEF const s_aOptions[] = + { + }; + + + int ch; + RTGETOPTUNION Value; + RTGETOPTSTATE GetState; + RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0 /* fFlags */); + while ((ch = RTGetOpt(&GetState, &Value))) + { + switch (ch) + { + default: + return RTGetOptPrintError(ch, &Value); + } + } +} +#endif + + +/** + * Checks whether the given testcase name is already existing. + * + * @returns Pointer to existing testcase, NULL if not found. + * @param pszFilename The filename to check. + */ +static PCTSTDEVTESTCASE tstDevTestcaseFind(const char *pszName) +{ + PCTSTDEVTESTCASE pIt; + RTListForEach(&g_LstTestcases, pIt, TSTDEVTESTCASE, NdTestcases) + { + if (!RTStrCmp(pIt->pTestcaseReg->szName, pszName)) + return pIt; + } + + return NULL; +} + + +/** + * @interface_method_impl{TSTDEVPLUGINREGISTER,pfnRegisterTestcase} + */ +static DECLCALLBACK(int) tstDevRegisterTestcase(void *pvUser, PCTSTDEVTESTCASEREG pTestcaseReg) +{ + int rc = VINF_SUCCESS; + PTSTDEVPLUGIN pPlugin = (PTSTDEVPLUGIN)pvUser; + + /* Try to find a testcase with the name first. */ + if (!tstDevTestcaseFind(pTestcaseReg->szName)) + { + PTSTDEVTESTCASE pTestcase = (PTSTDEVTESTCASE)RTMemAllocZ(sizeof(TSTDEVPLUGIN)); + if (RT_LIKELY(pTestcase)) + { + pTestcase->pPlugin = pPlugin; + pPlugin->cRefs++; + pTestcase->pTestcaseReg = pTestcaseReg; + RTListAppend(&g_LstTestcases, &pTestcase->NdTestcases); + return VINF_SUCCESS; + } + else + rc = VERR_NO_MEMORY; + } + else + rc = VERR_ALREADY_EXISTS; + + return rc; +} + + +/** + * Checks whether the given plugin filename was already loaded. + * + * @returns Pointer to already loaded plugin, NULL if not found. + * @param pszFilename The filename to check. + */ +static PCTSTDEVPLUGIN tstDevPluginFind(const char *pszFilename) +{ + PCTSTDEVPLUGIN pIt; + RTListForEach(&g_LstPlugins, pIt, TSTDEVPLUGIN, NdPlugins) + { + if (!RTStrCmp(pIt->pszFilename, pszFilename)) + return pIt; + } + + return NULL; +} + + +/** + * Tries to loads the given plugin. + * + * @returns VBox status code. + * @param pszFilename The filename to load. + */ +static int tstDevLoadPlugin(const char *pszFilename) +{ + int rc = VINF_SUCCESS; + + /* Check whether the plugin is loaded first. */ + if (!tstDevPluginFind(pszFilename)) + { + PTSTDEVPLUGIN pPlugin = (PTSTDEVPLUGIN)RTMemAllocZ(sizeof(TSTDEVPLUGIN)); + if (RT_LIKELY(pPlugin)) + { + pPlugin->pszFilename = RTStrDup(pszFilename); + pPlugin->cRefs = 1; + rc = RTLdrLoad(pszFilename, &pPlugin->hMod); + if (RT_SUCCESS(rc)) + { + TSTDEVPLUGINREGISTER TestcaseRegister; + PFNTSTDEVPLUGINLOAD pfnPluginLoad = NULL; + + TestcaseRegister.pfnRegisterTestcase = tstDevRegisterTestcase; + + rc = RTLdrGetSymbol(pPlugin->hMod, TSTDEV_PLUGIN_LOAD_NAME, (void**)&pfnPluginLoad); + if (RT_FAILURE(rc) || !pfnPluginLoad) + { + LogFunc(("error resolving the entry point %s in plugin %s, rc=%Rrc, pfnPluginLoad=%#p\n", + TSTDEV_PLUGIN_LOAD_NAME, pszFilename, rc, pfnPluginLoad)); + if (RT_SUCCESS(rc)) + rc = VERR_SYMBOL_NOT_FOUND; + } + + if (RT_SUCCESS(rc)) + { + /* Get the function table. */ + rc = pfnPluginLoad(pPlugin, &TestcaseRegister); + } + else + LogFunc(("ignored plugin '%s': rc=%Rrc\n", pszFilename, rc)); + + /* Create a plugin entry on success. */ + if (RT_SUCCESS(rc)) + { + RTListAppend(&g_LstPlugins, &pPlugin->NdPlugins); + return VINF_SUCCESS; + } + else + RTLdrClose(pPlugin->hMod); + } + + RTMemFree(pPlugin); + } + else + rc = VERR_NO_MEMORY; + } + + return rc; +} + + +/** + * Checks whether the given testcase name is already existing. + * + * @returns Pointer to already loaded plugin, NULL if not found. + * @param pszFilename The filename to check. + */ +static PCTSTDEVPDMDEV tstDevPdmDeviceFind(const char *pszName) +{ + PCTSTDEVPDMDEV pIt; + RTListForEach(&g_LstPdmDevs, pIt, TSTDEVPDMDEV, NdPdmDevs) + { + if (!RTStrCmp(pIt->pReg->szName, pszName)) + return pIt; + } + + return NULL; +} + + +/** + * Checks that a PDMDRVREG::szName, PDMDEVREG::szName or PDMUSBREG::szName + * field contains only a limited set of ASCII characters. + * + * @returns true / false. + * @param pszName The name to validate. + */ +bool tstDevPdmR3IsValidName(const char *pszName) +{ + char ch; + while ( (ch = *pszName) != '\0' + && ( RT_C_IS_ALNUM(ch) + || ch == '-' + || ch == ' ' /** @todo disallow this! */ + || ch == '_') ) + pszName++; + return ch == '\0'; +} + + +/** + * @interface_method_impl{PDMDEVREGCB,pfnRegister} + */ +static DECLCALLBACK(int) tstDevPdmR3DevReg_Register(PPDMDEVREGCB pCallbacks, PCPDMDEVREG pReg) +{ + /* + * Validate the registration structure (mostly copy and paste from PDMDevice.cpp). + */ + Assert(pReg); + AssertMsgReturn(pReg->u32Version == PDM_DEVREG_VERSION, + ("Unknown struct version %#x!\n", pReg->u32Version), + VERR_PDM_UNKNOWN_DEVREG_VERSION); + + AssertMsgReturn( pReg->szName[0] + && strlen(pReg->szName) < sizeof(pReg->szName) + && tstDevPdmR3IsValidName(pReg->szName), + ("Invalid name '%.*s'\n", sizeof(pReg->szName), pReg->szName), + VERR_PDM_INVALID_DEVICE_REGISTRATION); + AssertMsgReturn( !(pReg->fFlags & PDM_DEVREG_FLAGS_RC) + || ( pReg->szRCMod[0] + && strlen(pReg->szRCMod) < sizeof(pReg->szRCMod)), + ("Invalid GC module name '%s' - (Device %s)\n", pReg->szRCMod, pReg->szName), + VERR_PDM_INVALID_DEVICE_REGISTRATION); + AssertMsgReturn( !(pReg->fFlags & PDM_DEVREG_FLAGS_R0) + || ( pReg->szR0Mod[0] + && strlen(pReg->szR0Mod) < sizeof(pReg->szR0Mod)), + ("Invalid R0 module name '%s' - (Device %s)\n", pReg->szR0Mod, pReg->szName), + VERR_PDM_INVALID_DEVICE_REGISTRATION); + AssertMsgReturn((pReg->fFlags & PDM_DEVREG_FLAGS_HOST_BITS_MASK) == PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT, + ("Invalid host bits flags! fFlags=%#x (Device %s)\n", pReg->fFlags, pReg->szName), + VERR_PDM_INVALID_DEVICE_HOST_BITS); + AssertMsgReturn((pReg->fFlags & PDM_DEVREG_FLAGS_GUEST_BITS_MASK), + ("Invalid guest bits flags! fFlags=%#x (Device %s)\n", pReg->fFlags, pReg->szName), + VERR_PDM_INVALID_DEVICE_REGISTRATION); + AssertMsgReturn(pReg->fClass, + ("No class! (Device %s)\n", pReg->szName), + VERR_PDM_INVALID_DEVICE_REGISTRATION); + AssertMsgReturn(pReg->cMaxInstances > 0, + ("Max instances %u! (Device %s)\n", pReg->cMaxInstances, pReg->szName), + VERR_PDM_INVALID_DEVICE_REGISTRATION); + AssertMsgReturn(pReg->cbInstance <= (uint32_t)(pReg->fFlags & (PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0) ? 96 * _1K : _1M), + ("Instance size %d bytes! (Device %s)\n", pReg->cbInstance, pReg->szName), + VERR_PDM_INVALID_DEVICE_REGISTRATION); + AssertMsgReturn(pReg->pfnConstruct, + ("No constructor! (Device %s)\n", pReg->szName), + VERR_PDM_INVALID_DEVICE_REGISTRATION); + AssertLogRelMsgReturn((pReg->fFlags & PDM_DEVREG_FLAGS_GUEST_BITS_MASK) == PDM_DEVREG_FLAGS_GUEST_BITS_DEFAULT, + ("PDM: Rejected device '%s' because it didn't match the guest bits.\n", pReg->szName), + VERR_PDM_INVALID_DEVICE_GUEST_BITS); + AssertLogRelMsg(pReg->u32VersionEnd == PDM_DEVREG_VERSION, + ("u32VersionEnd=%#x, expected %#x. (szName=%s)\n", + pReg->u32VersionEnd, PDM_DEVREG_VERSION, pReg->szName)); + + /* + * Check for duplicates. + */ + int rc = VINF_SUCCESS; + PCTSTDEVPDMDEVREGCBINT pRegCB = (PCTSTDEVPDMDEVREGCBINT)pCallbacks; + if (!tstDevPdmDeviceFind(pReg->szName)) + { + PTSTDEVPDMDEV pPdmDev = (PTSTDEVPDMDEV)RTMemAllocZ(sizeof(TSTDEVPDMDEV)); + if (RT_LIKELY(pPdmDev)) + { + pPdmDev->pPdmMod = pRegCB->pMod; + pRegCB->pMod->cRefs++; + pPdmDev->pReg = pReg; + RTListAppend(&g_LstPdmDevs, &pPdmDev->NdPdmDevs); + return VINF_SUCCESS; + } + else + rc = VERR_NO_MEMORY; + } + else + rc = VERR_PDM_DEVICE_NAME_CLASH; + + return rc; +} + + +/** + * Checks whether the given PDM module filename was already loaded. + * + * @returns Pointer to already loaded plugin, NULL if not found. + * @param pszFilename The filename to check. + */ +static PCTSTDEVPDMMOD tstDevPdmModFind(const char *pszFilename) +{ + PCTSTDEVPDMMOD pIt; + RTListForEach(&g_LstPdmMods, pIt, TSTDEVPDMMOD, NdPdmMods) + { + if (!RTStrCmp(pIt->pszFilename, pszFilename)) + return pIt; + } + + return NULL; +} + + +/** + * Resolve an external symbol during RTLdrGetBits(). + * + * @returns iprt status code. + * @param hLdrMod The loader module handle. + * @param pszModule Module name. + * @param pszSymbol Symbol name, NULL if uSymbol should be used. + * @param uSymbol Symbol ordinal, ~0 if pszSymbol should be used. + * @param pValue Where to store the symbol value (address). + * @param pvUser User argument. + */ +static DECLCALLBACK(int) tstDevPdmLoadR0RcModGetImport(RTLDRMOD hLdrMod, const char *pszModule, const char *pszSymbol, + unsigned uSymbol, RTUINTPTR *pValue, void *pvUser) +{ + RT_NOREF(hLdrMod, uSymbol, pszModule); + PTSTDEVPDMMOD pMod = (PTSTDEVPDMMOD)pvUser; + + /* Resolve the import. */ + PCTSTDEVPDMR0IMPORTS pImpDesc = NULL; + bool fFound = false; + for (uint32_t i = 0; i < RT_ELEMENTS(g_aPdmR0Imports); i++) + { + pImpDesc = &g_aPdmR0Imports[i]; + if (!strcmp(pszSymbol, pImpDesc->pszSymbol)) + { + fFound = true; + break; + } + } + + int rc = VERR_SYMBOL_NOT_FOUND; + if (fFound) + { + /* Check whether the symbol has a trampoline already. */ + PTSTDEVPDMMODTRAMPOLINE pTrampoline = (PTSTDEVPDMMODTRAMPOLINE)pMod->R0Rc.pbTrampoline; + for (uint32_t i = 0; i < pMod->R0Rc.cTrampolines; i++) + { + if (pTrampoline->AddrTarget == (uintptr_t)pImpDesc->pfn) + break; + pTrampoline++; + } + + /* Create new trampoline if not found. */ + if (pTrampoline->AddrTarget != (uintptr_t)pImpDesc->pfn) + { + if (pMod->R0Rc.cTrampolines < pMod->R0Rc.cTrampolinesMax) + { + pTrampoline = pMod->R0Rc.pTrampolineNext; + pMod->R0Rc.pTrampolineNext++; + pMod->R0Rc.cTrampolines++; + pTrampoline->abJmp[0] = 0xff; /* jmp */ + pTrampoline->abJmp[1] = 0x25; /* rip */ + pTrampoline->abJmp[2] = 0x00; /* offset */ + pTrampoline->abJmp[3] = 0x00; + pTrampoline->abJmp[4] = 0x00; + pTrampoline->abJmp[5] = 0x00; + pTrampoline->AddrTarget = (uintptr_t)pImpDesc->pfn; + rc = VINF_SUCCESS; + } + else + { + rc = VERR_SYMBOL_NOT_FOUND; + AssertFailed(); + } + } + else + rc = VINF_SUCCESS; + + if (RT_SUCCESS(rc)) + *pValue = (RTUINTPTR)pTrampoline; + } + else + AssertFailed(); + + return rc; +} + + +/** + * Loads a new R0 modules given by the filename. + * + * @returns VBox status code. + * @param pMod Pointer to module structure. + */ +static int tstDevPdmLoadR0RcMod(PTSTDEVPDMMOD pMod) +{ + int rc = VINF_SUCCESS; + const char *pszFile = RTPathFilename(pMod->pszFilename); + + /* Check whether the plugin is loaded first. */ + if (!tstDevPdmModFind(pszFile)) + { + /* + * R0 modules need special treatment as these are relocatable images + * which are supposed to run in ring 0. + */ + rc = RTLdrOpen(pMod->pszFilename, 0, RTLDRARCH_HOST, &pMod->hLdrMod); + if (RT_SUCCESS(rc)) + { + size_t cb = RTLdrSize(pMod->hLdrMod) + 1024 * sizeof(TSTDEVPDMMODTRAMPOLINE); + + /* Allocate bits. */ + uint32_t fFlags = RTMEMALLOCEX_FLAGS_EXEC; +#ifdef RT_OS_LINUX + /* + * amd64 ELF binaries support only a 2GB code segment everything must be in + * (X86_64_PC32 relocation) so we have to use a trampoline to the final destination + * which is kept close to the imported module. + */ + fFlags |= RTMEMALLOCEX_FLAGS_32BIT_REACH; +#endif + rc = RTMemAllocEx(cb, 0, fFlags, (void **)&pMod->R0Rc.pbTrampoline); + pMod->R0Rc.cbBits = cb; + if (RT_SUCCESS(rc)) + { + pMod->R0Rc.pvBits = pMod->R0Rc.pbTrampoline + 1024 * sizeof(TSTDEVPDMMODTRAMPOLINE); + pMod->R0Rc.cTrampolinesMax = 1024; + pMod->R0Rc.cTrampolines = 0; + pMod->R0Rc.pTrampolineNext = (PTSTDEVPDMMODTRAMPOLINE)pMod->R0Rc.pbTrampoline; + /* Get the bits. */ + rc = RTLdrGetBits(pMod->hLdrMod, pMod->R0Rc.pvBits, (uintptr_t)pMod->R0Rc.pvBits, + tstDevPdmLoadR0RcModGetImport, pMod); + if (RT_FAILURE(rc)) + RTMemFreeEx(pMod->R0Rc.pbTrampoline, pMod->R0Rc.cbBits); + } + + if (RT_FAILURE(rc)) + RTLdrClose(pMod->hLdrMod); + } + } + + return rc; +} + + +/** + * Loads the given + */ +static int tstDevPdmLoadR3Mod(PTSTDEVPDMMOD pMod) +{ + int rc = RTLdrLoad(pMod->pszFilename, &pMod->hLdrMod); + if (RT_SUCCESS(rc)) + { + FNPDMVBOXDEVICESREGISTER *pfnVBoxDevicesRegister; + rc = RTLdrGetSymbol(pMod->hLdrMod, "VBoxDevicesRegister", (void**)&pfnVBoxDevicesRegister); + if (RT_FAILURE(rc) || !pfnVBoxDevicesRegister) + { + LogFunc(("error resolving the entry point %s in plugin %s, rc=%Rrc, pfnPluginLoad=%#p\n", + "VBoxDevicesRegister", pMod->pszFilename, rc, pfnVBoxDevicesRegister)); + if (RT_SUCCESS(rc)) + rc = VERR_SYMBOL_NOT_FOUND; + } + + if (RT_SUCCESS(rc)) + { + TSTDEVPDMDEVREGCBINT RegCB; + RegCB.Core.u32Version = PDM_DEVREG_CB_VERSION; + RegCB.Core.pfnRegister = tstDevPdmR3DevReg_Register; + RegCB.pMod = pMod; + rc = pfnVBoxDevicesRegister(&RegCB.Core, VBOX_VERSION); + } + else + LogFunc(("ignored plugin '%s': rc=%Rrc\n", pMod->pszFilename, rc)); + + if (RT_FAILURE(rc)) + RTLdrClose(pMod->hLdrMod); + } + + return rc; +} + + +/** + * Tries to loads the given PDM module. + * + * @returns VBox status code. + * @param pszFilename The filename to load. + * @param enmModType The module type. + */ +static int tstDevPdmLoadMod(const char *pszFilename, TSTDEVPDMMODTYPE enmModType) +{ + int rc = VINF_SUCCESS; + + /* Check whether the plugin is loaded first. */ + if (!tstDevPdmModFind(pszFilename)) + { + PTSTDEVPDMMOD pMod = (PTSTDEVPDMMOD)RTMemAllocZ(sizeof(TSTDEVPDMMOD)); + if (RT_LIKELY(pMod)) + { + pMod->pszFilename = RTStrDup(pszFilename); + pMod->cRefs = 1; + pMod->enmType = enmModType; + + if (enmModType == TSTDEVPDMMODTYPE_R3) + rc = tstDevPdmLoadR3Mod(pMod); + else if (enmModType == TSTDEVPDMMODTYPE_RC || enmModType == TSTDEVPDMMODTYPE_R0) + rc = tstDevPdmLoadR0RcMod(pMod); + + if (RT_SUCCESS(rc)) + RTListAppend(&g_LstPdmMods, &pMod->NdPdmMods); + else + RTMemFree(pMod); + } + else + rc = VERR_NO_MEMORY; + } + + return rc; +} + + +/** + * Tries to resolve the given symbol from the module given. + * + * @returns VBox status code. + * @param pThis The device under test instance. + * @param pszMod The module name. + * @param enmModType The module type if the module needs to be loaded. + * @param pszSymbol The symbol to resolve. + * @param ppfn Where to store the value on success. + */ +DECLHIDDEN(int) tstDevPdmLdrGetSymbol(PTSTDEVDUTINT pThis, const char *pszMod, TSTDEVPDMMODTYPE enmModType, + const char *pszSymbol, PFNRT *ppfn) +{ + RT_NOREF(pThis); + + int rc = VINF_SUCCESS; + PCTSTDEVPDMMOD pMod = tstDevPdmModFind(pszMod); + if (!pMod) + { + /* Try to load the module. */ + rc = tstDevPdmLoadMod(pszMod, enmModType); + if (RT_SUCCESS(rc)) + { + pMod = tstDevPdmModFind(pszMod); + AssertPtr(pMod); + } + } + + if (RT_SUCCESS(rc)) + { + if (pMod->enmType == TSTDEVPDMMODTYPE_R0 || pMod->enmType == TSTDEVPDMMODTYPE_RC) + rc = RTLdrGetSymbolEx(pMod->hLdrMod, pMod->R0Rc.pvBits, (uintptr_t)pMod->R0Rc.pvBits, + UINT32_MAX, pszSymbol, (PRTLDRADDR)ppfn); + else + rc = RTLdrGetSymbol(pMod->hLdrMod, pszSymbol, (void **)ppfn); + } + + return rc; +} + + +static TSTDEVCFGITEM s_aTestcaseCfg[] = +{ + {"CtrlMemBufSize", TSTDEVCFGITEMTYPE_INTEGER, "0" }, + {NULL, TSTDEVCFGITEMTYPE_INVALID, NULL } +}; + +static TSTDEVTESTCASEREG s_TestcaseDef = +{ + "test", + "Testcase during implementation", + "nvme", + 0, + &s_aTestcaseCfg[0], + NULL, +}; + +/** + * Create a new PDM device with default config. + * + * @returns VBox status code. + * @param pszName Name of the device to create. + */ +static int tstDevPdmDevCreate(const char *pszName) +{ + int rc = VINF_SUCCESS; + PCTSTDEVPDMDEV pPdmDev = tstDevPdmDeviceFind(pszName); + if (RT_LIKELY(pPdmDev)) + { + TSTDEVDUTINT Dut; + Dut.pTestcaseReg = &s_TestcaseDef; + Dut.enmCtx = TSTDEVDUTCTX_R3; + Dut.pVm = NULL; + Dut.SupSession.pDut = &Dut; + RTListInit(&Dut.LstIoPorts); + RTListInit(&Dut.LstTimers); + RTListInit(&Dut.LstMmHeap); + RTListInit(&Dut.LstPdmThreads); + RTListInit(&Dut.SupSession.LstSupSem); + CFGMNODE Cfg; + Cfg.pVmmCallbacks = &g_tstDevVmmCallbacks; + Cfg.pDut = &Dut; + + rc = RTCritSectRwInit(&Dut.CritSectLists); + AssertRC(rc); + + PPDMDEVINS pDevIns = (PPDMDEVINS)RTMemAllocZ(RT_UOFFSETOF_DYN(PDMDEVINS, achInstanceData[pPdmDev->pReg->cbInstance])); + pDevIns->u32Version = PDM_DEVINS_VERSION; + pDevIns->iInstance = 0; + pDevIns->pReg = pPdmDev->pReg; + pDevIns->pvInstanceDataR3 = &pDevIns->achInstanceData[0]; + pDevIns->pHlpR3 = &g_tstDevPdmDevHlpR3; + pDevIns->pCfg = &Cfg; + pDevIns->Internal.s.pVmmCallbacks = &g_tstDevVmmCallbacks; + pDevIns->Internal.s.pDut = &Dut; + rc = pPdmDev->pReg->pfnConstruct(pDevIns, 0, &Cfg); + if (RT_SUCCESS(rc)) + { + PRTDEVDUTIOPORT pIoPort = RTListGetFirst(&Dut.LstIoPorts, RTDEVDUTIOPORT, NdIoPorts); + uint32_t uVal = 0; + PDMCritSectEnter(pDevIns->pCritSectRoR3, VERR_IGNORED); + pIoPort->pfnInR0(pDevIns, pIoPort->pvUserR0, pIoPort->PortStart, &uVal, sizeof(uint8_t)); + PDMCritSectLeave(pDevIns->pCritSectRoR3); + } + } + else + rc = VERR_NOT_FOUND; + + return rc; +} + +int main(int argc, char *argv[]) +{ + /* + * Init the runtime and parse the arguments. + */ + RTEXITCODE rcExit = RTEXITCODE_SUCCESS; + int rc = RTR3InitExe(argc, &argv, 0); + if (RT_SUCCESS(rc)) + { + RTListInit(&g_LstPlugins); + RTListInit(&g_LstTestcases); + RTListInit(&g_LstPdmMods); + RTListInit(&g_LstPdmDevs); + + rc = tstDevLoadPlugin("TSTDevTestcases"); + if (RT_SUCCESS(rc) || true) + { + rc = tstDevPdmLoadMod(argv[1], TSTDEVPDMMODTYPE_R3); + if (RT_SUCCESS(rc)) + rc = tstDevPdmDevCreate("nvme"); + else + rcExit = RTEXITCODE_FAILURE; + } + else + rcExit = RTEXITCODE_FAILURE; + + //rcExit = tstDevParseOptions(argc, argv); + } + else + rcExit = RTEXITCODE_FAILURE; + + return rcExit; +} + diff --git a/src/VBox/Devices/testcase/tstDeviceInternal.h b/src/VBox/Devices/testcase/tstDeviceInternal.h new file mode 100644 index 00000000..e994e902 --- /dev/null +++ b/src/VBox/Devices/testcase/tstDeviceInternal.h @@ -0,0 +1,241 @@ +/** @file + * tstDevice: Shared definitions between the framework and the shim library. + */ + +/* + * Copyright (C) 2017-2019 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_INCLUDED_SRC_testcase_tstDeviceInternal_h +#define VBOX_INCLUDED_SRC_testcase_tstDeviceInternal_h +#ifndef RT_WITHOUT_PRAGMA_ONCE +# pragma once +#endif + +#include <VBox/types.h> +#include <iprt/assert.h> +#include <iprt/list.h> +#include <iprt/semaphore.h> + +#include "tstDevicePlugin.h" +#include "tstDeviceVMMInternal.h" + +RT_C_DECLS_BEGIN + + +/** Converts PDM device instance to the device under test structure. */ +#define TSTDEV_PDMDEVINS_2_DUT(a_pDevIns) ((a_pDevIns)->Internal.s.pDut) + +/** + * PDM module descriptor type. + */ +typedef enum TSTDEVPDMMODTYPE +{ + /** Invalid module type. */ + TSTDEVPDMMODTYPE_INVALID = 0, + /** Ring 3 module. */ + TSTDEVPDMMODTYPE_R3, + /** Ring 0 module. */ + TSTDEVPDMMODTYPE_R0, + /** Raw context module. */ + TSTDEVPDMMODTYPE_RC, + /** 32bit hack. */ + TSTDEVPDMMODTYPE_32BIT_HACK = 0x7fffffff +} TSTDEVPDMMODTYPE; + +/** + * Registered I/O port access handler. + */ +typedef struct RTDEVDUTIOPORT +{ + /** Node for the list of registered handlers. */ + RTLISTNODE NdIoPorts; + /** Start I/O port the handler is for. */ + RTIOPORT PortStart; + /** Number of ports handled. */ + RTIOPORT cPorts; + /** Opaque user data - R3. */ + void *pvUserR3; + /** Out handler - R3. */ + PFNIOMIOPORTOUT pfnOutR3; + /** In handler - R3. */ + PFNIOMIOPORTIN pfnInR3; + /** Out string handler - R3. */ + PFNIOMIOPORTOUTSTRING pfnOutStrR3; + /** In string handler - R3. */ + PFNIOMIOPORTINSTRING pfnInStrR3; + + /** Opaque user data - R0. */ + void *pvUserR0; + /** Out handler - R0. */ + PFNIOMIOPORTOUT pfnOutR0; + /** In handler - R0. */ + PFNIOMIOPORTIN pfnInR0; + /** Out string handler - R0. */ + PFNIOMIOPORTOUTSTRING pfnOutStrR0; + /** In string handler - R0. */ + PFNIOMIOPORTINSTRING pfnInStrR0; + +#ifdef TSTDEV_SUPPORTS_RC + /** Opaque user data - RC. */ + void *pvUserRC; + /** Out handler - RC. */ + PFNIOMIOPORTOUT pfnOutRC; + /** In handler - RC. */ + PFNIOMIOPORTIN pfnInRC; + /** Out string handler - RC. */ + PFNIOMIOPORTOUTSTRING pfnOutStrRC; + /** In string handler - RC. */ + PFNIOMIOPORTINSTRING pfnInStrRC; +#endif +} RTDEVDUTIOPORT; +/** Pointer to a registered I/O port handler. */ +typedef RTDEVDUTIOPORT *PRTDEVDUTIOPORT; +/** Pointer to a const I/O port handler. */ +typedef const RTDEVDUTIOPORT *PCRTDEVDUTIOPORT; + +/** + * The Support Driver session state. + */ +typedef struct TSTDEVSUPDRVSESSION +{ + /** Pointer to the owning device under test instance. */ + PTSTDEVDUTINT pDut; + /** List of event semaphores. */ + RTLISTANCHOR LstSupSem; +} TSTDEVSUPDRVSESSION; +/** Pointer to the Support Driver session state. */ +typedef TSTDEVSUPDRVSESSION *PTSTDEVSUPDRVSESSION; + +/** Converts a Support Driver session handle to the internal state. */ +#define TSTDEV_PSUPDRVSESSION_2_PTSTDEVSUPDRVSESSION(a_pSession) ((PTSTDEVSUPDRVSESSION)(a_pSession)) +/** Converts the internal session state to a Support Driver session handle. */ +#define TSTDEV_PTSTDEVSUPDRVSESSION_2_PSUPDRVSESSION(a_pSession) ((PSUPDRVSESSION)(a_pSession)) + +/** + * Support driver event semaphore. + */ +typedef struct TSTDEVSUPSEMEVENT +{ + /** Node for the event semaphore list. */ + RTLISTNODE NdSupSem; + /** Flag whether this is multi event semaphore. */ + bool fMulti; + /** Event smeaphore handles depending on the flag above. */ + union + { + RTSEMEVENT hSemEvt; + RTSEMEVENTMULTI hSemEvtMulti; + } u; +} TSTDEVSUPSEMEVENT; +/** Pointer to a support event semaphore state. */ +typedef TSTDEVSUPSEMEVENT *PTSTDEVSUPSEMEVENT; + +/** Converts a Support event semaphore handle to the internal state. */ +#define TSTDEV_SUPSEMEVENT_2_PTSTDEVSUPSEMEVENT(a_pSupSemEvt) ((PTSTDEVSUPSEMEVENT)(a_pSupSemEvt)) +/** Converts the internal session state to a Support event semaphore handle. */ +#define TSTDEV_PTSTDEVSUPSEMEVENT_2_SUPSEMEVENT(a_pSupSemEvt) ((SUPSEMEVENT)(a_pSupSemEvt)) + +/** + * The contex the device under test is currently in. + */ +typedef enum TSTDEVDUTCTX +{ + /** Invalid context. */ + TSTDEVDUTCTX_INVALID = 0, + /** R3 context. */ + TSTDEVDUTCTX_R3, + /** R0 context. */ + TSTDEVDUTCTX_R0, + /** RC context. */ + TSTDEVDUTCTX_RC, + /** 32bit hack. */ + TSTDEVDUTCTX_32BIT_HACK = 0x7fffffff +} TSTDEVDUTCTX; + +/** + * PCI region descriptor. + */ +typedef struct TSTDEVDUTPCIREGION +{ + /** Size of the region. */ + RTGCPHYS cbRegion; + /** Address space type. */ + PCIADDRESSSPACE enmType; + /** Region mapping callback. */ + PFNPCIIOREGIONMAP pfnRegionMap; +} TSTDEVDUTPCIREGION; +/** Pointer to a PCI region descriptor. */ +typedef TSTDEVDUTPCIREGION *PTSTDEVDUTPCIREGION; +/** Pointer to a const PCI region descriptor. */ +typedef const TSTDEVDUTPCIREGION *PCTSTDEVDUTPCIREGION; + +/** + * Device under test instance data. + */ +typedef struct TSTDEVDUTINT +{ + /** Pointer to the testcase this device is part of. */ + PCTSTDEVTESTCASEREG pTestcaseReg; + /** Pointer to the PDM device instance. */ + PPDMDEVINS pDevIns; + /** Current device context. */ + TSTDEVDUTCTX enmCtx; + /** Critical section protecting the lists below. */ + RTCRITSECTRW CritSectLists; + /** List of registered I/O port handlers. */ + RTLISTANCHOR LstIoPorts; + /** List of timers registered. */ + RTLISTANCHOR LstTimers; + /** List of registered MMIO regions. */ + RTLISTANCHOR LstMmio; + /** List of MM Heap allocations. */ + RTLISTANCHOR LstMmHeap; + /** List of PDM threads. */ + RTLISTANCHOR LstPdmThreads; + /** The SUP session we emulate. */ + TSTDEVSUPDRVSESSION SupSession; + /** The VM state assoicated with this device. */ + PVM pVm; + /** The registered PCI device instance if this is a PCI device. */ + PPDMPCIDEV pPciDev; + /** PCI Region descriptors. */ + TSTDEVDUTPCIREGION aPciRegions[VBOX_PCI_NUM_REGIONS]; +} TSTDEVDUTINT; + + +DECLHIDDEN(int) tstDevPdmLdrGetSymbol(PTSTDEVDUTINT pThis, const char *pszMod, TSTDEVPDMMODTYPE enmModType, + const char *pszSymbol, PFNRT *ppfn); + + +DECLINLINE(int) tstDevDutLockShared(PTSTDEVDUTINT pThis) +{ + return RTCritSectRwEnterShared(&pThis->CritSectLists); +} + +DECLINLINE(int) tstDevDutUnlockShared(PTSTDEVDUTINT pThis) +{ + return RTCritSectRwLeaveShared(&pThis->CritSectLists); +} + +DECLINLINE(int) tstDevDutLockExcl(PTSTDEVDUTINT pThis) +{ + return RTCritSectRwEnterExcl(&pThis->CritSectLists); +} + +DECLINLINE(int) tstDevDutUnlockExcl(PTSTDEVDUTINT pThis) +{ + return RTCritSectRwLeaveExcl(&pThis->CritSectLists); +} + +RT_C_DECLS_END + +#endif /* !VBOX_INCLUDED_SRC_testcase_tstDeviceInternal_h */ diff --git a/src/VBox/Devices/testcase/tstDevicePdmDevHlp.cpp b/src/VBox/Devices/testcase/tstDevicePdmDevHlp.cpp new file mode 100644 index 00000000..76fb8999 --- /dev/null +++ b/src/VBox/Devices/testcase/tstDevicePdmDevHlp.cpp @@ -0,0 +1,1917 @@ +/* $Id: tstDevicePdmDevHlp.cpp $ */ +/** @file + * tstDevice - Test framework for PDM devices/drivers, PDM helper implementation. + */ + +/* + * Copyright (C) 2017-2019 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_DEFAULT /** @todo */ +#include <VBox/types.h> +#include <VBox/version.h> +#include <VBox/vmm/pdmpci.h> + +#include <iprt/assert.h> +#include <iprt/mem.h> + +#include "tstDeviceInternal.h" + + +/********************************************************************************************************************************* +* Defined Constants And Macros * +*********************************************************************************************************************************/ + +/** @def PDMDEV_ASSERT_DEVINS + * Asserts the validity of the device instance. + */ +#ifdef VBOX_STRICT +# define PDMDEV_ASSERT_DEVINS(pDevIns) \ + do { \ + AssertPtr(pDevIns); \ + Assert(pDevIns->u32Version == PDM_DEVINS_VERSION); \ + Assert(pDevIns->CTX_SUFF(pvInstanceData) == (void *)&pDevIns->achInstanceData[0]); \ + } while (0) +#else +# define PDMDEV_ASSERT_DEVINS(pDevIns) do { } while (0) +#endif + + +/********************************************************************************************************************************* +* Structures and Typedefs * +*********************************************************************************************************************************/ + + + +/********************************************************************************************************************************* +* Global Variables * +*********************************************************************************************************************************/ + + + +/********************************************************************************************************************************* +* Internal Functions * +*********************************************************************************************************************************/ + + + +/** @interface_method_impl{PDMDEVHLPR3,pfnIOPortRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegister(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTHCPTR pvUser, PFNIOMIOPORTOUT pfnOut, PFNIOMIOPORTIN pfnIn, + PFNIOMIOPORTOUTSTRING pfnOutStr, PFNIOMIOPORTINSTRING pfnInStr, const char *pszDesc) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_IOPortRegister: caller='%s'/%d: Port=%#x cPorts=%#x pvUser=%p pfnOut=%p pfnIn=%p pfnOutStr=%p pfnInStr=%p p32_tszDesc=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, Port, cPorts, pvUser, pfnOut, pfnIn, pfnOutStr, pfnInStr, pszDesc, pszDesc)); + + /** @todo Verify there is no overlapping. */ + + RT_NOREF(pszDesc); + int rc = VINF_SUCCESS; + PRTDEVDUTIOPORT pIoPort = (PRTDEVDUTIOPORT)RTMemAllocZ(sizeof(RTDEVDUTIOPORT)); + if (RT_LIKELY(pIoPort)) + { + pIoPort->PortStart = Port; + pIoPort->cPorts = cPorts; + pIoPort->pvUserR3 = pvUser; + pIoPort->pfnOutR3 = pfnOut; + pIoPort->pfnInR3 = pfnIn; + pIoPort->pfnOutStrR3 = pfnOutStr; + pIoPort->pfnInStrR3 = pfnInStr; + RTListAppend(&pDevIns->Internal.s.pDut->LstIoPorts, &pIoPort->NdIoPorts); + } + else + rc = VERR_NO_MEMORY; + + LogFlow(("pdmR3DevHlp_IOPortRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnIOPortRegisterRC} */ +static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegisterRC(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTRCPTR pvUser, + const char *pszOut, const char *pszIn, + const char *pszOutStr, const char *pszInStr, const char *pszDesc) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_IOPortRegisterRC: caller='%s'/%d: Port=%#x cPorts=%#x pvUser=%p pszOut=%p:{%s} pszIn=%p:{%s} pszOutStr=%p:{%s} pszInStr=%p:{%s} pszDesc=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, Port, cPorts, pvUser, pszOut, pszOut, pszIn, pszIn, pszOutStr, pszOutStr, pszInStr, pszInStr, pszDesc, pszDesc)); + + /** @todo */ + int rc = VINF_SUCCESS; + //AssertFailed(); + + LogFlow(("pdmR3DevHlp_IOPortRegisterRC: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnIOPortRegisterR0} */ +static DECLCALLBACK(int) pdmR3DevHlp_IOPortRegisterR0(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts, RTR0PTR pvUser, + const char *pszOut, const char *pszIn, + const char *pszOutStr, const char *pszInStr, const char *pszDesc) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_IOPortRegisterR0: caller='%s'/%d: Port=%#x cPorts=%#x pvUser=%p pszOut=%p:{%s} pszIn=%p:{%s} pszOutStr=%p:{%s} pszInStr=%p:{%s} pszDesc=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, Port, cPorts, pvUser, pszOut, pszOut, pszIn, pszIn, pszOutStr, pszOutStr, pszInStr, pszInStr, pszDesc, pszDesc)); + + PTSTDEVDUTINT pThis = pDevIns->Internal.s.pDut; + PRTDEVDUTIOPORT pIoPort; + int rc = VERR_NOT_FOUND; + RTListForEach(&pThis->LstIoPorts, pIoPort, RTDEVDUTIOPORT, NdIoPorts) + { + /** @todo Support overlapping port ranges. */ + if ( pIoPort->PortStart == Port + && pIoPort->cPorts == cPorts) + { + rc = VINF_SUCCESS; + pIoPort->pvUserR0 = (void *)pvUser; + if (pszOut) + rc = tstDevPdmLdrGetSymbol(pThis, pDevIns->pReg->szR0Mod, TSTDEVPDMMODTYPE_R0, pszOut, (PFNRT *)&pIoPort->pfnOutR0); + if (RT_SUCCESS(rc) && pszIn) + rc = tstDevPdmLdrGetSymbol(pThis, pDevIns->pReg->szR0Mod, TSTDEVPDMMODTYPE_R0, pszIn, (PFNRT *)&pIoPort->pfnInR0); + if (RT_SUCCESS(rc) && pszOutStr) + rc = tstDevPdmLdrGetSymbol(pThis, pDevIns->pReg->szR0Mod, TSTDEVPDMMODTYPE_R0, pszOutStr, (PFNRT *)&pIoPort->pfnOutStrR0); + if (RT_SUCCESS(rc) && pszInStr) + rc = tstDevPdmLdrGetSymbol(pThis, pDevIns->pReg->szR0Mod, TSTDEVPDMMODTYPE_R0, pszInStr, (PFNRT *)&pIoPort->pfnInStrR0); + break; + } + } + + LogFlow(("pdmR3DevHlp_IOPortRegisterR0: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnIOPortDeregister} */ +static DECLCALLBACK(int) pdmR3DevHlp_IOPortDeregister(PPDMDEVINS pDevIns, RTIOPORT Port, RTIOPORT cPorts) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_IOPortDeregister: caller='%s'/%d: Port=%#x cPorts=%#x\n", + pDevIns->pReg->szName, pDevIns->iInstance, Port, cPorts)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_IOPortDeregister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnMMIORegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_MMIORegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTHCPTR pvUser, + PFNIOMMMIOWRITE pfnWrite, PFNIOMMMIOREAD pfnRead, PFNIOMMMIOFILL pfnFill, + uint32_t fFlags, const char *pszDesc) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMIORegister: caller='%s'/%d: GCPhysStart=%RGp cbRange=%RGp pvUser=%p pfnWrite=%p pfnRead=%p pfnFill=%p fFlags=%#x pszDesc=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, pvUser, pfnWrite, pfnRead, pfnFill, pszDesc, fFlags, pszDesc)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMIORegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnMMIORegisterRC} */ +static DECLCALLBACK(int) pdmR3DevHlp_MMIORegisterRC(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTRCPTR pvUser, + const char *pszWrite, const char *pszRead, const char *pszFill) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMIORegisterRC: caller='%s'/%d: GCPhysStart=%RGp cbRange=%RGp pvUser=%p pszWrite=%p:{%s} pszRead=%p:{%s} pszFill=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, pvUser, pszWrite, pszWrite, pszRead, pszRead, pszFill, pszFill)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMIORegisterRC: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + +/** @interface_method_impl{PDMDEVHLPR3,pfnMMIORegisterR0} */ +static DECLCALLBACK(int) pdmR3DevHlp_MMIORegisterR0(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange, RTR0PTR pvUser, + const char *pszWrite, const char *pszRead, const char *pszFill) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMIORegisterHC: caller='%s'/%d: GCPhysStart=%RGp cbRange=%RGp pvUser=%p pszWrite=%p:{%s} pszRead=%p:{%s} pszFill=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, pvUser, pszWrite, pszWrite, pszRead, pszRead, pszFill, pszFill)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMIORegisterR0: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnMMIODeregister} */ +static DECLCALLBACK(int) pdmR3DevHlp_MMIODeregister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTGCPHYS cbRange) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMIODeregister: caller='%s'/%d: GCPhysStart=%RGp cbRange=%RGp\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMIODeregister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** + * @copydoc PDMDEVHLPR3::pfnMMIO2Register + */ +static DECLCALLBACK(int) pdmR3DevHlp_MMIO2Register(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cb, + uint32_t fFlags, void **ppv, const char *pszDesc) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMIO2Register: caller='%s'/%d: pPciDev=%p (%#x) iRegion=%#x cb=%#RGp fFlags=%RX32 ppv=%p pszDescp=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, + cb, fFlags, ppv, pszDesc, pszDesc)); + //AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 == pDevIns, VERR_INVALID_PARAMETER); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMIO2Register: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** + * @interface_method_impl{PDMDEVHLPR3,pfnMMIOExPreRegister} + */ +static DECLCALLBACK(int) +pdmR3DevHlp_MMIOExPreRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion, uint32_t fFlags, + const char *pszDesc, + RTHCPTR pvUser, PFNIOMMMIOWRITE pfnWrite, PFNIOMMMIOREAD pfnRead, PFNIOMMMIOFILL pfnFill, + RTR0PTR pvUserR0, const char *pszWriteR0, const char *pszReadR0, const char *pszFillR0, + RTRCPTR pvUserRC, const char *pszWriteRC, const char *pszReadRC, const char *pszFillRC) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMIOExPreRegister: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x cbRegion=%#RGp fFlags=%RX32 pszDesc=%p:{%s}\n" + " pvUser=%p pfnWrite=%p pfnRead=%p pfnFill=%p\n" + " pvUserR0=%p pszWriteR0=%s pszReadR0=%s pszFillR0=%s\n" + " pvUserRC=%p pszWriteRC=%s pszReadRC=%s pszFillRC=%s\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, cbRegion, + fFlags, pszDesc, pszDesc, + pvUser, pfnWrite, pfnRead, pfnFill, + pvUserR0, pszWriteR0, pszReadR0, pszFillR0, + pvUserRC, pszWriteRC, pszReadRC, pszFillRC)); + //AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 == pDevIns, VERR_INVALID_PARAMETER); + + /* + * Resolve the functions. + */ + AssertLogRelReturn( (!pszWriteR0 && !pszReadR0 && !pszFillR0) + || (pDevIns->pReg->szR0Mod[0] && (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_R0)), + VERR_INVALID_PARAMETER); + AssertLogRelReturn( (!pszWriteRC && !pszReadRC && !pszFillRC) + || (pDevIns->pReg->szRCMod[0] && (pDevIns->pReg->fFlags & PDM_DEVREG_FLAGS_RC)), + VERR_INVALID_PARAMETER); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMIOExPreRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** + * @copydoc PDMDEVHLPR3::pfnMMIOExDeregister + */ +static DECLCALLBACK(int) pdmR3DevHlp_MMIOExDeregister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMIOExDeregister: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion)); + + AssertReturn(iRegion <= UINT8_MAX || iRegion == UINT32_MAX, VERR_INVALID_PARAMETER); + //AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 == pDevIns, VERR_INVALID_PARAMETER); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMIOExDeregister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** + * @copydoc PDMDEVHLPR3::pfnMMIOExMap + */ +static DECLCALLBACK(int) pdmR3DevHlp_MMIOExMap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMIOExMap: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x GCPhys=%#RGp\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, GCPhys)); + //AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 != NULL, VERR_INVALID_PARAMETER); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMIOExMap: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** + * @copydoc PDMDEVHLPR3::pfnMMIOExUnmap + */ +static DECLCALLBACK(int) pdmR3DevHlp_MMIOExUnmap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS GCPhys) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMIOExUnmap: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x GCPhys=%#RGp\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, GCPhys)); + //AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 != NULL, VERR_INVALID_PARAMETER); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMIOExUnmap: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** + * @copydoc PDMDEVHLPR3::pfnMMIOExReduce + */ +static DECLCALLBACK(int) pdmR3DevHlp_MMIOExReduce(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS cbRegion) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMIOExReduce: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x cbRegion=%RGp\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, cbRegion)); + //AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 != NULL, VERR_INVALID_PARAMETER); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMIOExReduce: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** + * @copydoc PDMDEVHLPR3::pfnMMHyperMapMMIO2 + */ +static DECLCALLBACK(int) pdmR3DevHlp_MMHyperMapMMIO2(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off, + RTGCPHYS cb, const char *pszDesc, PRTRCPTR pRCPtr) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMHyperMapMMIO2: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x off=%RGp cb=%RGp pszDesc=%p:{%s} pRCPtr=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, off, cb, pszDesc, pszDesc, pRCPtr)); + //AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 == pDevIns, VERR_INVALID_PARAMETER); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMHyperMapMMIO2: caller='%s'/%d: returns %Rrc *pRCPtr=%RRv\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *pRCPtr)); + return rc; +} + + +/** + * @copydoc PDMDEVHLPR3::pfnMMIO2MapKernel + */ +static DECLCALLBACK(int) pdmR3DevHlp_MMIO2MapKernel(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, RTGCPHYS off, + RTGCPHYS cb,const char *pszDesc, PRTR0PTR pR0Ptr) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMIO2MapKernel: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%#x off=%RGp cb=%RGp pszDesc=%p:{%s} pR0Ptr=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev ? pPciDev->uDevFn : UINT32_MAX, iRegion, off, cb, pszDesc, pszDesc, pR0Ptr)); + //AssertReturn(!pPciDev || pPciDev->Int.s.pDevInsR3 == pDevIns, VERR_INVALID_PARAMETER); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_MMIO2MapKernel: caller='%s'/%d: returns %Rrc *pR0Ptr=%RHv\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *pR0Ptr)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnROMRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_ROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, + const void *pvBinary, uint32_t cbBinary, uint32_t fFlags, const char *pszDesc) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x pvBinary=%p cbBinary=%#x fFlags=%#RX32 pszDesc=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, pvBinary, cbBinary, fFlags, pszDesc, pszDesc)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnROMProtectShadow} */ +static DECLCALLBACK(int) pdmR3DevHlp_ROMProtectShadow(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, PGMROMPROT enmProt) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_ROMProtectShadow: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x enmProt=%d\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPhysStart, cbRange, enmProt)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_ROMProtectShadow: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnSSMRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_SSMRegister(PPDMDEVINS pDevIns, uint32_t uVersion, size_t cbGuess, const char *pszBefore, + PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote, + PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone, + PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_SSMRegister: caller='%s'/%d: uVersion=%#x cbGuess=%#x pszBefore=%p:{%s}\n" + " pfnLivePrep=%p pfnLiveExec=%p pfnLiveVote=%p pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoadDone=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, uVersion, cbGuess, pszBefore, pszBefore, + pfnLivePrep, pfnLiveExec, pfnLiveVote, + pfnSavePrep, pfnSaveExec, pfnSaveDone, + pfnLoadPrep, pfnLoadExec, pfnLoadDone)); + + /** @todo */ + int rc = VINF_SUCCESS; + //AssertFailed(); + + LogFlow(("pdmR3DevHlp_SSMRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnTMTimerCreate} */ +static DECLCALLBACK(int) pdmR3DevHlp_TMTimerCreate(PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback, void *pvUser, + uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_TMTimerCreate: caller='%s'/%d: enmClock=%d pfnCallback=%p pvUser=%p fFlags=%#x pszDesc=%p:{%s} ppTimer=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, enmClock, pfnCallback, pvUser, fFlags, pszDesc, pszDesc, ppTimer)); + + int rc = VINF_SUCCESS; + PTMTIMERR3 pTimer = (PTMTIMERR3)RTMemAllocZ(sizeof(TMTIMER)); + if (RT_LIKELY(pTimer)) + { + pTimer->pVmmCallbacks = pDevIns->Internal.s.pVmmCallbacks; + pTimer->enmClock = enmClock; + pTimer->pfnCallbackDev = pfnCallback; + pTimer->pvUser = pvUser; + pTimer->fFlags = fFlags; + RTListAppend(&pDevIns->Internal.s.pDut->LstTimers, &pTimer->NdDevTimers); + *ppTimer = pTimer; + } + else + rc = VERR_NO_MEMORY; + + LogFlow(("pdmR3DevHlp_TMTimerCreate: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnTMUtcNow} */ +static DECLCALLBACK(PRTTIMESPEC) pdmR3DevHlp_TMUtcNow(PPDMDEVINS pDevIns, PRTTIMESPEC pTime) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_TMUtcNow: caller='%s'/%d: pTime=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pTime)); + + AssertFailed(); + + LogFlow(("pdmR3DevHlp_TMUtcNow: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, RTTimeSpecGetNano(pTime))); + return pTime; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnTMTimeVirtGet} */ +static DECLCALLBACK(uint64_t) pdmR3DevHlp_TMTimeVirtGet(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_TMTimeVirtGet: caller='%s'/%d\n", + pDevIns->pReg->szName, pDevIns->iInstance)); + + uint64_t u64Time = 0; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_TMTimeVirtGet: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Time)); + return u64Time; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnTMTimeVirtGetFreq} */ +static DECLCALLBACK(uint64_t) pdmR3DevHlp_TMTimeVirtGetFreq(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_TMTimeVirtGetFreq: caller='%s'/%d\n", + pDevIns->pReg->szName, pDevIns->iInstance)); + + uint64_t u64Freq = 0; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_TMTimeVirtGetFreq: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Freq)); + return u64Freq; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnTMTimeVirtGetNano} */ +static DECLCALLBACK(uint64_t) pdmR3DevHlp_TMTimeVirtGetNano(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_TMTimeVirtGetNano: caller='%s'/%d\n", + pDevIns->pReg->szName, pDevIns->iInstance)); + + uint64_t u64Nano = 0; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_TMTimeVirtGetNano: caller='%s'/%d: returns %RU64\n", pDevIns->pReg->szName, pDevIns->iInstance, u64Nano)); + return u64Nano; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnGetSupDrvSession} */ +static DECLCALLBACK(PSUPDRVSESSION) pdmR3DevHlp_GetSupDrvSession(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_GetSupDrvSession: caller='%s'/%d\n", + pDevIns->pReg->szName, pDevIns->iInstance)); + + PTSTDEVDUTINT pThis = TSTDEV_PDMDEVINS_2_DUT(pDevIns); + PSUPDRVSESSION pSession = TSTDEV_PTSTDEVSUPDRVSESSION_2_PSUPDRVSESSION(&pThis->SupSession); + + LogFlow(("pdmR3DevHlp_GetSupDrvSession: caller='%s'/%d: returns %#p\n", pDevIns->pReg->szName, pDevIns->iInstance, pSession)); + return pSession; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnQueryGenericUserObject} */ +static DECLCALLBACK(void *) pdmR3DevHlp_QueryGenericUserObject(PPDMDEVINS pDevIns, PCRTUUID pUuid) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_QueryGenericUserObject: caller='%s'/%d: pUuid=%p:%RTuuid\n", + pDevIns->pReg->szName, pDevIns->iInstance, pUuid, pUuid)); + + void *pvRet = NULL; + + LogRel(("pdmR3DevHlp_QueryGenericUserObject: caller='%s'/%d: returns %#p for %RTuuid\n", + pDevIns->pReg->szName, pDevIns->iInstance, pvRet, pUuid)); + return pvRet; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPhysRead} */ +static DECLCALLBACK(int) pdmR3DevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PhysRead: caller='%s'/%d: GCPhys=%RGp pvBuf=%p cbRead=%#x\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, pvBuf, cbRead)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + Log(("pdmR3DevHlp_PhysRead: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPhysWrite} */ +static DECLCALLBACK(int) pdmR3DevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PhysWrite: caller='%s'/%d: GCPhys=%RGp pvBuf=%p cbWrite=%#x\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, pvBuf, cbWrite)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + Log(("pdmR3DevHlp_PhysWrite: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPhysGCPhys2CCPtr} */ +static DECLCALLBACK(int) pdmR3DevHlp_PhysGCPhys2CCPtr(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, void **ppv, PPGMPAGEMAPLOCK pLock) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PhysGCPhys2CCPtr: caller='%s'/%d: GCPhys=%RGp fFlags=%#x ppv=%p pLock=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, fFlags, ppv, pLock)); + AssertReturn(!fFlags, VERR_INVALID_PARAMETER); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + Log(("pdmR3DevHlp_PhysGCPhys2CCPtr: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPhysGCPhys2CCPtrReadOnly} */ +static DECLCALLBACK(int) pdmR3DevHlp_PhysGCPhys2CCPtrReadOnly(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t fFlags, const void **ppv, PPGMPAGEMAPLOCK pLock) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PhysGCPhys2CCPtrReadOnly: caller='%s'/%d: GCPhys=%RGp fFlags=%#x ppv=%p pLock=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, fFlags, ppv, pLock)); + AssertReturn(!fFlags, VERR_INVALID_PARAMETER); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + Log(("pdmR3DevHlp_PhysGCPhys2CCPtrReadOnly: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPhysReleasePageMappingLock} */ +static DECLCALLBACK(void) pdmR3DevHlp_PhysReleasePageMappingLock(PPDMDEVINS pDevIns, PPGMPAGEMAPLOCK pLock) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PhysReleasePageMappingLock: caller='%s'/%d: pLock=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pLock)); + + AssertFailed(); + + Log(("pdmR3DevHlp_PhysReleasePageMappingLock: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance)); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPhysReadGCVirt} */ +static DECLCALLBACK(int) pdmR3DevHlp_PhysReadGCVirt(PPDMDEVINS pDevIns, void *pvDst, RTGCPTR GCVirtSrc, size_t cb) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PhysReadGCVirt: caller='%s'/%d: pvDst=%p GCVirt=%RGv cb=%#x\n", + pDevIns->pReg->szName, pDevIns->iInstance, pvDst, GCVirtSrc, cb)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_PhysReadGCVirt: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPhysWriteGCVirt} */ +static DECLCALLBACK(int) pdmR3DevHlp_PhysWriteGCVirt(PPDMDEVINS pDevIns, RTGCPTR GCVirtDst, const void *pvSrc, size_t cb) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PhysWriteGCVirt: caller='%s'/%d: GCVirtDst=%RGv pvSrc=%p cb=%#x\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCVirtDst, pvSrc, cb)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_PhysWriteGCVirt: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPhysGCPtr2GCPhys} */ +static DECLCALLBACK(int) pdmR3DevHlp_PhysGCPtr2GCPhys(PPDMDEVINS pDevIns, RTGCPTR GCPtr, PRTGCPHYS pGCPhys) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PhysGCPtr2GCPhys: caller='%s'/%d: GCPtr=%RGv pGCPhys=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPtr, pGCPhys)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_PhysGCPtr2GCPhys: caller='%s'/%d: returns %Rrc *pGCPhys=%RGp\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *pGCPhys)); + + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnMMHeapAlloc} */ +static DECLCALLBACK(void *) pdmR3DevHlp_MMHeapAlloc(PPDMDEVINS pDevIns, size_t cb) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMHeapAlloc: caller='%s'/%d: cb=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, cb)); + + PTSTDEVDUTINT pThis = TSTDEV_PDMDEVINS_2_DUT(pDevIns); + + void *pv = NULL; + PTSTDEVMMHEAPALLOC pHeapAlloc = (PTSTDEVMMHEAPALLOC)RTMemAllocZ(cb + sizeof(TSTDEVMMHEAPALLOC) - 1); + if (pHeapAlloc) + { + /* Poison */ + memset(&pHeapAlloc->abAlloc[0], 0xfe, cb); + pHeapAlloc->cbAlloc = cb; + pHeapAlloc->pVmmCallbacks = pDevIns->Internal.s.pVmmCallbacks; + pHeapAlloc->pDut = pThis; + + tstDevDutLockExcl(pThis); + RTListAppend(&pThis->LstMmHeap, &pHeapAlloc->NdMmHeap); + tstDevDutUnlockExcl(pThis); + + pv = &pHeapAlloc->abAlloc[0]; + } + + LogFlow(("pdmR3DevHlp_MMHeapAlloc: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pv)); + return pv; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnMMHeapAllocZ} */ +static DECLCALLBACK(void *) pdmR3DevHlp_MMHeapAllocZ(PPDMDEVINS pDevIns, size_t cb) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMHeapAllocZ: caller='%s'/%d: cb=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, cb)); + + void *pv = pdmR3DevHlp_MMHeapAlloc(pDevIns, cb); + if (VALID_PTR(pv)) + memset(pv, 0, cb); + + LogFlow(("pdmR3DevHlp_MMHeapAllocZ: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pv)); + return pv; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnMMHeapFree} */ +static DECLCALLBACK(void) pdmR3DevHlp_MMHeapFree(PPDMDEVINS pDevIns, void *pv) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_MMHeapFree: caller='%s'/%d: pv=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pv)); + + MMR3HeapFree(pv); + + LogFlow(("pdmR3DevHlp_MMHeapAlloc: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance)); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMState} */ +static DECLCALLBACK(VMSTATE) pdmR3DevHlp_VMState(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + + VMSTATE enmVMState = VMSTATE_CREATING; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_VMState: caller='%s'/%d: returns %d\n", pDevIns->pReg->szName, pDevIns->iInstance, + enmVMState)); + return enmVMState; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMTeleportedAndNotFullyResumedYet} */ +static DECLCALLBACK(bool) pdmR3DevHlp_VMTeleportedAndNotFullyResumedYet(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + + bool fRc = false; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_VMState: caller='%s'/%d: returns %RTbool\n", pDevIns->pReg->szName, pDevIns->iInstance, + fRc)); + return fRc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMSetError} */ +static DECLCALLBACK(int) pdmR3DevHlp_VMSetError(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RT_NOREF(rc, pszFile, iLine, pszFunction, pszFormat); + rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMSetErrorV} */ +static DECLCALLBACK(int) pdmR3DevHlp_VMSetErrorV(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RT_NOREF(rc, pszFile, iLine, pszFunction, pszFormat, va); + rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMSetRuntimeError} */ +static DECLCALLBACK(int) pdmR3DevHlp_VMSetRuntimeError(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RT_NOREF(fFlags, pszErrorId, pszFormat); + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMSetRuntimeErrorV} */ +static DECLCALLBACK(int) pdmR3DevHlp_VMSetRuntimeErrorV(PPDMDEVINS pDevIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RT_NOREF(fFlags, pszErrorId, pszFormat, va); + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnDBGFStopV} */ +static DECLCALLBACK(int) pdmR3DevHlp_DBGFStopV(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction, const char *pszFormat, va_list args) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); +#ifdef LOG_ENABLED + va_list va2; + va_copy(va2, args); + LogFlow(("pdmR3DevHlp_DBGFStopV: caller='%s'/%d: pszFile=%p:{%s} iLine=%d pszFunction=%p:{%s} pszFormat=%p:{%s} (%N)\n", + pDevIns->pReg->szName, pDevIns->iInstance, pszFile, pszFile, iLine, pszFunction, pszFunction, pszFormat, pszFormat, pszFormat, &va2)); + va_end(va2); +#endif + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_DBGFStopV: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnDBGFInfoRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_DBGFInfoRegister(PPDMDEVINS pDevIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_DBGFInfoRegister: caller='%s'/%d: pszName=%p:{%s} pszDesc=%p:{%s} pfnHandler=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pszName, pszName, pszDesc, pszDesc, pfnHandler)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_DBGFInfoRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnDBGFRegRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_DBGFRegRegister(PPDMDEVINS pDevIns, PCDBGFREGDESC paRegisters) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_DBGFRegRegister: caller='%s'/%d: paRegisters=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, paRegisters)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_DBGFRegRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnDBGFTraceBuf} */ +static DECLCALLBACK(RTTRACEBUF) pdmR3DevHlp_DBGFTraceBuf(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RTTRACEBUF hTraceBuf = NULL; + AssertFailed(); + LogFlow(("pdmR3DevHlp_DBGFTraceBuf: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, hTraceBuf)); + return hTraceBuf; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnSTAMRegister} */ +static DECLCALLBACK(void) pdmR3DevHlp_STAMRegister(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, const char *pszName, + STAMUNIT enmUnit, const char *pszDesc) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RT_NOREF(pvSample, enmType, pszName, enmUnit, pszDesc); + AssertFailed(); +} + + + +/** @interface_method_impl{PDMDEVHLPR3,pfnSTAMRegisterF} */ +static DECLCALLBACK(void) pdmR3DevHlp_STAMRegisterF(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, + STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RT_NOREF(pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName); + AssertFailed(); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnSTAMRegisterV} */ +static DECLCALLBACK(void) pdmR3DevHlp_STAMRegisterV(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, + STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RT_NOREF(pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args); + AssertFailed(); +} + + +/** + * @interface_method_impl{PDMDEVHLPR3,pfnPCIRegister} + */ +static DECLCALLBACK(int) pdmR3DevHlp_PCIRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t idxDevCfg, uint32_t fFlags, + uint8_t uPciDevNo, uint8_t uPciFunNo, const char *pszName) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PCIRegister: caller='%s'/%d: pPciDev=%p:{.config={%#.256Rhxs} idxDevCfg=%d fFlags=%#x uPciDevNo=%#x uPciFunNo=%#x pszName=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev->abConfig, idxDevCfg, fFlags, uPciDevNo, uPciFunNo, pszName, pszName ? pszName : "")); + + /* + * Validate input. + */ + AssertLogRelMsgReturn(RT_VALID_PTR(pPciDev), + ("'%s'/%d: Invalid pPciDev value: %p\n", pDevIns->pReg->szName, pDevIns->iInstance, pPciDev), + VERR_INVALID_POINTER); + AssertLogRelMsgReturn(PDMPciDevGetVendorId(pPciDev), + ("'%s'/%d: Vendor ID is not set!\n", pDevIns->pReg->szName, pDevIns->iInstance), + VERR_INVALID_POINTER); + AssertLogRelMsgReturn(idxDevCfg < 256 || idxDevCfg == PDMPCIDEVREG_CFG_NEXT, + ("'%s'/%d: Invalid config selector: %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, idxDevCfg), + VERR_OUT_OF_RANGE); + AssertLogRelMsgReturn( uPciDevNo < 32 + || uPciDevNo == PDMPCIDEVREG_DEV_NO_FIRST_UNUSED + || uPciDevNo == PDMPCIDEVREG_DEV_NO_SAME_AS_PREV, + ("'%s'/%d: Invalid PCI device number: %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, uPciDevNo), + VERR_INVALID_PARAMETER); + AssertLogRelMsgReturn( uPciFunNo < 8 + || uPciFunNo == PDMPCIDEVREG_FUN_NO_FIRST_UNUSED, + ("'%s'/%d: Invalid PCI funcion number: %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, uPciFunNo), + VERR_INVALID_PARAMETER); + AssertLogRelMsgReturn(!(fFlags & ~PDMPCIDEVREG_F_VALID_MASK), + ("'%s'/%d: Invalid flags: %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, fFlags), + VERR_INVALID_FLAGS); + int rc = VINF_SUCCESS; + pDevIns->Internal.s.pDut->pPciDev = pPciDev; + + LogFlow(("pdmR3DevHlp_PCIRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPCIRegisterMsi} */ +static DECLCALLBACK(int) pdmR3DevHlp_PCIRegisterMsi(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, PPDMMSIREG pMsiReg) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PCIRegisterMsi: caller='%s'/%d: pPciDev=%p:{%#x} pMsgReg=%p:{cMsiVectors=%d, cMsixVectors=%d}\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev->uDevFn, pMsiReg, pMsiReg->cMsiVectors, pMsiReg->cMsixVectors)); + + int rc = VERR_NOT_SUPPORTED; /** @todo */ + + LogFlow(("pdmR3DevHlp_PCIRegisterMsi: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPCIIORegionRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_PCIIORegionRegister(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion, + RTGCPHYS cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PCIIORegionRegister: caller='%s'/%d: pPciDev=%p:{%#x} iRegion=%d cbRegion=%RGp enmType=%d pfnCallback=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev->uDevFn, iRegion, cbRegion, enmType, pfnCallback)); + + AssertLogRelMsgReturn(iRegion < VBOX_PCI_NUM_REGIONS, + ("Region %u exceeds maximum region index %u\n", iRegion, VBOX_PCI_NUM_REGIONS), + VERR_INVALID_PARAMETER); + + int rc = VINF_SUCCESS; + PTSTDEVDUTINT pThis = TSTDEV_PDMDEVINS_2_DUT(pDevIns); + PTSTDEVDUTPCIREGION pRegion = &pThis->aPciRegions[iRegion]; + pRegion->cbRegion = cbRegion; + pRegion->enmType = enmType; + pRegion->pfnRegionMap = pfnCallback; + + LogFlow(("pdmR3DevHlp_PCIIORegionRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPCISetConfigCallbacks} */ +static DECLCALLBACK(void) pdmR3DevHlp_PCISetConfigCallbacks(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, PFNPCICONFIGREAD pfnRead, PPFNPCICONFIGREAD ppfnReadOld, + PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PCISetConfigCallbacks: caller='%s'/%d: pPciDev=%p pfnRead=%p ppfnReadOld=%p pfnWrite=%p ppfnWriteOld=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pfnRead, ppfnReadOld, pfnWrite, ppfnWriteOld)); + + /* + * Validate input and resolve defaults. + */ + AssertPtr(pfnRead); + AssertPtr(pfnWrite); + AssertPtrNull(ppfnReadOld); + AssertPtrNull(ppfnWriteOld); + AssertPtrNull(pPciDev); + + AssertFailed(); + + LogFlow(("pdmR3DevHlp_PCISetConfigCallbacks: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance)); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPCIPhysRead} */ +static DECLCALLBACK(int) pdmR3DevHlp_PCIPhysRead(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RT_NOREF(pPciDev); + return pDevIns->pHlpR3->pfnPhysRead(pDevIns, GCPhys, pvBuf, cbRead); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPCIPhysWrite} */ +static DECLCALLBACK(int) +pdmR3DevHlp_PCIPhysWrite(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RT_NOREF(pPciDev); + return pDevIns->pHlpR3->pfnPhysWrite(pDevIns, GCPhys, pvBuf, cbWrite); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPCISetIrq} */ +static DECLCALLBACK(void) pdmR3DevHlp_PCISetIrq(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PCISetIrq: caller='%s'/%d: pPciDev=%p:{%#x} iIrq=%d iLevel=%d\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciDev, pPciDev->uDevFn, iIrq, iLevel)); + + AssertFailed(); + + LogFlow(("pdmR3DevHlp_PCISetIrq: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance)); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPCISetIrqNoWait} */ +static DECLCALLBACK(void) pdmR3DevHlp_PCISetIrqNoWait(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, int iIrq, int iLevel) +{ + pdmR3DevHlp_PCISetIrq(pDevIns, pPciDev, iIrq, iLevel); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnISASetIrq} */ +static DECLCALLBACK(void) pdmR3DevHlp_ISASetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_ISASetIrq: caller='%s'/%d: iIrq=%d iLevel=%d\n", pDevIns->pReg->szName, pDevIns->iInstance, iIrq, iLevel)); + + //AssertFailed(); + + LogFlow(("pdmR3DevHlp_ISASetIrq: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance)); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnISASetIrqNoWait} */ +static DECLCALLBACK(void) pdmR3DevHlp_ISASetIrqNoWait(PPDMDEVINS pDevIns, int iIrq, int iLevel) +{ + pdmR3DevHlp_ISASetIrq(pDevIns, iIrq, iLevel); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnIoApicSendMsi} */ +static DECLCALLBACK(void) pdmR3DevHlp_IoApicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, uint32_t uValue) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_IoApicSendMsi: caller='%s'/%d: GCPhys=%RGp uValue=%#x\n", pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, uValue)); + + /* + * Validate input. + */ + Assert(GCPhys != 0); + Assert(uValue != 0); + AssertFailed(); + + LogFlow(("pdmR3DevHlp_IoApicSendMsi: caller='%s'/%d: returns void\n", pDevIns->pReg->szName, pDevIns->iInstance)); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnDriverAttach} */ +static DECLCALLBACK(int) pdmR3DevHlp_DriverAttach(PPDMDEVINS pDevIns, uint32_t iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_DriverAttach: caller='%s'/%d: iLun=%d pBaseInterface=%p ppBaseInterface=%p pszDesc=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, iLun, pBaseInterface, ppBaseInterface, pszDesc, pszDesc)); + + /** @todo */ + int rc = VERR_PDM_NO_ATTACHED_DRIVER; + //AssertFailed(); + + LogFlow(("pdmR3DevHlp_DriverAttach: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnDriverDetach} */ +static DECLCALLBACK(int) pdmR3DevHlp_DriverDetach(PPDMDEVINS pDevIns, PPDMDRVINS pDrvIns, uint32_t fFlags) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); RT_NOREF_PV(pDevIns); + LogFlow(("pdmR3DevHlp_DriverDetach: caller='%s'/%d: pDrvIns=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pDrvIns)); + + RT_NOREF(fFlags); + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_DriverDetach: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnQueueCreate} */ +static DECLCALLBACK(int) pdmR3DevHlp_QueueCreate(PPDMDEVINS pDevIns, size_t cbItem, uint32_t cItems, uint32_t cMilliesInterval, + PFNPDMQUEUEDEV pfnCallback, bool fRZEnabled, const char *pszName, PPDMQUEUE *ppQueue) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_QueueCreate: caller='%s'/%d: cbItem=%#x cItems=%#x cMilliesInterval=%u pfnCallback=%p fRZEnabled=%RTbool pszName=%p:{%s} ppQueue=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, cbItem, cItems, cMilliesInterval, pfnCallback, fRZEnabled, pszName, pszName, ppQueue)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_QueueCreate: caller='%s'/%d: returns %Rrc *ppQueue=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, rc, *ppQueue)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnCritSectInit} */ +static DECLCALLBACK(int) pdmR3DevHlp_CritSectInit(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, RT_SRC_POS_DECL, + const char *pszNameFmt, va_list va) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_CritSectInit: caller='%s'/%d: pCritSect=%p pszNameFmt=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, pCritSect, pszNameFmt, pszNameFmt)); + + RT_NOREF(RT_SRC_POS_ARGS, pszNameFmt, pCritSect, va); + int rc = RTCritSectInit(&pCritSect->s.CritSect); + if (RT_SUCCESS(rc)) + pCritSect->s.pVmmCallbacks = pDevIns->Internal.s.pVmmCallbacks; + + LogFlow(("pdmR3DevHlp_CritSectInit: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnCritSectGetNop} */ +static DECLCALLBACK(PPDMCRITSECT) pdmR3DevHlp_CritSectGetNop(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + + AssertFailed(); + PPDMCRITSECT pCritSect = NULL; + + LogFlow(("pdmR3DevHlp_CritSectGetNop: caller='%s'/%d: return %p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pCritSect)); + return pCritSect; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnCritSectGetNopR0} */ +static DECLCALLBACK(R0PTRTYPE(PPDMCRITSECT)) pdmR3DevHlp_CritSectGetNopR0(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + + R0PTRTYPE(PPDMCRITSECT) pCritSect = 0; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_CritSectGetNopR0: caller='%s'/%d: return %RHv\n", + pDevIns->pReg->szName, pDevIns->iInstance, pCritSect)); + return pCritSect; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnCritSectGetNopRC} */ +static DECLCALLBACK(RCPTRTYPE(PPDMCRITSECT)) pdmR3DevHlp_CritSectGetNopRC(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + + RCPTRTYPE(PPDMCRITSECT) pCritSect = 0; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_CritSectGetNopRC: caller='%s'/%d: return %RRv\n", + pDevIns->pReg->szName, pDevIns->iInstance, pCritSect)); + return pCritSect; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnSetDeviceCritSect} */ +static DECLCALLBACK(int) pdmR3DevHlp_SetDeviceCritSect(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect) +{ + /* + * Validate input. + * + * Note! We only allow the automatically created default critical section + * to be replaced by this API. + */ + PDMDEV_ASSERT_DEVINS(pDevIns); + AssertPtrReturn(pCritSect, VERR_INVALID_POINTER); + LogFlow(("pdmR3DevHlp_SetDeviceCritSect: caller='%s'/%d: pCritSect=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pCritSect)); + + /** @todo Implement default atomatic critical section. */ + pDevIns->pCritSectRoR3 = pCritSect; + + LogFlow(("pdmR3DevHlp_SetDeviceCritSect: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS)); + return VINF_SUCCESS; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnThreadCreate} */ +static DECLCALLBACK(int) pdmR3DevHlp_ThreadCreate(PPDMDEVINS pDevIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDEV pfnThread, + PFNPDMTHREADWAKEUPDEV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_ThreadCreate: caller='%s'/%d: ppThread=%p pvUser=%p pfnThread=%p pfnWakeup=%p cbStack=%#zx enmType=%d pszName=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName, pszName)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_ThreadCreate: caller='%s'/%d: returns %Rrc *ppThread=%RTthrd\n", pDevIns->pReg->szName, pDevIns->iInstance, + rc, *ppThread)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnSetAsyncNotification} */ +static DECLCALLBACK(int) pdmR3DevHlp_SetAsyncNotification(PPDMDEVINS pDevIns, PFNPDMDEVASYNCNOTIFY pfnAsyncNotify) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_SetAsyncNotification: caller='%s'/%d: pfnAsyncNotify=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pfnAsyncNotify)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_SetAsyncNotification: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnAsyncNotificationCompleted} */ +static DECLCALLBACK(void) pdmR3DevHlp_AsyncNotificationCompleted(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + AssertFailed(); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnRTCRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_RTCRegister(PPDMDEVINS pDevIns, PCPDMRTCREG pRtcReg, PCPDMRTCHLP *ppRtcHlp) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_RTCRegister: caller='%s'/%d: pRtcReg=%p:{.u32Version=%#x, .pfnWrite=%p, .pfnRead=%p} ppRtcHlp=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pRtcReg, pRtcReg->u32Version, pRtcReg->pfnWrite, + pRtcReg->pfnWrite, ppRtcHlp)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_RTCRegister: caller='%s'/%d: returns %Rrc\n", + pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnDMARegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_DMARegister(PPDMDEVINS pDevIns, unsigned uChannel, PFNDMATRANSFERHANDLER pfnTransferHandler, void *pvUser) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + + RT_NOREF(uChannel, pfnTransferHandler, pvUser); + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_DMARegister: caller='%s'/%d: returns %Rrc\n", + pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnDMAReadMemory} */ +static DECLCALLBACK(int) pdmR3DevHlp_DMAReadMemory(PPDMDEVINS pDevIns, unsigned uChannel, void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbRead) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_DMAReadMemory: caller='%s'/%d: uChannel=%d pvBuffer=%p off=%#x cbBlock=%#x pcbRead=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, uChannel, pvBuffer, off, cbBlock, pcbRead)); + + RT_NOREF(uChannel, pvBuffer, off, cbBlock, pcbRead); + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_DMAReadMemory: caller='%s'/%d: returns %Rrc\n", + pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnDMAWriteMemory} */ +static DECLCALLBACK(int) pdmR3DevHlp_DMAWriteMemory(PPDMDEVINS pDevIns, unsigned uChannel, const void *pvBuffer, uint32_t off, uint32_t cbBlock, uint32_t *pcbWritten) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_DMAWriteMemory: caller='%s'/%d: uChannel=%d pvBuffer=%p off=%#x cbBlock=%#x pcbWritten=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, uChannel, pvBuffer, off, cbBlock, pcbWritten)); + + RT_NOREF(uChannel, pvBuffer, off, cbBlock, pcbWritten); + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_DMAWriteMemory: caller='%s'/%d: returns %Rrc\n", + pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnDMASetDREQ} */ +static DECLCALLBACK(int) pdmR3DevHlp_DMASetDREQ(PPDMDEVINS pDevIns, unsigned uChannel, unsigned uLevel) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_DMASetDREQ: caller='%s'/%d: uChannel=%d uLevel=%d\n", + pDevIns->pReg->szName, pDevIns->iInstance, uChannel, uLevel)); + + RT_NOREF(uChannel, uLevel); + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_DMASetDREQ: caller='%s'/%d: returns %Rrc\n", + pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + +/** @interface_method_impl{PDMDEVHLPR3,pfnDMAGetChannelMode} */ +static DECLCALLBACK(uint8_t) pdmR3DevHlp_DMAGetChannelMode(PPDMDEVINS pDevIns, unsigned uChannel) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_DMAGetChannelMode: caller='%s'/%d: uChannel=%d\n", + pDevIns->pReg->szName, pDevIns->iInstance, uChannel)); + + uint8_t u8Mode = 0; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_DMAGetChannelMode: caller='%s'/%d: returns %#04x\n", + pDevIns->pReg->szName, pDevIns->iInstance, u8Mode)); + return u8Mode; +} + +/** @interface_method_impl{PDMDEVHLPR3,pfnDMASchedule} */ +static DECLCALLBACK(void) pdmR3DevHlp_DMASchedule(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_DMASchedule: caller='%s'/%d\n", + pDevIns->pReg->szName, pDevIns->iInstance)); + + AssertFailed(); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnCMOSWrite} */ +static DECLCALLBACK(int) pdmR3DevHlp_CMOSWrite(PPDMDEVINS pDevIns, unsigned iReg, uint8_t u8Value) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_CMOSWrite: caller='%s'/%d: iReg=%#04x u8Value=%#04x\n", + pDevIns->pReg->szName, pDevIns->iInstance, iReg, u8Value)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_CMOSWrite: caller='%s'/%d: return %Rrc\n", + pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnCMOSRead} */ +static DECLCALLBACK(int) pdmR3DevHlp_CMOSRead(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_CMOSWrite: caller='%s'/%d: iReg=%#04x pu8Value=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, iReg, pu8Value)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_CMOSWrite: caller='%s'/%d: return %Rrc\n", + pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnAssertEMT} */ +static DECLCALLBACK(bool) pdmR3DevHlp_AssertEMT(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RT_NOREF(pszFile, iLine, pszFunction); + AssertFailed(); + return false; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnAssertOther} */ +static DECLCALLBACK(bool) pdmR3DevHlp_AssertOther(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + RT_NOREF(pszFile, iLine, pszFunction); + AssertFailed(); + return false; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnLdrGetRCInterfaceSymbols} */ +static DECLCALLBACK(int) pdmR3DevHlp_LdrGetRCInterfaceSymbols(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface, + const char *pszSymPrefix, const char *pszSymList) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PDMLdrGetRCInterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_PDMLdrGetRCInterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, + pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnLdrGetR0InterfaceSymbols} */ +static DECLCALLBACK(int) pdmR3DevHlp_LdrGetR0InterfaceSymbols(PPDMDEVINS pDevIns, void *pvInterface, size_t cbInterface, + const char *pszSymPrefix, const char *pszSymList) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PDMLdrGetR0InterfaceSymbols: caller='%s'/%d: pvInterface=%p cbInterface=%zu pszSymPrefix=%p:{%s} pszSymList=%p:{%s}\n", + pDevIns->pReg->szName, pDevIns->iInstance, pvInterface, cbInterface, pszSymPrefix, pszSymPrefix, pszSymList, pszSymList)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_PDMLdrGetR0InterfaceSymbols: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, + pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnCallR0} */ +static DECLCALLBACK(int) pdmR3DevHlp_CallR0(PPDMDEVINS pDevIns, uint32_t uOperation, uint64_t u64Arg) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_CallR0: caller='%s'/%d: uOperation=%#x u64Arg=%#RX64\n", + pDevIns->pReg->szName, pDevIns->iInstance, uOperation, u64Arg)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_CallR0: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, + pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMGetSuspendReason} */ +static DECLCALLBACK(VMSUSPENDREASON) pdmR3DevHlp_VMGetSuspendReason(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + VMSUSPENDREASON enmReason = VMSUSPENDREASON_INVALID; + AssertFailed(); + LogFlow(("pdmR3DevHlp_VMGetSuspendReason: caller='%s'/%d: returns %d\n", + pDevIns->pReg->szName, pDevIns->iInstance, enmReason)); + return enmReason; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMGetResumeReason} */ +static DECLCALLBACK(VMRESUMEREASON) pdmR3DevHlp_VMGetResumeReason(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + VMRESUMEREASON enmReason = VMRESUMEREASON_INVALID; + AssertFailed(); + LogFlow(("pdmR3DevHlp_VMGetResumeReason: caller='%s'/%d: returns %d\n", + pDevIns->pReg->szName, pDevIns->iInstance, enmReason)); + return enmReason; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnGetUVM} */ +static DECLCALLBACK(PUVM) pdmR3DevHlp_GetUVM(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + AssertFailed(); + LogFlow(("pdmR3DevHlp_GetUVM: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, NULL)); + return NULL; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnGetVM} */ +static DECLCALLBACK(PVM) pdmR3DevHlp_GetVM(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + PTSTDEVDUTINT pThis = TSTDEV_PDMDEVINS_2_DUT(pDevIns); + PVM pVM = pThis->pVm; + LogFlow(("pdmR3DevHlp_GetVM: caller='%s'/%d: returns %p\n", pDevIns->pReg->szName, pDevIns->iInstance, NULL)); + return pVM; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnGetVMCPU} */ +static DECLCALLBACK(PVMCPU) pdmR3DevHlp_GetVMCPU(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + AssertFailed(); + LogFlow(("pdmR3DevHlp_GetVMCPU: caller='%s'/%d for CPU %u\n", pDevIns->pReg->szName, pDevIns->iInstance, NULL)); + return NULL; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnGetCurrentCpuId} */ +static DECLCALLBACK(VMCPUID) pdmR3DevHlp_GetCurrentCpuId(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + VMCPUID idCpu = 0; + AssertFailed(); + LogFlow(("pdmR3DevHlp_GetCurrentCpuId: caller='%s'/%d for CPU %u\n", pDevIns->pReg->szName, pDevIns->iInstance, idCpu)); + return idCpu; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPCIBusRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_PCIBusRegister(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg, + PCPDMPCIHLPR3 *ppPciHlpR3, uint32_t *piBus) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PCIBusRegister: caller='%s'/%d: pPciBusReg=%p:{.u32Version=%#x, .pfnRegisterR3=%p, .pfnIORegionRegisterR3=%p, " + ".pfnSetIrqR3=%p, .pszSetIrqRC=%p:{%s}, .pszSetIrqR0=%p:{%s}} ppPciHlpR3=%p piBus=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPciBusReg, pPciBusReg->u32Version, pPciBusReg->pfnRegisterR3, + pPciBusReg->pfnIORegionRegisterR3, pPciBusReg->pfnSetIrqR3, pPciBusReg->pszSetIrqRC, pPciBusReg->pszSetIrqRC, + pPciBusReg->pszSetIrqR0, pPciBusReg->pszSetIrqR0, ppPciHlpR3, piBus)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_PCIBusRegister: caller='%s'/%d: returns %Rrc *piBus=%u\n", + pDevIns->pReg->szName, pDevIns->iInstance, rc, *piBus)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPICRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_PICRegister(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLPR3 *ppPicHlpR3) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_PICRegister: caller='%s'/%d: pPicReg=%p:{.u32Version=%#x, .pfnSetIrqR3=%p, .pfnGetInterruptR3=%p, .pszGetIrqRC=%p:{%s}, .pszGetInterruptRC=%p:{%s}, .pszGetIrqR0=%p:{%s}, .pszGetInterruptR0=%p:{%s} } ppPicHlpR3=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pPicReg, pPicReg->u32Version, pPicReg->pfnSetIrqR3, pPicReg->pfnGetInterruptR3, + pPicReg->pszSetIrqRC, pPicReg->pszSetIrqRC, pPicReg->pszGetInterruptRC, pPicReg->pszGetInterruptRC, + pPicReg->pszSetIrqR0, pPicReg->pszSetIrqR0, pPicReg->pszGetInterruptR0, pPicReg->pszGetInterruptR0, + ppPicHlpR3)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_PICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnAPICRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnIOAPICRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_IOAPICRegister(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLPR3 *ppIoApicHlpR3) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_IOAPICRegister: caller='%s'/%d: pIoApicReg=%p:{.u32Version=%#x, .pfnSetIrqR3=%p, .pszSetIrqRC=%p:{%s}, .pszSetIrqR0=%p:{%s}} ppIoApicHlpR3=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pIoApicReg, pIoApicReg->u32Version, pIoApicReg->pfnSetIrqR3, + pIoApicReg->pszSetIrqRC, pIoApicReg->pszSetIrqRC, pIoApicReg->pszSetIrqR0, pIoApicReg->pszSetIrqR0, ppIoApicHlpR3)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_IOAPICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnHPETRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_HPETRegister(PPDMDEVINS pDevIns, PPDMHPETREG pHpetReg, PCPDMHPETHLPR3 *ppHpetHlpR3) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); RT_NOREF_PV(pDevIns); + LogFlow(("pdmR3DevHlp_HPETRegister: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance)); + + RT_NOREF(pHpetReg, ppHpetHlpR3); + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_HPETRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnPciRawRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_PciRawRegister(PPDMDEVINS pDevIns, PPDMPCIRAWREG pPciRawReg, PCPDMPCIRAWHLPR3 *ppPciRawHlpR3) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); RT_NOREF_PV(pDevIns); + LogFlow(("pdmR3DevHlp_PciRawRegister: caller='%s'/%d:\n", pDevIns->pReg->szName, pDevIns->iInstance)); + + RT_NOREF(pPciRawReg, ppPciRawHlpR3); + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_PciRawRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnDMACRegister} */ +static DECLCALLBACK(int) pdmR3DevHlp_DMACRegister(PPDMDEVINS pDevIns, PPDMDMACREG pDmacReg, PCPDMDMACHLP *ppDmacHlp) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_DMACRegister: caller='%s'/%d: pDmacReg=%p:{.u32Version=%#x, .pfnRun=%p, .pfnRegister=%p, .pfnReadMemory=%p, .pfnWriteMemory=%p, .pfnSetDREQ=%p, .pfnGetChannelMode=%p} ppDmacHlp=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pDmacReg, pDmacReg->u32Version, pDmacReg->pfnRun, pDmacReg->pfnRegister, + pDmacReg->pfnReadMemory, pDmacReg->pfnWriteMemory, pDmacReg->pfnSetDREQ, pDmacReg->pfnGetChannelMode, ppDmacHlp)); + + RT_NOREF(pDmacReg, ppDmacHlp); + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_DMACRegister: caller='%s'/%d: returns %Rrc\n", + pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** + * @copydoc PDMDEVHLPR3::pfnRegisterVMMDevHeap + */ +static DECLCALLBACK(int) pdmR3DevHlp_RegisterVMMDevHeap(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbHeap) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_RegisterVMMDevHeap: caller='%s'/%d: GCPhys=%RGp pvHeap=%p cbHeap=%#x\n", + pDevIns->pReg->szName, pDevIns->iInstance, GCPhys, pvHeap, cbHeap)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_RegisterVMMDevHeap: caller='%s'/%d: returns %Rrc\n", + pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** + * @interface_method_impl{PDMDEVHLPR3,pfnFirmwareRegister} + */ +static DECLCALLBACK(int) pdmR3DevHlp_FirmwareRegister(PPDMDEVINS pDevIns, PCPDMFWREG pFwReg, PCPDMFWHLPR3 *ppFwHlp) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_FirmwareRegister: caller='%s'/%d: pFWReg=%p:{.u32Version=%#x, .pfnIsHardReset=%p, .u32TheEnd=%#x} ppFwHlp=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, pFwReg, pFwReg->u32Version, pFwReg->pfnIsHardReset, pFwReg->u32TheEnd, ppFwHlp)); + + RT_NOREF(pFwReg, ppFwHlp); + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_FirmwareRegister: caller='%s'/%d: returns %Rrc\n", + pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMReset} */ +static DECLCALLBACK(int) pdmR3DevHlp_VMReset(PPDMDEVINS pDevIns, uint32_t fFlags) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_VMReset: caller='%s'/%d: fFlags=%#x\n", + pDevIns->pReg->szName, pDevIns->iInstance, fFlags)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_VMReset: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMSuspend} */ +static DECLCALLBACK(int) pdmR3DevHlp_VMSuspend(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_VMSuspend: caller='%s'/%d:\n", + pDevIns->pReg->szName, pDevIns->iInstance)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_VMSuspend: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMSuspendSaveAndPowerOff} */ +static DECLCALLBACK(int) pdmR3DevHlp_VMSuspendSaveAndPowerOff(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_VMSuspendSaveAndPowerOff: caller='%s'/%d:\n", + pDevIns->pReg->szName, pDevIns->iInstance)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_VMSuspendSaveAndPowerOff: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnVMPowerOff} */ +static DECLCALLBACK(int) pdmR3DevHlp_VMPowerOff(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_VMPowerOff: caller='%s'/%d:\n", + pDevIns->pReg->szName, pDevIns->iInstance)); + + int rc = VERR_NOT_IMPLEMENTED; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_VMPowerOff: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); + return rc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnA20IsEnabled} */ +static DECLCALLBACK(bool) pdmR3DevHlp_A20IsEnabled(PPDMDEVINS pDevIns) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + + bool fRc = false; + AssertFailed(); + + LogFlow(("pdmR3DevHlp_A20IsEnabled: caller='%s'/%d: returns %d\n", pDevIns->pReg->szName, pDevIns->iInstance, fRc)); + return fRc; +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnA20Set} */ +static DECLCALLBACK(void) pdmR3DevHlp_A20Set(PPDMDEVINS pDevIns, bool fEnable) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_A20Set: caller='%s'/%d: fEnable=%d\n", pDevIns->pReg->szName, pDevIns->iInstance, fEnable)); + AssertFailed(); +} + + +/** @interface_method_impl{PDMDEVHLPR3,pfnGetCpuId} */ +static DECLCALLBACK(void) pdmR3DevHlp_GetCpuId(PPDMDEVINS pDevIns, uint32_t iLeaf, + uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx) +{ + PDMDEV_ASSERT_DEVINS(pDevIns); + LogFlow(("pdmR3DevHlp_GetCpuId: caller='%s'/%d: iLeaf=%d pEax=%p pEbx=%p pEcx=%p pEdx=%p\n", + pDevIns->pReg->szName, pDevIns->iInstance, iLeaf, pEax, pEbx, pEcx, pEdx)); + AssertPtr(pEax); AssertPtr(pEbx); AssertPtr(pEcx); AssertPtr(pEdx); + + AssertFailed(); + + LogFlow(("pdmR3DevHlp_GetCpuId: caller='%s'/%d: returns void - *pEax=%#x *pEbx=%#x *pEcx=%#x *pEdx=%#x\n", + pDevIns->pReg->szName, pDevIns->iInstance, *pEax, *pEbx, *pEcx, *pEdx)); +} + +const PDMDEVHLPR3 g_tstDevPdmDevHlpR3 = +{ + PDM_DEVHLPR3_VERSION, + pdmR3DevHlp_IOPortRegister, + pdmR3DevHlp_IOPortRegisterRC, + pdmR3DevHlp_IOPortRegisterR0, + pdmR3DevHlp_IOPortDeregister, + pdmR3DevHlp_MMIORegister, + pdmR3DevHlp_MMIORegisterRC, + pdmR3DevHlp_MMIORegisterR0, + pdmR3DevHlp_MMIODeregister, + pdmR3DevHlp_MMIO2Register, + pdmR3DevHlp_MMIOExPreRegister, + pdmR3DevHlp_MMIOExDeregister, + pdmR3DevHlp_MMIOExMap, + pdmR3DevHlp_MMIOExUnmap, + pdmR3DevHlp_MMIOExReduce, + pdmR3DevHlp_MMHyperMapMMIO2, + pdmR3DevHlp_MMIO2MapKernel, + pdmR3DevHlp_ROMRegister, + pdmR3DevHlp_ROMProtectShadow, + pdmR3DevHlp_SSMRegister, + pdmR3DevHlp_TMTimerCreate, + pdmR3DevHlp_TMUtcNow, + pdmR3DevHlp_PhysRead, + pdmR3DevHlp_PhysWrite, + pdmR3DevHlp_PhysGCPhys2CCPtr, + pdmR3DevHlp_PhysGCPhys2CCPtrReadOnly, + pdmR3DevHlp_PhysReleasePageMappingLock, + pdmR3DevHlp_PhysReadGCVirt, + pdmR3DevHlp_PhysWriteGCVirt, + pdmR3DevHlp_PhysGCPtr2GCPhys, + pdmR3DevHlp_MMHeapAlloc, + pdmR3DevHlp_MMHeapAllocZ, + pdmR3DevHlp_MMHeapFree, + pdmR3DevHlp_VMState, + pdmR3DevHlp_VMTeleportedAndNotFullyResumedYet, + pdmR3DevHlp_VMSetError, + pdmR3DevHlp_VMSetErrorV, + pdmR3DevHlp_VMSetRuntimeError, + pdmR3DevHlp_VMSetRuntimeErrorV, + pdmR3DevHlp_DBGFStopV, + pdmR3DevHlp_DBGFInfoRegister, + pdmR3DevHlp_DBGFRegRegister, + pdmR3DevHlp_DBGFTraceBuf, + pdmR3DevHlp_STAMRegister, + pdmR3DevHlp_STAMRegisterF, + pdmR3DevHlp_STAMRegisterV, + pdmR3DevHlp_PCIRegister, + pdmR3DevHlp_PCIRegisterMsi, + pdmR3DevHlp_PCIIORegionRegister, + pdmR3DevHlp_PCISetConfigCallbacks, + pdmR3DevHlp_PCIPhysRead, + pdmR3DevHlp_PCIPhysWrite, + pdmR3DevHlp_PCISetIrq, + pdmR3DevHlp_PCISetIrqNoWait, + pdmR3DevHlp_ISASetIrq, + pdmR3DevHlp_ISASetIrqNoWait, + pdmR3DevHlp_IoApicSendMsi, + pdmR3DevHlp_DriverAttach, + pdmR3DevHlp_DriverDetach, + pdmR3DevHlp_QueueCreate, + pdmR3DevHlp_CritSectInit, + pdmR3DevHlp_CritSectGetNop, + pdmR3DevHlp_CritSectGetNopR0, + pdmR3DevHlp_CritSectGetNopRC, + pdmR3DevHlp_SetDeviceCritSect, + pdmR3DevHlp_ThreadCreate, + pdmR3DevHlp_SetAsyncNotification, + pdmR3DevHlp_AsyncNotificationCompleted, + pdmR3DevHlp_RTCRegister, + pdmR3DevHlp_PCIBusRegister, + pdmR3DevHlp_PICRegister, + pdmR3DevHlp_APICRegister, + pdmR3DevHlp_IOAPICRegister, + pdmR3DevHlp_HPETRegister, + pdmR3DevHlp_PciRawRegister, + pdmR3DevHlp_DMACRegister, + pdmR3DevHlp_DMARegister, + pdmR3DevHlp_DMAReadMemory, + pdmR3DevHlp_DMAWriteMemory, + pdmR3DevHlp_DMASetDREQ, + pdmR3DevHlp_DMAGetChannelMode, + pdmR3DevHlp_DMASchedule, + pdmR3DevHlp_CMOSWrite, + pdmR3DevHlp_CMOSRead, + pdmR3DevHlp_AssertEMT, + pdmR3DevHlp_AssertOther, + pdmR3DevHlp_LdrGetRCInterfaceSymbols, + pdmR3DevHlp_LdrGetR0InterfaceSymbols, + pdmR3DevHlp_CallR0, + pdmR3DevHlp_VMGetSuspendReason, + pdmR3DevHlp_VMGetResumeReason, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + pdmR3DevHlp_GetUVM, + pdmR3DevHlp_GetVM, + pdmR3DevHlp_GetVMCPU, + pdmR3DevHlp_GetCurrentCpuId, + pdmR3DevHlp_RegisterVMMDevHeap, + pdmR3DevHlp_FirmwareRegister, + pdmR3DevHlp_VMReset, + pdmR3DevHlp_VMSuspend, + pdmR3DevHlp_VMSuspendSaveAndPowerOff, + pdmR3DevHlp_VMPowerOff, + pdmR3DevHlp_A20IsEnabled, + pdmR3DevHlp_A20Set, + pdmR3DevHlp_GetCpuId, + pdmR3DevHlp_TMTimeVirtGet, + pdmR3DevHlp_TMTimeVirtGetFreq, + pdmR3DevHlp_TMTimeVirtGetNano, + pdmR3DevHlp_GetSupDrvSession, + pdmR3DevHlp_QueryGenericUserObject, + PDM_DEVHLPR3_VERSION /* the end */ +}; + diff --git a/src/VBox/Devices/testcase/tstDevicePlugin.h b/src/VBox/Devices/testcase/tstDevicePlugin.h new file mode 100644 index 00000000..9b4c6b8e --- /dev/null +++ b/src/VBox/Devices/testcase/tstDevicePlugin.h @@ -0,0 +1,128 @@ +/** @file + * tstDevice: Plugin API. + */ + +/* + * Copyright (C) 2017-2019 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_INCLUDED_SRC_testcase_tstDevicePlugin_h +#define VBOX_INCLUDED_SRC_testcase_tstDevicePlugin_h +#ifndef RT_WITHOUT_PRAGMA_ONCE +# pragma once +#endif + +#include <VBox/types.h> + +/** + * Config item type. + */ +typedef enum TSTDEVCFGITEMTYPE +{ + /** Invalid type. */ + TSTDEVCFGITEMTYPE_INVALID = 0, + /** String type. */ + TSTDEVCFGITEMTYPE_STRING, + /** Integer value encoded in the string. */ + TSTDEVCFGITEMTYPE_INTEGER, + /** Raw bytes. */ + TSTDEVCFGITEMTYPE_BYTES, + /** 32bit hack. */ + TSTDEVCFGITEMTYPE_32BIT_HACK = 0x7fffffff +} TSTDEVCFGITEMTYPE; +/** Pointer to a config item type. */ +typedef TSTDEVCFGITEMTYPE *PTSTDEVCFGITEMTYPE; + + +/** + * Testcase config item. + */ +typedef struct TSTDEVCFGITEM +{ + /** The key of the item. */ + const char *pszKey; + /** Type of the config item. */ + TSTDEVCFGITEMTYPE enmType; + /** The value of the item (as a string/number of bytes to make static + * instantiation easier). */ + const char *pszVal; +} TSTDEVCFGITEM; +/** Pointer to a testcase config item. */ +typedef TSTDEVCFGITEM *PTSTDEVCFGITEM; +/** Pointer to a constant testcase config item. */ +typedef const TSTDEVCFGITEM *PCTSTDEVCFGITEM; + + +/** Device under test handle. */ +typedef struct TSTDEVDUTINT *TSTDEVDUT; + +/** + * Testcase registration structure. + */ +typedef struct TSTDEVTESTCASEREG +{ + /** Testcase name. */ + char szName[16]; + /** Testcase description. */ + const char *pszDesc; + /** The device name the testcase handles. */ + char szDevName[16]; + /** Flags for this testcase. */ + uint32_t fFlags; + /** CFGM configuration for the device to be instantiated. */ + PCTSTDEVCFGITEM paDevCfg; + + /** + * Testcase entry point. + * + * @returns VBox status code. + * @param hDut Handle of the device under test. + */ + DECLR3CALLBACKMEMBER(int, pfnTestEntry, (TSTDEVDUT hDut)); +} TSTDEVTESTCASEREG; +/** Pointer to a testcase registration structure. */ +typedef TSTDEVTESTCASEREG *PTSTDEVTESTCASEREG; +/** Pointer to a constant testcase registration structure. */ +typedef const TSTDEVTESTCASEREG *PCTSTDEVTESTCASEREG; + + +/** + * Testcase register callbacks structure. + */ +typedef struct TSTDEVPLUGINREGISTER +{ + /** + * Registers a new testcase. + * + * @returns VBox status code. + * @param pvUser Opaque user data given in the plugin load callback. + * @param pTestcaseReg The testcase descriptor to register. + */ + DECLR3CALLBACKMEMBER(int, pfnRegisterTestcase, (void *pvUser, PCTSTDEVTESTCASEREG pTestcaseReg)); + +} TSTDEVPLUGINREGISTER; +/** Pointer to a backend register callbacks structure. */ +typedef TSTDEVPLUGINREGISTER *PTSTDEVPLUGINREGISTER; + + +/** + * Initialization entry point called by the device test framework when + * a plugin is loaded. + * + * @returns VBox status code. + * @param pvUser Opaque user data passed in the register callbacks. + * @param pRegisterCallbacks Pointer to the register callbacks structure. + */ +typedef DECLCALLBACK(int) FNTSTDEVPLUGINLOAD(void *pvUser, PTSTDEVPLUGINREGISTER pRegisterCallbacks); +typedef FNTSTDEVPLUGINLOAD *PFNTSTDEVPLUGINLOAD; +#define TSTDEV_PLUGIN_LOAD_NAME "TSTDevPluginLoad" + +#endif /* !VBOX_INCLUDED_SRC_testcase_tstDevicePlugin_h */ diff --git a/src/VBox/Devices/testcase/tstDeviceSUP.cpp b/src/VBox/Devices/testcase/tstDeviceSUP.cpp new file mode 100644 index 00000000..1f95dc48 --- /dev/null +++ b/src/VBox/Devices/testcase/tstDeviceSUP.cpp @@ -0,0 +1,251 @@ +/* $Id: tstDeviceSUP.cpp $ */ +/** @file + * tstDevice - Test framework for PDM devices/drivers, SUP library exports. + */ + +/* + * Copyright (C) 2017-2019 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_DEFAULT /** @todo */ +#include <VBox/sup.h> + +#include <iprt/mem.h> +#include <iprt/semaphore.h> + +#include "tstDeviceInternal.h" + + +/********************************************************************************************************************************* +* Defined Constants And Macros * +*********************************************************************************************************************************/ + + + +/********************************************************************************************************************************* +* Structures and Typedefs * +*********************************************************************************************************************************/ + + + +/********************************************************************************************************************************* +* Global Variables * +*********************************************************************************************************************************/ + + + +/********************************************************************************************************************************* +* Internal Functions * +*********************************************************************************************************************************/ + +SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, PRTERRINFO pErrInfo) +{ + RT_NOREF(fFlags, pErrInfo); + int rc = VINF_SUCCESS; + + if (!RTStrCmp(pszFilename, "VBoxVMM")) + rc = RTLdrLoad("tstDeviceVBoxVMMStubs", phLdrMod); + else + { + /* Implement loading of any missing libraries here. */ + AssertFailed(); + rc = VERR_NOT_FOUND; + } + + return rc; +} + + +SUPDECL(int) SUPSemEventCreate(PSUPDRVSESSION pSession, PSUPSEMEVENT phEvent) +{ + PTSTDEVSUPDRVSESSION pThis = TSTDEV_PSUPDRVSESSION_2_PTSTDEVSUPDRVSESSION(pSession); + int rc = VINF_SUCCESS; + PTSTDEVSUPSEMEVENT pSupSem = (PTSTDEVSUPSEMEVENT)RTMemAllocZ(sizeof(TSTDEVSUPSEMEVENT)); + + if (VALID_PTR(pSupSem)) + { + pSupSem->fMulti = false; + rc = RTSemEventCreate(&pSupSem->u.hSemEvt); + if (RT_SUCCESS(rc)) + { + RTListAppend(&pThis->LstSupSem, &pSupSem->NdSupSem); + *phEvent = TSTDEV_PTSTDEVSUPSEMEVENT_2_SUPSEMEVENT(pSupSem); + } + else + RTMemFree(pSupSem); + } + else + rc = VERR_NO_MEMORY; + + return rc; +} + +SUPDECL(int) SUPSemEventClose(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) +{ + PTSTDEVSUPDRVSESSION pThis = TSTDEV_PSUPDRVSESSION_2_PTSTDEVSUPDRVSESSION(pSession); + PTSTDEVSUPSEMEVENT pSupSem = TSTDEV_SUPSEMEVENT_2_PTSTDEVSUPSEMEVENT(hEvent); + + PTSTDEVSUPSEMEVENT pIt; + RTListForEach(&pThis->LstSupSem, pIt, TSTDEVSUPSEMEVENT, NdSupSem) + { + if (pIt == pSupSem) + { + AssertReturn(!pSupSem->fMulti, VERR_INVALID_HANDLE); + RTListNodeRemove(&pSupSem->NdSupSem); + RTSemEventDestroy(pSupSem->u.hSemEvt); + RTMemFree(pSupSem); + return VINF_OBJECT_DESTROYED; + } + } + + AssertFailed(); + return VERR_INVALID_HANDLE; +} + +SUPDECL(int) SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent) +{ + RT_NOREF(pSession); + PTSTDEVSUPSEMEVENT pSupSem = TSTDEV_SUPSEMEVENT_2_PTSTDEVSUPSEMEVENT(hEvent); + AssertReturn(!pSupSem->fMulti, VERR_INVALID_HANDLE); + + return RTSemEventSignal(pSupSem->u.hSemEvt); +} + +SUPDECL(int) SUPSemEventWait(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t cMillies) +{ + RT_NOREF(pSession); + PTSTDEVSUPSEMEVENT pSupSem = TSTDEV_SUPSEMEVENT_2_PTSTDEVSUPSEMEVENT(hEvent); + AssertReturn(!pSupSem->fMulti, VERR_INVALID_HANDLE); + + return RTSemEventWait(pSupSem->u.hSemEvt, cMillies); +} + +SUPDECL(int) SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t cMillies) +{ + RT_NOREF(pSession); + PTSTDEVSUPSEMEVENT pSupSem = TSTDEV_SUPSEMEVENT_2_PTSTDEVSUPSEMEVENT(hEvent); + AssertReturn(!pSupSem->fMulti, VERR_INVALID_HANDLE); + + return RTSemEventWaitNoResume(pSupSem->u.hSemEvt, cMillies); +} + +SUPDECL(int) SUPSemEventWaitNsAbsIntr(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint64_t uNsTimeout) +{ + RT_NOREF(pSession); + PTSTDEVSUPSEMEVENT pSupSem = TSTDEV_SUPSEMEVENT_2_PTSTDEVSUPSEMEVENT(hEvent); + AssertReturn(!pSupSem->fMulti, VERR_INVALID_HANDLE); + +#if 0 + return RTSemEventWaitEx(pSupSem->u.hSemEvt, + RTSEMWAIT_FLAGS_INTERRUPTIBLE | RTSEMWAIT_FLAGS_ABSOLUTE | RTSEMWAIT_FLAGS_NANOSECS, + uNsTimeout); +#else + RT_NOREF(uNsTimeout); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +#endif +} + +SUPDECL(int) SUPSemEventWaitNsRelIntr(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint64_t cNsTimeout) +{ + RT_NOREF(pSession); + PTSTDEVSUPSEMEVENT pSupSem = TSTDEV_SUPSEMEVENT_2_PTSTDEVSUPSEMEVENT(hEvent); + AssertReturn(!pSupSem->fMulti, VERR_INVALID_HANDLE); + +#if 0 + return RTSemEventWaitEx(pSupSem->u.hSemEvt, + RTSEMWAIT_FLAGS_INTERRUPTIBLE | RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_NANOSECS, + cNsTimeout); +#else + RT_NOREF(cNsTimeout); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +#endif +} + +SUPDECL(uint32_t) SUPSemEventGetResolution(PSUPDRVSESSION pSession) +{ + RT_NOREF(pSession); +#if 0 + return RTSemEventGetResolution(); +#else + AssertFailed(); + return 0; +#endif +} + +SUPDECL(int) SUPSemEventMultiCreate(PSUPDRVSESSION pSession, PSUPSEMEVENTMULTI phEventMulti) +{ + RT_NOREF(pSession, phEventMulti); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + +SUPDECL(int) SUPSemEventMultiClose(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti) +{ + RT_NOREF(pSession, hEventMulti); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + +SUPDECL(int) SUPSemEventMultiSignal(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti) +{ + RT_NOREF(pSession, hEventMulti); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + +SUPDECL(int) SUPSemEventMultiReset(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti) +{ + RT_NOREF(pSession, hEventMulti); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + +SUPDECL(int) SUPSemEventMultiWait(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint32_t cMillies) +{ + RT_NOREF(pSession, hEventMulti, cMillies); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + +SUPDECL(int) SUPSemEventMultiWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint32_t cMillies) +{ + RT_NOREF(pSession, hEventMulti, cMillies); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + +SUPDECL(int) SUPSemEventMultiWaitNsAbsIntr(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint64_t uNsTimeout) +{ + RT_NOREF(pSession, hEventMulti, uNsTimeout); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + +SUPDECL(int) SUPSemEventMultiWaitNsRelIntr(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint64_t cNsTimeout) +{ + RT_NOREF(pSession, hEventMulti, cNsTimeout); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + +SUPDECL(uint32_t) SUPSemEventMultiGetResolution(PSUPDRVSESSION pSession) +{ + RT_NOREF(pSession); + AssertFailed(); + return 0; +} + diff --git a/src/VBox/Devices/testcase/tstDeviceStructSize.cpp b/src/VBox/Devices/testcase/tstDeviceStructSize.cpp new file mode 100644 index 00000000..7a908012 --- /dev/null +++ b/src/VBox/Devices/testcase/tstDeviceStructSize.cpp @@ -0,0 +1,437 @@ +/* $Id: tstDeviceStructSize.cpp $ */ +/** @file + * tstDeviceStructSize - testcase for check structure sizes/alignment + * and to verify that HC and RC uses the same + * representation of the structures. + */ + +/* + * Copyright (C) 2006-2019 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 * +*********************************************************************************************************************************/ +#include <VBox/types.h> +#include <iprt/x86.h> + +#define VBOX_WITH_HGCM /* grumble */ +#define VBOX_DEVICE_STRUCT_TESTCASE + +/* Check that important preprocessor macros does not get redefined: */ +#include <VBox/cdefs.h> +#include <VBox/log.h> +#ifdef DEBUG +# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG +#else +# undef VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG +#endif +#ifdef LOG_ENABLED +# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED +#else +# undef VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED +#endif +#ifdef VBOX_STRICT +# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT +#else +# undef VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT +#endif +#ifdef RT_STRICT +# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT +#else +# undef VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT +#endif + +/* The structures we're checking: */ +#undef LOG_GROUP +#include "../Bus/DevPciInternal.h" +#undef LOG_GROUP +#include "../Graphics/DevVGA.cpp" +#undef LOG_GROUP +#include "../Input/DevPS2.cpp" +#undef LOG_GROUP +#include "../Input/PS2K.cpp" +#undef LOG_GROUP +#include "../Input/PS2M.cpp" +#ifdef VBOX_WITH_E1000 +# undef LOG_GROUP +# include "../Network/DevE1000.cpp" +#endif +#undef LOG_GROUP +#include "../Network/DevPCNet.cpp" +#ifdef VBOX_WITH_VIRTIO +# undef LOG_GROUP +# include "../Network/DevVirtioNet.cpp" +#endif +#undef LOG_GROUP +#include "../PC/DevACPI.cpp" +#undef LOG_GROUP +#include "../PC/DevPIC.cpp" +#undef LOG_GROUP +#include "../PC/DevPit-i8254.cpp" +#undef LOG_GROUP +#include "../PC/DevRTC.cpp" +# undef LOG_GROUP +# include "../../VMM/VMMR3/APIC.cpp" +#undef LOG_GROUP +#include "../PC/DevIoApic.cpp" +#undef LOG_GROUP +#include "../PC/DevHPET.cpp" +#undef LOG_GROUP +#include "../PC/DevDMA.cpp" +#undef LOG_GROUP +#include "../EFI/DevSmc.cpp" +#undef LOG_GROUP +#include "../Storage/DevATA.cpp" +#ifdef VBOX_WITH_USB +# undef LOG_GROUP +# include "../USB/DevOHCI.cpp" +# ifdef VBOX_WITH_EHCI_IMPL +# undef LOG_GROUP +# include "../USB/DevEHCI.cpp" +# endif +# ifdef VBOX_WITH_XHCI_IMPL +# undef LOG_GROUP +# include "../USB/DevXHCI.cpp" +# endif +#endif +#undef LOG_GROUP +#include "../VMMDev/VMMDev.cpp" +#undef LOG_GROUP +#include "../Parallel/DevParallel.cpp" +#undef LOG_GROUP +#include "../Serial/DevSerial.cpp" +#undef LOG_GROUP +#include "../Serial/DevOxPcie958.cpp" +#ifdef VBOX_WITH_AHCI +# undef LOG_GROUP +# include "../Storage/DevAHCI.cpp" +#endif +#ifdef VBOX_WITH_BUSLOGIC +# undef LOG_GROUP +# include "../Storage/DevBusLogic.cpp" +#endif +#ifdef VBOX_WITH_LSILOGIC +# undef LOG_GROUP +# include "../Storage/DevLsiLogicSCSI.cpp" +#endif +#ifdef VBOX_WITH_NVME_IMPL +# undef LOG_GROUP +# include "../Storage/DevNVMe.cpp" +#endif + +#ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL +# undef LOG_GROUP +# include "../Bus/DevPciRaw.cpp" +#endif + +#include <VBox/vmm/pdmaudioifs.h> + +#undef LOG_GROUP +#include "../Audio/DevIchAc97.cpp" +#undef LOG_GROUP +#include "../Audio/DevHDA.cpp" + + +/* Check that important preprocessor macros didn't get redefined: */ +#if defined(DEBUG) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG) +# error "DEBUG was modified! This may throw off structure tests." +#endif +#if defined(LOG_ENABLED) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED) +# error "LOG_ENABLED was modified! This may throw off structure tests." +#endif +#if defined(RT_STRICT) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT) +# error "RT_STRICT was modified! This may throw off structure tests." +#endif +#if defined(VBOX_STRICT) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT) +# error "VBOX_STRICT was modified! This may throw off structure tests." +#endif + + +#include <stdio.h> + + +/********************************************************************************************************************************* +* Defined Constants And Macros * +*********************************************************************************************************************************/ +/** + * Checks the offset of a data member. + * @param type Type. + * @param off Correct offset. + * @param m Member name. + */ +#define CHECK_OFF(type, off, m) \ + do { \ + if (off != RT_OFFSETOF(type, m)) \ + { \ + printf("tstDeviceStructSize: Error! %#010x %s Member offset wrong by %d (should be %d -- but is %d)\n", \ + RT_OFFSETOF(type, m), #type "." #m, off - RT_OFFSETOF(type, m), off, RT_OFFSETOF(type, m)); \ + rc++; \ + } \ + else \ + printf("%#08x (%d) %s\n", RT_OFFSETOF(type, m), RT_OFFSETOF(type, m), #type "." #m); \ + } while (0) + +/** + * Checks the size of type. + * @param type Type. + * @param size Correct size. + */ +#define CHECK_SIZE(type, size) \ + do { \ + if (size != sizeof(type)) \ + { \ + printf("tstDeviceStructSize: Error! sizeof(%s): %#x (%d) Size wrong by %d (should be %d -- but is %d)\n", \ + #type, (int)sizeof(type), (int)sizeof(type), (int)sizeof(type) - (int)size, (int)size, (int)sizeof(type)); \ + rc++; \ + } \ + else \ + printf("tstDeviceStructSize: info: sizeof(%s): %#x (%d)\n", #type, (int)sizeof(type), (int)sizeof(type)); \ + } while (0) + +/** + * Checks the alignment of a struct member. + */ +#define CHECK_MEMBER_ALIGNMENT(strct, member, align) \ + do \ + { \ + if (RT_OFFSETOF(strct, member) & ((align) - 1) ) \ + { \ + printf("tstDeviceStructSize: error! %s::%s offset=%#x (%u) expected alignment %#x, meaning %#x (%u) off\n", \ + #strct, #member, \ + (unsigned)RT_OFFSETOF(strct, member), \ + (unsigned)RT_OFFSETOF(strct, member), \ + (unsigned)(align), \ + (unsigned)(((align) - RT_OFFSETOF(strct, member)) & ((align) - 1)), \ + (unsigned)(((align) - RT_OFFSETOF(strct, member)) & ((align) - 1)) ); \ + rc++; \ + } \ + } while (0) + +/** + * Checks that the size of a type is aligned correctly. + */ +#define CHECK_SIZE_ALIGNMENT(type, align) \ + do { \ + if (RT_ALIGN_Z(sizeof(type), (align)) != sizeof(type)) \ + { \ + printf("tstDeviceStructSize: error! %s size=%#x (%u), align=%#x %#x (%u) bytes off\n", \ + #type, \ + (unsigned)sizeof(type), \ + (unsigned)sizeof(type), \ + (align), \ + (unsigned)RT_ALIGN_Z(sizeof(type), align) - (unsigned)sizeof(type), \ + (unsigned)RT_ALIGN_Z(sizeof(type), align) - (unsigned)sizeof(type)); \ + rc++; \ + } \ + } while (0) + +/** + * Checks that a internal struct padding is big enough. + */ +#define CHECK_PADDING(strct, member, align) \ + do \ + { \ + strct *p = NULL; NOREF(p); \ + if (sizeof(p->member.s) > sizeof(p->member.padding)) \ + { \ + printf("tstDeviceStructSize: error! padding of %s::%s is too small, padding=%d struct=%d correct=%d\n", #strct, #member, \ + (int)sizeof(p->member.padding), (int)sizeof(p->member.s), (int)RT_ALIGN_Z(sizeof(p->member.s), (align))); \ + rc++; \ + } \ + else if (RT_ALIGN_Z(sizeof(p->member.padding), (align)) != sizeof(p->member.padding)) \ + { \ + printf("tstDeviceStructSize: error! padding of %s::%s is misaligned, padding=%d correct=%d\n", #strct, #member, \ + (int)sizeof(p->member.padding), (int)RT_ALIGN_Z(sizeof(p->member.s), (align))); \ + rc++; \ + } \ + } while (0) + +/** + * Checks that a internal struct padding is big enough. + */ +#define CHECK_PADDING2(strct) \ + do \ + { \ + strct *p = NULL; NOREF(p); \ + if (sizeof(p->s) > sizeof(p->padding)) \ + { \ + printf("tstDeviceStructSize: error! padding of %s is too small, padding=%d struct=%d correct=%d\n", #strct, \ + (int)sizeof(p->padding), (int)sizeof(p->s), (int)RT_ALIGN_Z(sizeof(p->s), 32)); \ + rc++; \ + } \ + } while (0) + +/** + * Checks that a internal struct padding is big enough. + */ +#define CHECK_PADDING3(strct, member, pad_member) \ + do \ + { \ + strct *p = NULL; NOREF(p); \ + if (sizeof(p->member) > sizeof(p->pad_member)) \ + { \ + printf("tstDeviceStructSize: error! padding of %s::%s is too small, padding=%d struct=%d\n", #strct, #member, \ + (int)sizeof(p->pad_member), (int)sizeof(p->member)); \ + rc++; \ + } \ + } while (0) + +/** + * Prints the offset of a struct member. + */ +#define PRINT_OFFSET(strct, member) \ + do \ + { \ + printf("tstDeviceStructSize: info: %s::%s offset %d sizeof %d\n", #strct, #member, (int)RT_OFFSETOF(strct, member), (int)RT_SIZEOFMEMB(strct, member)); \ + } while (0) + + +int main() +{ + int rc = 0; + printf("tstDeviceStructSize: TESTING\n"); + + /* Assert sanity */ + CHECK_SIZE(uint128_t, 128/8); + CHECK_SIZE(int128_t, 128/8); + CHECK_SIZE(uint64_t, 64/8); + CHECK_SIZE(int64_t, 64/8); + CHECK_SIZE(uint32_t, 32/8); + CHECK_SIZE(int32_t, 32/8); + CHECK_SIZE(uint16_t, 16/8); + CHECK_SIZE(int16_t, 16/8); + CHECK_SIZE(uint8_t, 8/8); + CHECK_SIZE(int8_t, 8/8); + + /* Basic alignment checks. */ + CHECK_MEMBER_ALIGNMENT(PDMDEVINS, achInstanceData, 64); + CHECK_MEMBER_ALIGNMENT(PDMPCIDEV, Int.s, 16); + CHECK_MEMBER_ALIGNMENT(PDMPCIDEV, Int.s.aIORegions, 16); + + /* + * Misc alignment checks (keep this somewhat alphabetical). + */ + CHECK_MEMBER_ALIGNMENT(AC97STATE, CritSect, 8); + + CHECK_MEMBER_ALIGNMENT(AHCI, lock, 8); + CHECK_MEMBER_ALIGNMENT(AHCI, ahciPort[0], 8); + + CHECK_MEMBER_ALIGNMENT(APICDEV, pDevInsR0, 8); + CHECK_MEMBER_ALIGNMENT(APICDEV, pDevInsRC, 8); + + CHECK_MEMBER_ALIGNMENT(ATADevState, cTotalSectors, 8); + CHECK_MEMBER_ALIGNMENT(ATADevState, StatATADMA, 8); + CHECK_MEMBER_ALIGNMENT(ATADevState, StatReads, 8); + CHECK_MEMBER_ALIGNMENT(ATACONTROLLER, lock, 8); + CHECK_MEMBER_ALIGNMENT(ATACONTROLLER, StatAsyncOps, 8); + CHECK_MEMBER_ALIGNMENT(BUSLOGIC, CritSectIntr, 8); +#ifdef VBOX_WITH_STATISTICS + CHECK_MEMBER_ALIGNMENT(DEVPIC, StatSetIrqGC, 8); +#endif +#ifdef VBOX_WITH_E1000 + CHECK_MEMBER_ALIGNMENT(E1KSTATE, cs, 8); + CHECK_MEMBER_ALIGNMENT(E1KSTATE, csRx, 8); + CHECK_MEMBER_ALIGNMENT(E1KSTATE, StatReceiveBytes, 8); +#endif +#ifdef VBOX_WITH_VIRTIO + CHECK_MEMBER_ALIGNMENT(VNETSTATE, StatReceiveBytes, 8); +#endif + //CHECK_MEMBER_ALIGNMENT(E1KSTATE, csTx, 8); +#ifdef VBOX_WITH_USB +# ifdef VBOX_WITH_EHCI_IMPL + CHECK_MEMBER_ALIGNMENT(EHCI, RootHub, 8); +# ifdef VBOX_WITH_STATISTICS + CHECK_MEMBER_ALIGNMENT(EHCI, StatCanceledIsocUrbs, 8); +# endif +# endif +# ifdef VBOX_WITH_XHCI_IMPL + CHECK_MEMBER_ALIGNMENT(XHCI, pWorkerThread, 8); + CHECK_MEMBER_ALIGNMENT(XHCI, IBase, 8); + CHECK_MEMBER_ALIGNMENT(XHCI, MMIOBase, 8); + CHECK_MEMBER_ALIGNMENT(XHCI, RootHub2, 8); + CHECK_MEMBER_ALIGNMENT(XHCI, RootHub3, 8); + CHECK_MEMBER_ALIGNMENT(XHCI, cmdr_dqp, 8); +# ifdef VBOX_WITH_STATISTICS + CHECK_MEMBER_ALIGNMENT(XHCI, StatErrorIsocUrbs, 8); + CHECK_MEMBER_ALIGNMENT(XHCI, StatIntrsCleared, 8); +# endif +# endif +#endif + CHECK_MEMBER_ALIGNMENT(E1KSTATE, StatReceiveBytes, 8); + CHECK_MEMBER_ALIGNMENT(IOAPIC, au64RedirTable, 8); +# ifdef VBOX_WITH_STATISTICS + CHECK_MEMBER_ALIGNMENT(IOAPIC, StatMmioReadRZ, 8); +# endif + CHECK_MEMBER_ALIGNMENT(LSILOGISCSI, GCPhysMMIOBase, 8); + CHECK_MEMBER_ALIGNMENT(LSILOGISCSI, aMessage, 8); + CHECK_MEMBER_ALIGNMENT(LSILOGISCSI, ReplyPostQueueCritSect, 8); + CHECK_MEMBER_ALIGNMENT(LSILOGISCSI, ReplyFreeQueueCritSect, 8); + CHECK_MEMBER_ALIGNMENT(LSILOGISCSI, uReplyFreeQueueNextEntryFreeWrite, 8); + CHECK_MEMBER_ALIGNMENT(LSILOGISCSI, VBoxSCSI, 8); +#ifdef VBOX_WITH_USB + CHECK_MEMBER_ALIGNMENT(OHCI, RootHub, 8); +# ifdef VBOX_WITH_STATISTICS + CHECK_MEMBER_ALIGNMENT(OHCI, StatCanceledIsocUrbs, 8); +# endif +#endif + CHECK_MEMBER_ALIGNMENT(DEVPCIBUS, apDevices, 64); + CHECK_MEMBER_ALIGNMENT(DEVPCIROOT, auPciApicIrqLevels, 16); + CHECK_MEMBER_ALIGNMENT(DEVPCIROOT, Piix3.auPciLegacyIrqLevels, 16); + CHECK_MEMBER_ALIGNMENT(PCNETSTATE, u64LastPoll, 8); + CHECK_MEMBER_ALIGNMENT(PCNETSTATE, CritSect, 8); + CHECK_MEMBER_ALIGNMENT(PCNETSTATE, StatReceiveBytes, 8); +#ifdef VBOX_WITH_STATISTICS + CHECK_MEMBER_ALIGNMENT(PCNETSTATE, StatMMIOReadRZ, 8); +#endif + CHECK_MEMBER_ALIGNMENT(PITSTATE, StatPITIrq, 8); + CHECK_MEMBER_ALIGNMENT(DEVSERIAL, UartCore, 8); + CHECK_MEMBER_ALIGNMENT(UARTCORE, CritSect, 8); +#ifdef VBOX_WITH_VMSVGA + CHECK_SIZE(VMSVGAState, RT_ALIGN_Z(sizeof(VMSVGAState), 8)); + CHECK_MEMBER_ALIGNMENT(VGASTATE, svga, 8); + CHECK_MEMBER_ALIGNMENT(VGASTATE, svga.au32ScratchRegion, 8); + CHECK_MEMBER_ALIGNMENT(VGASTATE, svga.StatRegBitsPerPixelWr, 8); +#endif + CHECK_MEMBER_ALIGNMENT(VGASTATE, cMonitors, 8); + CHECK_MEMBER_ALIGNMENT(VGASTATE, GCPhysVRAM, 8); + CHECK_MEMBER_ALIGNMENT(VGASTATE, Dev, 8); + CHECK_MEMBER_ALIGNMENT(VGASTATE, CritSect, 8); + CHECK_MEMBER_ALIGNMENT(VGASTATE, StatRZMemoryRead, 8); + CHECK_MEMBER_ALIGNMENT(VGASTATE, CritSectIRQ, 8); + CHECK_MEMBER_ALIGNMENT(VMMDevState, CritSect, 8); +#ifdef VBOX_WITH_VIRTIO + CHECK_MEMBER_ALIGNMENT(VPCISTATE, cs, 8); + CHECK_MEMBER_ALIGNMENT(VPCISTATE, led, 4); + CHECK_MEMBER_ALIGNMENT(VPCISTATE, Queues, 8); +#endif +#ifdef VBOX_WITH_PCI_PASSTHROUGH_IMPL + CHECK_MEMBER_ALIGNMENT(PCIRAWSENDREQ, u.aGetRegionInfo.u64RegionSize, 8); +#endif + +#ifdef VBOX_WITH_RAW_MODE + /* + * Compare HC and RC. + */ + printf("tstDeviceStructSize: Comparing HC and RC...\n"); +# include "tstDeviceStructSizeRC.h" +#endif + + /* + * Report result. + */ + if (rc) + printf("tstDeviceStructSize: FAILURE - %d errors\n", rc); + else + printf("tstDeviceStructSize: SUCCESS\n"); + return rc; +} diff --git a/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp b/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp new file mode 100644 index 00000000..10b393b7 --- /dev/null +++ b/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp @@ -0,0 +1,2138 @@ +/* $Id: tstDeviceStructSizeRC.cpp $ */ +/** @file + * tstDeviceStructSizeGC - Generate structure member and size checks from the RC perspective. + * + * This is built using the VBoxRc template but linked into a host + * ring-3 executable, rather hacky. + */ + +/* + * Copyright (C) 2006-2019 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. + */ + + +/* + * Sanity checks. + */ +#ifndef IN_RC +# error Incorrect template! +#endif +#if defined(IN_RING3) || defined(IN_RING0) +# error Incorrect template! +#endif + + +/********************************************************************************************************************************* +* Header Files * +*********************************************************************************************************************************/ +#define VBOX_DEVICE_STRUCT_TESTCASE +#define VBOX_WITH_HGCM /* grumble */ + +/* Check that important preprocessor macros does not get redefined: */ +#include <VBox/cdefs.h> +#include <VBox/log.h> +#ifdef DEBUG +# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG +#else +# undef VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG +#endif +#ifdef LOG_ENABLED +# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED +#else +# undef VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED +#endif +#ifdef VBOX_STRICT +# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT +#else +# undef VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT +#endif +#ifdef RT_STRICT +# define VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT +#else +# undef VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT +#endif + +/* The structures we're checking: */ +#undef LOG_GROUP +#include "../Bus/DevPciInternal.h" +#undef LOG_GROUP +#include "../EFI/DevSmc.cpp" +#undef LOG_GROUP +#include "../Graphics/DevVGA.cpp" +#undef LOG_GROUP +#include "../Input/DevPS2.cpp" +#undef LOG_GROUP +#include "../Input/PS2K.cpp" +#undef LOG_GROUP +#include "../Input/PS2M.cpp" +#undef LOG_GROUP +#include "../Network/DevPCNet.cpp" +#undef LOG_GROUP +#include "../PC/DevACPI.cpp" +#undef LOG_GROUP +#include "../PC/DevPIC.cpp" +#undef LOG_GROUP +#include "../PC/DevPit-i8254.cpp" +#undef LOG_GROUP +#include "../PC/DevRTC.cpp" +# undef LOG_GROUP +# include "../../VMM/VMMR3/APIC.cpp" +#undef LOG_GROUP +#include "../PC/DevIoApic.cpp" +#undef LOG_GROUP +#include "../PC/DevDMA.cpp" +#undef LOG_GROUP +#include "../Storage/DevATA.cpp" +#ifdef VBOX_WITH_USB +# undef LOG_GROUP +# include "../USB/DevOHCI.cpp" +# ifdef VBOX_WITH_EHCI_IMPL +# undef LOG_GROUP +# include "../USB/DevEHCI.cpp" +# endif +# ifdef VBOX_WITH_XHCI_IMPL +# undef LOG_GROUP +# include "../USB/DevXHCI.cpp" +# endif +#endif +#undef LOG_GROUP +#include "../VMMDev/VMMDev.cpp" +#undef LOG_GROUP +#include "../Parallel/DevParallel.cpp" +#undef LOG_GROUP +#include "../Serial/DevSerial.cpp" +#undef LOG_GROUP +#include "../Serial/DevOxPcie958.cpp" +#undef LOG_GROUP +#include "../Serial/UartCore.h" +#ifdef VBOX_WITH_AHCI +# undef LOG_GROUP +# include "../Storage/DevAHCI.cpp" +#endif +#ifdef VBOX_WITH_E1000 +# undef LOG_GROUP +# include "../Network/DevE1000.cpp" +#endif +#ifdef VBOX_WITH_VIRTIO +# undef LOG_GROUP +# include "../Network/DevVirtioNet.cpp" +#endif +#ifdef VBOX_WITH_BUSLOGIC +# undef LOG_GROUP +# include "../Storage/DevBusLogic.cpp" +#endif +#ifdef VBOX_WITH_LSILOGIC +# undef LOG_GROUP +# include "../Storage/DevLsiLogicSCSI.cpp" +#endif +#undef LOG_GROUP +#include "../PC/DevHPET.cpp" +#undef LOG_GROUP +#include "../Audio/DevIchAc97.cpp" +#undef LOG_GROUP +#include "../Audio/DevHDA.cpp" +#ifdef VBOX_WITH_NVME_IMPL +# undef LOG_GROUP +# include "../Storage/DevNVMe.cpp" +#endif + +/* Check that important preprocessor macros didn't get redefined: */ +#if defined(DEBUG) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_DEBUG) +# error "DEBUG was modified! This may throw off structure tests." +#endif +#if defined(LOG_ENABLED) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_LOG_ENABLED) +# error "LOG_ENABLED was modified! This may throw off structure tests." +#endif +#if defined(RT_STRICT) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_RT_STRICT) +# error "RT_STRICT was modified! This may throw off structure tests." +#endif +#if defined(VBOX_STRICT) != defined(VBOX_DEVICE_STRUCT_TESTCASE_CHECK_VBOX_STRICT) +# error "VBOX_STRICT was modified! This may throw off structure tests." +#endif + + +/* we don't use iprt here because we're pretending to be in GC! */ +#include <stdio.h> + +#define GEN_CHECK_SIZE(s) printf(" CHECK_SIZE(%s, %d);\n", #s, (int)sizeof(s)) +#define GEN_CHECK_OFF(s, m) printf(" CHECK_OFF(%s, %d, %s);\n", #s, (int)RT_OFFSETOF(s, m), #m) +#define GEN_CHECK_PADDING(s, m, a) printf(" CHECK_PADDING(%s, %s, %u);\n", #s, #m, (a)) + +int main() +{ + /* misc */ + GEN_CHECK_SIZE(PDMDEVINS); + GEN_CHECK_OFF(PDMDEVINS, Internal); + GEN_CHECK_OFF(PDMDEVINS, pReg); + GEN_CHECK_OFF(PDMDEVINS, pCfg); + GEN_CHECK_OFF(PDMDEVINS, iInstance); + GEN_CHECK_OFF(PDMDEVINS, IBase); + GEN_CHECK_OFF(PDMDEVINS, pHlpR3); + GEN_CHECK_OFF(PDMDEVINS, pHlpR0); + GEN_CHECK_OFF(PDMDEVINS, pHlpRC); + GEN_CHECK_OFF(PDMDEVINS, pvInstanceDataR3); + GEN_CHECK_OFF(PDMDEVINS, pvInstanceDataR0); + GEN_CHECK_OFF(PDMDEVINS, pvInstanceDataRC); + GEN_CHECK_OFF(PDMDEVINS, achInstanceData); + + /* PDMPCIDEV */ + GEN_CHECK_SIZE(PDMPCIDEV); + GEN_CHECK_SIZE(PDMPCIDEVINT); + GEN_CHECK_SIZE(PCIIOREGION); /** @todo fix name of PCIIOREGION */ + GEN_CHECK_OFF(PDMPCIDEV, abConfig); + GEN_CHECK_OFF(PDMPCIDEV, uDevFn); + GEN_CHECK_OFF(PDMPCIDEV, pszNameR3); + GEN_CHECK_OFF(PDMPCIDEV, pfnRegionLoadChangeHookR3); + GEN_CHECK_OFF(PDMPCIDEV, Int); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.aIORegions); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.aIORegions[1]); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.aIORegions[VBOX_PCI_NUM_REGIONS - 1]); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.aIORegions[0].addr); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.aIORegions[0].size); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.aIORegions[0].type); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.aIORegions[0].padding); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.pBusR3); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.pBusR0); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.pBusRC); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.pfnConfigRead); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.pfnConfigWrite); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.fFlags); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.uIrqPinState); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.pfnBridgeConfigRead); + GEN_CHECK_OFF(PDMPCIDEV, Int.s.pfnBridgeConfigWrite); + GEN_CHECK_PADDING(PDMPCIDEV, Int, 8); + + /* DevPciInternal.h */ + GEN_CHECK_SIZE(DEVPCIBUS); + GEN_CHECK_OFF(DEVPCIBUS, iBus); + GEN_CHECK_OFF(DEVPCIBUS, iDevSearch); + GEN_CHECK_OFF(DEVPCIBUS, cBridges); + GEN_CHECK_OFF(DEVPCIBUS, apDevices); + GEN_CHECK_OFF(DEVPCIBUS, apDevices[1]); + GEN_CHECK_OFF(DEVPCIBUS, pDevInsR3); + GEN_CHECK_OFF(DEVPCIBUS, pPciHlpR3); + GEN_CHECK_OFF(DEVPCIBUS, papBridgesR3); + GEN_CHECK_OFF(DEVPCIBUS, pDevInsR0); + GEN_CHECK_OFF(DEVPCIBUS, pPciHlpR0); + GEN_CHECK_OFF(DEVPCIBUS, pDevInsRC); + GEN_CHECK_OFF(DEVPCIBUS, pPciHlpRC); + GEN_CHECK_OFF(DEVPCIBUS, PciDev); + GEN_CHECK_SIZE(PIIX3ISABRIDGE); + GEN_CHECK_SIZE(DEVPCIROOT); + GEN_CHECK_OFF(DEVPCIROOT, PciBus); + GEN_CHECK_OFF(DEVPCIROOT, pDevInsR3); + GEN_CHECK_OFF(DEVPCIROOT, pDevInsR0); + GEN_CHECK_OFF(DEVPCIROOT, pDevInsRC); + GEN_CHECK_OFF(DEVPCIROOT, fUseIoApic); + GEN_CHECK_OFF(DEVPCIROOT, u64PciConfigMMioAddress); + GEN_CHECK_OFF(DEVPCIROOT, u64PciConfigMMioLength); + GEN_CHECK_OFF(DEVPCIROOT, auPciApicIrqLevels); + GEN_CHECK_OFF(DEVPCIROOT, auPciApicIrqLevels[1]); + GEN_CHECK_OFF(DEVPCIROOT, uConfigReg); + GEN_CHECK_OFF(DEVPCIROOT, Piix3.iAcpiIrqLevel); + GEN_CHECK_OFF(DEVPCIROOT, Piix3.iAcpiIrq); + GEN_CHECK_OFF(DEVPCIROOT, Piix3.auPciLegacyIrqLevels); + GEN_CHECK_OFF(DEVPCIROOT, Piix3.auPciLegacyIrqLevels[1]); + GEN_CHECK_OFF(DEVPCIROOT, Piix3.PIIX3State); + GEN_CHECK_OFF(DEVPCIROOT, uPciBiosBus); + GEN_CHECK_OFF(DEVPCIROOT, uPciBiosIo); + GEN_CHECK_OFF(DEVPCIROOT, uPciBiosMmio); + GEN_CHECK_OFF(DEVPCIROOT, uPciBiosMmio64); + + /* EFI/DevSMC.cpp */ + GEN_CHECK_SIZE(DEVSMC); + GEN_CHECK_OFF(DEVSMC, bCmd); + GEN_CHECK_OFF(DEVSMC, offKey); + GEN_CHECK_OFF(DEVSMC, offValue); + GEN_CHECK_OFF(DEVSMC, cKeys); + GEN_CHECK_OFF(DEVSMC, CurKey); + GEN_CHECK_OFF(DEVSMC, u); + GEN_CHECK_OFF(DEVSMC, u.s); + GEN_CHECK_OFF(DEVSMC, u.s.bState); + GEN_CHECK_OFF(DEVSMC, u.s.bStatusCode); + GEN_CHECK_OFF(DEVSMC, u.s.bStatusCode); + GEN_CHECK_OFF(DEVSMC, szOsk0And1); + GEN_CHECK_OFF(DEVSMC, bDollaryNumber); + GEN_CHECK_OFF(DEVSMC, bShutdownReason); + GEN_CHECK_OFF(DEVSMC, bNinjaActionTimerJob); + + /* DevVGA.cpp */ + GEN_CHECK_SIZE(VGASTATE); + GEN_CHECK_OFF(VGASTATE, vram_ptrR3); + GEN_CHECK_OFF(VGASTATE, get_bpp); + GEN_CHECK_OFF(VGASTATE, get_offsets); + GEN_CHECK_OFF(VGASTATE, get_resolution); + GEN_CHECK_OFF(VGASTATE, rgb_to_pixel); + GEN_CHECK_OFF(VGASTATE, cursor_invalidate); + GEN_CHECK_OFF(VGASTATE, cursor_draw_line); + GEN_CHECK_OFF(VGASTATE, vram_size); + GEN_CHECK_OFF(VGASTATE, latch); + GEN_CHECK_OFF(VGASTATE, sr_index); + GEN_CHECK_OFF(VGASTATE, sr); + GEN_CHECK_OFF(VGASTATE, sr[1]); + GEN_CHECK_OFF(VGASTATE, gr_index); + GEN_CHECK_OFF(VGASTATE, gr); + GEN_CHECK_OFF(VGASTATE, gr[1]); + GEN_CHECK_OFF(VGASTATE, ar_index); + GEN_CHECK_OFF(VGASTATE, ar); + GEN_CHECK_OFF(VGASTATE, ar[1]); + GEN_CHECK_OFF(VGASTATE, ar_flip_flop); + GEN_CHECK_OFF(VGASTATE, cr_index); + GEN_CHECK_OFF(VGASTATE, cr); + GEN_CHECK_OFF(VGASTATE, cr[1]); + GEN_CHECK_OFF(VGASTATE, msr); + GEN_CHECK_OFF(VGASTATE, msr); + GEN_CHECK_OFF(VGASTATE, fcr); + GEN_CHECK_OFF(VGASTATE, st00); + GEN_CHECK_OFF(VGASTATE, st01); + GEN_CHECK_OFF(VGASTATE, dac_state); + GEN_CHECK_OFF(VGASTATE, dac_sub_index); + GEN_CHECK_OFF(VGASTATE, dac_read_index); + GEN_CHECK_OFF(VGASTATE, dac_write_index); + GEN_CHECK_OFF(VGASTATE, dac_cache); + GEN_CHECK_OFF(VGASTATE, dac_cache[1]); + GEN_CHECK_OFF(VGASTATE, palette); + GEN_CHECK_OFF(VGASTATE, palette[1]); + GEN_CHECK_OFF(VGASTATE, bank_offset); +#ifdef CONFIG_BOCHS_VBE + GEN_CHECK_OFF(VGASTATE, vbe_index); + GEN_CHECK_OFF(VGASTATE, vbe_regs); + GEN_CHECK_OFF(VGASTATE, vbe_regs[1]); + GEN_CHECK_OFF(VGASTATE, vbe_regs[VBE_DISPI_INDEX_NB - 1]); + GEN_CHECK_OFF(VGASTATE, vbe_start_addr); + GEN_CHECK_OFF(VGASTATE, vbe_line_offset); + GEN_CHECK_OFF(VGASTATE, vbe_bank_max); +#endif + GEN_CHECK_OFF(VGASTATE, font_offsets); + GEN_CHECK_OFF(VGASTATE, font_offsets[1]); + GEN_CHECK_OFF(VGASTATE, graphic_mode); + GEN_CHECK_OFF(VGASTATE, shift_control); + GEN_CHECK_OFF(VGASTATE, double_scan); + GEN_CHECK_OFF(VGASTATE, line_offset); + GEN_CHECK_OFF(VGASTATE, line_compare); + GEN_CHECK_OFF(VGASTATE, start_addr); + GEN_CHECK_OFF(VGASTATE, plane_updated); + GEN_CHECK_OFF(VGASTATE, last_cw); + GEN_CHECK_OFF(VGASTATE, last_ch); + GEN_CHECK_OFF(VGASTATE, last_width); + GEN_CHECK_OFF(VGASTATE, last_height); + GEN_CHECK_OFF(VGASTATE, last_scr_width); + GEN_CHECK_OFF(VGASTATE, last_scr_height); + GEN_CHECK_OFF(VGASTATE, last_bpp); + GEN_CHECK_OFF(VGASTATE, cursor_start); + GEN_CHECK_OFF(VGASTATE, cursor_end); + GEN_CHECK_OFF(VGASTATE, cursor_offset); + GEN_CHECK_OFF(VGASTATE, invalidated_y_table); + GEN_CHECK_OFF(VGASTATE, invalidated_y_table[1]); + GEN_CHECK_OFF(VGASTATE, invalidated_y_table[(VGA_MAX_HEIGHT / 32) - 1]); + GEN_CHECK_OFF(VGASTATE, last_palette); + GEN_CHECK_OFF(VGASTATE, last_palette[1]); + GEN_CHECK_OFF(VGASTATE, last_ch_attr); + GEN_CHECK_OFF(VGASTATE, last_ch_attr[CH_ATTR_SIZE - 1]); + GEN_CHECK_OFF(VGASTATE, u32Marker); + GEN_CHECK_OFF(VGASTATE, pDevInsRC); + GEN_CHECK_OFF(VGASTATE, vram_ptrRC); + GEN_CHECK_OFF(VGASTATE, pDevInsR3); +#ifdef VBOX_WITH_HGSMI + GEN_CHECK_OFF(VGASTATE, pHGSMI); +#endif +#ifdef VBOX_WITH_VDMA + GEN_CHECK_OFF(VGASTATE, pVdma); +#endif + GEN_CHECK_OFF(VGASTATE, IBase); + GEN_CHECK_OFF(VGASTATE, IPort); +#if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_CRHGSMI)) + GEN_CHECK_OFF(VGASTATE, IVBVACallbacks); +#endif + GEN_CHECK_OFF(VGASTATE, pDrvBase); + GEN_CHECK_OFF(VGASTATE, pDrv); + GEN_CHECK_OFF(VGASTATE, RefreshTimer); + GEN_CHECK_OFF(VGASTATE, pDevInsR0); +#ifdef VBOX_WITH_VMSVGA + GEN_CHECK_OFF(VGASTATE, svga.pFIFOR3); + GEN_CHECK_OFF(VGASTATE, svga.pFIFOR0); + GEN_CHECK_OFF(VGASTATE, svga.pSvgaR3State); + GEN_CHECK_OFF(VGASTATE, svga.p3dState); + GEN_CHECK_OFF(VGASTATE, svga.pbVgaFrameBufferR3); + GEN_CHECK_OFF(VGASTATE, svga.GCPhysFIFO); + GEN_CHECK_OFF(VGASTATE, svga.cbFIFO); + GEN_CHECK_OFF(VGASTATE, svga.cbFIFOConfig); + GEN_CHECK_OFF(VGASTATE, svga.u32SVGAId); + GEN_CHECK_OFF(VGASTATE, svga.fConfigured); + GEN_CHECK_OFF(VGASTATE, svga.fBusy); + GEN_CHECK_OFF(VGASTATE, svga.fTraces); + GEN_CHECK_OFF(VGASTATE, svga.u32GuestId); + GEN_CHECK_OFF(VGASTATE, svga.cScratchRegion); + GEN_CHECK_OFF(VGASTATE, svga.u32IrqStatus); + GEN_CHECK_OFF(VGASTATE, svga.u32IrqMask); + GEN_CHECK_OFF(VGASTATE, svga.u32PitchLock); + GEN_CHECK_OFF(VGASTATE, svga.u32CurrentGMRId); + GEN_CHECK_OFF(VGASTATE, svga.u32RegCaps); + GEN_CHECK_OFF(VGASTATE, svga.BasePort); + GEN_CHECK_OFF(VGASTATE, svga.u32IndexReg); + GEN_CHECK_OFF(VGASTATE, svga.pSupDrvSession); + GEN_CHECK_OFF(VGASTATE, svga.FIFORequestSem); + GEN_CHECK_OFF(VGASTATE, svga.FIFOExtCmdSem); + GEN_CHECK_OFF(VGASTATE, svga.pFIFOIOThread); + GEN_CHECK_OFF(VGASTATE, svga.uWidth); + GEN_CHECK_OFF(VGASTATE, svga.uHeight); + GEN_CHECK_OFF(VGASTATE, svga.uBpp); + GEN_CHECK_OFF(VGASTATE, svga.cbScanline); + GEN_CHECK_OFF(VGASTATE, svga.u32MaxWidth); + GEN_CHECK_OFF(VGASTATE, svga.u32MaxHeight); + GEN_CHECK_OFF(VGASTATE, svga.viewport); + GEN_CHECK_OFF(VGASTATE, svga.u32ActionFlags); + GEN_CHECK_OFF(VGASTATE, svga.f3DEnabled); + GEN_CHECK_OFF(VGASTATE, svga.fVRAMTracking); + GEN_CHECK_OFF(VGASTATE, svga.u8FIFOExtCommand); + GEN_CHECK_OFF(VGASTATE, svga.fFifoExtCommandWakeup); + GEN_CHECK_OFF(VGASTATE, svga.au32ScratchRegion); + GEN_CHECK_OFF(VGASTATE, svga.StatRegBitsPerPixelWr); + GEN_CHECK_OFF(VGASTATE, svga.StatRegWriteOnlyRd); +#endif + GEN_CHECK_OFF(VGASTATE, cMonitors); + GEN_CHECK_OFF(VGASTATE, cMilliesRefreshInterval); + GEN_CHECK_OFF(VGASTATE, au32DirtyBitmap); + GEN_CHECK_OFF(VGASTATE, au32DirtyBitmap[1]); + GEN_CHECK_OFF(VGASTATE, au32DirtyBitmap[(VGA_VRAM_MAX / PAGE_SIZE / 32) - 1]); + GEN_CHECK_OFF(VGASTATE, fHasDirtyBits); + GEN_CHECK_OFF(VGASTATE, fLFBUpdated); + GEN_CHECK_OFF(VGASTATE, fGCEnabled); + GEN_CHECK_OFF(VGASTATE, fR0Enabled); + GEN_CHECK_OFF(VGASTATE, fRemappedVGA); + GEN_CHECK_OFF(VGASTATE, fRenderVRAM); + GEN_CHECK_OFF(VGASTATE, GCPhysVRAM); + GEN_CHECK_OFF(VGASTATE, CritSect); + GEN_CHECK_OFF(VGASTATE, Dev); + GEN_CHECK_OFF(VGASTATE, StatRZMemoryRead); + GEN_CHECK_OFF(VGASTATE, StatR3MemoryRead); + GEN_CHECK_OFF(VGASTATE, StatRZMemoryWrite); + GEN_CHECK_OFF(VGASTATE, StatR3MemoryWrite); +#ifdef VBE_BYTEWISE_IO + GEN_CHECK_OFF(VGASTATE, fReadVBEData); + GEN_CHECK_OFF(VGASTATE, fWriteVBEData); + GEN_CHECK_OFF(VGASTATE, fReadVBEIndex); + GEN_CHECK_OFF(VGASTATE, fWriteVBEIndex); + GEN_CHECK_OFF(VGASTATE, cbWriteVBEData); + GEN_CHECK_OFF(VGASTATE, cbWriteVBEIndex); +# ifdef VBE_NEW_DYN_LIST + GEN_CHECK_OFF(VGASTATE, cbWriteVBEExtraAddress); +# endif +#endif +#ifdef VBE_NEW_DYN_LIST + GEN_CHECK_OFF(VGASTATE, pbVBEExtraData); + GEN_CHECK_OFF(VGASTATE, cbVBEExtraData); + GEN_CHECK_OFF(VGASTATE, u16VBEExtraAddress); +#endif + GEN_CHECK_OFF(VGASTATE, pbLogo); + GEN_CHECK_OFF(VGASTATE, pszLogoFile); + GEN_CHECK_OFF(VGASTATE, pbLogoBitmap); + GEN_CHECK_OFF(VGASTATE, offLogoData); + GEN_CHECK_OFF(VGASTATE, cbLogo); + GEN_CHECK_OFF(VGASTATE, LogoCommand); + GEN_CHECK_OFF(VGASTATE, cxLogo); + GEN_CHECK_OFF(VGASTATE, cyLogo); + GEN_CHECK_OFF(VGASTATE, cLogoPlanes); + GEN_CHECK_OFF(VGASTATE, cLogoBits); + GEN_CHECK_OFF(VGASTATE, LogoCompression); + GEN_CHECK_OFF(VGASTATE, cLogoUsedColors); + GEN_CHECK_OFF(VGASTATE, cLogoPalEntries); + GEN_CHECK_OFF(VGASTATE, fLogoClearScreen); + GEN_CHECK_OFF(VGASTATE, au32LogoPalette); + GEN_CHECK_OFF(VGASTATE, pbVgaBios); + GEN_CHECK_OFF(VGASTATE, cbVgaBios); + GEN_CHECK_OFF(VGASTATE, pszVgaBiosFile); +#ifdef VBOX_WITH_HGSMI + GEN_CHECK_OFF(VGASTATE, IOPortBase); +#endif +#ifdef VBOX_WITH_WDDM + GEN_CHECK_OFF(VGASTATE, fGuestCaps); +#endif + + /* Input/pckbd.c */ + GEN_CHECK_SIZE(KBDState); + GEN_CHECK_OFF(KBDState, write_cmd); + GEN_CHECK_OFF(KBDState, status); + GEN_CHECK_OFF(KBDState, mode); + GEN_CHECK_OFF(KBDState, pDevInsR3); + GEN_CHECK_OFF(KBDState, pDevInsR0); + GEN_CHECK_OFF(KBDState, pDevInsRC); + GEN_CHECK_SIZE(KbdKeyQ); + GEN_CHECK_OFF(KbdCmdQ, rpos); + GEN_CHECK_OFF(KbdCmdQ, wpos); + GEN_CHECK_OFF(KbdCmdQ, cUsed); + GEN_CHECK_OFF(KbdCmdQ, cSize); + GEN_CHECK_OFF(KbdCmdQ, abQueue); + GEN_CHECK_SIZE(KbdCmdQ); + /* Input/PS2K.c */ + GEN_CHECK_SIZE(PS2K); + GEN_CHECK_OFF(PS2K, fScanning); + GEN_CHECK_OFF(PS2K, fNumLockOn); + GEN_CHECK_OFF(PS2K, u8ScanSet); + GEN_CHECK_OFF(PS2K, u8TypematicCfg); + GEN_CHECK_OFF(PS2K, enmTypematicState); + GEN_CHECK_OFF(PS2K, keyQ); + GEN_CHECK_OFF(PS2K, cmdQ); + GEN_CHECK_OFF(PS2K, uTypematicDelay); + GEN_CHECK_OFF(PS2K, fThrottleActive); + GEN_CHECK_OFF(PS2K, pKbdDelayTimerRC); + GEN_CHECK_OFF(PS2K, pKbdDelayTimerR3); + GEN_CHECK_OFF(PS2K, pKbdDelayTimerR0); + GEN_CHECK_OFF(PS2K, pKbdTypematicTimerRC); + GEN_CHECK_OFF(PS2K, pKbdTypematicTimerR3); + GEN_CHECK_OFF(PS2K, pKbdTypematicTimerR0); + GEN_CHECK_OFF(PS2K, pThrottleTimerRC); + GEN_CHECK_OFF(PS2K, pThrottleTimerR3); + GEN_CHECK_OFF(PS2K, pThrottleTimerR0); + GEN_CHECK_OFF(PS2K, pCritSectR3); + GEN_CHECK_OFF(PS2K, Keyboard.IBase); + GEN_CHECK_OFF(PS2K, Keyboard.IPort); + GEN_CHECK_OFF(PS2K, Keyboard.pDrvBase); + GEN_CHECK_OFF(PS2K, Keyboard.pDrv); + /* Input/PS2M.c */ + GEN_CHECK_SIZE(PS2M); + GEN_CHECK_OFF(PS2M, u8State); + GEN_CHECK_OFF(PS2M, u8SampleRate); + GEN_CHECK_OFF(PS2M, u8Resolution); + GEN_CHECK_OFF(PS2M, u8CurrCmd); + GEN_CHECK_OFF(PS2M, fThrottleActive); + GEN_CHECK_OFF(PS2M, fDelayReset); + GEN_CHECK_OFF(PS2M, enmMode); + GEN_CHECK_OFF(PS2M, enmProtocol); + GEN_CHECK_OFF(PS2M, enmKnockState); + GEN_CHECK_OFF(PS2M, evtQ); + GEN_CHECK_OFF(PS2M, cmdQ); + GEN_CHECK_OFF(PS2M, iAccumX); + GEN_CHECK_OFF(PS2M, fAccumB); + GEN_CHECK_OFF(PS2M, fCurrB); + GEN_CHECK_OFF(PS2M, uThrottleDelay); + GEN_CHECK_OFF(PS2M, pCritSectR3); + GEN_CHECK_OFF(PS2M, pDelayTimerR3); + GEN_CHECK_OFF(PS2M, pThrottleTimerR3); + GEN_CHECK_OFF(PS2M, pDelayTimerRC); + GEN_CHECK_OFF(PS2M, pThrottleTimerRC); + GEN_CHECK_OFF(PS2M, pDelayTimerR0); + GEN_CHECK_OFF(PS2M, pThrottleTimerR0); + GEN_CHECK_OFF(PS2M, Mouse.IBase); + GEN_CHECK_OFF(PS2M, Mouse.IPort); + GEN_CHECK_OFF(PS2M, Mouse.pDrvBase); + GEN_CHECK_OFF(PS2M, Mouse.pDrv); + + /* Network/DevPCNet.cpp */ + GEN_CHECK_SIZE(PCNETSTATE); + GEN_CHECK_OFF(PCNETSTATE, PciDev); +#ifndef PCNET_NO_POLLING + GEN_CHECK_OFF(PCNETSTATE, pTimerPollR3); + GEN_CHECK_OFF(PCNETSTATE, pTimerPollR0); + GEN_CHECK_OFF(PCNETSTATE, pTimerPollRC); +#endif + GEN_CHECK_OFF(PCNETSTATE, pTimerSoftIntR3); + GEN_CHECK_OFF(PCNETSTATE, pTimerSoftIntR0); + GEN_CHECK_OFF(PCNETSTATE, pTimerSoftIntRC); + GEN_CHECK_OFF(PCNETSTATE, u32RAP); + GEN_CHECK_OFF(PCNETSTATE, iISR); + GEN_CHECK_OFF(PCNETSTATE, u32Lnkst); + GEN_CHECK_OFF(PCNETSTATE, GCRDRA); + GEN_CHECK_OFF(PCNETSTATE, GCTDRA); + GEN_CHECK_OFF(PCNETSTATE, aPROM); + GEN_CHECK_OFF(PCNETSTATE, aPROM[1]); + GEN_CHECK_OFF(PCNETSTATE, aCSR); + GEN_CHECK_OFF(PCNETSTATE, aCSR[1]); + GEN_CHECK_OFF(PCNETSTATE, aCSR[CSR_MAX_REG - 1]); + GEN_CHECK_OFF(PCNETSTATE, aBCR); + GEN_CHECK_OFF(PCNETSTATE, aBCR[1]); + GEN_CHECK_OFF(PCNETSTATE, aBCR[BCR_MAX_RAP - 1]); + GEN_CHECK_OFF(PCNETSTATE, aMII); + GEN_CHECK_OFF(PCNETSTATE, aMII[1]); + GEN_CHECK_OFF(PCNETSTATE, aMII[MII_MAX_REG - 1]); + GEN_CHECK_OFF(PCNETSTATE, u16CSR0LastSeenByGuest); + GEN_CHECK_OFF(PCNETSTATE, u64LastPoll); + GEN_CHECK_OFF(PCNETSTATE, abLoopBuf); + GEN_CHECK_OFF(PCNETSTATE, abRecvBuf); + GEN_CHECK_OFF(PCNETSTATE, iLog2DescSize); + GEN_CHECK_OFF(PCNETSTATE, GCUpperPhys); + GEN_CHECK_OFF(PCNETSTATE, pXmitQueueR3); + GEN_CHECK_OFF(PCNETSTATE, pXmitQueueR0); + GEN_CHECK_OFF(PCNETSTATE, pXmitQueueRC); + GEN_CHECK_OFF(PCNETSTATE, pCanRxQueueR3); + GEN_CHECK_OFF(PCNETSTATE, pCanRxQueueR0); + GEN_CHECK_OFF(PCNETSTATE, pCanRxQueueRC); + GEN_CHECK_OFF(PCNETSTATE, pTimerRestore); + GEN_CHECK_OFF(PCNETSTATE, pDevInsR3); + GEN_CHECK_OFF(PCNETSTATE, pDevInsR0); + GEN_CHECK_OFF(PCNETSTATE, pDevInsRC); + GEN_CHECK_OFF(PCNETSTATE, pDrvR3); + GEN_CHECK_OFF(PCNETSTATE, pDrvBase); + GEN_CHECK_OFF(PCNETSTATE, IBase); + GEN_CHECK_OFF(PCNETSTATE, INetworkDown); + GEN_CHECK_OFF(PCNETSTATE, INetworkConfig); + GEN_CHECK_OFF(PCNETSTATE, MMIOBase); + GEN_CHECK_OFF(PCNETSTATE, IOPortBase); + GEN_CHECK_OFF(PCNETSTATE, fLinkUp); + GEN_CHECK_OFF(PCNETSTATE, fLinkTempDown); + GEN_CHECK_OFF(PCNETSTATE, cLinkDownReported); + GEN_CHECK_OFF(PCNETSTATE, MacConfigured); + GEN_CHECK_OFF(PCNETSTATE, Led); + GEN_CHECK_OFF(PCNETSTATE, ILeds); + GEN_CHECK_OFF(PCNETSTATE, pLedsConnector); + GEN_CHECK_OFF(PCNETSTATE, CritSect); +#ifdef PCNET_NO_POLLING + GEN_CHECK_OFF(PCNETSTATE, TDRAPhysOld); + GEN_CHECK_OFF(PCNETSTATE, cbTDRAOld); + GEN_CHECK_OFF(PCNETSTATE, RDRAPhysOld); + GEN_CHECK_OFF(PCNETSTATE, cbRDRAOld); + GEN_CHECK_OFF(PCNETSTATE, pfnEMInterpretInstructionGC + GEN_CHECK_OFF(PCNETSTATE, pfnEMInterpretInstructionR0 +#endif + GEN_CHECK_OFF(PCNETSTATE, fGCEnabled); + GEN_CHECK_OFF(PCNETSTATE, fR0Enabled); + GEN_CHECK_OFF(PCNETSTATE, uDevType); + GEN_CHECK_OFF(PCNETSTATE, StatReceiveBytes); + GEN_CHECK_OFF(PCNETSTATE, StatTransmitBytes); +#ifdef VBOX_WITH_STATISTICS + GEN_CHECK_OFF(PCNETSTATE, StatMMIOReadR3); + GEN_CHECK_OFF(PCNETSTATE, StatMMIOReadRZ); + GEN_CHECK_OFF(PCNETSTATE, StatMIIReads); +# ifdef PCNET_NO_POLLING + GEN_CHECK_OFF(PCNETSTATE, StatRCVRingWrite); + GEN_CHECK_OFF(PCNETSTATE, StatRingWriteOutsideRangeR3); +# endif +#endif + + /* PC/DevACPI.cpp */ + GEN_CHECK_SIZE(ACPIState); + GEN_CHECK_OFF(ACPIState, dev); + GEN_CHECK_OFF(ACPIState, pm1a_en); + GEN_CHECK_OFF(ACPIState, pm1a_sts); + GEN_CHECK_OFF(ACPIState, pm1a_ctl); + GEN_CHECK_OFF(ACPIState, u64PmTimerInitial); + GEN_CHECK_OFF(ACPIState, pPmTimerR3); + GEN_CHECK_OFF(ACPIState, pPmTimerR0); + GEN_CHECK_OFF(ACPIState, pPmTimerRC); + GEN_CHECK_OFF(ACPIState, uPmTimerVal); + GEN_CHECK_OFF(ACPIState, gpe0_en); + GEN_CHECK_OFF(ACPIState, gpe0_sts); + GEN_CHECK_OFF(ACPIState, uBatteryIndex); + GEN_CHECK_OFF(ACPIState, au8BatteryInfo); + GEN_CHECK_OFF(ACPIState, uSystemInfoIndex); + GEN_CHECK_OFF(ACPIState, u64RamSize); + GEN_CHECK_OFF(ACPIState, uSleepState); + GEN_CHECK_OFF(ACPIState, au8RSDPPage); + GEN_CHECK_OFF(ACPIState, u8IndexShift); + GEN_CHECK_OFF(ACPIState, u8UseIOApic); + GEN_CHECK_OFF(ACPIState, fUseFdc); + GEN_CHECK_OFF(ACPIState, fUseHpet); + GEN_CHECK_OFF(ACPIState, fUseSmc); + GEN_CHECK_OFF(ACPIState, CpuSetAttached); + GEN_CHECK_OFF(ACPIState, idCpuLockCheck); + GEN_CHECK_OFF(ACPIState, CpuSetLocked); + GEN_CHECK_OFF(ACPIState, u32CpuEventType); + GEN_CHECK_OFF(ACPIState, u32CpuEvent); + GEN_CHECK_OFF(ACPIState, fCpuHotPlug); + GEN_CHECK_OFF(ACPIState, u32NicPciAddress); + GEN_CHECK_OFF(ACPIState, u32HbcPciAddress); + GEN_CHECK_OFF(ACPIState, u64PciConfigMMioAddress); + GEN_CHECK_OFF(ACPIState, IBase); + GEN_CHECK_OFF(ACPIState, IACPIPort); + GEN_CHECK_OFF(ACPIState, pDevInsR3); + GEN_CHECK_OFF(ACPIState, pDevInsR0); + GEN_CHECK_OFF(ACPIState, pDrvBase); + GEN_CHECK_OFF(ACPIState, pDrv); + GEN_CHECK_OFF(ACPIState, u16SMBusSlvDat); + + /* PC/DevPIC.cpp */ + GEN_CHECK_SIZE(PICSTATE); + GEN_CHECK_OFF(PICSTATE, last_irr); + GEN_CHECK_OFF(PICSTATE, irr); + GEN_CHECK_OFF(PICSTATE, imr); + GEN_CHECK_OFF(PICSTATE, isr); + GEN_CHECK_OFF(PICSTATE, priority_add); + GEN_CHECK_OFF(PICSTATE, irq_base); + GEN_CHECK_OFF(PICSTATE, read_reg_select); + GEN_CHECK_OFF(PICSTATE, poll); + GEN_CHECK_OFF(PICSTATE, special_mask); + GEN_CHECK_OFF(PICSTATE, init_state); + GEN_CHECK_OFF(PICSTATE, auto_eoi); + GEN_CHECK_OFF(PICSTATE, rotate_on_auto_eoi); + GEN_CHECK_OFF(PICSTATE, special_fully_nested_mode); + GEN_CHECK_OFF(PICSTATE, init4); + GEN_CHECK_OFF(PICSTATE, elcr); + GEN_CHECK_OFF(PICSTATE, elcr_mask); + GEN_CHECK_OFF(PICSTATE, pDevInsR3); + GEN_CHECK_OFF(PICSTATE, pDevInsR0); + GEN_CHECK_OFF(PICSTATE, pDevInsRC); + GEN_CHECK_OFF(PICSTATE, idxPic); + GEN_CHECK_OFF(PICSTATE, auTags); + + GEN_CHECK_SIZE(DEVPIC); + GEN_CHECK_OFF(DEVPIC, aPics); + GEN_CHECK_OFF(DEVPIC, aPics[1]); + GEN_CHECK_OFF(DEVPIC, pDevInsR3); + GEN_CHECK_OFF(DEVPIC, pDevInsR0); + GEN_CHECK_OFF(DEVPIC, pDevInsRC); + GEN_CHECK_OFF(DEVPIC, pPicHlpR3); + GEN_CHECK_OFF(DEVPIC, pPicHlpR0); + GEN_CHECK_OFF(DEVPIC, pPicHlpRC); +#ifdef VBOX_WITH_STATISTICS + GEN_CHECK_OFF(DEVPIC, StatSetIrqGC); + GEN_CHECK_OFF(DEVPIC, StatClearedActiveSlaveIRQ); +#endif + + /* PC/DevPit-i8254.cpp */ + GEN_CHECK_SIZE(DMAState); + GEN_CHECK_OFF(DMAState, DMAC); + GEN_CHECK_OFF(DMAState, DMAC[0].ChState[0]); + GEN_CHECK_OFF(DMAState, DMAC[0].ChState[1]); + GEN_CHECK_OFF(DMAState, DMAC[0].u8Mask); + GEN_CHECK_OFF(DMAState, DMAC[1].ChState[0]); + GEN_CHECK_OFF(DMAState, DMAC[1].ChState[1]); + GEN_CHECK_OFF(DMAState, DMAC[1].u8Mask); + + /* PC/DevPit-i8254.cpp */ + GEN_CHECK_SIZE(PITCHANNEL); + GEN_CHECK_OFF(PITCHANNEL, pPitR3); + GEN_CHECK_OFF(PITCHANNEL, pTimerR3); + GEN_CHECK_OFF(PITCHANNEL, pPitR0); + GEN_CHECK_OFF(PITCHANNEL, pTimerR0); + GEN_CHECK_OFF(PITCHANNEL, pPitRC); + GEN_CHECK_OFF(PITCHANNEL, pTimerRC); + GEN_CHECK_OFF(PITCHANNEL, u64ReloadTS); + GEN_CHECK_OFF(PITCHANNEL, u64NextTS); + GEN_CHECK_OFF(PITCHANNEL, count_load_time); + GEN_CHECK_OFF(PITCHANNEL, next_transition_time); + GEN_CHECK_OFF(PITCHANNEL, irq); + GEN_CHECK_OFF(PITCHANNEL, cRelLogEntries); + GEN_CHECK_OFF(PITCHANNEL, count); + GEN_CHECK_OFF(PITCHANNEL, latched_count); + GEN_CHECK_OFF(PITCHANNEL, count_latched); + GEN_CHECK_OFF(PITCHANNEL, status_latched); + GEN_CHECK_OFF(PITCHANNEL, status); + GEN_CHECK_OFF(PITCHANNEL, read_state); + GEN_CHECK_OFF(PITCHANNEL, write_state); + GEN_CHECK_OFF(PITCHANNEL, write_latch); + GEN_CHECK_OFF(PITCHANNEL, rw_mode); + GEN_CHECK_OFF(PITCHANNEL, mode); + GEN_CHECK_OFF(PITCHANNEL, bcd); + GEN_CHECK_OFF(PITCHANNEL, gate); + GEN_CHECK_SIZE(PITSTATE); + GEN_CHECK_OFF(PITSTATE, channels); + GEN_CHECK_OFF(PITSTATE, channels[1]); + GEN_CHECK_OFF(PITSTATE, speaker_data_on); +// GEN_CHECK_OFF(PITSTATE, dummy_refresh_clock); + GEN_CHECK_OFF(PITSTATE, IOPortBaseCfg); + GEN_CHECK_OFF(PITSTATE, fSpeakerCfg); + GEN_CHECK_OFF(PITSTATE, pDevIns); + GEN_CHECK_OFF(PITSTATE, StatPITIrq); + GEN_CHECK_OFF(PITSTATE, StatPITHandler); + + /* PC/DevRTC.cpp */ + GEN_CHECK_SIZE(RTCSTATE); + GEN_CHECK_OFF(RTCSTATE, cmos_data); + GEN_CHECK_OFF(RTCSTATE, cmos_data[1]); + GEN_CHECK_OFF(RTCSTATE, cmos_index); + GEN_CHECK_OFF(RTCSTATE, current_tm); + GEN_CHECK_OFF(RTCSTATE, current_tm.tm_sec); + GEN_CHECK_OFF(RTCSTATE, current_tm.tm_min); + GEN_CHECK_OFF(RTCSTATE, current_tm.tm_hour); + GEN_CHECK_OFF(RTCSTATE, current_tm.tm_mday); + GEN_CHECK_OFF(RTCSTATE, current_tm.tm_mon); + GEN_CHECK_OFF(RTCSTATE, current_tm.tm_year); + GEN_CHECK_OFF(RTCSTATE, current_tm.tm_wday); + GEN_CHECK_OFF(RTCSTATE, current_tm.tm_yday); + GEN_CHECK_OFF(RTCSTATE, irq); + GEN_CHECK_OFF(RTCSTATE, fUTC); + GEN_CHECK_OFF(RTCSTATE, IOPortBase); + GEN_CHECK_OFF(RTCSTATE, pPeriodicTimerR0); + GEN_CHECK_OFF(RTCSTATE, pPeriodicTimerR3); + GEN_CHECK_OFF(RTCSTATE, pPeriodicTimerRC); + GEN_CHECK_OFF(RTCSTATE, next_periodic_time); + GEN_CHECK_OFF(RTCSTATE, next_second_time); + GEN_CHECK_OFF(RTCSTATE, pSecondTimerR0); + GEN_CHECK_OFF(RTCSTATE, pSecondTimerR3); + GEN_CHECK_OFF(RTCSTATE, pSecondTimerRC); + GEN_CHECK_OFF(RTCSTATE, pSecondTimer2R0); + GEN_CHECK_OFF(RTCSTATE, pSecondTimer2R3); + GEN_CHECK_OFF(RTCSTATE, pSecondTimer2RC); + GEN_CHECK_OFF(RTCSTATE, pDevInsR0); + GEN_CHECK_OFF(RTCSTATE, pDevInsR3); + GEN_CHECK_OFF(RTCSTATE, pDevInsRC); + GEN_CHECK_OFF(RTCSTATE, RtcReg); + GEN_CHECK_OFF(RTCSTATE, pRtcHlpR3); + GEN_CHECK_OFF(RTCSTATE, cRelLogEntries); + GEN_CHECK_OFF(RTCSTATE, CurLogPeriod); + GEN_CHECK_OFF(RTCSTATE, CurHintPeriod); + + GEN_CHECK_SIZE(APIC); + GEN_CHECK_OFF(APIC, pApicDevR0); + GEN_CHECK_OFF(APIC, pApicDevR3); + GEN_CHECK_OFF(APIC, pApicDevRC); + GEN_CHECK_OFF(APIC, HCPhysApicPib); + GEN_CHECK_OFF(APIC, pvApicPibR0); + GEN_CHECK_OFF(APIC, pvApicPibR3); + GEN_CHECK_OFF(APIC, pvApicPibRC); + GEN_CHECK_OFF(APIC, cbApicPib); + GEN_CHECK_OFF(APIC, fVirtApicRegsEnabled); + GEN_CHECK_OFF(APIC, fPostedIntrsEnabled); + GEN_CHECK_OFF(APIC, fSupportsTscDeadline); + GEN_CHECK_OFF(APIC, fIoApicPresent); + GEN_CHECK_OFF(APIC, fRZEnabled); + GEN_CHECK_OFF(APIC, enmMaxMode); + + GEN_CHECK_SIZE(APICCPU); + GEN_CHECK_OFF(APICCPU, pvApicPageR0); + GEN_CHECK_OFF(APICCPU, pvApicPageR3); + GEN_CHECK_OFF(APICCPU, pvApicPageRC); + GEN_CHECK_OFF(APICCPU, cbApicPage); + GEN_CHECK_OFF(APICCPU, uEsrInternal); + GEN_CHECK_OFF(APICCPU, uApicBaseMsr); + GEN_CHECK_OFF(APICCPU, HCPhysApicPib); + GEN_CHECK_OFF(APICCPU, pvApicPibR0); + GEN_CHECK_OFF(APICCPU, pvApicPibR3); + GEN_CHECK_OFF(APICCPU, pvApicPibRC); + GEN_CHECK_OFF(APICCPU, ApicPibLevel); + GEN_CHECK_OFF(APICCPU, pTimerR0); + GEN_CHECK_OFF(APICCPU, pTimerR3); + GEN_CHECK_OFF(APICCPU, pTimerRC); + GEN_CHECK_OFF(APICCPU, TimerCritSect); + GEN_CHECK_OFF(APICCPU, u64TimerInitial); + GEN_CHECK_OFF(APICCPU, uHintedTimerInitialCount); + GEN_CHECK_OFF(APICCPU, uHintedTimerShift); +# ifdef VBOX_WITH_STATISTICS + GEN_CHECK_OFF(APICCPU, StatMmioReadRZ); + GEN_CHECK_OFF(APICCPU, StatMmioReadR3); + GEN_CHECK_OFF(APICCPU, StatMmioWriteRZ); + GEN_CHECK_OFF(APICCPU, StatMmioWriteR3); + GEN_CHECK_OFF(APICCPU, StatMsrReadRZ); + GEN_CHECK_OFF(APICCPU, StatMsrReadR3); + GEN_CHECK_OFF(APICCPU, StatMsrWriteRZ); + GEN_CHECK_OFF(APICCPU, StatMsrWriteR3); + GEN_CHECK_OFF(APICCPU, StatUpdatePendingIntrs); + GEN_CHECK_OFF(APICCPU, StatPostIntr); + GEN_CHECK_OFF(APICCPU, StatPostIntrAlreadyPending); + GEN_CHECK_OFF(APICCPU, StatTimerCallback); + GEN_CHECK_OFF(APICCPU, StatTprWrite); + GEN_CHECK_OFF(APICCPU, StatTprRead); + GEN_CHECK_OFF(APICCPU, StatEoiWrite); + GEN_CHECK_OFF(APICCPU, StatMaskedByTpr); + GEN_CHECK_OFF(APICCPU, StatMaskedByPpr); + GEN_CHECK_OFF(APICCPU, StatTimerIcrWrite); + GEN_CHECK_OFF(APICCPU, StatIcrLoWrite); + GEN_CHECK_OFF(APICCPU, StatIcrHiWrite); + GEN_CHECK_OFF(APICCPU, StatIcrFullWrite); +# endif /* VBOX_WITH_STATISTICS */ + + /* PC/DevIoApic.cpp */ + GEN_CHECK_SIZE(IOAPIC); + GEN_CHECK_OFF(IOAPIC, pDevInsR3); + GEN_CHECK_OFF(IOAPIC, pIoApicHlpR3); + GEN_CHECK_OFF(IOAPIC, pDevInsR0); + GEN_CHECK_OFF(IOAPIC, pIoApicHlpR0); + GEN_CHECK_OFF(IOAPIC, pDevInsRC); + GEN_CHECK_OFF(IOAPIC, pIoApicHlpRC); + GEN_CHECK_OFF(IOAPIC, u8Id); + GEN_CHECK_OFF(IOAPIC, u8Index); + GEN_CHECK_OFF(IOAPIC, cCpus); + GEN_CHECK_OFF(IOAPIC, au64RedirTable); + GEN_CHECK_OFF(IOAPIC, uIrr); +# ifdef VBOX_WITH_STATISTICS + GEN_CHECK_OFF(IOAPIC, StatMmioReadRZ); + GEN_CHECK_OFF(IOAPIC, StatMmioReadR3); + GEN_CHECK_OFF(IOAPIC, StatMmioWriteRZ); + GEN_CHECK_OFF(IOAPIC, StatMmioWriteR3); + GEN_CHECK_OFF(IOAPIC, StatSetIrqRZ); + GEN_CHECK_OFF(IOAPIC, StatSetIrqR3); + GEN_CHECK_OFF(IOAPIC, StatSetEoiRZ); + GEN_CHECK_OFF(IOAPIC, StatSetEoiR3); +# endif + + /* Storage/DevATA.cpp */ + GEN_CHECK_SIZE(BMDMAState); + GEN_CHECK_OFF(BMDMAState, u8Cmd); + GEN_CHECK_OFF(BMDMAState, u8Status); + GEN_CHECK_OFF(BMDMAState, GCPhysAddr); + GEN_CHECK_SIZE(BMDMADesc); + GEN_CHECK_OFF(BMDMADesc, GCPhysBuffer); + GEN_CHECK_OFF(BMDMADesc, cbBuffer); + GEN_CHECK_SIZE(ATADevState); + GEN_CHECK_OFF(ATADevState, fLBA48); + GEN_CHECK_OFF(ATADevState, fATAPI); + GEN_CHECK_OFF(ATADevState, fIrqPending); + GEN_CHECK_OFF(ATADevState, cMultSectors); + GEN_CHECK_OFF(ATADevState, cbSector); + GEN_CHECK_OFF(ATADevState, PCHSGeometry.cCylinders); + GEN_CHECK_OFF(ATADevState, PCHSGeometry.cHeads); + GEN_CHECK_OFF(ATADevState, PCHSGeometry.cSectors); + GEN_CHECK_OFF(ATADevState, cSectorsPerIRQ); + GEN_CHECK_OFF(ATADevState, cTotalSectors); + GEN_CHECK_OFF(ATADevState, uATARegFeature); + GEN_CHECK_OFF(ATADevState, uATARegFeatureHOB); + GEN_CHECK_OFF(ATADevState, uATARegError); + GEN_CHECK_OFF(ATADevState, uATARegNSector); + GEN_CHECK_OFF(ATADevState, uATARegNSectorHOB); + GEN_CHECK_OFF(ATADevState, uATARegSector); + GEN_CHECK_OFF(ATADevState, uATARegSectorHOB); + GEN_CHECK_OFF(ATADevState, uATARegLCyl); + GEN_CHECK_OFF(ATADevState, uATARegLCylHOB); + GEN_CHECK_OFF(ATADevState, uATARegHCyl); + GEN_CHECK_OFF(ATADevState, uATARegHCylHOB); + GEN_CHECK_OFF(ATADevState, uATARegSelect); + GEN_CHECK_OFF(ATADevState, uATARegStatus); + GEN_CHECK_OFF(ATADevState, uATARegCommand); + GEN_CHECK_OFF(ATADevState, uATARegDevCtl); + GEN_CHECK_OFF(ATADevState, uATATransferMode); + GEN_CHECK_OFF(ATADevState, uTxDir); + GEN_CHECK_OFF(ATADevState, iBeginTransfer); + GEN_CHECK_OFF(ATADevState, iSourceSink); + GEN_CHECK_OFF(ATADevState, fDMA); + GEN_CHECK_OFF(ATADevState, fATAPITransfer); + GEN_CHECK_OFF(ATADevState, cbTotalTransfer); + GEN_CHECK_OFF(ATADevState, cbElementaryTransfer); + GEN_CHECK_OFF(ATADevState, iIOBufferCur); + GEN_CHECK_OFF(ATADevState, iIOBufferEnd); + GEN_CHECK_OFF(ATADevState, iIOBufferPIODataStart); + GEN_CHECK_OFF(ATADevState, iIOBufferPIODataEnd); + GEN_CHECK_OFF(ATADevState, iATAPILBA); + GEN_CHECK_OFF(ATADevState, cbATAPISector); + GEN_CHECK_OFF(ATADevState, aATAPICmd); + GEN_CHECK_OFF(ATADevState, aATAPICmd[ATAPI_PACKET_SIZE - 1]); + GEN_CHECK_OFF(ATADevState, abATAPISense); + GEN_CHECK_OFF(ATADevState, abATAPISense[ATAPI_SENSE_SIZE - 1]); + GEN_CHECK_OFF(ATADevState, cNotifiedMediaChange); + GEN_CHECK_OFF(ATADevState, MediaEventStatus); + GEN_CHECK_OFF(ATADevState, MediaTrackType); + GEN_CHECK_OFF(ATADevState, Led); + GEN_CHECK_OFF(ATADevState, cbIOBuffer); + GEN_CHECK_OFF(ATADevState, pbIOBufferR3); + GEN_CHECK_OFF(ATADevState, pbIOBufferR0); + GEN_CHECK_OFF(ATADevState, pbIOBufferRC); + GEN_CHECK_OFF(ATADevState, StatATADMA); + GEN_CHECK_OFF(ATADevState, StatATAPIO); + GEN_CHECK_OFF(ATADevState, StatATAPIDMA); + GEN_CHECK_OFF(ATADevState, StatATAPIPIO); + GEN_CHECK_OFF(ATADevState, StatReads); + GEN_CHECK_OFF(ATADevState, StatBytesRead); + GEN_CHECK_OFF(ATADevState, StatWrites); + GEN_CHECK_OFF(ATADevState, StatBytesWritten); + GEN_CHECK_OFF(ATADevState, StatFlushes); + GEN_CHECK_OFF(ATADevState, fATAPIPassthrough); + GEN_CHECK_OFF(ATADevState, fOverwriteInquiry); + GEN_CHECK_OFF(ATADevState, cErrors); + GEN_CHECK_OFF(ATADevState, pDrvBase); + GEN_CHECK_OFF(ATADevState, pDrvMedia); + GEN_CHECK_OFF(ATADevState, pDrvMount); + GEN_CHECK_OFF(ATADevState, IBase); + GEN_CHECK_OFF(ATADevState, IPort); + GEN_CHECK_OFF(ATADevState, IMountNotify); + GEN_CHECK_OFF(ATADevState, iLUN); + GEN_CHECK_OFF(ATADevState, pDevInsR3); + GEN_CHECK_OFF(ATADevState, pDevInsR0); + GEN_CHECK_OFF(ATADevState, pDevInsRC); + GEN_CHECK_OFF(ATADevState, pControllerR3); + GEN_CHECK_OFF(ATADevState, pControllerR0); + GEN_CHECK_OFF(ATADevState, pControllerRC); + GEN_CHECK_OFF(ATADevState, szSerialNumber); + GEN_CHECK_OFF(ATADevState, szSerialNumber[ATA_SERIAL_NUMBER_LENGTH]); + GEN_CHECK_OFF(ATADevState, szFirmwareRevision); + GEN_CHECK_OFF(ATADevState, szFirmwareRevision[ATA_FIRMWARE_REVISION_LENGTH]); + GEN_CHECK_OFF(ATADevState, szModelNumber); + GEN_CHECK_OFF(ATADevState, szModelNumber[ATA_MODEL_NUMBER_LENGTH]); + GEN_CHECK_OFF(ATADevState, szInquiryVendorId); + GEN_CHECK_OFF(ATADevState, szInquiryVendorId[SCSI_INQUIRY_VENDOR_ID_LENGTH]); + GEN_CHECK_OFF(ATADevState, szInquiryProductId); + GEN_CHECK_OFF(ATADevState, szInquiryProductId[SCSI_INQUIRY_PRODUCT_ID_LENGTH]); + GEN_CHECK_OFF(ATADevState, szInquiryRevision); + GEN_CHECK_OFF(ATADevState, szInquiryRevision[SCSI_INQUIRY_REVISION_LENGTH]); + GEN_CHECK_OFF(ATADevState, pTrackList); + GEN_CHECK_SIZE(ATATransferRequest); + GEN_CHECK_OFF(ATATransferRequest, iIf); + GEN_CHECK_OFF(ATATransferRequest, iBeginTransfer); + GEN_CHECK_OFF(ATATransferRequest, iSourceSink); + GEN_CHECK_OFF(ATATransferRequest, cbTotalTransfer); + GEN_CHECK_OFF(ATATransferRequest, uTxDir); + GEN_CHECK_SIZE(ATAAbortRequest); + GEN_CHECK_OFF(ATAAbortRequest, iIf); + GEN_CHECK_OFF(ATAAbortRequest, fResetDrive); + GEN_CHECK_SIZE(ATARequest); + GEN_CHECK_OFF(ATARequest, ReqType); + GEN_CHECK_OFF(ATARequest, u); + GEN_CHECK_OFF(ATARequest, u.t); + GEN_CHECK_OFF(ATARequest, u.a); + GEN_CHECK_SIZE(ATACONTROLLER); + GEN_CHECK_OFF(ATACONTROLLER, IOPortBase1); + GEN_CHECK_OFF(ATACONTROLLER, IOPortBase2); + GEN_CHECK_OFF(ATACONTROLLER, irq); + GEN_CHECK_OFF(ATACONTROLLER, lock); + GEN_CHECK_OFF(ATACONTROLLER, iSelectedIf); + GEN_CHECK_OFF(ATACONTROLLER, iAIOIf); + GEN_CHECK_OFF(ATACONTROLLER, uAsyncIOState); + GEN_CHECK_OFF(ATACONTROLLER, fChainedTransfer); + GEN_CHECK_OFF(ATACONTROLLER, fReset); + GEN_CHECK_OFF(ATACONTROLLER, fRedo); + GEN_CHECK_OFF(ATACONTROLLER, fRedoIdle); + GEN_CHECK_OFF(ATACONTROLLER, fRedoDMALastDesc); + GEN_CHECK_OFF(ATACONTROLLER, BmDma); + GEN_CHECK_OFF(ATACONTROLLER, GCPhysFirstDMADesc); + GEN_CHECK_OFF(ATACONTROLLER, GCPhysLastDMADesc); + GEN_CHECK_OFF(ATACONTROLLER, GCPhysRedoDMABuffer); + GEN_CHECK_OFF(ATACONTROLLER, cbRedoDMABuffer); + GEN_CHECK_OFF(ATACONTROLLER, aIfs); + GEN_CHECK_OFF(ATACONTROLLER, aIfs[1]); + GEN_CHECK_OFF(ATACONTROLLER, pDevInsR3); + GEN_CHECK_OFF(ATACONTROLLER, pDevInsR0); + GEN_CHECK_OFF(ATACONTROLLER, pDevInsRC); + GEN_CHECK_OFF(ATACONTROLLER, fShutdown); + GEN_CHECK_OFF(ATACONTROLLER, AsyncIOThread); + GEN_CHECK_OFF(ATACONTROLLER, hAsyncIOSem); + GEN_CHECK_OFF(ATACONTROLLER, aAsyncIORequests[4]); + GEN_CHECK_OFF(ATACONTROLLER, AsyncIOReqHead); + GEN_CHECK_OFF(ATACONTROLLER, AsyncIOReqTail); + GEN_CHECK_OFF(ATACONTROLLER, AsyncIORequestLock); + GEN_CHECK_OFF(ATACONTROLLER, SuspendIOSem); + GEN_CHECK_OFF(ATACONTROLLER, fSignalIdle); + GEN_CHECK_OFF(ATACONTROLLER, DelayIRQMillies); + GEN_CHECK_OFF(ATACONTROLLER, u64ResetTime); + GEN_CHECK_OFF(ATACONTROLLER, StatAsyncOps); + GEN_CHECK_OFF(ATACONTROLLER, StatAsyncMinWait); + GEN_CHECK_OFF(ATACONTROLLER, StatAsyncMaxWait); + GEN_CHECK_OFF(ATACONTROLLER, StatAsyncTimeUS); + GEN_CHECK_OFF(ATACONTROLLER, StatAsyncTime); + GEN_CHECK_OFF(ATACONTROLLER, StatLockWait); + GEN_CHECK_SIZE(PCIATAState); + GEN_CHECK_OFF(PCIATAState, dev); + GEN_CHECK_OFF(PCIATAState, aCts); + GEN_CHECK_OFF(PCIATAState, aCts[1]); + GEN_CHECK_OFF(PCIATAState, pDevIns); + GEN_CHECK_OFF(PCIATAState, IBase); + GEN_CHECK_OFF(PCIATAState, ILeds); + GEN_CHECK_OFF(PCIATAState, pLedsConnector); + GEN_CHECK_OFF(PCIATAState, fRCEnabled); + GEN_CHECK_OFF(PCIATAState, fR0Enabled); + +#ifdef VBOX_WITH_USB + /* USB/DevOHCI.cpp */ + GEN_CHECK_SIZE(OHCIHUBPORT); + GEN_CHECK_OFF(OHCIHUBPORT, fReg); + GEN_CHECK_OFF(OHCIHUBPORT, pDev); + + GEN_CHECK_SIZE(OHCIROOTHUB); + GEN_CHECK_OFF(OHCIROOTHUB, pIBase); + GEN_CHECK_OFF(OHCIROOTHUB, pIRhConn); + GEN_CHECK_OFF(OHCIROOTHUB, pIDev); + GEN_CHECK_OFF(OHCIROOTHUB, IBase); + GEN_CHECK_OFF(OHCIROOTHUB, IRhPort); + GEN_CHECK_OFF(OHCIROOTHUB, status); + GEN_CHECK_OFF(OHCIROOTHUB, desc_a); + GEN_CHECK_OFF(OHCIROOTHUB, desc_b); + GEN_CHECK_OFF(OHCIROOTHUB, aPorts); + GEN_CHECK_OFF(OHCIROOTHUB, aPorts[1]); + GEN_CHECK_OFF(OHCIROOTHUB, aPorts[OHCI_NDP_MAX - 1]); + GEN_CHECK_OFF(OHCIROOTHUB, pOhci); + + GEN_CHECK_SIZE(OHCI); + GEN_CHECK_OFF(OHCI, PciDev); + GEN_CHECK_OFF(OHCI, MMIOBase); + GEN_CHECK_OFF(OHCI, pEndOfFrameTimerR3); + GEN_CHECK_OFF(OHCI, pEndOfFrameTimerR0); + GEN_CHECK_OFF(OHCI, pEndOfFrameTimerRC); + GEN_CHECK_OFF(OHCI, pDevInsR3); + GEN_CHECK_OFF(OHCI, pDevInsR0); + GEN_CHECK_OFF(OHCI, pDevInsRC); + GEN_CHECK_OFF(OHCI, SofTime); + //GEN_CHECK_OFF(OHCI, dqic:3); + //GEN_CHECK_OFF(OHCI, fno:1); + GEN_CHECK_OFF(OHCI, RootHub); + GEN_CHECK_OFF(OHCI, ctl); + GEN_CHECK_OFF(OHCI, status); + GEN_CHECK_OFF(OHCI, intr_status); + GEN_CHECK_OFF(OHCI, intr); + GEN_CHECK_OFF(OHCI, hcca); + GEN_CHECK_OFF(OHCI, per_cur); + GEN_CHECK_OFF(OHCI, ctrl_cur); + GEN_CHECK_OFF(OHCI, ctrl_head); + GEN_CHECK_OFF(OHCI, bulk_cur); + GEN_CHECK_OFF(OHCI, bulk_head); + GEN_CHECK_OFF(OHCI, done); + //GEN_CHECK_OFF(OHCI, fsmps:15); + //GEN_CHECK_OFF(OHCI, fit:1); + //GEN_CHECK_OFF(OHCI, fi:14); + //GEN_CHECK_OFF(OHCI, frt:1); + GEN_CHECK_OFF(OHCI, HcFmNumber); + GEN_CHECK_OFF(OHCI, pstart); + GEN_CHECK_OFF(OHCI, cTicksPerFrame); + GEN_CHECK_OFF(OHCI, cTicksPerUsbTick); + GEN_CHECK_OFF(OHCI, cInFlight); + GEN_CHECK_OFF(OHCI, aInFlight); + GEN_CHECK_OFF(OHCI, aInFlight[0].GCPhysTD); + GEN_CHECK_OFF(OHCI, aInFlight[0].pUrb); + GEN_CHECK_OFF(OHCI, aInFlight[1]); + GEN_CHECK_OFF(OHCI, cInDoneQueue); + GEN_CHECK_OFF(OHCI, aInDoneQueue); + GEN_CHECK_OFF(OHCI, aInDoneQueue[0].GCPhysTD); + GEN_CHECK_OFF(OHCI, aInDoneQueue[1]); + GEN_CHECK_OFF(OHCI, u32FmDoneQueueTail); + GEN_CHECK_OFF(OHCI, pLoad); +# ifdef VBOX_WITH_STATISTICS + GEN_CHECK_OFF(OHCI, StatCanceledIsocUrbs); + GEN_CHECK_OFF(OHCI, StatCanceledGenUrbs); + GEN_CHECK_OFF(OHCI, StatDroppedUrbs); + GEN_CHECK_OFF(OHCI, StatTimer); +# endif + GEN_CHECK_OFF(OHCI, CsIrq); + GEN_CHECK_OFF(OHCI, CritSect); + +# ifdef VBOX_WITH_EHCI_IMPL + /* USB/DevEHCI.cpp */ + GEN_CHECK_SIZE(EHCIHUBPORT); + GEN_CHECK_OFF(EHCIHUBPORT, fReg); + GEN_CHECK_OFF(EHCIHUBPORT, pDev); + + GEN_CHECK_SIZE(EHCIROOTHUB); + GEN_CHECK_OFF(EHCIROOTHUB, pIBase); + GEN_CHECK_OFF(EHCIROOTHUB, pIRhConn); + GEN_CHECK_OFF(EHCIROOTHUB, pIDev); + GEN_CHECK_OFF(EHCIROOTHUB, IBase); + GEN_CHECK_OFF(EHCIROOTHUB, IRhPort); + GEN_CHECK_OFF(EHCIROOTHUB, Led); + GEN_CHECK_OFF(EHCIROOTHUB, ILeds); + GEN_CHECK_OFF(EHCIROOTHUB, pLedsConnector); + GEN_CHECK_OFF(EHCIROOTHUB, aPorts); + GEN_CHECK_OFF(EHCIROOTHUB, aPorts[1]); + GEN_CHECK_OFF(EHCIROOTHUB, aPorts[EHCI_NDP_MAX - 1]); + GEN_CHECK_OFF(EHCIROOTHUB, pEhci); + + GEN_CHECK_SIZE(EHCI); + GEN_CHECK_OFF(EHCI, PciDev); + GEN_CHECK_OFF(EHCI, MMIOBase); + GEN_CHECK_OFF(EHCI, pDevInsR3); + GEN_CHECK_OFF(EHCI, pDevInsR0); + GEN_CHECK_OFF(EHCI, pDevInsRC); + GEN_CHECK_OFF(EHCI, MMIOBase); + GEN_CHECK_OFF(EHCI, SofTime); + GEN_CHECK_OFF(EHCI, RootHub); + GEN_CHECK_OFF(EHCI, cap_length); + GEN_CHECK_OFF(EHCI, hci_version); + GEN_CHECK_OFF(EHCI, hcs_params); + GEN_CHECK_OFF(EHCI, hcc_params); + GEN_CHECK_OFF(EHCI, cmd); + GEN_CHECK_OFF(EHCI, intr_status); + GEN_CHECK_OFF(EHCI, intr); + GEN_CHECK_OFF(EHCI, frame_idx); + GEN_CHECK_OFF(EHCI, ds_segment); + GEN_CHECK_OFF(EHCI, periodic_list_base); + GEN_CHECK_OFF(EHCI, async_list_base); + GEN_CHECK_OFF(EHCI, config); + GEN_CHECK_OFF(EHCI, uIrqInterval); + GEN_CHECK_OFF(EHCI, HcFmNumber); + GEN_CHECK_OFF(EHCI, uFramesPerTimerCall); + GEN_CHECK_OFF(EHCI, cTicksPerFrame); + GEN_CHECK_OFF(EHCI, cTicksPerUsbTick); + GEN_CHECK_OFF(EHCI, cInFlight); + GEN_CHECK_OFF(EHCI, aInFlight); + GEN_CHECK_OFF(EHCI, aInFlight[0].GCPhysTD); + GEN_CHECK_OFF(EHCI, aInFlight[0].pUrb); + GEN_CHECK_OFF(EHCI, aInFlight[1]); + GEN_CHECK_OFF(EHCI, aInFlight[256]); + GEN_CHECK_OFF(EHCI, pLoad); + GEN_CHECK_OFF(EHCI, fAsyncTraversalTimerActive); +# ifdef VBOX_WITH_STATISTICS + GEN_CHECK_OFF(EHCI, StatCanceledIsocUrbs); + GEN_CHECK_OFF(EHCI, StatCanceledGenUrbs); + GEN_CHECK_OFF(EHCI, StatDroppedUrbs); +# endif + GEN_CHECK_OFF(EHCI, u64TimerHz); + GEN_CHECK_OFF(EHCI, cIdleCycles); + GEN_CHECK_OFF(EHCI, uFrameRate); + GEN_CHECK_OFF(EHCI, fIdle); + GEN_CHECK_OFF(EHCI, hThreadFrame); + GEN_CHECK_OFF(EHCI, hSemEventFrame); + GEN_CHECK_OFF(EHCI, fBusStarted); + GEN_CHECK_OFF(EHCI, CsIrq); + GEN_CHECK_OFF(EHCI, uFrameRateDefault); + GEN_CHECK_OFF(EHCI, nsWait); + GEN_CHECK_OFF(EHCI, CritSect); +# endif /* VBOX_WITH_EHCI_IMPL */ + +# ifdef VBOX_WITH_XHCI_IMPL + /* USB/DevXHCI.cpp */ + GEN_CHECK_SIZE(XHCIHUBPORT); + GEN_CHECK_OFF(XHCIHUBPORT, portsc); + GEN_CHECK_OFF(XHCIHUBPORT, portpm); + GEN_CHECK_OFF(XHCIHUBPORT, portli); + GEN_CHECK_OFF(XHCIHUBPORT, pDev); + + GEN_CHECK_SIZE(XHCIROOTHUB); + GEN_CHECK_OFF(XHCIROOTHUB, pIBase); + GEN_CHECK_OFF(XHCIROOTHUB, pIRhConn); + GEN_CHECK_OFF(XHCIROOTHUB, pIDev); + GEN_CHECK_OFF(XHCIROOTHUB, IBase); + GEN_CHECK_OFF(XHCIROOTHUB, IRhPort); + GEN_CHECK_OFF(XHCIROOTHUB, Led); + GEN_CHECK_OFF(XHCIROOTHUB, cPortsImpl); + GEN_CHECK_OFF(XHCIROOTHUB, pXhci); + + GEN_CHECK_SIZE(XHCIINTRPTR); + GEN_CHECK_OFF(XHCIINTRPTR, iman); + GEN_CHECK_OFF(XHCIINTRPTR, imod); + GEN_CHECK_OFF(XHCIINTRPTR, erstba); + GEN_CHECK_OFF(XHCIINTRPTR, erdp); + GEN_CHECK_OFF(XHCIINTRPTR, erep); + GEN_CHECK_OFF(XHCIINTRPTR, erst_idx); + GEN_CHECK_OFF(XHCIINTRPTR, trb_count); + GEN_CHECK_OFF(XHCIINTRPTR, evtr_pcs); + GEN_CHECK_OFF(XHCIINTRPTR, ipe); + + GEN_CHECK_SIZE(XHCI); + GEN_CHECK_OFF(XHCI, PciDev); + GEN_CHECK_OFF(XHCI, pDevInsR3); + GEN_CHECK_OFF(XHCI, pDevInsR0); + GEN_CHECK_OFF(XHCI, pDevInsRC); + GEN_CHECK_OFF(XHCI, pNotifierQueueR3); + GEN_CHECK_OFF(XHCI, pNotifierQueueR0); + GEN_CHECK_OFF(XHCI, pNotifierQueueRC); + GEN_CHECK_OFF(XHCI, pWrapTimerR3); + GEN_CHECK_OFF(XHCI, pWrapTimerR0); + GEN_CHECK_OFF(XHCI, pWrapTimerRC); + GEN_CHECK_OFF(XHCI, pWorkerThread); + GEN_CHECK_OFF(XHCI, pSupDrvSession); + GEN_CHECK_OFF(XHCI, hEvtProcess); + GEN_CHECK_OFF(XHCI, fWrkThreadSleeping); + GEN_CHECK_OFF(XHCI, u32TasksNew); + GEN_CHECK_OFF(XHCI, ILeds); + GEN_CHECK_OFF(XHCI, pLedsConnector); + GEN_CHECK_OFF(XHCI, MMIOBase); + GEN_CHECK_OFF(XHCI, RootHub2); + GEN_CHECK_OFF(XHCI, RootHub3); + GEN_CHECK_OFF(XHCI, aPorts); + GEN_CHECK_OFF(XHCI, aPorts[1]); + GEN_CHECK_OFF(XHCI, aPorts[XHCI_NDP_MAX - 1]); + GEN_CHECK_OFF(XHCI, cap_length); + GEN_CHECK_OFF(XHCI, hci_version); + GEN_CHECK_OFF(XHCI, hcs_params3); + GEN_CHECK_OFF(XHCI, hcc_params); + GEN_CHECK_OFF(XHCI, dbell_off); + GEN_CHECK_OFF(XHCI, rts_off); + GEN_CHECK_OFF(XHCI, cmd); + GEN_CHECK_OFF(XHCI, status); + GEN_CHECK_OFF(XHCI, dnctrl); + GEN_CHECK_OFF(XHCI, config); + GEN_CHECK_OFF(XHCI, crcr); + GEN_CHECK_OFF(XHCI, dcbaap); + GEN_CHECK_OFF(XHCI, abExtCap); + GEN_CHECK_OFF(XHCI, cbExtCap); + GEN_CHECK_OFF(XHCI, cmdr_dqp); + GEN_CHECK_OFF(XHCI, cmdr_ccs); + GEN_CHECK_OFF(XHCI, aSlotState); + GEN_CHECK_OFF(XHCI, aBellsRung); + GEN_CHECK_OFF(XHCI, pLoad); +# ifdef VBOX_WITH_STATISTICS + GEN_CHECK_OFF(XHCI, StatErrorIsocUrbs); + GEN_CHECK_OFF(XHCI, StatErrorIsocPkts); + GEN_CHECK_OFF(XHCI, StatEventsWritten); + GEN_CHECK_OFF(XHCI, StatEventsDropped); + GEN_CHECK_OFF(XHCI, StatIntrsPending); + GEN_CHECK_OFF(XHCI, StatIntrsSet); + GEN_CHECK_OFF(XHCI, StatIntrsNotSet); + GEN_CHECK_OFF(XHCI, StatIntrsCleared); +# endif +# endif /* VBOX_WITH_XHCI_IMPL */ +#endif /* VBOX_WITH_USB */ + + /* Parallel/DevParallel.cpp */ + GEN_CHECK_SIZE(PARALLELPORT); + GEN_CHECK_OFF(PARALLELPORT, pDevInsR3); + GEN_CHECK_OFF(PARALLELPORT, pDevInsR0); + GEN_CHECK_OFF(PARALLELPORT, pDevInsRC); + GEN_CHECK_OFF(PARALLELPORT, IBase); + GEN_CHECK_OFF(PARALLELPORT, IHostParallelPort); + GEN_CHECK_OFF(PARALLELPORT, pDrvHostParallelConnector); + GEN_CHECK_OFF(PARALLELPORT, fGCEnabled); + GEN_CHECK_OFF(PARALLELPORT, fR0Enabled); + GEN_CHECK_OFF(PARALLELPORT, fEppTimeout); + GEN_CHECK_OFF(PARALLELPORT, IOBase); + GEN_CHECK_OFF(PARALLELPORT, iIrq); + GEN_CHECK_OFF(PARALLELPORT, regData); + GEN_CHECK_OFF(PARALLELPORT, regStatus); + GEN_CHECK_OFF(PARALLELPORT, regControl); + GEN_CHECK_OFF(PARALLELPORT, regEppAddr); + GEN_CHECK_OFF(PARALLELPORT, regEppData); +#if 0 + GEN_CHECK_OFF(PARALLELPORT, reg_ecp_ecr); + GEN_CHECK_OFF(PARALLELPORT, reg_ecp_base_plus_400h); + GEN_CHECK_OFF(PARALLELPORT, reg_ecp_config_b); + GEN_CHECK_OFF(PARALLELPORT, ecp_fifo); + GEN_CHECK_OFF(PARALLELPORT, ecp_fifo[1]); + GEN_CHECK_OFF(PARALLELPORT, act_fifo_pos_write); + GEN_CHECK_OFF(PARALLELPORT, act_fifo_pos_read); +#endif + + /* Serial/UartCore.cpp */ + GEN_CHECK_SIZE(UARTCORE); + GEN_CHECK_OFF(UARTCORE, CritSect); + GEN_CHECK_OFF(UARTCORE, pDevInsR3); + GEN_CHECK_OFF(UARTCORE, pDevInsR0); + GEN_CHECK_OFF(UARTCORE, pDevInsRC); + GEN_CHECK_OFF(UARTCORE, iLUN); + GEN_CHECK_OFF(UARTCORE, IBase); + GEN_CHECK_OFF(UARTCORE, ISerialPort); + GEN_CHECK_OFF(UARTCORE, pDrvBase); + GEN_CHECK_OFF(UARTCORE, pDrvSerial); + GEN_CHECK_OFF(UARTCORE, fFlags); + GEN_CHECK_OFF(UARTCORE, enmType); + GEN_CHECK_OFF(UARTCORE, pTimerRcvFifoTimeoutR3); + GEN_CHECK_OFF(UARTCORE, pTimerTxUnconnectedR3); + GEN_CHECK_OFF(UARTCORE, pfnUartIrqReqR3); + GEN_CHECK_OFF(UARTCORE, pTimerRcvFifoTimeoutR0); + GEN_CHECK_OFF(UARTCORE, pTimerTxUnconnectedR0); + GEN_CHECK_OFF(UARTCORE, pfnUartIrqReqR0); + GEN_CHECK_OFF(UARTCORE, pTimerRcvFifoTimeoutRC); + GEN_CHECK_OFF(UARTCORE, pTimerTxUnconnectedRC); + GEN_CHECK_OFF(UARTCORE, pfnUartIrqReqRC); + GEN_CHECK_OFF(UARTCORE, uRegDivisor); + GEN_CHECK_OFF(UARTCORE, uRegRbr); + GEN_CHECK_OFF(UARTCORE, uRegThr); + GEN_CHECK_OFF(UARTCORE, uRegIer); + GEN_CHECK_OFF(UARTCORE, uRegIir); + GEN_CHECK_OFF(UARTCORE, uRegFcr); + GEN_CHECK_OFF(UARTCORE, uRegLcr); + GEN_CHECK_OFF(UARTCORE, uRegMcr); + GEN_CHECK_OFF(UARTCORE, uRegLsr); + GEN_CHECK_OFF(UARTCORE, uRegMsr); + GEN_CHECK_OFF(UARTCORE, uRegScr); + GEN_CHECK_OFF(UARTCORE, fIrqCtiPending); + GEN_CHECK_OFF(UARTCORE, fThreEmptyPending); + GEN_CHECK_OFF(UARTCORE, FifoXmit); + GEN_CHECK_OFF(UARTCORE, FifoRecv); + GEN_CHECK_OFF(UARTCORE, cSymbolXferTicks); + GEN_CHECK_OFF(UARTCORE, cbAvailRdr); + + /* Serial/DevSerial.cpp */ + GEN_CHECK_SIZE(DEVSERIAL); + GEN_CHECK_OFF(DEVSERIAL, pDevInsR3); + GEN_CHECK_OFF(DEVSERIAL, pDevInsR0); + GEN_CHECK_OFF(DEVSERIAL, pDevInsRC); + GEN_CHECK_OFF(DEVSERIAL, fR0Enabled); + GEN_CHECK_OFF(DEVSERIAL, fRCEnabled); + GEN_CHECK_OFF(DEVSERIAL, uIrq); + GEN_CHECK_OFF(DEVSERIAL, PortBase); + GEN_CHECK_OFF(DEVSERIAL, UartCore); + + /* Serial/DevOxPcie958.cpp */ + GEN_CHECK_SIZE(DEVOX958); + GEN_CHECK_OFF(DEVOX958, PciDev); + GEN_CHECK_OFF(DEVOX958, pDevInsR3); + GEN_CHECK_OFF(DEVOX958, pDevInsR0); + GEN_CHECK_OFF(DEVOX958, pDevInsRC); + GEN_CHECK_OFF(DEVOX958, fR0Enabled); + GEN_CHECK_OFF(DEVOX958, fRCEnabled); + GEN_CHECK_OFF(DEVOX958, u32RegIrqStsGlob); + GEN_CHECK_OFF(DEVOX958, u32RegIrqEnGlob); + GEN_CHECK_OFF(DEVOX958, u32RegIrqEnWake); + GEN_CHECK_OFF(DEVOX958, cUarts); + GEN_CHECK_OFF(DEVOX958, GCPhysMMIO); + GEN_CHECK_OFF(DEVOX958, aUarts); + GEN_CHECK_OFF(DEVOX958, aUarts[OX958_UARTS_MAX - 1]); + +#ifdef VBOX_WITH_AHCI + /* Storage/DevAHCI.cpp */ + + GEN_CHECK_SIZE(AHCIPort); + GEN_CHECK_OFF(AHCIPort, pDevInsR3); + GEN_CHECK_OFF(AHCIPort, pDevInsR0); + GEN_CHECK_OFF(AHCIPort, pDevInsRC); + GEN_CHECK_OFF(AHCIPort, pAhciR3); + GEN_CHECK_OFF(AHCIPort, pAhciR0); + GEN_CHECK_OFF(AHCIPort, pAhciRC); + GEN_CHECK_OFF(AHCIPort, regCLB); + GEN_CHECK_OFF(AHCIPort, regCLBU); + GEN_CHECK_OFF(AHCIPort, regFB); + GEN_CHECK_OFF(AHCIPort, regFBU); + GEN_CHECK_OFF(AHCIPort, regIS); + GEN_CHECK_OFF(AHCIPort, regIE); + GEN_CHECK_OFF(AHCIPort, regCMD); + GEN_CHECK_OFF(AHCIPort, regTFD); + GEN_CHECK_OFF(AHCIPort, regSIG); + GEN_CHECK_OFF(AHCIPort, regSSTS); + GEN_CHECK_OFF(AHCIPort, regSCTL); + GEN_CHECK_OFF(AHCIPort, regSERR); + GEN_CHECK_OFF(AHCIPort, regSACT); + GEN_CHECK_OFF(AHCIPort, regCI); + GEN_CHECK_OFF(AHCIPort, cTasksActive); + GEN_CHECK_OFF(AHCIPort, GCPhysAddrClb); + GEN_CHECK_OFF(AHCIPort, GCPhysAddrFb); + GEN_CHECK_OFF(AHCIPort, fPoweredOn); + GEN_CHECK_OFF(AHCIPort, fSpunUp); + GEN_CHECK_OFF(AHCIPort, fFirstD2HFisSent); + GEN_CHECK_OFF(AHCIPort, fATAPI); + GEN_CHECK_OFF(AHCIPort, fPortReset); + GEN_CHECK_OFF(AHCIPort, fTrimEnabled); + GEN_CHECK_OFF(AHCIPort, fResetDevice); + GEN_CHECK_OFF(AHCIPort, fHotpluggable); + GEN_CHECK_OFF(AHCIPort, fRedo); + GEN_CHECK_OFF(AHCIPort, fWrkThreadSleeping); + GEN_CHECK_OFF(AHCIPort, cTotalSectors); + GEN_CHECK_OFF(AHCIPort, cbSector); + GEN_CHECK_OFF(AHCIPort, cMultSectors); + GEN_CHECK_OFF(AHCIPort, uATATransferMode); + GEN_CHECK_OFF(AHCIPort, abATAPISense); + GEN_CHECK_OFF(AHCIPort, cLogSectorsPerPhysicalExp); + GEN_CHECK_OFF(AHCIPort, iLUN); + GEN_CHECK_OFF(AHCIPort, u32TasksFinished); + GEN_CHECK_OFF(AHCIPort, u32QueuedTasksFinished); + GEN_CHECK_OFF(AHCIPort, u32TasksNew); + GEN_CHECK_OFF(AHCIPort, u32TasksRedo); + GEN_CHECK_OFF(AHCIPort, u32CurrentCommandSlot); + GEN_CHECK_OFF(AHCIPort, pDrvBase); + GEN_CHECK_OFF(AHCIPort, pDrvMedia); + GEN_CHECK_OFF(AHCIPort, pDrvMediaEx); + GEN_CHECK_OFF(AHCIPort, IBase); + GEN_CHECK_OFF(AHCIPort, IPort); + GEN_CHECK_OFF(AHCIPort, IMediaExPort); + GEN_CHECK_OFF(AHCIPort, PCHSGeometry); + GEN_CHECK_OFF(AHCIPort, Led); + GEN_CHECK_OFF(AHCIPort, pAsyncIOThread); + + GEN_CHECK_OFF(AHCIPort, pTaskErr); + GEN_CHECK_OFF(AHCIPort, hEvtProcess); + GEN_CHECK_OFF(AHCIPort, szSerialNumber); + GEN_CHECK_OFF(AHCIPort, szSerialNumber[AHCI_SERIAL_NUMBER_LENGTH]); /* One additional byte for the termination.*/ + GEN_CHECK_OFF(AHCIPort, szFirmwareRevision); + GEN_CHECK_OFF(AHCIPort, szFirmwareRevision[AHCI_FIRMWARE_REVISION_LENGTH]); /* One additional byte for the termination.*/ + GEN_CHECK_OFF(AHCIPort, szModelNumber); + GEN_CHECK_OFF(AHCIPort, szModelNumber[AHCI_MODEL_NUMBER_LENGTH]); /* One additional byte for the termination.*/ + GEN_CHECK_OFF(AHCIPort, szInquiryVendorId); + GEN_CHECK_OFF(AHCIPort, szInquiryVendorId[AHCI_ATAPI_INQUIRY_VENDOR_ID_LENGTH]); /* One additional byte for the termination.*/ + GEN_CHECK_OFF(AHCIPort, szInquiryProductId); + GEN_CHECK_OFF(AHCIPort, szInquiryProductId[AHCI_ATAPI_INQUIRY_PRODUCT_ID_LENGTH]); /* One additional byte for the termination.*/ + GEN_CHECK_OFF(AHCIPort, szInquiryRevision); + GEN_CHECK_OFF(AHCIPort, szInquiryRevision[AHCI_ATAPI_INQUIRY_REVISION_LENGTH]); /* One additional byte for the termination.*/ + GEN_CHECK_OFF(AHCIPort, cErrors); + GEN_CHECK_OFF(AHCIPort, fRedo); + + GEN_CHECK_SIZE(AHCI); + GEN_CHECK_OFF(AHCI, dev); + GEN_CHECK_OFF(AHCI, pDevInsR3); + GEN_CHECK_OFF(AHCI, pDevInsR0); + GEN_CHECK_OFF(AHCI, pDevInsRC); + GEN_CHECK_OFF(AHCI, IBase); + GEN_CHECK_OFF(AHCI, ILeds); + GEN_CHECK_OFF(AHCI, pLedsConnector); + GEN_CHECK_OFF(AHCI, MMIOBase); + GEN_CHECK_OFF(AHCI, regHbaCap); + GEN_CHECK_OFF(AHCI, regHbaCtrl); + GEN_CHECK_OFF(AHCI, regHbaIs); + GEN_CHECK_OFF(AHCI, regHbaPi); + GEN_CHECK_OFF(AHCI, regHbaVs); + GEN_CHECK_OFF(AHCI, regHbaCccCtl); + GEN_CHECK_OFF(AHCI, regHbaCccPorts); + GEN_CHECK_OFF(AHCI, regIdx); + GEN_CHECK_OFF(AHCI, pHbaCccTimerR3); + GEN_CHECK_OFF(AHCI, pHbaCccTimerR0); + GEN_CHECK_OFF(AHCI, pHbaCccTimerRC); + GEN_CHECK_OFF(AHCI, pNotifierQueueR3); + GEN_CHECK_OFF(AHCI, pNotifierQueueR0); + GEN_CHECK_OFF(AHCI, pNotifierQueueRC); + GEN_CHECK_OFF(AHCI, uCccPortNr); + GEN_CHECK_OFF(AHCI, uCccTimeout); + GEN_CHECK_OFF(AHCI, uCccNr); + GEN_CHECK_OFF(AHCI, uCccCurrentNr); + GEN_CHECK_OFF(AHCI, ahciPort); + GEN_CHECK_OFF(AHCI, ahciPort[AHCI_MAX_NR_PORTS_IMPL-1]); + GEN_CHECK_OFF(AHCI, lock); + GEN_CHECK_OFF(AHCI, u32PortsInterrupted); + GEN_CHECK_OFF(AHCI, cThreadsActive); + GEN_CHECK_OFF(AHCI, fReset); + GEN_CHECK_OFF(AHCI, f64BitAddr); + GEN_CHECK_OFF(AHCI, fGCEnabled); + GEN_CHECK_OFF(AHCI, fR0Enabled); + GEN_CHECK_OFF(AHCI, fSignalIdle); + GEN_CHECK_OFF(AHCI, fBootable); + GEN_CHECK_OFF(AHCI, fLegacyPortResetMethod); + GEN_CHECK_OFF(AHCI, cPortsImpl); + GEN_CHECK_OFF(AHCI, cCmdSlotsAvail); + GEN_CHECK_OFF(AHCI, f8ByteMMIO4BytesWrittenSuccessfully); + GEN_CHECK_OFF(AHCI, pSupDrvSession); +#endif /* VBOX_WITH_AHCI */ + +#ifdef VBOX_WITH_E1000 + GEN_CHECK_SIZE(EEPROM93C46); + GEN_CHECK_OFF(EEPROM93C46, m_eState); + GEN_CHECK_OFF(EEPROM93C46, m_au16Data); + GEN_CHECK_OFF(EEPROM93C46, m_fWriteEnabled); + GEN_CHECK_OFF(EEPROM93C46, m_u16Word); + GEN_CHECK_OFF(EEPROM93C46, m_u16Mask); + GEN_CHECK_OFF(EEPROM93C46, m_u16Addr); + GEN_CHECK_OFF(EEPROM93C46, m_u32InternalWires); + GEN_CHECK_OFF(EEPROM93C46, m_eOp); + + GEN_CHECK_SIZE(E1KSTATE); + GEN_CHECK_OFF(E1KSTATE, IBase); + GEN_CHECK_OFF(E1KSTATE, INetworkDown); + GEN_CHECK_OFF(E1KSTATE, INetworkConfig); + GEN_CHECK_OFF(E1KSTATE, ILeds); + GEN_CHECK_OFF(E1KSTATE, pDrvBase); + GEN_CHECK_OFF(E1KSTATE, pDrvR3); + GEN_CHECK_OFF(E1KSTATE, pDrvR0); + GEN_CHECK_OFF(E1KSTATE, pDrvRC); + GEN_CHECK_OFF(E1KSTATE, pLedsConnector); + GEN_CHECK_OFF(E1KSTATE, pDevInsR3); + GEN_CHECK_OFF(E1KSTATE, pDevInsR0); + GEN_CHECK_OFF(E1KSTATE, pDevInsRC); + GEN_CHECK_OFF(E1KSTATE, pTxQueueR3); + GEN_CHECK_OFF(E1KSTATE, pTxQueueR0); + GEN_CHECK_OFF(E1KSTATE, pTxQueueRC); + GEN_CHECK_OFF(E1KSTATE, pCanRxQueueR3); + GEN_CHECK_OFF(E1KSTATE, pCanRxQueueR0); + GEN_CHECK_OFF(E1KSTATE, pCanRxQueueRC); + GEN_CHECK_OFF(E1KSTATE, pRIDTimerR3); + GEN_CHECK_OFF(E1KSTATE, pRIDTimerR0); + GEN_CHECK_OFF(E1KSTATE, pRIDTimerRC); + GEN_CHECK_OFF(E1KSTATE, pRADTimerR3); + GEN_CHECK_OFF(E1KSTATE, pRADTimerR0); + GEN_CHECK_OFF(E1KSTATE, pRADTimerRC); + GEN_CHECK_OFF(E1KSTATE, pTIDTimerR3); + GEN_CHECK_OFF(E1KSTATE, pTIDTimerR0); + GEN_CHECK_OFF(E1KSTATE, pTIDTimerRC); + GEN_CHECK_OFF(E1KSTATE, pTADTimerR3); + GEN_CHECK_OFF(E1KSTATE, pTADTimerR0); + GEN_CHECK_OFF(E1KSTATE, pTADTimerRC); + GEN_CHECK_OFF(E1KSTATE, pIntTimerR3); + GEN_CHECK_OFF(E1KSTATE, pIntTimerR0); + GEN_CHECK_OFF(E1KSTATE, pIntTimerRC); + GEN_CHECK_OFF(E1KSTATE, pLUTimerR3); + GEN_CHECK_OFF(E1KSTATE, pLUTimerR0); + GEN_CHECK_OFF(E1KSTATE, pLUTimerRC); + GEN_CHECK_OFF(E1KSTATE, cs); +# ifndef E1K_GLOBAL_MUTEX + GEN_CHECK_OFF(E1KSTATE, csRx); +# endif + GEN_CHECK_OFF(E1KSTATE, addrMMReg); + GEN_CHECK_OFF(E1KSTATE, macConfigured); + GEN_CHECK_OFF(E1KSTATE, IOPortBase); + GEN_CHECK_OFF(E1KSTATE, pciDevice); + GEN_CHECK_OFF(E1KSTATE, u64AckedAt); + GEN_CHECK_OFF(E1KSTATE, fIntRaised); + GEN_CHECK_OFF(E1KSTATE, fCableConnected); + GEN_CHECK_OFF(E1KSTATE, fR0Enabled); + GEN_CHECK_OFF(E1KSTATE, fRCEnabled); + GEN_CHECK_OFF(E1KSTATE, auRegs[E1K_NUM_OF_32BIT_REGS]); + GEN_CHECK_OFF(E1KSTATE, led); + GEN_CHECK_OFF(E1KSTATE, u32PktNo); + GEN_CHECK_OFF(E1KSTATE, uSelectedReg); + GEN_CHECK_OFF(E1KSTATE, auMTA[128]); + GEN_CHECK_OFF(E1KSTATE, aRecAddr); + GEN_CHECK_OFF(E1KSTATE, auVFTA[128]); + GEN_CHECK_OFF(E1KSTATE, u16RxBSize); + GEN_CHECK_OFF(E1KSTATE, fLocked); + GEN_CHECK_OFF(E1KSTATE, fDelayInts); + GEN_CHECK_OFF(E1KSTATE, fIntMaskUsed); + GEN_CHECK_OFF(E1KSTATE, fMaybeOutOfSpace); + GEN_CHECK_OFF(E1KSTATE, hEventMoreRxDescAvail); + GEN_CHECK_OFF(E1KSTATE, contextTSE); + GEN_CHECK_OFF(E1KSTATE, contextNormal); +# ifdef E1K_WITH_TXD_CACHE + GEN_CHECK_OFF(E1KSTATE, aTxDescriptors); + GEN_CHECK_OFF(E1KSTATE, nTxDFetched); + GEN_CHECK_OFF(E1KSTATE, iTxDCurrent); + GEN_CHECK_OFF(E1KSTATE, fGSO); + GEN_CHECK_OFF(E1KSTATE, cbTxAlloc); +# endif + GEN_CHECK_OFF(E1KSTATE, GsoCtx); + GEN_CHECK_OFF(E1KSTATE, uTxFallback); + GEN_CHECK_OFF(E1KSTATE, fVTag); + GEN_CHECK_OFF(E1KSTATE, u16VTagTCI); + GEN_CHECK_OFF(E1KSTATE, aTxPacketFallback[E1K_MAX_TX_PKT_SIZE]); + GEN_CHECK_OFF(E1KSTATE, u16TxPktLen); + GEN_CHECK_OFF(E1KSTATE, fIPcsum); + GEN_CHECK_OFF(E1KSTATE, fTCPcsum); + GEN_CHECK_OFF(E1KSTATE, u32PayRemain); + GEN_CHECK_OFF(E1KSTATE, u16HdrRemain); + GEN_CHECK_OFF(E1KSTATE, u16SavedFlags); + GEN_CHECK_OFF(E1KSTATE, u32SavedCsum); + GEN_CHECK_OFF(E1KSTATE, eeprom); + GEN_CHECK_OFF(E1KSTATE, phy); + GEN_CHECK_OFF(E1KSTATE, StatReceiveBytes); +#endif /* VBOX_WITH_E1000 */ + +#ifdef VBOX_WITH_VIRTIO + GEN_CHECK_OFF(VPCISTATE, cs); + GEN_CHECK_OFF(VPCISTATE, szInstance); + GEN_CHECK_OFF(VPCISTATE, IBase); + GEN_CHECK_OFF(VPCISTATE, ILeds); + GEN_CHECK_OFF(VPCISTATE, pLedsConnector); + GEN_CHECK_OFF(VPCISTATE, pDevInsR3); + GEN_CHECK_OFF(VPCISTATE, pDevInsR0); + GEN_CHECK_OFF(VPCISTATE, pDevInsRC); + GEN_CHECK_OFF(VPCISTATE, pciDevice); + GEN_CHECK_OFF(VPCISTATE, IOPortBase); + GEN_CHECK_OFF(VPCISTATE, led); + GEN_CHECK_OFF(VPCISTATE, uGuestFeatures); + GEN_CHECK_OFF(VPCISTATE, uQueueSelector); + GEN_CHECK_OFF(VPCISTATE, uStatus); + GEN_CHECK_OFF(VPCISTATE, uISR); + GEN_CHECK_OFF(VPCISTATE, Queues); + GEN_CHECK_OFF(VPCISTATE, Queues[VIRTIO_MAX_NQUEUES]); + GEN_CHECK_OFF(VNETSTATE, VPCI); + GEN_CHECK_OFF(VNETSTATE, INetworkDown); + GEN_CHECK_OFF(VNETSTATE, INetworkConfig); + GEN_CHECK_OFF(VNETSTATE, pDrvBase); + GEN_CHECK_OFF(VNETSTATE, pCanRxQueueR3); + GEN_CHECK_OFF(VNETSTATE, pCanRxQueueR0); + GEN_CHECK_OFF(VNETSTATE, pCanRxQueueRC); + GEN_CHECK_OFF(VNETSTATE, pLinkUpTimer); +# ifdef VNET_TX_DELAY + GEN_CHECK_OFF(VNETSTATE, pTxTimerR3); + GEN_CHECK_OFF(VNETSTATE, pTxTimerR0); + GEN_CHECK_OFF(VNETSTATE, pTxTimerRC); +# endif /* VNET_TX_DELAY */ + GEN_CHECK_OFF(VNETSTATE, config); + GEN_CHECK_OFF(VNETSTATE, macConfigured); + GEN_CHECK_OFF(VNETSTATE, fCableConnected); + GEN_CHECK_OFF(VNETSTATE, u32PktNo); + GEN_CHECK_OFF(VNETSTATE, fPromiscuous); + GEN_CHECK_OFF(VNETSTATE, fAllMulti); + GEN_CHECK_OFF(VNETSTATE, pRxQueue); + GEN_CHECK_OFF(VNETSTATE, pTxQueue); + GEN_CHECK_OFF(VNETSTATE, pCtlQueue); + GEN_CHECK_OFF(VNETSTATE, fMaybeOutOfSpace); + GEN_CHECK_OFF(VNETSTATE, hEventMoreRxDescAvail); +#endif /* VBOX_WITH_VIRTIO */ + +#ifdef VBOX_WITH_SCSI + GEN_CHECK_SIZE(VBOXSCSI); + GEN_CHECK_OFF(VBOXSCSI, regIdentify); + GEN_CHECK_OFF(VBOXSCSI, uTargetDevice); + GEN_CHECK_OFF(VBOXSCSI, uTxDir); + GEN_CHECK_OFF(VBOXSCSI, cbCDB); + GEN_CHECK_OFF(VBOXSCSI, abCDB); + GEN_CHECK_OFF(VBOXSCSI, abCDB[11]); + GEN_CHECK_OFF(VBOXSCSI, iCDB); + GEN_CHECK_OFF(VBOXSCSI, pbBuf); + GEN_CHECK_OFF(VBOXSCSI, cbBuf); + GEN_CHECK_OFF(VBOXSCSI, iBuf); + GEN_CHECK_OFF(VBOXSCSI, fBusy); + GEN_CHECK_OFF(VBOXSCSI, enmState); +#endif + + /* VMMDev*.cpp/h */ + GEN_CHECK_SIZE(VMMDEV); + GEN_CHECK_OFF(VMMDEV, PciDev); + GEN_CHECK_OFF(VMMDEV, CritSect); + GEN_CHECK_OFF(VMMDEV, hypervisorSize); + GEN_CHECK_OFF(VMMDEV, mouseCapabilities); + GEN_CHECK_OFF(VMMDEV, mouseXAbs); + GEN_CHECK_OFF(VMMDEV, mouseYAbs); + GEN_CHECK_OFF(VMMDEV, fHostCursorRequested); + GEN_CHECK_OFF(VMMDEV, pDevInsR3); + GEN_CHECK_OFF(VMMDEV, pDevInsR0); + GEN_CHECK_OFF(VMMDEV, pDevInsRC); + GEN_CHECK_OFF(VMMDEV, IBase); + GEN_CHECK_OFF(VMMDEV, IPort); +#ifdef VBOX_WITH_HGCM + GEN_CHECK_OFF(VMMDEV, IHGCMPort); +#endif + GEN_CHECK_OFF(VMMDEV, pDrvBase); + GEN_CHECK_OFF(VMMDEV, pDrv); +#ifdef VBOX_WITH_HGCM + GEN_CHECK_OFF(VMMDEV, pHGCMDrv); +#endif + GEN_CHECK_OFF(VMMDEV, szMsg); + GEN_CHECK_OFF(VMMDEV, iMsg); + GEN_CHECK_OFF(VMMDEV, irq); + GEN_CHECK_OFF(VMMDEV, u32HostEventFlags); + GEN_CHECK_OFF(VMMDEV, u32GuestFilterMask); + GEN_CHECK_OFF(VMMDEV, u32NewGuestFilterMask); + GEN_CHECK_OFF(VMMDEV, fNewGuestFilterMask); + GEN_CHECK_OFF(VMMDEV, GCPhysVMMDevRAM); + GEN_CHECK_OFF(VMMDEV, pVMMDevRAMR3); + GEN_CHECK_OFF(VMMDEV, pVMMDevRAMR0); + GEN_CHECK_OFF(VMMDEV, pVMMDevRAMRC); + GEN_CHECK_OFF(VMMDEV, pVMMDevHeapR3); + GEN_CHECK_OFF(VMMDEV, GCPhysVMMDevHeap); + GEN_CHECK_OFF(VMMDEV, guestInfo); + GEN_CHECK_OFF(VMMDEV, guestCaps); + GEN_CHECK_OFF(VMMDEV, fu32AdditionsOk); + GEN_CHECK_OFF(VMMDEV, u32VideoAccelEnabled); + GEN_CHECK_OFF(VMMDEV, displayChangeData); + GEN_CHECK_OFF(VMMDEV, pCredentials); + GEN_CHECK_OFF(VMMDEV, cMbMemoryBalloon); + GEN_CHECK_OFF(VMMDEV, cMbMemoryBalloonLast); + GEN_CHECK_OFF(VMMDEV, cbGuestRAM); + GEN_CHECK_OFF(VMMDEV, idSession); + GEN_CHECK_OFF(VMMDEV, u32StatIntervalSize); + GEN_CHECK_OFF(VMMDEV, u32LastStatIntervalSize); + GEN_CHECK_OFF(VMMDEV, fLastSeamlessEnabled), + GEN_CHECK_OFF(VMMDEV, fSeamlessEnabled); + GEN_CHECK_OFF(VMMDEV, fVRDPEnabled); + GEN_CHECK_OFF(VMMDEV, uVRDPExperienceLevel); +#ifdef VMMDEV_WITH_ALT_TIMESYNC + GEN_CHECK_OFF(VMMDEV, hostTime); + GEN_CHECK_OFF(VMMDEV, fTimesyncBackdoorLo); +#endif + GEN_CHECK_OFF(VMMDEV, fGetHostTimeDisabled); + GEN_CHECK_OFF(VMMDEV, fBackdoorLogDisabled); + GEN_CHECK_OFF(VMMDEV, fKeepCredentials); + GEN_CHECK_OFF(VMMDEV, fHeapEnabled); +#ifdef VBOX_WITH_HGCM + GEN_CHECK_OFF(VMMDEV, listHGCMCmd); + GEN_CHECK_OFF(VMMDEV, critsectHGCMCmdList); + GEN_CHECK_OFF(VMMDEV, u32HGCMEnabled); +#endif + GEN_CHECK_OFF(VMMDEV, SharedFolders); + GEN_CHECK_OFF(VMMDEV, SharedFolders.Led); + GEN_CHECK_OFF(VMMDEV, SharedFolders.ILeds); + GEN_CHECK_OFF(VMMDEV, SharedFolders.pLedsConnector); + GEN_CHECK_OFF(VMMDEV, fCpuHotPlugEventsEnabled); + GEN_CHECK_OFF(VMMDEV, enmCpuHotPlugEvent); + GEN_CHECK_OFF(VMMDEV, idCpuCore); + GEN_CHECK_OFF(VMMDEV, idCpuPackage); + GEN_CHECK_OFF(VMMDEV, StatMemBalloonChunks); + GEN_CHECK_OFF(VMMDEV, fRZEnabled); + GEN_CHECK_OFF(VMMDEV, fTestingEnabled); + GEN_CHECK_OFF(VMMDEV, fTestingMMIO); + GEN_CHECK_OFF(VMMDEV, u32TestingHighTimestamp); + GEN_CHECK_OFF(VMMDEV, u32TestingCmd); + GEN_CHECK_OFF(VMMDEV, offTestingData); + GEN_CHECK_OFF(VMMDEV, TestingData); + GEN_CHECK_OFF(VMMDEV, TestingData.Value.u64Value); + GEN_CHECK_OFF(VMMDEV, TestingData.Value.u32Unit); + GEN_CHECK_OFF(VMMDEV, TestingData.Value.szName); + GEN_CHECK_OFF(VMMDEV, nsLastHeartbeatTS); + GEN_CHECK_OFF(VMMDEV, fFlatlined); + GEN_CHECK_OFF(VMMDEV, fHeartbeatActive); + GEN_CHECK_OFF(VMMDEV, cNsHeartbeatInterval); + GEN_CHECK_OFF(VMMDEV, cNsHeartbeatTimeout); + GEN_CHECK_OFF(VMMDEV, pFlatlinedTimer); + +#ifdef VBOX_WITH_BUSLOGIC + GEN_CHECK_SIZE(BUSLOGICDEVICE); + GEN_CHECK_OFF(BUSLOGICDEVICE, pBusLogicR3); + GEN_CHECK_OFF(BUSLOGICDEVICE, pBusLogicR0); + GEN_CHECK_OFF(BUSLOGICDEVICE, pBusLogicRC); + GEN_CHECK_OFF(BUSLOGICDEVICE, fPresent); + GEN_CHECK_OFF(BUSLOGICDEVICE, iLUN); + GEN_CHECK_OFF(BUSLOGICDEVICE, IBase); + GEN_CHECK_OFF(BUSLOGICDEVICE, IMediaPort); + GEN_CHECK_OFF(BUSLOGICDEVICE, IMediaExPort); + GEN_CHECK_OFF(BUSLOGICDEVICE, ILed); + GEN_CHECK_OFF(BUSLOGICDEVICE, pDrvBase); + GEN_CHECK_OFF(BUSLOGICDEVICE, pDrvMedia); + GEN_CHECK_OFF(BUSLOGICDEVICE, pDrvMediaEx); + GEN_CHECK_OFF(BUSLOGICDEVICE, Led); + GEN_CHECK_OFF(BUSLOGICDEVICE, cOutstandingRequests); + + GEN_CHECK_SIZE(BUSLOGIC); + GEN_CHECK_OFF(BUSLOGIC, dev); + GEN_CHECK_OFF(BUSLOGIC, pDevInsR3); + GEN_CHECK_OFF(BUSLOGIC, pDevInsR0); + GEN_CHECK_OFF(BUSLOGIC, pDevInsRC); + GEN_CHECK_OFF(BUSLOGIC, IOPortBase); + GEN_CHECK_OFF(BUSLOGIC, MMIOBase); + GEN_CHECK_OFF(BUSLOGIC, regStatus); + GEN_CHECK_OFF(BUSLOGIC, regInterrupt); + GEN_CHECK_OFF(BUSLOGIC, regGeometry); + GEN_CHECK_OFF(BUSLOGIC, LocalRam); + GEN_CHECK_OFF(BUSLOGIC, uOperationCode); + GEN_CHECK_OFF(BUSLOGIC, aCommandBuffer); + GEN_CHECK_OFF(BUSLOGIC, aCommandBuffer[BUSLOGIC_COMMAND_SIZE_MAX]); + GEN_CHECK_OFF(BUSLOGIC, iParameter); + GEN_CHECK_OFF(BUSLOGIC, cbCommandParametersLeft); + GEN_CHECK_OFF(BUSLOGIC, fUseLocalRam); + GEN_CHECK_OFF(BUSLOGIC, aReplyBuffer); + GEN_CHECK_OFF(BUSLOGIC, aReplyBuffer[BUSLOGIC_REPLY_SIZE_MAX]); + GEN_CHECK_OFF(BUSLOGIC, iReply); + GEN_CHECK_OFF(BUSLOGIC, cbReplyParametersLeft); + GEN_CHECK_OFF(BUSLOGIC, fIRQEnabled); + GEN_CHECK_OFF(BUSLOGIC, cMailbox); + GEN_CHECK_OFF(BUSLOGIC, GCPhysAddrMailboxOutgoingBase); + GEN_CHECK_OFF(BUSLOGIC, uMailboxOutgoingPositionCurrent); + GEN_CHECK_OFF(BUSLOGIC, cMailboxesReady); + GEN_CHECK_OFF(BUSLOGIC, fNotificationSent); + GEN_CHECK_OFF(BUSLOGIC, GCPhysAddrMailboxIncomingBase); + GEN_CHECK_OFF(BUSLOGIC, uMailboxIncomingPositionCurrent); + GEN_CHECK_OFF(BUSLOGIC, fStrictRoundRobinMode); + GEN_CHECK_OFF(BUSLOGIC, fExtendedLunCCBFormat); + GEN_CHECK_OFF(BUSLOGIC, pNotifierQueueR3); + GEN_CHECK_OFF(BUSLOGIC, pNotifierQueueR0); + GEN_CHECK_OFF(BUSLOGIC, pNotifierQueueRC); + GEN_CHECK_OFF(BUSLOGIC, CritSectIntr); + GEN_CHECK_OFF(BUSLOGIC, VBoxSCSI); + GEN_CHECK_OFF(BUSLOGIC, aDeviceStates); + GEN_CHECK_OFF(BUSLOGIC, aDeviceStates[BUSLOGIC_MAX_DEVICES-1]); + GEN_CHECK_OFF(BUSLOGIC, IBase); + GEN_CHECK_OFF(BUSLOGIC, ILeds); + GEN_CHECK_OFF(BUSLOGIC, pLedsConnector); + GEN_CHECK_OFF(BUSLOGIC, pMediaNotify); + GEN_CHECK_OFF(BUSLOGIC, fSignalIdle); + GEN_CHECK_OFF(BUSLOGIC, fWrkThreadSleeping); + GEN_CHECK_OFF(BUSLOGIC, fBiosReqPending); + GEN_CHECK_OFF(BUSLOGIC, pSupDrvSession); + GEN_CHECK_OFF(BUSLOGIC, hEvtProcess); + GEN_CHECK_OFF(BUSLOGIC, paGCPhysAddrCCBRedo); + GEN_CHECK_OFF(BUSLOGIC, cReqsRedo); +# ifdef LOG_ENABLED + GEN_CHECK_OFF(BUSLOGIC, cInMailboxesReady); +# endif +#endif /* VBOX_WITH_BUSLOGIC */ + +#ifdef VBOX_WITH_LSILOGIC + GEN_CHECK_SIZE(LSILOGICSCSI); + GEN_CHECK_OFF(LSILOGICSCSI, PciDev); + GEN_CHECK_OFF(LSILOGICSCSI, pDevInsR3); + GEN_CHECK_OFF(LSILOGICSCSI, pDevInsR0); + GEN_CHECK_OFF(LSILOGICSCSI, pDevInsRC); + GEN_CHECK_OFF(LSILOGICSCSI, fGCEnabled); + GEN_CHECK_OFF(LSILOGICSCSI, fR0Enabled); + GEN_CHECK_OFF(LSILOGICSCSI, enmState); + GEN_CHECK_OFF(LSILOGICSCSI, enmWhoInit); + GEN_CHECK_OFF(LSILOGICSCSI, enmDoorbellState); + GEN_CHECK_OFF(LSILOGICSCSI, fDiagnosticEnabled); + GEN_CHECK_OFF(LSILOGICSCSI, fNotificationSent); + GEN_CHECK_OFF(LSILOGICSCSI, fEventNotificationEnabled); + GEN_CHECK_OFF(LSILOGICSCSI, fDiagRegsEnabled); + GEN_CHECK_OFF(LSILOGICSCSI, pNotificationQueueR3); + GEN_CHECK_OFF(LSILOGICSCSI, pNotificationQueueR0); + GEN_CHECK_OFF(LSILOGICSCSI, pNotificationQueueRC); + GEN_CHECK_OFF(LSILOGICSCSI, cDeviceStates); + GEN_CHECK_OFF(LSILOGICSCSI, paDeviceStates); + GEN_CHECK_OFF(LSILOGICSCSI, GCPhysMMIOBase); + GEN_CHECK_OFF(LSILOGICSCSI, IOPortBase); + GEN_CHECK_OFF(LSILOGICSCSI, uInterruptMask); + GEN_CHECK_OFF(LSILOGICSCSI, uInterruptStatus); + GEN_CHECK_OFF(LSILOGICSCSI, aMessage); + GEN_CHECK_OFF(LSILOGICSCSI, aMessage[sizeof(MptConfigurationRequest)-1]); + GEN_CHECK_OFF(LSILOGICSCSI, iMessage); + GEN_CHECK_OFF(LSILOGICSCSI, cMessage); + GEN_CHECK_OFF(LSILOGICSCSI, ReplyBuffer); + GEN_CHECK_OFF(LSILOGICSCSI, uNextReplyEntryRead); + GEN_CHECK_OFF(LSILOGICSCSI, cReplySize); + GEN_CHECK_OFF(LSILOGICSCSI, u16IOCFaultCode); + GEN_CHECK_OFF(LSILOGICSCSI, u32HostMFAHighAddr); + GEN_CHECK_OFF(LSILOGICSCSI, u32SenseBufferHighAddr); + GEN_CHECK_OFF(LSILOGICSCSI, cMaxDevices); + GEN_CHECK_OFF(LSILOGICSCSI, cMaxBuses); + GEN_CHECK_OFF(LSILOGICSCSI, cbReplyFrame); + GEN_CHECK_OFF(LSILOGICSCSI, iDiagnosticAccess); + GEN_CHECK_OFF(LSILOGICSCSI, cReplyQueueEntries); + GEN_CHECK_OFF(LSILOGICSCSI, cRequestQueueEntries); + GEN_CHECK_OFF(LSILOGICSCSI, ReplyPostQueueCritSect); + GEN_CHECK_OFF(LSILOGICSCSI, ReplyFreeQueueCritSect); + GEN_CHECK_OFF(LSILOGICSCSI, RequestQueueCritSect); + GEN_CHECK_OFF(LSILOGICSCSI, ReplyFreeQueueWriteCritSect); + GEN_CHECK_OFF(LSILOGICSCSI, pReplyFreeQueueBaseR3); + GEN_CHECK_OFF(LSILOGICSCSI, pReplyPostQueueBaseR3); + GEN_CHECK_OFF(LSILOGICSCSI, pRequestQueueBaseR3); + GEN_CHECK_OFF(LSILOGICSCSI, pReplyFreeQueueBaseR0); + GEN_CHECK_OFF(LSILOGICSCSI, pReplyPostQueueBaseR0); + GEN_CHECK_OFF(LSILOGICSCSI, pRequestQueueBaseR0); + GEN_CHECK_OFF(LSILOGICSCSI, pReplyFreeQueueBaseRC); + GEN_CHECK_OFF(LSILOGICSCSI, pReplyPostQueueBaseRC); + GEN_CHECK_OFF(LSILOGICSCSI, pRequestQueueBaseRC); + GEN_CHECK_OFF(LSILOGICSCSI, uReplyFreeQueueNextEntryFreeWrite); + GEN_CHECK_OFF(LSILOGICSCSI, uReplyFreeQueueNextAddressRead); + GEN_CHECK_OFF(LSILOGICSCSI, uReplyPostQueueNextEntryFreeWrite); + GEN_CHECK_OFF(LSILOGICSCSI, uReplyPostQueueNextAddressRead); + GEN_CHECK_OFF(LSILOGICSCSI, uRequestQueueNextEntryFreeWrite); + GEN_CHECK_OFF(LSILOGICSCSI, uRequestQueueNextAddressRead); + GEN_CHECK_OFF(LSILOGICSCSI, u16NextHandle); + GEN_CHECK_OFF(LSILOGICSCSI, enmCtrlType); + GEN_CHECK_OFF(LSILOGICSCSI, VBoxSCSI); + GEN_CHECK_OFF(LSILOGICSCSI, IBase); + GEN_CHECK_OFF(LSILOGICSCSI, ILeds); + GEN_CHECK_OFF(LSILOGICSCSI, pLedsConnector); + GEN_CHECK_OFF(LSILOGICSCSI, pMediaNotify); + GEN_CHECK_OFF(LSILOGICSCSI, pConfigurationPages); + GEN_CHECK_OFF(LSILOGICSCSI, fSignalIdle); + GEN_CHECK_OFF(LSILOGICSCSI, fRedo); + GEN_CHECK_OFF(LSILOGICSCSI, fWrkThreadSleeping); + GEN_CHECK_OFF(LSILOGICSCSI, pTasksRedoHead); + GEN_CHECK_OFF(LSILOGICSCSI, u32DiagMemAddr); + GEN_CHECK_OFF(LSILOGICSCSI, cbMemRegns); + GEN_CHECK_OFF(LSILOGICSCSI, ListMemRegns); + GEN_CHECK_OFF(LSILOGICSCSI, pSupDrvSession); + GEN_CHECK_OFF(LSILOGICSCSI, pThreadWrk); + GEN_CHECK_OFF(LSILOGICSCSI, hEvtProcess); +#endif /* VBOX_WITH_LSILOGIC */ + + GEN_CHECK_SIZE(HPET); + GEN_CHECK_OFF(HPET, pDevInsR3); + GEN_CHECK_OFF(HPET, pDevInsR0); + GEN_CHECK_OFF(HPET, pDevInsRC); + GEN_CHECK_OFF(HPET, u64HpetOffset); + GEN_CHECK_OFF(HPET, u32Capabilities); + GEN_CHECK_OFF(HPET, u32Period); + GEN_CHECK_OFF(HPET, u64HpetConfig); + GEN_CHECK_OFF(HPET, u64Isr); + GEN_CHECK_OFF(HPET, u64HpetCounter); + GEN_CHECK_OFF(HPET, CritSect); + GEN_CHECK_OFF(HPET, fIch9); + + GEN_CHECK_SIZE(HPETTIMER); + GEN_CHECK_OFF(HPETTIMER, pTimerR3); + GEN_CHECK_OFF(HPETTIMER, pHpetR3); + GEN_CHECK_OFF(HPETTIMER, pTimerR0); + GEN_CHECK_OFF(HPETTIMER, pHpetR0); + GEN_CHECK_OFF(HPETTIMER, pTimerRC); + GEN_CHECK_OFF(HPETTIMER, pHpetRC); + GEN_CHECK_OFF(HPETTIMER, idxTimer); + GEN_CHECK_OFF(HPETTIMER, u64Config); + GEN_CHECK_OFF(HPETTIMER, u64Cmp); + GEN_CHECK_OFF(HPETTIMER, u64Fsb); + GEN_CHECK_OFF(HPETTIMER, u64Period); + GEN_CHECK_OFF(HPETTIMER, u8Wrap); + + GEN_CHECK_SIZE(AC97DRIVER); + GEN_CHECK_OFF(AC97DRIVER, Node); + GEN_CHECK_OFF(AC97DRIVER, pAC97State); + GEN_CHECK_OFF(AC97DRIVER, fFlags); + GEN_CHECK_OFF(AC97DRIVER, uLUN); + GEN_CHECK_OFF(AC97DRIVER, fAttached); + GEN_CHECK_OFF(AC97DRIVER, pConnector); + GEN_CHECK_OFF(AC97DRIVER, LineIn); + GEN_CHECK_OFF(AC97DRIVER, MicIn); + GEN_CHECK_OFF(AC97DRIVER, Out); + + GEN_CHECK_SIZE(AC97STATE); + GEN_CHECK_OFF(AC97STATE, CritSect); + GEN_CHECK_OFF(AC97STATE, pDevInsR3); + GEN_CHECK_OFF(AC97STATE, pDevInsR0); + GEN_CHECK_OFF(AC97STATE, pDevInsRC); + GEN_CHECK_OFF(AC97STATE, fRZEnabled); + GEN_CHECK_OFF(AC97STATE, glob_cnt); + GEN_CHECK_OFF(AC97STATE, glob_sta); + GEN_CHECK_OFF(AC97STATE, cas); + GEN_CHECK_OFF(AC97STATE, last_samp); + GEN_CHECK_OFF(AC97STATE, mixer_data); + GEN_CHECK_OFF(AC97STATE, aStreams); + GEN_CHECK_OFF(AC97STATE, uTimerHz); + GEN_CHECK_OFF(AC97STATE, pTimerRC); + GEN_CHECK_OFF(AC97STATE, pTimerR3); + GEN_CHECK_OFF(AC97STATE, pTimerR0); +#ifdef VBOX_WITH_STATISTICS + GEN_CHECK_OFF(AC97STATE, StatTimer); + GEN_CHECK_OFF(AC97STATE, StatIn); + GEN_CHECK_OFF(AC97STATE, StatOut); + GEN_CHECK_OFF(AC97STATE, StatBytesRead); + GEN_CHECK_OFF(AC97STATE, StatBytesWritten); +#endif + GEN_CHECK_OFF(AC97STATE, lstDrv); + GEN_CHECK_OFF(AC97STATE, pMixer); + GEN_CHECK_OFF(AC97STATE, pSinkOut); + GEN_CHECK_OFF(AC97STATE, pSinkLineIn); + GEN_CHECK_OFF(AC97STATE, pSinkMicIn); + GEN_CHECK_OFF(AC97STATE, silence); + GEN_CHECK_OFF(AC97STATE, bup_flag); + GEN_CHECK_OFF(AC97STATE, IBase); + GEN_CHECK_OFF(AC97STATE, IOPortBase); + GEN_CHECK_OFF(AC97STATE, uCodecModel); + + GEN_CHECK_SIZE(AC97STREAM); + GEN_CHECK_OFF(AC97STREAM, pAC97State); + + GEN_CHECK_SIZE(AC97STREAMSTATE); + GEN_CHECK_OFF(AC97STREAMSTATE, CritSect); + GEN_CHECK_OFF(AC97STREAMSTATE, pCircBuf); + GEN_CHECK_OFF(AC97STREAMSTATE, tsTransferLast); + + GEN_CHECK_SIZE(HDADRIVERSTREAM); + GEN_CHECK_OFF(HDADRIVERSTREAM, pMixStrm); + + GEN_CHECK_SIZE(HDADRIVER); + GEN_CHECK_OFF(HDADRIVER, Node); + GEN_CHECK_OFF(HDADRIVER, pHDAState); + GEN_CHECK_OFF(HDADRIVER, fFlags); + GEN_CHECK_OFF(HDADRIVER, uLUN); + GEN_CHECK_OFF(HDADRIVER, fAttached); + GEN_CHECK_OFF(HDADRIVER, pConnector); + GEN_CHECK_OFF(HDADRIVER, LineIn); +#ifdef VBOX_WITH_HDA_MIC_IN + GEN_CHECK_OFF(HDADRIVER, MicIn); +#endif + GEN_CHECK_OFF(HDADRIVER, Front); +#ifdef VBOX_WITH_HDA_51_SURROUND + GEN_CHECK_OFF(HDADRIVER, CenterLFE); + GEN_CHECK_OFF(HDADRIVER, Rear); +#endif + + GEN_CHECK_SIZE(HDABDLESTATE); + GEN_CHECK_OFF(HDABDLESTATE, u32BDLIndex); + GEN_CHECK_OFF(HDABDLESTATE, cbBelowFIFOW); + GEN_CHECK_OFF(HDABDLESTATE, u32BufOff); + + GEN_CHECK_SIZE(HDABDLEDESC); + GEN_CHECK_OFF(HDABDLEDESC, u64BufAddr); + GEN_CHECK_OFF(HDABDLEDESC, u32BufSize); + GEN_CHECK_OFF(HDABDLEDESC, fFlags); + + GEN_CHECK_SIZE(HDABDLE); + GEN_CHECK_OFF(HDABDLE, Desc); + GEN_CHECK_OFF(HDABDLE, State); + + GEN_CHECK_SIZE(HDASTREAMMAP); + + GEN_CHECK_SIZE(HDASTREAMSTATE); + GEN_CHECK_OFF(HDASTREAMSTATE, uCurBDLE); + GEN_CHECK_OFF(HDASTREAMSTATE, fInReset); + GEN_CHECK_OFF(HDASTREAMSTATE, Mapping); + GEN_CHECK_OFF(HDASTREAMSTATE, BDLE); + GEN_CHECK_OFF(HDASTREAMSTATE, pCircBuf); + + GEN_CHECK_SIZE(HDASTREAMDBGINFORT); + + GEN_CHECK_SIZE(HDASTREAMDBGINFO); + GEN_CHECK_OFF(HDASTREAMDBGINFO, Runtime); + + GEN_CHECK_SIZE(HDASTREAM); + GEN_CHECK_OFF(HDASTREAM, u8SD); + GEN_CHECK_OFF(HDASTREAM, u64BDLBase); + GEN_CHECK_OFF(HDASTREAM, u16FMT); + GEN_CHECK_OFF(HDASTREAM, u16FIFOS); + GEN_CHECK_OFF(HDASTREAM, u16LVI); + GEN_CHECK_OFF(HDASTREAM, State); + GEN_CHECK_OFF(HDASTREAM, Dbg); + GEN_CHECK_OFF(HDASTREAM, CritSect); + + GEN_CHECK_SIZE(HDASTATE); + GEN_CHECK_OFF(HDASTATE, PciDev); + GEN_CHECK_OFF(HDASTATE, pDevInsR3); + GEN_CHECK_OFF(HDASTATE, pDevInsR0); + GEN_CHECK_OFF(HDASTATE, pDevInsRC); + GEN_CHECK_OFF(HDASTATE, IBase); + GEN_CHECK_OFF(HDASTATE, MMIOBaseAddr); + GEN_CHECK_OFF(HDASTATE, au32Regs[0]); + GEN_CHECK_OFF(HDASTATE, au32Regs[HDA_NUM_REGS]); + GEN_CHECK_OFF(HDASTATE, aStreams); + GEN_CHECK_OFF(HDASTATE, aTags); + GEN_CHECK_OFF(HDASTATE, u64CORBBase); + GEN_CHECK_OFF(HDASTATE, u64RIRBBase); + GEN_CHECK_OFF(HDASTATE, u64DPBase); + GEN_CHECK_OFF(HDASTATE, pu32CorbBuf); + GEN_CHECK_OFF(HDASTATE, cbCorbBuf); + GEN_CHECK_OFF(HDASTATE, pu64RirbBuf); + GEN_CHECK_OFF(HDASTATE, cbRirbBuf); + GEN_CHECK_OFF(HDASTATE, fRZEnabled); +#ifdef VBOX_WITH_STATISTICS +# ifndef VBOX_WITH_AUDIO_CALLBACKS + GEN_CHECK_OFF(HDASTATE, StatTimer); +# endif + GEN_CHECK_OFF(HDASTATE, StatBytesRead); + GEN_CHECK_OFF(HDASTATE, StatBytesWritten); +#endif /* VBOX_WITH_STATISTICS */ + GEN_CHECK_OFF(HDASTATE, pCodec); + GEN_CHECK_OFF(HDASTATE, lstDrv); + GEN_CHECK_OFF(HDASTATE, pMixer); + GEN_CHECK_OFF(HDASTATE, SinkFront); +#ifdef VBOX_WITH_HDA_51_SURROUND + GEN_CHECK_OFF(HDASTATE, SinkCenterLFE); + GEN_CHECK_OFF(HDASTATE, SinkRear); +#endif + GEN_CHECK_OFF(HDASTATE, SinkLineIn); +#ifdef VBOX_WITH_HDA_MIC_IN + GEN_CHECK_OFF(HDASTATE, SinkMicIn); +#endif + GEN_CHECK_OFF(HDASTATE, u64WalClk); + GEN_CHECK_OFF(HDASTATE, u16RespIntCnt); + GEN_CHECK_OFF(HDASTATE, cPosAdjustFrames); + GEN_CHECK_OFF(HDASTATE, u8IRQL); + +#ifdef VBOX_WITH_NVME_IMPL + GEN_CHECK_SIZE(NVMEQUEUEHDR); + GEN_CHECK_OFF(NVMEQUEUEHDR, u16Id); + GEN_CHECK_OFF(NVMEQUEUEHDR, cEntries); + GEN_CHECK_OFF(NVMEQUEUEHDR, enmState); + GEN_CHECK_OFF(NVMEQUEUEHDR, GCPhysBase); + GEN_CHECK_OFF(NVMEQUEUEHDR, cbEntry); + GEN_CHECK_OFF(NVMEQUEUEHDR, idxHead); + GEN_CHECK_OFF(NVMEQUEUEHDR, idxTail); + GEN_CHECK_OFF(NVMEQUEUEHDR, fPhysCont); + GEN_CHECK_OFF(NVMEQUEUEHDR, enmType); + + GEN_CHECK_SIZE(NVMEQUEUESUBM); + GEN_CHECK_OFF(NVMEQUEUESUBM, Hdr); + GEN_CHECK_OFF(NVMEQUEUESUBM, u16CompletionQueueId); + GEN_CHECK_OFF(NVMEQUEUESUBM, enmPriority); + GEN_CHECK_OFF(NVMEQUEUESUBM, hEvtProcess); + GEN_CHECK_OFF(NVMEQUEUESUBM, pWrkThrdR3); + GEN_CHECK_OFF(NVMEQUEUESUBM, NdLstWrkThrdAssgnd); + GEN_CHECK_OFF(NVMEQUEUESUBM, cReqsActive); + + GEN_CHECK_SIZE(NVMEQUEUECOMP); + GEN_CHECK_OFF(NVMEQUEUECOMP, Hdr); + GEN_CHECK_OFF(NVMEQUEUECOMP, fIntrEnabled); + GEN_CHECK_OFF(NVMEQUEUECOMP, u32IntrVec); + GEN_CHECK_OFF(NVMEQUEUECOMP, cSubmQueuesRef); + GEN_CHECK_OFF(NVMEQUEUECOMP, cWaiters); + GEN_CHECK_OFF(NVMEQUEUECOMP, LstCompletionsWaiting); + GEN_CHECK_OFF(NVMEQUEUECOMP, hMtx); + + GEN_CHECK_SIZE(NVME); + GEN_CHECK_OFF(NVME, PciDev); + GEN_CHECK_OFF(NVME, pDevInsR3); + GEN_CHECK_OFF(NVME, pDevInsR0); + GEN_CHECK_OFF(NVME, pDevInsRC); + GEN_CHECK_OFF(NVME, IBase); + GEN_CHECK_OFF(NVME, ILeds); + GEN_CHECK_OFF(NVME, pLedsConnector); + GEN_CHECK_OFF(NVME, pSupDrvSession); + GEN_CHECK_OFF(NVME, GCPhysMMIO); + GEN_CHECK_OFF(NVME, IOPortBase); + GEN_CHECK_OFF(NVME, cQueuesSubmMax); + GEN_CHECK_OFF(NVME, cQueuesCompMax); + GEN_CHECK_OFF(NVME, cQueueEntriesMax); + GEN_CHECK_OFF(NVME, cTimeoutMax); + GEN_CHECK_OFF(NVME, cWrkThrdsMax); + GEN_CHECK_OFF(NVME, cCompQueuesWaitersMax); + GEN_CHECK_OFF(NVME, cNamespaces); + GEN_CHECK_OFF(NVME, szSerialNumber); + GEN_CHECK_OFF(NVME, szModelNumber); + GEN_CHECK_OFF(NVME, szFirmwareRevision); + GEN_CHECK_OFF(NVME, fRCEnabled); + GEN_CHECK_OFF(NVME, fR0Enabled); + GEN_CHECK_OFF(NVME, enmState); + GEN_CHECK_OFF(NVME, u32IntrMask); + GEN_CHECK_OFF(NVME, aIntrVecs); + GEN_CHECK_OFF(NVME, u32IoCompletionQueueEntrySize); + GEN_CHECK_OFF(NVME, u32IoSubmissionQueueEntrySize); + GEN_CHECK_OFF(NVME, uShutdwnNotifierLast); + GEN_CHECK_OFF(NVME, uAmsSet); + GEN_CHECK_OFF(NVME, uMpsSet); + GEN_CHECK_OFF(NVME, uCssSet); + GEN_CHECK_OFF(NVME, u32RegIdx); + GEN_CHECK_OFF(NVME, cbPage); + GEN_CHECK_OFF(NVME, paQueuesSubmR3); + GEN_CHECK_OFF(NVME, paQueuesCompR3); + GEN_CHECK_OFF(NVME, paQueuesSubmR0); + GEN_CHECK_OFF(NVME, paQueuesCompR0); + GEN_CHECK_OFF(NVME, paQueuesSubmRC); + GEN_CHECK_OFF(NVME, paQueuesCompRC); + GEN_CHECK_OFF(NVME, pvCtrlMemBufR3); + GEN_CHECK_OFF(NVME, GCPhysCtrlMemBuf); + GEN_CHECK_OFF(NVME, cbCtrlMemBuf); + GEN_CHECK_OFF(NVME, u32CtrlMemBufSz); + GEN_CHECK_OFF(NVME, pWakeQueueR3); + GEN_CHECK_OFF(NVME, pWakeQueueR0); + GEN_CHECK_OFF(NVME, pWakeQueueRC); + GEN_CHECK_OFF(NVME, cAsyncEvtReqsMax); + GEN_CHECK_OFF(NVME, CritSectAsyncEvtReqs); + GEN_CHECK_OFF(NVME, paAsyncEvtReqCids); + GEN_CHECK_OFF(NVME, paNamespaces); + GEN_CHECK_OFF(NVME, cWrkThrdsCur); + GEN_CHECK_OFF(NVME, cWrkThrdsActive); + GEN_CHECK_OFF(NVME, LstWrkThrds); + GEN_CHECK_OFF(NVME, CritSectWrkThrds); + GEN_CHECK_OFF(NVME, fSignalIdle); +# ifdef VBOX_WITH_STATISTICS + GEN_CHECK_OFF(NVME, aStatMemXfer[0]); + GEN_CHECK_OFF(NVME, aStatMemXfer[NVME_CMBSZ_SUPP_BIT_IDX_MAX]); +# endif +#endif + + return (0); +} diff --git a/src/VBox/Devices/testcase/tstDeviceVMM.cpp b/src/VBox/Devices/testcase/tstDeviceVMM.cpp new file mode 100644 index 00000000..c93070a5 --- /dev/null +++ b/src/VBox/Devices/testcase/tstDeviceVMM.cpp @@ -0,0 +1,1108 @@ +/* $Id: tstDeviceVMM.cpp $ */ +/** @file + * tstDevice - Test framework for PDM devices/drivers, VMM callbacks implementation. + */ + +/* + * Copyright (C) 2017-2019 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_DEFAULT /** @todo */ +#include <VBox/types.h> +#include <VBox/version.h> +#include <VBox/vmm/pdmpci.h> + +#include <iprt/mem.h> + +#include "tstDeviceInternal.h" + + +/********************************************************************************************************************************* +* Defined Constants And Macros * +*********************************************************************************************************************************/ + +/** Frequency of the real clock. */ +#define TMCLOCK_FREQ_REAL UINT32_C(1000) +/** Frequency of the virtual clock. */ +#define TMCLOCK_FREQ_VIRTUAL UINT32_C(1000000000) + + +/********************************************************************************************************************************* +* Structures and Typedefs * +*********************************************************************************************************************************/ + + + +/********************************************************************************************************************************* +* Global Variables * +*********************************************************************************************************************************/ + + + +/********************************************************************************************************************************* +* Internal Functions * +*********************************************************************************************************************************/ + +/** + * Resolves a path reference to a configuration item. + * + * @returns VBox status code. + * @param paDevCfg The array of config items. + * @param pszName Name of a byte string value. + * @param ppItem Where to store the pointer to the item. + */ +static int tstDev_CfgmR3ResolveItem(PCTSTDEVCFGITEM paDevCfg, const char *pszName, PCTSTDEVCFGITEM *ppItem) +{ + *ppItem = NULL; + if (!paDevCfg) + return VERR_CFGM_VALUE_NOT_FOUND; + + size_t cchName = strlen(pszName); + PCTSTDEVCFGITEM pDevCfgItem = paDevCfg; + while (pDevCfgItem->pszKey != NULL) + { + size_t cchKey = strlen(pDevCfgItem->pszKey); + if (cchName == cchKey) + { + int iDiff = memcmp(pszName, pDevCfgItem->pszKey, cchName); + if (iDiff <= 0) + { + if (iDiff != 0) + break; + *ppItem = pDevCfgItem; + return VINF_SUCCESS; + } + } + + /* next */ + pDevCfgItem++; + } + return VERR_CFGM_VALUE_NOT_FOUND; +} + + +static DECLCALLBACK(bool) tstDevVmm_CFGMR3AreValuesValid(PCFGMNODE pNode, const char *pszzValid) +{ + if (pNode && pNode->pDut->pTestcaseReg->paDevCfg) + { + PCTSTDEVCFGITEM pDevCfgItem = pNode->pDut->pTestcaseReg->paDevCfg; + while (pDevCfgItem->pszKey != NULL) + { + size_t cchKey = strlen(pDevCfgItem->pszKey); + + /* search pszzValid for the name */ + const char *psz = pszzValid; + while (*psz) + { + size_t cch = strlen(psz); + if ( cch == cchKey + && !memcmp(psz, pDevCfgItem->pszKey, cch)) + break; + + /* next */ + psz += cch + 1; + } + + /* if at end of pszzValid we didn't find it => failure */ + if (!*psz) + return false; + + pDevCfgItem++; + } + } + + return true; +} + + +static DECLCALLBACK(void) tstDevVmm_CFGMR3Dump(PCFGMNODE pRoot) +{ + RT_NOREF(pRoot); + AssertFailed(); +} + + +static DECLCALLBACK(PCFGMNODE) tstDevVmm_CFGMR3GetChild(PCFGMNODE pNode, const char *pszPath) +{ + RT_NOREF(pNode, pszPath); + AssertFailed(); + return NULL; +} + + +static DECLCALLBACK(PCFGMNODE) tstDevVmm_CFGMR3GetChildFV(PCFGMNODE pNode, const char *pszPathFormat, va_list Args) +{ + RT_NOREF(pNode, pszPathFormat, Args); + AssertFailed(); + return NULL; +} + + +static DECLCALLBACK(PCFGMNODE) tstDevVmm_CFGMR3GetFirstChild(PCFGMNODE pNode) +{ + RT_NOREF(pNode); + AssertFailed(); + return NULL; +} + + +static DECLCALLBACK(int) tstDevVmm_CFGMR3GetName(PCFGMNODE pCur, char *pszName, size_t cchName) +{ + RT_NOREF(pCur, pszName, cchName); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(PCFGMNODE) tstDevVmm_CFGMR3GetNextChild(PCFGMNODE pCur) +{ + RT_NOREF(pCur); + AssertFailed(); + return NULL; +} + + +static DECLCALLBACK(PCFGMNODE) tstDevVmm_CFGMR3GetParent(PCFGMNODE pNode) +{ + RT_NOREF(pNode); + AssertFailed(); + return NULL; +} + + +static DECLCALLBACK(PCFGMNODE) tstDevVmm_CFGMR3GetRoot(PVM pVM) +{ + RT_NOREF(pVM); + AssertFailed(); + return NULL; +} + + +static DECLCALLBACK(int) tstDevVmm_CFGMR3InsertNode(PCFGMNODE pNode, const char *pszName, PCFGMNODE *ppChild) +{ + RT_NOREF(pNode, pszName, ppChild); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_CFGMR3InsertNodeFV(PCFGMNODE pNode, PCFGMNODE *ppChild, + const char *pszNameFormat, va_list Args) +{ + RT_NOREF(pNode, ppChild, pszNameFormat, Args); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_CFGMR3InsertString(PCFGMNODE pNode, const char *pszName, const char *pszString) +{ + RT_NOREF(pNode, pszName, pszString); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_CFGMR3QueryBytes(PCFGMNODE pNode, const char *pszName, void *pvData, size_t cbData) +{ + RT_NOREF(pNode, pszName, pvData, cbData); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_CFGMR3QueryInteger(PCFGMNODE pNode, const char *pszName, uint64_t *pu64) +{ + if (!pNode) + return VERR_CFGM_NO_PARENT; + + PCTSTDEVCFGITEM pCfgItem; + int rc = tstDev_CfgmR3ResolveItem(pNode->pDut->pTestcaseReg->paDevCfg, pszName, &pCfgItem); + if (RT_SUCCESS(rc)) + { + if (pCfgItem->enmType == TSTDEVCFGITEMTYPE_INTEGER) + *pu64 = RTStrToUInt64(pCfgItem->pszVal); + else + rc = VERR_CFGM_NOT_INTEGER; + } + + return rc; +} + + +static DECLCALLBACK(int) tstDevVmm_CFGMR3QuerySize(PCFGMNODE pNode, const char *pszName, size_t *pcb) +{ + if (!pNode) + return VERR_CFGM_NO_PARENT; + + PCTSTDEVCFGITEM pCfgItem; + int rc = tstDev_CfgmR3ResolveItem(pNode->pDut->pTestcaseReg->paDevCfg, pszName, &pCfgItem); + if (RT_SUCCESS(rc)) + { + switch (pCfgItem->enmType) + { + case TSTDEVCFGITEMTYPE_INTEGER: + *pcb = sizeof(uint64_t); + break; + + case TSTDEVCFGITEMTYPE_STRING: + *pcb = strlen(pCfgItem->pszVal) + 1; + break; + + case TSTDEVCFGITEMTYPE_BYTES: + AssertFailed(); + break; + + default: + rc = VERR_CFGM_IPE_1; + AssertMsgFailed(("Invalid value type %d\n", pCfgItem->enmType)); + break; + } + } + return rc; +} + + +static DECLCALLBACK(int) tstDevVmm_CFGMR3QueryString(PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString) +{ + if (!pNode) + return VERR_CFGM_NO_PARENT; + + PCTSTDEVCFGITEM pCfgItem; + int rc = tstDev_CfgmR3ResolveItem(pNode->pDut->pTestcaseReg->paDevCfg, pszName, &pCfgItem); + if (RT_SUCCESS(rc)) + { + switch (pCfgItem->enmType) + { + case TSTDEVCFGITEMTYPE_STRING: + { + size_t cchVal = strlen(pCfgItem->pszVal); + if (cchString <= cchVal + 1) + memcpy(pszString, pCfgItem->pszVal, cchVal); + else + rc = VERR_CFGM_NOT_ENOUGH_SPACE; + break; + } + case TSTDEVCFGITEMTYPE_INTEGER: + case TSTDEVCFGITEMTYPE_BYTES: + default: + rc = VERR_CFGM_IPE_1; + AssertMsgFailed(("Invalid value type %d\n", pCfgItem->enmType)); + break; + } + } + else + rc = VERR_CFGM_VALUE_NOT_FOUND; + + return rc; +} + + +static DECLCALLBACK(int) tstDevVmm_CFGMR3QueryStringAlloc(PCFGMNODE pNode, const char *pszName, char **ppszString) +{ + RT_NOREF(pNode, pszName, ppszString); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_CFGMR3QueryStringAllocDef(PCFGMNODE pNode, const char *pszName, char **ppszString, const char *pszDef) +{ + RT_NOREF(pNode, pszName, ppszString, pszDef); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(void) tstDevVmm_CFGMR3RemoveNode(PCFGMNODE pNode) +{ + RT_NOREF(pNode); + AssertFailed(); +} + + +static DECLCALLBACK(int) tstDevVmm_CFGMR3ValidateConfig(PCFGMNODE pNode, const char *pszNode, + const char *pszValidValues, const char *pszValidNodes, + const char *pszWho, uint32_t uInstance) +{ + RT_NOREF(pNode, pszNode, pszValidValues, pszValidNodes, pszWho, uInstance); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_IOMIOPortWrite(PVM pVM, PVMCPU pVCpu, RTIOPORT Port, uint32_t u32Value, size_t cbValue) +{ + RT_NOREF(pVM, pVCpu, Port, u32Value, cbValue); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_IOMMMIOMapMMIO2Page(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysRemapped, uint64_t fPageFlags) +{ + RT_NOREF(pVM, GCPhys, GCPhysRemapped, fPageFlags); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_IOMMMIOResetRegion(PVM pVM, RTGCPHYS GCPhys) +{ + RT_NOREF(pVM, GCPhys); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_MMHyperAlloc(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv) +{ + RT_NOREF(pVM, cb, uAlignment, enmTag, ppv); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_MMHyperFree(PVM pVM, void *pv) +{ + RT_NOREF(pVM, pv); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(RTR0PTR) tstDevVmm_MMHyperR3ToR0(PVM pVM, RTR3PTR R3Ptr) +{ + RT_NOREF(pVM, R3Ptr); + AssertFailed(); + return NIL_RTR0PTR; +} + + +static DECLCALLBACK(RTRCPTR) tstDevVmm_MMHyperR3ToRC(PVM pVM, RTR3PTR R3Ptr) +{ + RT_NOREF(pVM, R3Ptr); + AssertFailed(); + return NIL_RTRCPTR; +} + + +static DECLCALLBACK(void) tstDevVmm_MMR3HeapFree(void *pv) +{ + PTSTDEVMMHEAPALLOC pHeapAlloc = (PTSTDEVMMHEAPALLOC)((uint8_t *)pv - RT_UOFFSETOF(TSTDEVMMHEAPALLOC, abAlloc[0])); + PTSTDEVDUTINT pThis = pHeapAlloc->pDut; + + tstDevDutLockExcl(pThis); + RTListNodeRemove(&pHeapAlloc->NdMmHeap); + tstDevDutUnlockExcl(pThis); + + /* Poison */ + memset(&pHeapAlloc->abAlloc[0], 0xfc, pHeapAlloc->cbAlloc); + RTMemFree(pHeapAlloc); +} + + +static DECLCALLBACK(int) tstDevVmm_MMR3HyperAllocOnceNoRel(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv) +{ + RT_NOREF(pVM, cb, uAlignment, enmTag, ppv); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(uint64_t) tstDevVmm_MMR3PhysGetRamSize(PVM pVM) +{ + RT_NOREF(pVM); + AssertFailed(); + return 0; +} + + +static DECLCALLBACK(uint64_t) tstDevVmm_MMR3PhysGetRamSizeAbove4GB(PVM pVM) +{ + RT_NOREF(pVM); + AssertFailed(); + return 0; +} + + +static DECLCALLBACK(uint32_t) tstDevVmm_MMR3PhysGetRamSizeBelow4GB(PVM pVM) +{ + RT_NOREF(pVM); + AssertFailed(); + return 0; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMCritSectEnterDebug(PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL) +{ + RT_NOREF(rcBusy, uId, RT_SRC_POS_ARGS); + return RTCritSectEnter(&pCritSect->s.CritSect); +} + + +static DECLCALLBACK(bool) tstDevVmm_PDMCritSectIsInitialized(PCPDMCRITSECT pCritSect) +{ + RT_NOREF(pCritSect); + AssertFailed(); + return false; +} + + +static DECLCALLBACK(bool) tstDevVmm_PDMCritSectIsOwner(PCPDMCRITSECT pCritSect) +{ + return RTCritSectIsOwner(&pCritSect->s.CritSect); +} + + +static DECLCALLBACK(int) tstDevVmm_PDMCritSectLeave(PPDMCRITSECT pCritSect) +{ + return RTCritSectLeave(&pCritSect->s.CritSect); +} + + +static DECLCALLBACK(int) tstDevVmm_PDMCritSectTryEnterDebug(PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL) +{ + RT_NOREF(pCritSect, uId, RT_SRC_POS_ARGS); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMHCCritSectScheduleExitEvent(PPDMCRITSECT pCritSect, SUPSEMEVENT hEventToSignal) +{ + RT_NOREF(pCritSect, hEventToSignal); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(bool) tstDevVmm_PDMNsAllocateBandwidth(PPDMNSFILTER pFilter, size_t cbTransfer) +{ + RT_NOREF(pFilter, cbTransfer); + AssertFailed(); + return false; +} + + +static DECLCALLBACK(PPDMQUEUEITEMCORE) tstDevVmm_PDMQueueAlloc(PPDMQUEUE pQueue) +{ + RT_NOREF(pQueue); + AssertFailed(); + return NULL; +} + + +static DECLCALLBACK(bool) tstDevVmm_PDMQueueFlushIfNecessary(PPDMQUEUE pQueue) +{ + RT_NOREF(pQueue); + AssertFailed(); + return false; +} + + +static DECLCALLBACK(void) tstDevVmm_PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem) +{ + RT_NOREF(pQueue, pItem); + AssertFailed(); +} + + +static DECLCALLBACK(R0PTRTYPE(PPDMQUEUE)) tstDevVmm_PDMQueueR0Ptr(PPDMQUEUE pQueue) +{ + RT_NOREF(pQueue); + AssertFailed(); + return NIL_RTR0PTR; +} + + +static DECLCALLBACK(RCPTRTYPE(PPDMQUEUE)) tstDevVmm_PDMQueueRCPtr(PPDMQUEUE pQueue) +{ + RT_NOREF(pQueue); + AssertFailed(); + return NIL_RTRCPTR; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3AsyncCompletionEpClose(PPDMASYNCCOMPLETIONENDPOINT pEndpoint) +{ + RT_NOREF(pEndpoint); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3AsyncCompletionEpCreateForFile(PPPDMASYNCCOMPLETIONENDPOINT ppEndpoint, + const char *pszFilename, uint32_t fFlags, + PPDMASYNCCOMPLETIONTEMPLATE pTemplate) +{ + RT_NOREF(ppEndpoint, pszFilename, fFlags, pTemplate); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3AsyncCompletionEpFlush(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, void *pvUser, + PPPDMASYNCCOMPLETIONTASK ppTask) +{ + RT_NOREF(pEndpoint, pvUser, ppTask); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3AsyncCompletionEpGetSize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint64_t *pcbSize) +{ + RT_NOREF(pEndpoint, pcbSize); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3AsyncCompletionEpRead(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, + PCRTSGSEG paSegments, unsigned cSegments, + size_t cbRead, void *pvUser, + PPPDMASYNCCOMPLETIONTASK ppTask) +{ + RT_NOREF(pEndpoint, off, paSegments, cSegments, cbRead, pvUser, ppTask); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3AsyncCompletionEpSetBwMgr(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, const char *pszBwMgr) +{ + RT_NOREF(pEndpoint, pszBwMgr); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3AsyncCompletionEpSetSize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint64_t cbSize) +{ + RT_NOREF(pEndpoint, cbSize); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3AsyncCompletionEpWrite(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, + PCRTSGSEG paSegments, unsigned cSegments, + size_t cbWrite, void *pvUser, + PPPDMASYNCCOMPLETIONTASK ppTask) +{ + RT_NOREF(pEndpoint, off, paSegments, cSegments, cbWrite, pvUser, ppTask); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3AsyncCompletionTemplateDestroy(PPDMASYNCCOMPLETIONTEMPLATE pTemplate) +{ + RT_NOREF(pTemplate); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3BlkCacheClear(PPDMBLKCACHE pBlkCache) +{ + RT_NOREF(pBlkCache); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3BlkCacheDiscard(PPDMBLKCACHE pBlkCache, PCRTRANGE paRanges, + unsigned cRanges, void *pvUser) +{ + RT_NOREF(pBlkCache, paRanges, cRanges, pvUser); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3BlkCacheFlush(PPDMBLKCACHE pBlkCache, void *pvUser) +{ + RT_NOREF(pBlkCache, pvUser); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3BlkCacheIoXferComplete(PPDMBLKCACHE pBlkCache, PPDMBLKCACHEIOXFER hIoXfer, int rcIoXfer) +{ + RT_NOREF(pBlkCache, hIoXfer, rcIoXfer); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3BlkCacheRead(PPDMBLKCACHE pBlkCache, uint64_t off, PCRTSGBUF pSgBuf, size_t cbRead, void *pvUser) +{ + RT_NOREF(pBlkCache, off, pSgBuf, cbRead, pvUser); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3BlkCacheRelease(PPDMBLKCACHE pBlkCache) +{ + RT_NOREF(pBlkCache); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3BlkCacheResume(PPDMBLKCACHE pBlkCache) +{ + RT_NOREF(pBlkCache); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3BlkCacheSuspend(PPDMBLKCACHE pBlkCache) +{ + RT_NOREF(pBlkCache); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3BlkCacheWrite(PPDMBLKCACHE pBlkCache, uint64_t off, PCRTSGBUF pSgBuf, size_t cbWrite, void *pvUser) +{ + RT_NOREF(pBlkCache, off, pSgBuf, cbWrite, pvUser); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3CritSectDelete(PPDMCRITSECT pCritSect) +{ + RT_NOREF(pCritSect); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3QueryLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase) +{ + RT_NOREF(pUVM, pszDevice, iInstance, iLun, ppBase); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3ThreadDestroy(PPDMTHREAD pThread, int *pRcThread) +{ + RT_NOREF(pThread, pRcThread); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3ThreadResume(PPDMTHREAD pThread) +{ + RT_NOREF(pThread); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3ThreadSleep(PPDMTHREAD pThread, RTMSINTERVAL cMillies) +{ + RT_NOREF(pThread, cMillies); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_PDMR3ThreadSuspend(PPDMTHREAD pThread) +{ + RT_NOREF(pThread); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(uint64_t) tstDevVmm_TMCpuTicksPerSecond(PVM pVM) +{ + RT_NOREF(pVM); + AssertFailed(); + return 0; +} + + +static DECLCALLBACK(int) tstDevVmm_TMR3TimerDestroy(PTMTIMER pTimer) +{ + RT_NOREF(pTimer); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_TMR3TimerLoad(PTMTIMERR3 pTimer, PSSMHANDLE pSSM) +{ + RT_NOREF(pTimer, pSSM); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_TMR3TimerSave(PTMTIMERR3 pTimer, PSSMHANDLE pSSM) +{ + RT_NOREF(pTimer, pSSM); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_TMR3TimerSetCritSect(PTMTIMERR3 pTimer, PPDMCRITSECT pCritSect) +{ + RT_NOREF(pTimer, pCritSect); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(uint64_t) tstDevVmm_TMTimerFromMilli(PTMTIMER pTimer, uint64_t cMilliSecs) +{ + RT_NOREF(pTimer, cMilliSecs); + AssertFailed(); + return 0; +} + + +static DECLCALLBACK(uint64_t) tstDevVmm_TMTimerFromNano(PTMTIMER pTimer, uint64_t cNanoSecs) +{ + RT_NOREF(pTimer, cNanoSecs); + AssertFailed(); + return 0; +} + + +static DECLCALLBACK(uint64_t) tstDevVmm_TMTimerGet(PTMTIMER pTimer) +{ + RT_NOREF(pTimer); + AssertFailed(); + return 0; +} + + +static DECLCALLBACK(uint64_t) tstDevVmm_TMTimerGetFreq(PTMTIMER pTimer) +{ + switch (pTimer->enmClock) + { + case TMCLOCK_VIRTUAL: + case TMCLOCK_VIRTUAL_SYNC: + return TMCLOCK_FREQ_VIRTUAL; + + case TMCLOCK_REAL: + return TMCLOCK_FREQ_REAL; + + default: + AssertMsgFailed(("Invalid enmClock=%d\n", pTimer->enmClock)); + return 0; + } +} + + +static DECLCALLBACK(uint64_t) tstDevVmm_TMTimerGetNano(PTMTIMER pTimer) +{ + RT_NOREF(pTimer); + AssertFailed(); + return 0; +} + + +static DECLCALLBACK(bool) tstDevVmm_TMTimerIsActive(PTMTIMER pTimer) +{ + RT_NOREF(pTimer); + AssertFailed(); + return false; +} + + +static DECLCALLBACK(bool) tstDevVmm_TMTimerIsLockOwner(PTMTIMER pTimer) +{ + RT_NOREF(pTimer); + AssertFailed(); + return false; +} + + +static DECLCALLBACK(int) tstDevVmm_TMTimerLock(PTMTIMER pTimer, int rcBusy) +{ + RT_NOREF(pTimer, rcBusy); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(PTMTIMERR0) tstDevVmm_TMTimerR0Ptr(PTMTIMER pTimer) +{ + return (PTMTIMERR0)pTimer; +} + + +static DECLCALLBACK(PTMTIMERRC) tstDevVmm_TMTimerRCPtr(PTMTIMER pTimer) +{ + RT_NOREF(pTimer); + /* Impossible to implement RC modules at the moment. */ + return NIL_RTRCPTR; +} + + +static DECLCALLBACK(int) tstDevVmm_TMTimerSet(PTMTIMER pTimer, uint64_t u64Expire) +{ + RT_NOREF(pTimer, u64Expire); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_TMTimerSetFrequencyHint(PTMTIMER pTimer, uint32_t uHz) +{ + RT_NOREF(pTimer, uHz); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_TMTimerSetMicro(PTMTIMER pTimer, uint64_t cMicrosToNext) +{ + RT_NOREF(pTimer, cMicrosToNext); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_TMTimerSetMillies(PTMTIMER pTimer, uint32_t cMilliesToNext) +{ + RT_NOREF(pTimer, cMilliesToNext); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_TMTimerSetNano(PTMTIMER pTimer, uint64_t cNanosToNext) +{ + RT_NOREF(pTimer, cNanosToNext); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_TMTimerStop(PTMTIMER pTimer) +{ + RT_NOREF(pTimer); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(void) tstDevVmm_TMTimerUnlock(PTMTIMER pTimer) +{ + RT_NOREF(pTimer); + AssertFailed(); +} + + +static DECLCALLBACK(PVMCPU) tstDevVmm_VMMGetCpu(PVM pVM) +{ + RT_NOREF(pVM); + AssertFailed(); + return NULL; +} + + +static DECLCALLBACK(VMCPUID) tstDevVmm_VMMGetCpuId(PVM pVM) +{ + RT_NOREF(pVM); + AssertFailed(); + return NIL_VMCPUID; +} + + +static DECLCALLBACK(int) tstDevVmm_VMMR3DeregisterPatchMemory(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem) +{ + RT_NOREF(pVM, pPatchMem, cbPatchMem); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_VMMR3RegisterPatchMemory(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem) +{ + RT_NOREF(pVM, pPatchMem, cbPatchMem); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(RTNATIVETHREAD) tstDevVmm_VMR3GetVMCPUNativeThread(PVM pVM) +{ + RT_NOREF(pVM); + AssertFailed(); + return NIL_RTNATIVETHREAD; +} + + +static DECLCALLBACK(int) tstDevVmm_VMR3NotifyCpuDeviceReady(PVM pVM, VMCPUID idCpu) +{ + RT_NOREF(pVM, idCpu); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_VMR3ReqCallNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) +{ + RT_NOREF(pVM, idDstCpu, pfnFunction, cArgs); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_VMR3ReqCallVoidNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) +{ + RT_NOREF(pVM, idDstCpu, pfnFunction, cArgs); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_VMR3ReqPriorityCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) +{ + RT_NOREF(pVM, idDstCpu, pfnFunction, cArgs); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +static DECLCALLBACK(int) tstDevVmm_VMR3WaitForDeviceReady(PVM pVM, VMCPUID idCpu) +{ + RT_NOREF(pVM, idCpu); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + + +const TSTDEVVMMCALLBACKS g_tstDevVmmCallbacks = +{ + tstDevVmm_CFGMR3AreValuesValid, + tstDevVmm_CFGMR3Dump, + tstDevVmm_CFGMR3GetChild, + tstDevVmm_CFGMR3GetChildFV, + tstDevVmm_CFGMR3GetFirstChild, + tstDevVmm_CFGMR3GetName, + tstDevVmm_CFGMR3GetNextChild, + tstDevVmm_CFGMR3GetParent, + tstDevVmm_CFGMR3GetRoot, + tstDevVmm_CFGMR3InsertNode, + tstDevVmm_CFGMR3InsertNodeFV, + tstDevVmm_CFGMR3InsertString, + tstDevVmm_CFGMR3QueryBytes, + tstDevVmm_CFGMR3QueryInteger, + tstDevVmm_CFGMR3QuerySize, + tstDevVmm_CFGMR3QueryString, + tstDevVmm_CFGMR3QueryStringAlloc, + tstDevVmm_CFGMR3QueryStringAllocDef, + tstDevVmm_CFGMR3RemoveNode, + tstDevVmm_CFGMR3ValidateConfig, + tstDevVmm_IOMIOPortWrite, + tstDevVmm_IOMMMIOMapMMIO2Page, + tstDevVmm_IOMMMIOResetRegion, + tstDevVmm_MMHyperAlloc, + tstDevVmm_MMHyperFree, + tstDevVmm_MMHyperR3ToR0, + tstDevVmm_MMHyperR3ToRC, + tstDevVmm_MMR3HeapFree, + tstDevVmm_MMR3HyperAllocOnceNoRel, + tstDevVmm_MMR3PhysGetRamSize, + tstDevVmm_MMR3PhysGetRamSizeAbove4GB, + tstDevVmm_MMR3PhysGetRamSizeBelow4GB, + tstDevVmm_PDMCritSectEnterDebug, + tstDevVmm_PDMCritSectIsInitialized, + tstDevVmm_PDMCritSectIsOwner, + tstDevVmm_PDMCritSectLeave, + tstDevVmm_PDMCritSectTryEnterDebug, + tstDevVmm_PDMHCCritSectScheduleExitEvent, + tstDevVmm_PDMNsAllocateBandwidth, + tstDevVmm_PDMQueueAlloc, + tstDevVmm_PDMQueueFlushIfNecessary, + tstDevVmm_PDMQueueInsert, + tstDevVmm_PDMQueueR0Ptr, + tstDevVmm_PDMQueueRCPtr, + tstDevVmm_PDMR3AsyncCompletionEpClose, + tstDevVmm_PDMR3AsyncCompletionEpCreateForFile, + tstDevVmm_PDMR3AsyncCompletionEpFlush, + tstDevVmm_PDMR3AsyncCompletionEpGetSize, + tstDevVmm_PDMR3AsyncCompletionEpRead, + tstDevVmm_PDMR3AsyncCompletionEpSetBwMgr, + tstDevVmm_PDMR3AsyncCompletionEpSetSize, + tstDevVmm_PDMR3AsyncCompletionEpWrite, + tstDevVmm_PDMR3AsyncCompletionTemplateDestroy, + tstDevVmm_PDMR3BlkCacheClear, + tstDevVmm_PDMR3BlkCacheDiscard, + tstDevVmm_PDMR3BlkCacheFlush, + tstDevVmm_PDMR3BlkCacheIoXferComplete, + tstDevVmm_PDMR3BlkCacheRead, + tstDevVmm_PDMR3BlkCacheRelease, + tstDevVmm_PDMR3BlkCacheResume, + tstDevVmm_PDMR3BlkCacheSuspend, + tstDevVmm_PDMR3BlkCacheWrite, + tstDevVmm_PDMR3CritSectDelete, + tstDevVmm_PDMR3QueryLun, + tstDevVmm_PDMR3ThreadDestroy, + tstDevVmm_PDMR3ThreadResume, + tstDevVmm_PDMR3ThreadSleep, + tstDevVmm_PDMR3ThreadSuspend, + tstDevVmm_TMCpuTicksPerSecond, + tstDevVmm_TMR3TimerDestroy, + tstDevVmm_TMR3TimerLoad, + tstDevVmm_TMR3TimerSave, + tstDevVmm_TMR3TimerSetCritSect, + tstDevVmm_TMTimerFromMilli, + tstDevVmm_TMTimerFromNano, + tstDevVmm_TMTimerGet, + tstDevVmm_TMTimerGetFreq, + tstDevVmm_TMTimerGetNano, + tstDevVmm_TMTimerIsActive, + tstDevVmm_TMTimerIsLockOwner, + tstDevVmm_TMTimerLock, + tstDevVmm_TMTimerR0Ptr, + tstDevVmm_TMTimerRCPtr, + tstDevVmm_TMTimerSet, + tstDevVmm_TMTimerSetFrequencyHint, + tstDevVmm_TMTimerSetMicro, + tstDevVmm_TMTimerSetMillies, + tstDevVmm_TMTimerSetNano, + tstDevVmm_TMTimerStop, + tstDevVmm_TMTimerUnlock, + tstDevVmm_VMMGetCpu, + tstDevVmm_VMMGetCpuId, + tstDevVmm_VMMR3DeregisterPatchMemory, + tstDevVmm_VMMR3RegisterPatchMemory, + tstDevVmm_VMR3GetVMCPUNativeThread, + tstDevVmm_VMR3NotifyCpuDeviceReady, + tstDevVmm_VMR3ReqCallNoWait, + tstDevVmm_VMR3ReqCallVoidNoWait, + tstDevVmm_VMR3ReqPriorityCallWait, + tstDevVmm_VMR3WaitForDeviceReady +}; + diff --git a/src/VBox/Devices/testcase/tstDeviceVMMInternal.h b/src/VBox/Devices/testcase/tstDeviceVMMInternal.h new file mode 100644 index 00000000..50dae6b5 --- /dev/null +++ b/src/VBox/Devices/testcase/tstDeviceVMMInternal.h @@ -0,0 +1,364 @@ +/* $Id: tstDeviceVMMInternal.h $ */ +/** @file + * tstDevice - Test framework for PDM devices/drivers, definitions of VMM internal types. + */ + +/* + * Copyright (C) 2017-2019 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_INCLUDED_SRC_testcase_tstDeviceVMMInternal_h +#define VBOX_INCLUDED_SRC_testcase_tstDeviceVMMInternal_h +#ifndef RT_WITHOUT_PRAGMA_ONCE +# pragma once +#endif + +#include <VBox/types.h> +#include <VBox/vmm/tm.h> +#include <iprt/critsect.h> +#include <iprt/list.h> + +RT_C_DECLS_BEGIN + +/** Pointer to a VMM callback table. */ +typedef struct TSTDEVVMMCALLBACKS *PTSTDEVVMMCALLBACKS; +/** Pointer to a constant VMM callback table. */ +typedef const struct TSTDEVVMMCALLBACKS *PCTSTDEVVMMCALLBACKS; + +/** Pointer to the internal device under test instance. */ +typedef struct TSTDEVDUTINT *PTSTDEVDUTINT; +/** Pointer to a constant device under test instance. */ +typedef const struct TSTDEVDUTINT *PCTSTDEVDUTINT; + +/** + * Private device instance data. + */ +typedef struct PDMDEVINSINT +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** Pointer to the device under test the PDM device instance is for. */ + PTSTDEVDUTINT pDut; +} PDMDEVINSINT; +AssertCompile(sizeof(PDMDEVINSINT) <= (HC_ARCH_BITS == 32 ? 72 : 112 + 0x28)); + +/** + * CFGM node structure. + */ +typedef struct CFGMNODE +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** Device under test this CFGM node is for. */ + PTSTDEVDUTINT pDut; + /** @todo: */ +} CFGMNODE; + +/** + * PDM queue structure. + */ +typedef struct PDMQUEUE +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** @todo: */ +} PDMQUEUE; + +/** + * TM timer structure. + */ +typedef struct TMTIMER +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** List of timers created by the device. */ + RTLISTNODE NdDevTimers; + /** Clock this timer belongs to. */ + TMCLOCK enmClock; + /** Callback to call when the timer expires. */ + PFNTMTIMERDEV pfnCallbackDev; + /** Opaque user data to pass to the callback. */ + void *pvUser; + /** Flags. */ + uint32_t fFlags; + /** @todo: */ +} TMTIMER; + +/** + * Internal VMM structure of VMCPU + */ +typedef struct VMMCPU +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** @todo: */ +} VMMCPU; +AssertCompile(sizeof(VMMCPU) <= 704); + +/** + * Internal VMM structure of VM + */ +typedef struct VMM +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** @todo: */ +} VMM; +AssertCompile(sizeof(VMM) <= 1600); + +/** + * Internal VM structure of VM + */ +typedef struct VMINT +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** @todo: */ +} VMINT; +AssertCompile(sizeof(VMINT) <= 24); + +/** + * Internal per vCPU user VM structure. + */ +typedef struct VMINTUSERPERVMCPU +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** @todo: */ +} VMINTUSERPERVMCPU; +AssertCompile(sizeof(VMINTUSERPERVMCPU) <= 512); + +/** + * Internal user VM structure. + */ +typedef struct VMINTUSERPERVM +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** @todo: */ +} VMINTUSERPERVM; +AssertCompile(sizeof(VMINTUSERPERVM) <= 512); + +/** + * Internal PDM critical section structure. + */ +typedef struct PDMCRITSECTINT +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** The actual critical section used for emulation. */ + RTCRITSECT CritSect; +} PDMCRITSECTINT; +AssertCompile(sizeof(PDMCRITSECTINT) <= (HC_ARCH_BITS == 32 ? 0x80 : 0xc0)); + +/** + * Internal PDM thread instance data. + */ +typedef struct PDMTHREADINT +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** Pointer to the device under test. */ + PTSTDEVDUTINT pDut; + /** Node for the list of PDM threads. */ + RTLISTNODE NdPdmThreads; +} PDMTHREADINT; +AssertCompile(sizeof(PDMTHREADINT) <= 64); + +/** + * MM Heap allocation. + */ +typedef struct TSTDEVMMHEAPALLOC +{ + /** Node for the list of allocations. */ + RTLISTNODE NdMmHeap; + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** Pointer to the device under test the allocation was made for. */ + PTSTDEVDUTINT pDut; + /** Size of the allocation. */ + size_t cbAlloc; + /** Align the next member on a 16byte boundary. */ + size_t uAlignment0; + /** Start of the real allocation. */ + uint8_t abAlloc[RT_FLEXIBLE_ARRAY]; +} TSTDEVMMHEAPALLOC; +/** Pointer to a MM Heap allocation. */ +typedef TSTDEVMMHEAPALLOC *PTSTDEVMMHEAPALLOC; +/** Pointer to a const MM Heap allocation. */ +typedef const TSTDEVMMHEAPALLOC *PCTSTDEVMMHEAPALLOC; + +AssertCompileMemberAlignment(TSTDEVMMHEAPALLOC, abAlloc, HC_ARCH_BITS == 64 ? 16 : 8); + +#if 0 +/** + * Internal PDM netshaper filter instance data. + */ +typedef struct PDMNSFILTER +{ + /** Pointer to the callback table. */ + PCTSTDEVVMMCALLBACKS pVmmCallbacks; + /** @todo: */ +} PDMNSFILTER; +#endif + +#define PDMCRITSECTINT_DECLARED +#define PDMTHREADINT_DECLARED +#define PDMDEVINSINT_DECLARED +#define VMM_INCLUDED_SRC_include_VMInternal_h +#define VMM_INCLUDED_SRC_include_VMMInternal_h +RT_C_DECLS_END +#include <VBox/vmm/pdmcritsect.h> +#include <VBox/vmm/vm.h> +#include <VBox/vmm/uvm.h> +#include <VBox/vmm/cfgm.h> +#include <VBox/vmm/tm.h> +#include <VBox/vmm/pdmblkcache.h> +#include <VBox/vmm/pdmdev.h> +#include <VBox/vmm/pdmqueue.h> +#include <VBox/vmm/pdmthread.h> +#include <VBox/vmm/cfgm.h> +#include <VBox/vmm/mm.h> +#include <VBox/vmm/pdmasynccompletion.h> +#include <VBox/vmm/pdmnetshaper.h> +#include <VBox/vmm/pgm.h> +RT_C_DECLS_BEGIN + + +/** + * Callback table from the VMM shim library to the PDM test framework. + */ +typedef struct TSTDEVVMMCALLBACKS +{ + DECLR3CALLBACKMEMBER(bool, pfnCFGMR3AreValuesValid, (PCFGMNODE pNode, const char *pszzValid)); + DECLR3CALLBACKMEMBER(void, pfnCFGMR3Dump, (PCFGMNODE pRoot)); + DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMR3GetChild, (PCFGMNODE pNode, const char *pszPath)); + DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMR3GetChildFV, (PCFGMNODE pNode, const char *pszPathFormat, va_list Args)); + DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMR3GetFirstChild, (PCFGMNODE pNode)); + DECLR3CALLBACKMEMBER(int, pfnCFGMR3GetName, (PCFGMNODE pCur, char *pszName, size_t cchName)); + DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMR3GetNextChild, (PCFGMNODE pCur)); + DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMR3GetParent, (PCFGMNODE pNode)); + DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMR3GetRoot, (PVM pVM)); + DECLR3CALLBACKMEMBER(int, pfnCFGMR3InsertNode, (PCFGMNODE pNode, const char *pszName, PCFGMNODE *ppChild)); + DECLR3CALLBACKMEMBER(int, pfnCFGMR3InsertNodeFV, (PCFGMNODE pNode, PCFGMNODE *ppChild, + const char *pszNameFormat, va_list Args)); + DECLR3CALLBACKMEMBER(int, pfnCFGMR3InsertString, (PCFGMNODE pNode, const char *pszName, const char *pszString)); + DECLR3CALLBACKMEMBER(int, pfnCFGMR3QueryBytes, (PCFGMNODE pNode, const char *pszName, void *pvData, size_t cbData)); + DECLR3CALLBACKMEMBER(int, pfnCFGMR3QueryInteger, (PCFGMNODE pNode, const char *pszName, uint64_t *pu64)); + DECLR3CALLBACKMEMBER(int, pfnCFGMR3QuerySize, (PCFGMNODE pNode, const char *pszName, size_t *pcb)); + DECLR3CALLBACKMEMBER(int, pfnCFGMR3QueryString, (PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString)); + DECLR3CALLBACKMEMBER(int, pfnCFGMR3QueryStringAlloc, (PCFGMNODE pNode, const char *pszName, char **ppszString)); + DECLR3CALLBACKMEMBER(int, pfnCFGMR3QueryStringAllocDef, (PCFGMNODE pNode, const char *pszName, char **ppszString, const char *pszDef)); + DECLR3CALLBACKMEMBER(void, pfnCFGMR3RemoveNode, (PCFGMNODE pNode)); + DECLR3CALLBACKMEMBER(int, pfnCFGMR3ValidateConfig, (PCFGMNODE pNode, const char *pszNode, + const char *pszValidValues, const char *pszValidNodes, + const char *pszWho, uint32_t uInstance)); + + DECLR3CALLBACKMEMBER(int, pfnIOMIOPortWrite, (PVM pVM, PVMCPU pVCpu, RTIOPORT Port, uint32_t u32Value, size_t cbValue)); + DECLR3CALLBACKMEMBER(int, pfnIOMMMIOMapMMIO2Page, (PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysRemapped, uint64_t fPageFlags)); + DECLR3CALLBACKMEMBER(int, pfnIOMMMIOResetRegion, (PVM pVM, RTGCPHYS GCPhys)); + DECLR3CALLBACKMEMBER(int, pfnMMHyperAlloc, (PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv)); + DECLR3CALLBACKMEMBER(int, pfnMMHyperFree, (PVM pVM, void *pv)); + DECLR3CALLBACKMEMBER(RTR0PTR, pfnMMHyperR3ToR0, (PVM pVM, RTR3PTR R3Ptr)); + DECLR3CALLBACKMEMBER(RTRCPTR, pfnMMHyperR3ToRC, (PVM pVM, RTR3PTR R3Ptr)); + DECLR3CALLBACKMEMBER(void, pfnMMR3HeapFree, (void *pv)); + DECLR3CALLBACKMEMBER(int, pfnMMR3HyperAllocOnceNoRel, (PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv)); + DECLR3CALLBACKMEMBER(uint64_t, pfnMMR3PhysGetRamSize, (PVM pVM)); + DECLR3CALLBACKMEMBER(uint64_t, pfnMMR3PhysGetRamSizeAbove4GB, (PVM pVM)); + DECLR3CALLBACKMEMBER(uint32_t, pfnMMR3PhysGetRamSizeBelow4GB, (PVM pVM)); + DECLR3CALLBACKMEMBER(int, pfnPDMCritSectEnterDebug, (PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL)); + DECLR3CALLBACKMEMBER(bool, pfnPDMCritSectIsInitialized, (PCPDMCRITSECT pCritSect)); + DECLR3CALLBACKMEMBER(bool, pfnPDMCritSectIsOwner, (PCPDMCRITSECT pCritSect)); + DECLR3CALLBACKMEMBER(int, pfnPDMCritSectLeave, (PPDMCRITSECT pCritSect)); + DECLR3CALLBACKMEMBER(int, pfnPDMCritSectTryEnterDebug, (PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL)); + DECLR3CALLBACKMEMBER(int, pfnPDMHCCritSectScheduleExitEvent, (PPDMCRITSECT pCritSect, SUPSEMEVENT hEventToSignal)); + DECLR3CALLBACKMEMBER(bool, pfnPDMNsAllocateBandwidth, (PPDMNSFILTER pFilter, size_t cbTransfer)); + DECLR3CALLBACKMEMBER(PPDMQUEUEITEMCORE, pfnPDMQueueAlloc, (PPDMQUEUE pQueue)); + DECLR3CALLBACKMEMBER(bool, pfnPDMQueueFlushIfNecessary, (PPDMQUEUE pQueue)); + DECLR3CALLBACKMEMBER(void, pfnPDMQueueInsert, (PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem)); + DECLR3CALLBACKMEMBER(R0PTRTYPE(PPDMQUEUE), pfnPDMQueueR0Ptr, (PPDMQUEUE pQueue)); + DECLR3CALLBACKMEMBER(RCPTRTYPE(PPDMQUEUE), pfnPDMQueueRCPtr, (PPDMQUEUE pQueue)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3AsyncCompletionEpClose, (PPDMASYNCCOMPLETIONENDPOINT pEndpoint)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3AsyncCompletionEpCreateForFile, (PPPDMASYNCCOMPLETIONENDPOINT ppEndpoint, + const char *pszFilename, uint32_t fFlags, + PPDMASYNCCOMPLETIONTEMPLATE pTemplate)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3AsyncCompletionEpFlush, (PPDMASYNCCOMPLETIONENDPOINT pEndpoint, void *pvUser, + PPPDMASYNCCOMPLETIONTASK ppTask)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3AsyncCompletionEpGetSize, (PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint64_t *pcbSize)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3AsyncCompletionEpRead, (PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, + PCRTSGSEG paSegments, unsigned cSegments, + size_t cbRead, void *pvUser, + PPPDMASYNCCOMPLETIONTASK ppTask)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3AsyncCompletionEpSetBwMgr, (PPDMASYNCCOMPLETIONENDPOINT pEndpoint, const char *pszBwMgr)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3AsyncCompletionEpSetSize, (PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint64_t cbSize)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3AsyncCompletionEpWrite, (PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off, + PCRTSGSEG paSegments, unsigned cSegments, + size_t cbWrite, void *pvUser, + PPPDMASYNCCOMPLETIONTASK ppTask)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3AsyncCompletionTemplateDestroy, (PPDMASYNCCOMPLETIONTEMPLATE pTemplate)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3BlkCacheClear, (PPDMBLKCACHE pBlkCache)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3BlkCacheDiscard, (PPDMBLKCACHE pBlkCache, PCRTRANGE paRanges, + unsigned cRanges, void *pvUser)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3BlkCacheFlush, (PPDMBLKCACHE pBlkCache, void *pvUser)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3BlkCacheIoXferComplete, (PPDMBLKCACHE pBlkCache, PPDMBLKCACHEIOXFER hIoXfer, int rcIoXfer)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3BlkCacheRead, (PPDMBLKCACHE pBlkCache, uint64_t off, PCRTSGBUF pSgBuf, size_t cbRead, void *pvUser)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3BlkCacheRelease, (PPDMBLKCACHE pBlkCache)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3BlkCacheResume, (PPDMBLKCACHE pBlkCache)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3BlkCacheSuspend, (PPDMBLKCACHE pBlkCache)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3BlkCacheWrite, (PPDMBLKCACHE pBlkCache, uint64_t off, PCRTSGBUF pSgBuf, size_t cbWrite, void *pvUser)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3CritSectDelete, (PPDMCRITSECT pCritSect)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3QueryLun, (PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3ThreadDestroy, (PPDMTHREAD pThread, int *pRcThread)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3ThreadResume, (PPDMTHREAD pThread)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3ThreadSleep, (PPDMTHREAD pThread, RTMSINTERVAL cMillies)); + DECLR3CALLBACKMEMBER(int, pfnPDMR3ThreadSuspend, (PPDMTHREAD pThread)); + DECLR3CALLBACKMEMBER(uint64_t, pfnTMCpuTicksPerSecond, (PVM pVM)); + DECLR3CALLBACKMEMBER(int, pfnTMR3TimerDestroy, (PTMTIMER pTimer)); + DECLR3CALLBACKMEMBER(int, pfnTMR3TimerLoad, (PTMTIMERR3 pTimer, PSSMHANDLE pSSM)); + DECLR3CALLBACKMEMBER(int, pfnTMR3TimerSave, (PTMTIMERR3 pTimer, PSSMHANDLE pSSM)); + DECLR3CALLBACKMEMBER(int, pfnTMR3TimerSetCritSect, (PTMTIMERR3 pTimer, PPDMCRITSECT pCritSect)); + DECLR3CALLBACKMEMBER(uint64_t, pfnTMTimerFromMilli, (PTMTIMER pTimer, uint64_t cMilliSecs)); + DECLR3CALLBACKMEMBER(uint64_t, pfnTMTimerFromNano, (PTMTIMER pTimer, uint64_t cNanoSecs)); + DECLR3CALLBACKMEMBER(uint64_t, pfnTMTimerGet, (PTMTIMER pTimer)); + DECLR3CALLBACKMEMBER(uint64_t, pfnTMTimerGetFreq, (PTMTIMER pTimer)); + DECLR3CALLBACKMEMBER(uint64_t, pfnTMTimerGetNano, (PTMTIMER pTimer)); + DECLR3CALLBACKMEMBER(bool, pfnTMTimerIsActive, (PTMTIMER pTimer)); + DECLR3CALLBACKMEMBER(bool, pfnTMTimerIsLockOwner, (PTMTIMER pTimer)); + DECLR3CALLBACKMEMBER(int, pfnTMTimerLock, (PTMTIMER pTimer, int rcBusy)); + DECLR3CALLBACKMEMBER(PTMTIMERR0, pfnTMTimerR0Ptr, (PTMTIMER pTimer)); + DECLR3CALLBACKMEMBER(PTMTIMERRC, pfnTMTimerRCPtr, (PTMTIMER pTimer)); + DECLR3CALLBACKMEMBER(int, pfnTMTimerSet, (PTMTIMER pTimer, uint64_t u64Expire)); + DECLR3CALLBACKMEMBER(int, pfnTMTimerSetFrequencyHint, (PTMTIMER pTimer, uint32_t uHz)); + DECLR3CALLBACKMEMBER(int, pfnTMTimerSetMicro, (PTMTIMER pTimer, uint64_t cMicrosToNext)); + DECLR3CALLBACKMEMBER(int, pfnTMTimerSetMillies, (PTMTIMER pTimer, uint32_t cMilliesToNext)); + DECLR3CALLBACKMEMBER(int, pfnTMTimerSetNano, (PTMTIMER pTimer, uint64_t cNanosToNext)); + DECLR3CALLBACKMEMBER(int, pfnTMTimerStop, (PTMTIMER pTimer)); + DECLR3CALLBACKMEMBER(void, pfnTMTimerUnlock, (PTMTIMER pTimer)); + DECLR3CALLBACKMEMBER(PVMCPU, pfnVMMGetCpu, (PVM pVM)); + DECLR3CALLBACKMEMBER(VMCPUID, pfnVMMGetCpuId, (PVM pVM)); + DECLR3CALLBACKMEMBER(int, pfnVMMR3DeregisterPatchMemory, (PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem)); + DECLR3CALLBACKMEMBER(int, pfnVMMR3RegisterPatchMemory, (PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem)); + DECLR3CALLBACKMEMBER(RTNATIVETHREAD, pfnVMR3GetVMCPUNativeThread, (PVM pVM)); + DECLR3CALLBACKMEMBER(int, pfnVMR3NotifyCpuDeviceReady, (PVM pVM, VMCPUID idCpu)); + DECLR3CALLBACKMEMBER(int, pfnVMR3ReqCallNoWait, (PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)); + DECLR3CALLBACKMEMBER(int, pfnVMR3ReqCallVoidNoWait, (PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)); + DECLR3CALLBACKMEMBER(int, pfnVMR3ReqPriorityCallWait, (PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)); + DECLR3CALLBACKMEMBER(int, pfnVMR3WaitForDeviceReady, (PVM pVM, VMCPUID idCpu)); +} TSTDEVVMMCALLBACKS; + + +extern const PDMDEVHLPR3 g_tstDevPdmDevHlpR3; +extern const TSTDEVVMMCALLBACKS g_tstDevVmmCallbacks; + +RT_C_DECLS_END + +#endif /* !VBOX_INCLUDED_SRC_testcase_tstDeviceVMMInternal_h */ + diff --git a/src/VBox/Devices/testcase/tstDeviceVMMStubs.cpp b/src/VBox/Devices/testcase/tstDeviceVMMStubs.cpp new file mode 100644 index 00000000..3ac54bd5 --- /dev/null +++ b/src/VBox/Devices/testcase/tstDeviceVMMStubs.cpp @@ -0,0 +1,991 @@ +/* $Id: tstDeviceVMMStubs.cpp $ */ +/** @file + * tstDevice - Test framework for PDM devices/drivers, shim library exporting methods + * originally for VBoxVMM for intercepting (we don't want to use the PDM module + * to use the originals from VBoxVMM). + */ + +/* + * Copyright (C) 2017-2019 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. + */ +/* Methods imported from VBoxVMM by VBoxDD are extracted with: + * objdump -T VBoxDD.so | grep "UND" | awk -F ' ' '{print $5}' | grep -E "^TM|^PGM|^PDM|^CFGM|^IOM|^MM|^VM|^PDM|^SUP" | sort + */ + + +/********************************************************************************************************************************* +* Header Files * +*********************************************************************************************************************************/ +#define LOG_GROUP LOG_GROUP_DEFAULT /** @todo */ +#include <iprt/assert.h> +#include <iprt/mem.h> + +#include <VBox/err.h> +#include <VBox/cdefs.h> + +#include "tstDeviceVMMInternal.h" + + +/********************************************************************************************************************************* +* Defined Constants And Macros * +*********************************************************************************************************************************/ + + +/********************************************************************************************************************************* +* Structures and Typedefs * +*********************************************************************************************************************************/ + + +/********************************************************************************************************************************* +* Global Variables * +*********************************************************************************************************************************/ + + +/********************************************************************************************************************************* +* Internal Functions * +*********************************************************************************************************************************/ + + +/** + * @copydoc CFGMR3AreValuesValid + */ +VMMR3DECL(bool) CFGMR3AreValuesValid(PCFGMNODE pNode, const char *pszzValid) +{ + return pNode->pVmmCallbacks->pfnCFGMR3AreValuesValid(pNode, pszzValid); +} + + +/** + * @copydoc CFGMR3Dump + */ +VMMR3DECL(void) CFGMR3Dump(PCFGMNODE pRoot) +{ + pRoot->pVmmCallbacks->pfnCFGMR3Dump(pRoot); +} + + +/** + * @copydoc CFGMR3GetChild + */ +VMMR3DECL(PCFGMNODE) CFGMR3GetChild(PCFGMNODE pNode, const char *pszPath) +{ + return pNode->pVmmCallbacks->pfnCFGMR3GetChild(pNode, pszPath); +} + + +/** + * @copydoc CFGMR3GetChildF + */ +VMMR3DECL(PCFGMNODE) CFGMR3GetChildF(PCFGMNODE pNode, const char *pszPathFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3) +{ + va_list Args; + va_start(Args, pszPathFormat); + PCFGMNODE pChild = pNode->pVmmCallbacks->pfnCFGMR3GetChildFV(pNode, pszPathFormat, Args); + va_end(Args); + + return pChild; +} + + +/** + * @copydoc CFGMR3GetFirstChild + */ +VMMR3DECL(PCFGMNODE) CFGMR3GetFirstChild(PCFGMNODE pNode) +{ + return pNode->pVmmCallbacks->pfnCFGMR3GetFirstChild(pNode); +} + + +/** + * @copydoc CFGMR3GetName + */ +VMMR3DECL(int) CFGMR3GetName(PCFGMNODE pCur, char *pszName, size_t cchName) +{ + return pCur->pVmmCallbacks->pfnCFGMR3GetName(pCur, pszName, cchName); +} + + +/** + * @copydoc CFGMR3GetFirstChild + */ +VMMR3DECL(PCFGMNODE) CFGMR3GetNextChild(PCFGMNODE pNode) +{ + return pNode->pVmmCallbacks->pfnCFGMR3GetNextChild(pNode); +} + + +/** + * @copydoc CFGMR3GetParent + */ +VMMR3DECL(PCFGMNODE) CFGMR3GetParent(PCFGMNODE pNode) +{ + return pNode->pVmmCallbacks->pfnCFGMR3GetParent(pNode); +} + + +/** + * @copydoc CFGMR3GetRoot + */ +VMMR3DECL(PCFGMNODE) CFGMR3GetRoot(PVM pVM) +{ + return pVM->vm.s.pVmmCallbacks->pfnCFGMR3GetRoot(pVM); +} + + +/** + * @copydoc CFGMR3InsertNode + */ +VMMR3DECL(int) CFGMR3InsertNode(PCFGMNODE pNode, const char *pszName, PCFGMNODE *ppChild) +{ + return pNode->pVmmCallbacks->pfnCFGMR3InsertNode(pNode, pszName, ppChild); +} + + +/** + * @copydoc CFGMR3InsertNodeF + */ +VMMR3DECL(int) CFGMR3InsertNodeF(PCFGMNODE pNode, PCFGMNODE *ppChild, + const char *pszNameFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4) +{ + va_list Args; + va_start(Args, pszNameFormat); + int rc = pNode->pVmmCallbacks->pfnCFGMR3InsertNodeFV(pNode, ppChild, pszNameFormat, Args); + va_end(Args); + + return rc; +} + + +/** + * @copydoc CFGMR3InsertString + */ +VMMR3DECL(int) CFGMR3InsertString(PCFGMNODE pNode, const char *pszName, const char *pszString) +{ + return pNode->pVmmCallbacks->pfnCFGMR3InsertString(pNode, pszName, pszString); +} + + +/** + * @copydoc CFGMR3QueryBool + */ +VMMR3DECL(int) CFGMR3QueryBool(PCFGMNODE pNode, const char *pszName, bool *pf) +{ + uint64_t u64; + int rc = CFGMR3QueryInteger(pNode, pszName, &u64); + if (RT_SUCCESS(rc)) + *pf = u64 ? true : false; + return rc; +} + + +/** + * @copydoc CFGMR3QueryBoolDef + */ +VMMR3DECL(int) CFGMR3QueryBoolDef(PCFGMNODE pNode, const char *pszName, bool *pf, bool fDef) +{ + uint64_t u64; + int rc = CFGMR3QueryIntegerDef(pNode, pszName, &u64, fDef); + *pf = u64 ? true : false; + return rc; +} + + +/** + * @copydoc CFGMR3QueryBytes + */ +VMMR3DECL(int) CFGMR3QueryBytes(PCFGMNODE pNode, const char *pszName, void *pvData, size_t cbData) +{ + return pNode->pVmmCallbacks->pfnCFGMR3QueryBytes(pNode, pszName, pvData, cbData); +} + + +/** + * @copydoc CFGMR3QueryInteger + */ +VMMR3DECL(int) CFGMR3QueryInteger(PCFGMNODE pNode, const char *pszName, uint64_t *pu64) +{ + return pNode->pVmmCallbacks->pfnCFGMR3QueryInteger(pNode, pszName, pu64); +} + + +/** + * @copydoc CFGMR3QueryIntegerDef + */ +VMMR3DECL(int) CFGMR3QueryIntegerDef(PCFGMNODE pNode, const char *pszName, uint64_t *pu64, uint64_t u64Def) +{ + int rc = CFGMR3QueryInteger(pNode, pszName, pu64); + if (RT_FAILURE(rc)) + { + *pu64 = u64Def; + if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT) + rc = VINF_SUCCESS; + } + + return rc; +} + + +/** + * @copydoc CFGMR3QueryPortDef + */ +VMMR3DECL(int) CFGMR3QueryPortDef(PCFGMNODE pNode, const char *pszName, PRTIOPORT pPort, RTIOPORT PortDef) +{ + AssertCompileSize(RTIOPORT, 2); + return CFGMR3QueryU16Def(pNode, pszName, pPort, PortDef); +} + + +/** + * @copydoc CFGMR3QueryPtr + */ +VMMR3DECL(int) CFGMR3QueryPtr(PCFGMNODE pNode, const char *pszName, void **ppv) +{ + uint64_t u64; + int rc = CFGMR3QueryInteger(pNode, pszName, &u64); + if (RT_SUCCESS(rc)) + { + uintptr_t u = (uintptr_t)u64; + if (u64 == u) + *ppv = (void *)u; + else + rc = VERR_CFGM_INTEGER_TOO_BIG; + } + return rc; +} + + +/** + * @copydoc CFGMR3QueryS32 + */ +VMMR3DECL(int) CFGMR3QueryS32(PCFGMNODE pNode, const char *pszName, int32_t *pi32) +{ + uint64_t u64; + int rc = CFGMR3QueryInteger(pNode, pszName, &u64); + if (RT_SUCCESS(rc)) + { + if ( !(u64 & UINT64_C(0xffffffff80000000)) + || (u64 & UINT64_C(0xffffffff80000000)) == UINT64_C(0xffffffff80000000)) + *pi32 = (int32_t)u64; + else + rc = VERR_CFGM_INTEGER_TOO_BIG; + } + return rc; +} + + +/** + * @copydoc CFGMR3QueryS32Def + */ +VMMR3DECL(int) CFGMR3QueryS32Def(PCFGMNODE pNode, const char *pszName, int32_t *pi32, int32_t i32Def) +{ + uint64_t u64; + int rc = CFGMR3QueryIntegerDef(pNode, pszName, &u64, i32Def); + if (RT_SUCCESS(rc)) + { + if ( !(u64 & UINT64_C(0xffffffff80000000)) + || (u64 & UINT64_C(0xffffffff80000000)) == UINT64_C(0xffffffff80000000)) + *pi32 = (int32_t)u64; + else + rc = VERR_CFGM_INTEGER_TOO_BIG; + } + if (RT_FAILURE(rc)) + *pi32 = i32Def; + return rc; +} + + +/** + * @copydoc CFGMR3QuerySIntDef + */ +VMMR3DECL(int) CFGMR3QuerySIntDef(PCFGMNODE pNode, const char *pszName, signed int *pi, signed int iDef) +{ + AssertCompileSize(signed int, 4); + return CFGMR3QueryS32Def(pNode, pszName, (int32_t *)pi, iDef); +} + + +/** + * @copydoc CFGMR3QuerySize + */ +VMMDECL(int) CFGMR3QuerySize(PCFGMNODE pNode, const char *pszName, size_t *pcb) +{ + return pNode->pVmmCallbacks->pfnCFGMR3QuerySize(pNode, pszName, pcb); +} + + +/** + * @copydoc CFGMR3QueryString + */ +VMMR3DECL(int) CFGMR3QueryString(PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString) +{ + return pNode->pVmmCallbacks->pfnCFGMR3QueryString(pNode, pszName, pszString, cchString); +} + + +/** + * @copydoc CFGMR3QueryStringDef + */ +VMMR3DECL(int) CFGMR3QueryStringDef(PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString, const char *pszDef) +{ + int rc = CFGMR3QueryString(pNode, pszName, pszString, cchString); + if (RT_FAILURE(rc) && rc != VERR_CFGM_NOT_ENOUGH_SPACE) + { + size_t cchDef = strlen(pszDef); + if (cchString > cchDef) + { + memcpy(pszString, pszDef, cchDef); + memset(pszString + cchDef, 0, cchString - cchDef); + if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT) + rc = VINF_SUCCESS; + } + else if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT) + rc = VERR_CFGM_NOT_ENOUGH_SPACE; + } + + return rc; +} + + +/** + * @copydoc CFGMR3QueryStringAlloc + */ +VMMR3DECL(int) CFGMR3QueryStringAlloc(PCFGMNODE pNode, const char *pszName, char **ppszString) +{ +#if 0 + size_t cbString; + int rc = CFGMR3QuerySize(pNode, pszName, &cbString); + if (RT_SUCCESS(rc)) + { + char *pszString = cfgmR3StrAlloc(pNode->pVM, MM_TAG_CFGM_USER, cbString); + if (pszString) + { + rc = CFGMR3QueryString(pNode, pszName, pszString, cbString); + if (RT_SUCCESS(rc)) + *ppszString = pszString; + else + cfgmR3StrFree(pNode->pVM, pszString); + } + else + rc = VERR_NO_MEMORY; + } + return rc; +#endif + RT_NOREF(pNode, pszName, ppszString); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +/** + * @copydoc CFGMR3QueryStringAllocDef + */ +VMMR3DECL(int) CFGMR3QueryStringAllocDef(PCFGMNODE pNode, const char *pszName, char **ppszString, const char *pszDef) +{ + RT_NOREF(pNode, pszName, ppszString, pszDef); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +/** + * @copydoc CFGMR3QueryU16 + */ +VMMR3DECL(int) CFGMR3QueryU16(PCFGMNODE pNode, const char *pszName, uint16_t *pu16) +{ + uint64_t u64; + int rc = CFGMR3QueryInteger(pNode, pszName, &u64); + if (RT_SUCCESS(rc)) + { + if (!(u64 & UINT64_C(0xffffffffffff0000))) + *pu16 = (int16_t)u64; + else + rc = VERR_CFGM_INTEGER_TOO_BIG; + } + return rc; +} + + +/** + * @copydoc CFGMR3QueryU16Def + */ +VMMR3DECL(int) CFGMR3QueryU16Def(PCFGMNODE pNode, const char *pszName, uint16_t *pu16, uint16_t u16Def) +{ + uint64_t u64; + int rc = CFGMR3QueryIntegerDef(pNode, pszName, &u64, u16Def); + if (RT_SUCCESS(rc)) + { + if (!(u64 & UINT64_C(0xffffffffffff0000))) + *pu16 = (int16_t)u64; + else + rc = VERR_CFGM_INTEGER_TOO_BIG; + } + if (RT_FAILURE(rc)) + *pu16 = u16Def; + return rc; +} + + +/** + * @copydoc CFGMR3QueryU32 + */ +VMMR3DECL(int) CFGMR3QueryU32(PCFGMNODE pNode, const char *pszName, uint32_t *pu32) +{ + uint64_t u64; + int rc = CFGMR3QueryInteger(pNode, pszName, &u64); + if (RT_SUCCESS(rc)) + { + if (!(u64 & UINT64_C(0xffffffff00000000))) + *pu32 = (uint32_t)u64; + else + rc = VERR_CFGM_INTEGER_TOO_BIG; + } + return rc; +} + + +/** + * @copydoc CFGMR3QueryU32Def + */ +VMMR3DECL(int) CFGMR3QueryU32Def(PCFGMNODE pNode, const char *pszName, uint32_t *pu32, uint32_t u32Def) +{ + uint64_t u64; + int rc = CFGMR3QueryIntegerDef(pNode, pszName, &u64, u32Def); + if (RT_SUCCESS(rc)) + { + if (!(u64 & UINT64_C(0xffffffff00000000))) + *pu32 = (uint32_t)u64; + else + rc = VERR_CFGM_INTEGER_TOO_BIG; + } + if (RT_FAILURE(rc)) + *pu32 = u32Def; + return rc; +} + + +/** + * @copydoc CFGMR3QueryU64 + */ +VMMR3DECL(int) CFGMR3QueryU64(PCFGMNODE pNode, const char *pszName, uint64_t *pu64) +{ + return CFGMR3QueryInteger(pNode, pszName, pu64); +} + + +/** + * @copydoc CFGMR3QueryU64Def + */ +VMMR3DECL(int) CFGMR3QueryU64Def(PCFGMNODE pNode, const char *pszName, uint64_t *pu64, uint64_t u64Def) +{ + return CFGMR3QueryIntegerDef(pNode, pszName, pu64, u64Def); +} + + +/** + * @copydoc CFGMR3QueryU8 + */ +VMMR3DECL(int) CFGMR3QueryU8(PCFGMNODE pNode, const char *pszName, uint8_t *pu8) +{ + uint64_t u64; + int rc = CFGMR3QueryInteger(pNode, pszName, &u64); + if (RT_SUCCESS(rc)) + { + if (!(u64 & UINT64_C(0xffffffffffffff00))) + *pu8 = (uint8_t)u64; + else + rc = VERR_CFGM_INTEGER_TOO_BIG; + } + return rc; +} + + +/** + * @copydoc CFGMR3QueryU8Def + */ +VMMR3DECL(int) CFGMR3QueryU8Def(PCFGMNODE pNode, const char *pszName, uint8_t *pu8, uint8_t u8Def) +{ + uint64_t u64; + int rc = CFGMR3QueryIntegerDef(pNode, pszName, &u64, u8Def); + if (RT_SUCCESS(rc)) + { + if (!(u64 & UINT64_C(0xffffffffffffff00))) + *pu8 = (uint8_t)u64; + else + rc = VERR_CFGM_INTEGER_TOO_BIG; + } + if (RT_FAILURE(rc)) + *pu8 = u8Def; + return rc; +} + + +/** + * @copydoc CFGMR3RemoveNode + */ +VMMR3DECL(void) CFGMR3RemoveNode(PCFGMNODE pNode) +{ + pNode->pVmmCallbacks->pfnCFGMR3RemoveNode(pNode); +} + + +/** + * @copydoc CFGMR3ValidateConfig + */ +VMMR3DECL(int) CFGMR3ValidateConfig(PCFGMNODE pNode, const char *pszNode, + const char *pszValidValues, const char *pszValidNodes, + const char *pszWho, uint32_t uInstance) +{ + return pNode->pVmmCallbacks->pfnCFGMR3ValidateConfig(pNode, pszNode, pszValidValues, pszValidNodes, pszWho, uInstance); +} + + +/** + * @copydoc IOMIOPortWrite + */ +VMMDECL(VBOXSTRICTRC) IOMIOPortWrite(PVM pVM, PVMCPU pVCpu, RTIOPORT Port, uint32_t u32Value, size_t cbValue) +{ + return pVM->vm.s.pVmmCallbacks->pfnIOMIOPortWrite(pVM, pVCpu, Port, u32Value, cbValue); +} + + +/** + * @copydoc IOMMMIOMapMMIO2Page + */ +VMMDECL(int) IOMMMIOMapMMIO2Page(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysRemapped, uint64_t fPageFlags) +{ + return pVM->vm.s.pVmmCallbacks->pfnIOMMMIOMapMMIO2Page(pVM, GCPhys, GCPhysRemapped, fPageFlags); +} + + +/** + * @copydoc IOMMMIOResetRegion + */ +VMMDECL(int) IOMMMIOResetRegion(PVM pVM, RTGCPHYS GCPhys) +{ + return pVM->vm.s.pVmmCallbacks->pfnIOMMMIOResetRegion(pVM, GCPhys); +} + + +/** + * @copydoc MMHyperAlloc + */ +VMMDECL(int) MMHyperAlloc(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv) +{ + return pVM->vm.s.pVmmCallbacks->pfnMMHyperAlloc(pVM, cb, uAlignment, enmTag, ppv); +} + + +/** + * @copydoc MMHyperFree + */ +VMMDECL(int) MMHyperFree(PVM pVM, void *pv) +{ + return pVM->vm.s.pVmmCallbacks->pfnMMHyperFree(pVM, pv); +} + + +/** + * @copydoc MMHyperR3ToR0 + */ +VMMDECL(RTR0PTR) MMHyperR3ToR0(PVM pVM, RTR3PTR R3Ptr) +{ + return pVM->vm.s.pVmmCallbacks->pfnMMHyperR3ToR0(pVM, R3Ptr); +} + + +/** + * @copydoc MMHyperR3ToRC + */ +VMMDECL(RTRCPTR) MMHyperR3ToRC(PVM pVM, RTR3PTR R3Ptr) +{ + return pVM->vm.s.pVmmCallbacks->pfnMMHyperR3ToRC(pVM, R3Ptr); +} + + +/** + * @copydoc MMR3HeapFree + */ +VMMR3DECL(void) MMR3HeapFree(void *pv) +{ + PTSTDEVMMHEAPALLOC pHeapAlloc = (PTSTDEVMMHEAPALLOC)((uint8_t *)pv - RT_UOFFSETOF(TSTDEVMMHEAPALLOC, abAlloc[0])); + pHeapAlloc->pVmmCallbacks->pfnMMR3HeapFree(pv); +} + + +/** + * @copydoc MMR3HyperAllocOnceNoRel + */ +VMMR3DECL(int) MMR3HyperAllocOnceNoRel(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv) +{ + return pVM->vm.s.pVmmCallbacks->pfnMMR3HyperAllocOnceNoRel(pVM, cb, uAlignment, enmTag, ppv); +} + + +/** + * @copydoc MMR3PhysGetRamSize + */ +VMMR3DECL(uint64_t) MMR3PhysGetRamSize(PVM pVM) +{ + return pVM->vm.s.pVmmCallbacks->pfnMMR3PhysGetRamSize(pVM); +} + + +/** + * @copydoc MMR3PhysGetRamSizeBelow4GB + */ +VMMR3DECL(uint32_t) MMR3PhysGetRamSizeBelow4GB(PVM pVM) +{ + return pVM->vm.s.pVmmCallbacks->pfnMMR3PhysGetRamSizeBelow4GB(pVM); +} + + +/** + * @copydoc MMR3PhysGetRamSizeAbove4GB + */ +VMMR3DECL(uint64_t) MMR3PhysGetRamSizeAbove4GB(PVM pVM) +{ + return pVM->vm.s.pVmmCallbacks->pfnMMR3PhysGetRamSizeAbove4GB(pVM); +} + + +/** + * @copydoc PDMCritSectEnterDebug + */ +VMMDECL(int) PDMCritSectEnterDebug(PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL) +{ + return pCritSect->s.pVmmCallbacks->pfnPDMCritSectEnterDebug(pCritSect, rcBusy, uId, RT_SRC_POS_ARGS); +} + + +/** + * @copydoc PDMCritSectIsInitialized + */ +VMMDECL(bool) PDMCritSectIsInitialized(PCPDMCRITSECT pCritSect) +{ + return pCritSect->s.pVmmCallbacks->pfnPDMCritSectIsInitialized(pCritSect); +} + + +/** + * @copydoc PDMCritSectIsOwner + */ +VMMDECL(bool) PDMCritSectIsOwner(PCPDMCRITSECT pCritSect) +{ + return pCritSect->s.pVmmCallbacks->pfnPDMCritSectIsOwner(pCritSect); +} + + +/** + * @copydoc PDMCritSectLeave + */ +VMMDECL(int) PDMCritSectLeave(PPDMCRITSECT pCritSect) +{ + return pCritSect->s.pVmmCallbacks->pfnPDMCritSectLeave(pCritSect); +} + + +/** + * @copydoc PDMCritSectTryEnterDebug + */ +VMMDECL(int) PDMCritSectTryEnterDebug(PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL) +{ + return pCritSect->s.pVmmCallbacks->pfnPDMCritSectTryEnterDebug(pCritSect, uId, RT_SRC_POS_ARGS); +} + + +/** + * @copydoc PDMHCCritSectScheduleExitEvent + */ +VMMDECL(int) PDMHCCritSectScheduleExitEvent(PPDMCRITSECT pCritSect, SUPSEMEVENT hEventToSignal) +{ + return pCritSect->s.pVmmCallbacks->pfnPDMHCCritSectScheduleExitEvent(pCritSect, hEventToSignal); +} + + +/** + * @copydoc PDMNsAllocateBandwidth + */ +VMMDECL(bool) PDMNsAllocateBandwidth(PPDMNSFILTER pFilter, size_t cbTransfer) +{ +#if 0 + return pFilter->pVmmCallbacks->pfnPDMNsAllocateBandwidth(pFilter, cbTransfer); +#endif + RT_NOREF(pFilter, cbTransfer); + AssertFailed(); + return false; +} + + +/** + * @copydoc PDMQueueAlloc + */ +VMMDECL(PPDMQUEUEITEMCORE) PDMQueueAlloc(PPDMQUEUE pQueue) +{ + return pQueue->pVmmCallbacks->pfnPDMQueueAlloc(pQueue); +} + + +/** + * @copydoc PDMQueueFlushIfNecessary + */ +VMMDECL(bool) PDMQueueFlushIfNecessary(PPDMQUEUE pQueue) +{ + return pQueue->pVmmCallbacks->pfnPDMQueueFlushIfNecessary(pQueue); +} + + +/** + * @copydoc PDMQueueInsert + */ +VMMDECL(void) PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem) +{ + pQueue->pVmmCallbacks->pfnPDMQueueInsert(pQueue, pItem); +} + + +/** + * @copydoc PDMQueueR0Ptr + */ +VMMDECL(R0PTRTYPE(PPDMQUEUE)) PDMQueueR0Ptr(PPDMQUEUE pQueue) +{ + return pQueue->pVmmCallbacks->pfnPDMQueueR0Ptr(pQueue); +} + + +/** + * @copydoc PDMQueueRCPtr + */ +VMMDECL(RCPTRTYPE(PPDMQUEUE)) PDMQueueRCPtr(PPDMQUEUE pQueue) +{ + return pQueue->pVmmCallbacks->pfnPDMQueueRCPtr(pQueue); +} + + +/** + * @copydoc PGMHandlerPhysicalPageTempOff + */ +VMMDECL(int) PGMHandlerPhysicalPageTempOff(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage) +{ + RT_NOREF(pVM, GCPhys, GCPhysPage); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + + +/** + * @copydoc PGMShwMakePageWritable + */ +VMMDECL(int) PGMShwMakePageWritable(PVMCPU pVCpu, RTGCPTR GCPtr, uint32_t fFlags) +{ + RT_NOREF(pVCpu, GCPtr, fFlags); + AssertFailed(); + return VERR_NOT_IMPLEMENTED; +} + +/** @todo PDMR3AsyncCompletion + BlkCache + CritSect + QueryLun + Thread. */ + +/** + * @copydoc TMCpuTicksPerSecond + */ +VMMDECL(uint64_t) TMCpuTicksPerSecond(PVM pVM) +{ + return pVM->vm.s.pVmmCallbacks->pfnTMCpuTicksPerSecond(pVM); +} + + +/** + * @copydoc TMR3TimerDestroy + */ +VMMR3DECL(int) TMR3TimerDestroy(PTMTIMER pTimer) +{ + return pTimer->pVmmCallbacks->pfnTMR3TimerDestroy(pTimer); +} + + +/** + * @copydoc TMR3TimerSave + */ +VMMR3DECL(int) TMR3TimerSave(PTMTIMERR3 pTimer, PSSMHANDLE pSSM) +{ + return pTimer->pVmmCallbacks->pfnTMR3TimerSave(pTimer, pSSM); +} + + +/** + * @copydoc TMR3TimerLoad + */ +VMMR3DECL(int) TMR3TimerLoad(PTMTIMERR3 pTimer, PSSMHANDLE pSSM) +{ + return pTimer->pVmmCallbacks->pfnTMR3TimerLoad(pTimer, pSSM); +} + + +/** + * @copydoc TMR3TimerSetCritSect + */ +VMMR3DECL(int) TMR3TimerSetCritSect(PTMTIMERR3 pTimer, PPDMCRITSECT pCritSect) +{ + return pTimer->pVmmCallbacks->pfnTMR3TimerSetCritSect(pTimer, pCritSect); +} + + +/** + * @copydoc TMTimerFromMilli + */ +VMMDECL(uint64_t) TMTimerFromMilli(PTMTIMER pTimer, uint64_t cMilliSecs) +{ + return pTimer->pVmmCallbacks->pfnTMTimerFromMilli(pTimer, cMilliSecs); +} + + +/** + * @copydoc TMTimerFromNano + */ +VMMDECL(uint64_t) TMTimerFromNano(PTMTIMER pTimer, uint64_t cNanoSecs) +{ + return pTimer->pVmmCallbacks->pfnTMTimerFromNano(pTimer, cNanoSecs); +} + + +/** + * @copydoc TMTimerGet + */ +VMMDECL(uint64_t) TMTimerGet(PTMTIMER pTimer) +{ + return pTimer->pVmmCallbacks->pfnTMTimerGet(pTimer); +} + + +/** + * @copydoc TMTimerGetFreq + */ +VMMDECL(uint64_t) TMTimerGetFreq(PTMTIMER pTimer) +{ + return pTimer->pVmmCallbacks->pfnTMTimerGetFreq(pTimer); +} + + +/** + * @copydoc TMTimerGetNano + */ +VMMDECL(uint64_t) TMTimerGetNano(PTMTIMER pTimer) +{ + return pTimer->pVmmCallbacks->pfnTMTimerGetNano(pTimer); +} + + +/** + * @copydoc TMTimerIsActive + */ +VMMDECL(bool) TMTimerIsActive(PTMTIMER pTimer) +{ + return pTimer->pVmmCallbacks->pfnTMTimerIsActive(pTimer); +} + + +/** + * @copydoc TMTimerIsLockOwner + */ +VMMDECL(bool) TMTimerIsLockOwner(PTMTIMER pTimer) +{ + return pTimer->pVmmCallbacks->pfnTMTimerIsLockOwner(pTimer); +} + + +/** + * @copydoc TMTimerLock + */ +VMMDECL(int) TMTimerLock(PTMTIMER pTimer, int rcBusy) +{ + return pTimer->pVmmCallbacks->pfnTMTimerLock(pTimer, rcBusy); +} + + +/** + * @copydoc TMTimerR0Ptr + */ +VMMDECL(PTMTIMERR0) TMTimerR0Ptr(PTMTIMER pTimer) +{ + return pTimer->pVmmCallbacks->pfnTMTimerR0Ptr(pTimer); +} + + +/** + * @copydoc TMTimerRCPtr + */ +VMMDECL(PTMTIMERRC) TMTimerRCPtr(PTMTIMER pTimer) +{ + return pTimer->pVmmCallbacks->pfnTMTimerRCPtr(pTimer); +} + + +/** + * @copydoc TMTimerSet + */ +VMMDECL(int) TMTimerSet(PTMTIMER pTimer, uint64_t u64Expire) +{ + return pTimer->pVmmCallbacks->pfnTMTimerSet(pTimer, u64Expire); +} + + +/** + * @copydoc TMTimerSetFrequencyHint + */ +VMMDECL(int) TMTimerSetFrequencyHint(PTMTIMER pTimer, uint32_t uHz) +{ + return pTimer->pVmmCallbacks->pfnTMTimerSetFrequencyHint(pTimer, uHz); +} + + +/** + * @copydoc TMTimerSetMicro + */ +VMMDECL(int) TMTimerSetMicro(PTMTIMER pTimer, uint64_t cMicrosToNext) +{ + return pTimer->pVmmCallbacks->pfnTMTimerSetMicro(pTimer, cMicrosToNext); +} + + +/** + * @copydoc TMTimerSetMillies + */ +VMMDECL(int) TMTimerSetMillies(PTMTIMER pTimer, uint32_t cMilliesToNext) +{ + return pTimer->pVmmCallbacks->pfnTMTimerSetMillies(pTimer, cMilliesToNext); +} + + +/** + * @copydoc TMTimerSetNano + */ +VMMDECL(int) TMTimerSetNano(PTMTIMER pTimer, uint64_t cNanosToNext) +{ + return pTimer->pVmmCallbacks->pfnTMTimerSetNano(pTimer, cNanosToNext); +} + + +/** + * @copydoc TMTimerStop + */ +VMMDECL(int) TMTimerStop(PTMTIMER pTimer) +{ + return pTimer->pVmmCallbacks->pfnTMTimerStop(pTimer); +} + + +/** + * @copydoc TMTimerUnlock + */ +VMMDECL(void) TMTimerUnlock(PTMTIMER pTimer) +{ + return pTimer->pVmmCallbacks->pfnTMTimerUnlock(pTimer); +} + |