VMMDev.cpp revision 0defe73e08f591e32e92dfeb3de18ee84a180d2a
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * VMMDev - Guest <-> VMM/Host communication device.
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * Copyright (C) 2006-2012 Oracle Corporation
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * available from http://www.virtualbox.org. This file is free software;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * you can redistribute it and/or modify it under the terms of the GNU
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * General Public License (GPL) as published by the Free Software
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/*******************************************************************************
f78b12e570284aa8291f4ca1add24937fd107403vboxsync* Header Files *
f78b12e570284aa8291f4ca1add24937fd107403vboxsync*******************************************************************************/
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/* Enable dev_vmm Log3 statements to get IRQ-related logging. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/*******************************************************************************
f78b12e570284aa8291f4ca1add24937fd107403vboxsync* Defined Constants And Macros *
f78b12e570284aa8291f4ca1add24937fd107403vboxsync*******************************************************************************/
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#define PCIDEV_2_VMMDEVSTATE(pPciDev) ( (VMMDevState *)(pPciDev) )
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#define VMMDEVSTATE_2_DEVINS(pVMMDevState) ( (pVMMDevState)->pDevIns )
f78b12e570284aa8291f4ca1add24937fd107403vboxsync ( RT_HIWORD((s)->guestInfo.interfaceVersion) == 1 \
f78b12e570284aa8291f4ca1add24937fd107403vboxsync && RT_LOWORD((s)->guestInfo.interfaceVersion) == 3 )
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#define VBOX_GUEST_INTERFACE_VERSION_OK(additionsVersion) \
f78b12e570284aa8291f4ca1add24937fd107403vboxsync ( RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \
f78b12e570284aa8291f4ca1add24937fd107403vboxsync && RT_LOWORD(additionsVersion) <= RT_LOWORD(VMMDEV_VERSION) )
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#define VBOX_GUEST_INTERFACE_VERSION_OLD(additionsVersion) \
f78b12e570284aa8291f4ca1add24937fd107403vboxsync ( (RT_HIWORD(additionsVersion) < RT_HIWORD(VMMDEV_VERSION) \
f78b12e570284aa8291f4ca1add24937fd107403vboxsync || ( RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \
f78b12e570284aa8291f4ca1add24937fd107403vboxsync && RT_LOWORD(additionsVersion) <= RT_LOWORD(VMMDEV_VERSION) ) )
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#define VBOX_GUEST_INTERFACE_VERSION_TOO_OLD(additionsVersion) \
f78b12e570284aa8291f4ca1add24937fd107403vboxsync ( RT_HIWORD(additionsVersion) < RT_HIWORD(VMMDEV_VERSION) )
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#define VBOX_GUEST_INTERFACE_VERSION_NEW(additionsVersion) \
f78b12e570284aa8291f4ca1add24937fd107403vboxsync ( RT_HIWORD(additionsVersion) > RT_HIWORD(VMMDEV_VERSION) \
f78b12e570284aa8291f4ca1add24937fd107403vboxsync || ( RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \
f78b12e570284aa8291f4ca1add24937fd107403vboxsync && RT_LOWORD(additionsVersion) > RT_LOWORD(VMMDEV_VERSION) ) )
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/** The saved state version. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/** The saved state version which is missing the guest facility statuses. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#define VMMDEV_SAVED_STATE_VERSION_MISSING_FACILITY_STATUSES 14
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/** The saved state version which is missing the guestInfo2 bits. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#define VMMDEV_SAVED_STATE_VERSION_MISSING_GUEST_INFO_2 13
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/** The saved state version used by VirtualBox 3.0.
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * This doesn't have the config part. */
#ifndef VBOX_DEVICE_STRUCT_TESTCASE
if (u32EventFlags)
const bool fHadEvents =
Log3(("VMMDevNotifyGuest_EMT: fHadEvents = %d, u32HostEventFlags = 0x%08X, u32GuestFilterMask = 0x%08X.\n",
if (!fHadEvents)
const bool fHadEvents =
Log(("VMMDevCtlSetGuestFilterMask: u32OrMask = 0x%08X, u32NotMask = 0x%08X, fHadEvents = %d.\n", u32OrMask, u32NotMask, fHadEvents));
if (fHadEvents)
static DECLCALLBACK(int) vmmdevBackdoorLog(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
switch (u32)
case '\r': LogIt(LOG_INSTANCE, RTLOGGRPFLAGS_LEVEL_2, LOG_GROUP_DEV_VMM_BACKDOOR, ("vmmdev: <return>\n")); break;
case '\n': LogIt(LOG_INSTANCE, RTLOGGRPFLAGS_LEVEL_2, LOG_GROUP_DEV_VMM_BACKDOOR, ("vmmdev: <newline>\n")); break;
case '\t': LogIt(LOG_INSTANCE, RTLOGGRPFLAGS_LEVEL_2, LOG_GROUP_DEV_VMM_BACKDOOR, ("vmmdev: <tab>\n")); break;
default: LogIt(LOG_INSTANCE, RTLOGGRPFLAGS_LEVEL_2, LOG_GROUP_DEV_VMM_BACKDOOR, ("vmmdev: %c (%02x)\n", u32, u32)); break;
LogRelIt(LOG_REL_INSTANCE, RTLOGGRPFLAGS_LEVEL_1, LOG_GROUP_DEV_VMM_BACKDOOR, ("Guest Log: %s\n", pThis->szMsg));
LogRelIt(LOG_REL_INSTANCE, RTLOGGRPFLAGS_LEVEL_1, LOG_GROUP_DEV_VMM_BACKDOOR, ("Guest Log: %s\n", pThis->szMsg));
return VINF_SUCCESS;
#ifdef TIMESYNC_BACKDOOR
static DECLCALLBACK(int) vmmdevTimesyncBackdoorWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
switch (u32)
return VINF_SUCCESS;
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevTimesyncBackdoorRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
int rc;
return rc;
static char const s_szValidChars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz()[]{}+-.,";
pszTag++;
int cchPrefix;
static int vmmdevReqHandler_ReportGuestInfo2(VMMDevState *pThis, VMMDevRequestHeader *pRequestHeader)
AssertMsgReturn(pRequestHeader->size == sizeof(VMMDevReportGuestInfo2), ("%u\n", pRequestHeader->size), VERR_INVALID_PARAMETER);
uint32_t uFullVersion = VBOX_FULL_VERSION_MAKE(pInfo2->additionsMajor, pInfo2->additionsMinor, pInfo2->additionsBuild);
size_t cchStart = RTStrPrintf(szTmp, sizeof(szTmp), "%u.%u.%u", pInfo2->additionsMajor, pInfo2->additionsMinor, pInfo2->additionsBuild);
AssertMsgReturn(!strncmp(pszName, szTmp, cchStart), ("%s != %s\n", pszName, szTmp), VERR_INVALID_PARAMETER);
bool fOk = false;
pszName++;
if (!pszTag2)
if (fOk)
if (!fOk)
if (!fOk)
LogRel(("ReportGuestInfo2: Ignoring unparsable version name bits: '%s' -> '%s'.\n", pszName, pszRelaxedName));
pThis->pDrv->pfnUpdateGuestInfo2(pThis->pDrv, uFullVersion, pszName, pInfo2->additionsRevision, pInfo2->additionsFeatures);
return VINF_SUCCESS;
static PVMMDEVFACILITYSTATUSENTRY
vmmdevAllocFacilityStatusEntry(VMMDevState *pThis, uint32_t uFacility, bool fFixed, PCRTTIMESPEC pTimeSpecNow)
if (cToMove)
return NULL;
if (cToMove > 0)
if (pTimeSpecNow)
static PVMMDEVFACILITYSTATUSENTRY vmmdevGetFacilityStatusEntry(VMMDevState *pThis, uint32_t uFacility)
static int vmmdevReqHandler_ReportGuestStatus(VMMDevState *pThis, VMMDevRequestHeader *pRequestHeader)
AssertMsgReturn(pRequestHeader->size == sizeof(VMMDevReportGuestStatus), ("%u\n", pRequestHeader->size), VERR_INVALID_PARAMETER);
if (!pEntry)
static int g_cLogEntries = 0;
LogRel(("VMM: Facility table is full - facility=%u status=%u.\n", pStatus->facility, pStatus->status));
return VERR_OUT_OF_RESOURCES;
pThis->pDrv->pfnUpdateGuestStatus(pThis->pDrv, pStatus->facility, pStatus->status, pStatus->flags, &Now);
return VINF_SUCCESS;
#ifdef VBOX_WITH_PAGE_SHARING
static int vmmdevReqHandler_RegisterSharedModule(PPDMDEVINS pDevIns, VMMDevSharedModuleRegistrationRequest *pReq)
AssertMsgReturn(pReq->header.size == RT_UOFFSETOF(VMMDevSharedModuleRegistrationRequest, aRegions[pReq->cRegions]),
return PGMR3SharedModuleRegister(PDMDevHlpGetVM(pDevIns), pReq->enmGuestOS, pReq->szName, pReq->szVersion,
static int vmmdevReqHandler_UnregisterSharedModule(PPDMDEVINS pDevIns, VMMDevSharedModuleUnregistrationRequest *pReq)
static int vmmdevReqHandler_CheckSharedModules(PPDMDEVINS pDevIns, VMMDevSharedModuleCheckRequest *pReq)
static int vmmdevReqHandler_GetPageSharingStatus(VMMDevState *pThis, VMMDevPageSharingStatusRequest *pReq)
return VINF_SUCCESS;
#ifdef DEBUG
return PGMR3SharedModuleGetPageState(PDMDevHlpGetVM(pDevIns), pReq->GCPtrPage, &pReq->fShared, &pReq->uPageFlags);
return VERR_NOT_IMPLEMENTED;
static DECLCALLBACK(int) vmmdevRequestHandler(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
Log(("VMMDev: guest header version (0x%08X) differs from ours (0x%08X)\n", requestHeader.version, VMMDEV_REQUEST_HEADER_VERSION));
&& requestHeader.requestType != VMMDevReq_GetHostVersion) /* Always allow the guest to query the host capabilities. */
static int cRelWarn;
cRelWarn++;
goto l_end;
static int cRelWarn;
cRelWarn++;
goto l_end;
if (!pRequestHeader)
goto l_end;
case VMMDevReq_Idle:
AssertMsgBreakStmt(pRequestHeader->size == sizeof(VMMDevReportGuestInfo), ("%u\n", pRequestHeader->size),
case VMMDevReq_WriteCoreDump:
return VERR_PATH_NOT_FOUND;
case VMMDevReq_GetMouseStatus:
case VMMDevReq_SetMouseStatus:
bool fNotify = false;
fFeatures));
fNotify = true;
if (fNotify)
AssertMsg(pRequestHeader->size == 0x10028 && pRequestHeader->version == 10000, /* don't complain about legacy!!! */
fShape = false;
if (fShape)
NULL);
case VMMDevReq_GetHostTime:
pRequestHeader->rc = VMMR3RegisterPatchMemory(PDMDevHlpGetVM(pDevIns), pPatchRequest->pPatchMem, pPatchRequest->cbPatchMem);
pRequestHeader->rc = VMMR3DeregisterPatchMemory(PDMDevHlpGetVM(pDevIns), pPatchRequest->pPatchMem, pPatchRequest->cbPatchMem);
case VMMDevReq_SetPowerStatus:
case VMMDevPowerState_Pause:
* See documentation in VMMDev.h.
* See documentation in VMMDev.h.
if (pRequest)
if (!pRequest)
displayChangeRequest->xres, displayChangeRequest->yres, displayChangeRequest->bpp, displayChangeRequest->display));
* See documentation in VMMDev.h.
if (pRequest)
if (!pRequest)
VMMDevVideoModeSupportedRequest *videoModeSupportedRequest = (VMMDevVideoModeSupportedRequest*)pRequestHeader;
VMMDevVideoModeSupportedRequest2 *videoModeSupportedRequest2 = (VMMDevVideoModeSupportedRequest2*)pRequestHeader;
VMMDevGetHeightReductionRequest *heightReductionRequest = (VMMDevGetHeightReductionRequest*)pRequestHeader;
#ifdef VBOX_WITH_HGCM
case VMMDevReq_HGCMConnect:
case VMMDevReq_HGCMDisconnect:
#ifdef VBOX_WITH_64_BITS_GUESTS
case VMMDevReq_HGCMCall32:
case VMMDevReq_HGCMCall64:
case VMMDevReq_HGCMCall:
#ifdef VBOX_WITH_64_BITS_GUESTS
bool f64Bits = false;
case VMMDevReq_HGCMCancel:
case VMMDevReq_HGCMCancel2:
Log(("VMMDevReq_VideoAccelEnable guest ring buffer size %d, should be %d!!!\n", ptr->cbRingBuffer, VBVA_RING_BUFFER_SIZE));
< sizeof(VMMDevVideoSetVisibleRegion))
|| pRequestHeader->size != sizeof(VMMDevVideoSetVisibleRegion) + ptr->cRect * sizeof(RTRECT) - sizeof(RTRECT))
Log(("VMMDev: returning VRDP status %d level %d\n", pThis->fVRDPEnabled, pThis->u32VRDPExperienceLevel));
AssertFailed();
VMMDevGetMemBalloonChangeRequest *memBalloonChangeRequest = (VMMDevGetMemBalloonChangeRequest*)pRequestHeader;
|| pRequestHeader->size != (uint32_t)RT_OFFSETOF(VMMDevChangeMemBalloon, aPhysPage[memBalloonChange->cPages]))
AssertFailed();
pRequestHeader->rc = PGMR3PhysChangeMemBalloon(PDMDevHlpGetVM(pDevIns), !!memBalloonChange->fInflate, memBalloonChange->cPages, memBalloonChange->aPhysPage);
AssertFailed();
VMMDevGetStatisticsChangeRequest *statIntervalChangeRequest = (VMMDevGetStatisticsChangeRequest*)pRequestHeader;
#ifdef DEBUG
Log(("CPU%d: Total physical memory %-4d MB\n", pGuestStats->u32CpuId, (pGuestStats->u32PhysMemTotal + (_1M/_4K)-1) / (_1M/_4K)));
Log(("CPU%d: Free physical memory %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32PhysMemAvail / (_1M/_4K)));
Log(("CPU%d: Memory balloon size %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32PhysMemBalloon / (_1M/_4K)));
Log(("CPU%d: Committed memory %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32MemCommitTotal / (_1M/_4K)));
Log(("CPU%d: Total kernel memory %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32MemKernelTotal / (_1M/_4K)));
Log(("CPU%d: Paged kernel memory %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32MemKernelPaged / (_1M/_4K)));
Log(("CPU%d: Nonpaged kernel memory %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32MemKernelNonPaged / (_1M/_4K)));
Log(("CPU%d: System cache size %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32MemSystemCache / (_1M/_4K)));
Log(("CPU%d: Page file size %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32PageFileSize / (_1M/_4K)));
case VMMDevReq_GetHostVersion:
VMMDevCpuHotPlugStatusRequest *pReqCpuHotPlugStatus = (VMMDevCpuHotPlugStatusRequest *)pRequestHeader;
#ifdef VBOX_WITH_PAGE_SHARING
pRequestHeader->rc = vmmdevReqHandler_DebugIsPageShared(pDevIns, (VMMDevPageIsSharedRequest *)pRequestHeader);
#ifdef DEBUG
case VMMDevReq_LogString:
* Get a unique session id for this VM; the id will be different after each start, reset or restore of the VM
case VMMDevReq_GetSessionId:
if (pRequestHeader)
return rcRet;
static DECLCALLBACK(int) vmmdevIORAMRegionMap(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType)
LogFlow(("vmmdevR3IORAMRegionMap: iRegion=%d GCPhysAddress=%RGp cb=%#x enmType=%d\n", iRegion, GCPhysAddress, cb, enmType));
int rc;
rc = PDMDevHlpRegisterVMMDevHeap(pPciDev->pDevIns, GCPhysAddress, pThis->pVMMDevHeapR3, VMMDEV_HEAP_SIZE);
return rc;
static DECLCALLBACK(int) vmmdevIOPortRegionMap(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType)
AssertMsg(RT_ALIGN(GCPhysAddress, 8) == GCPhysAddress, ("Expected 8 byte alignment. GCPhysAddress=%#x\n", GCPhysAddress));
return rc;
#ifdef VBOX_WITH_HGCM
return NULL;
static DECLCALLBACK(int) vmmdevQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed)
VMMDevState *pThis = (VMMDevState *)( (uintptr_t)pInterface - RT_OFFSETOF(VMMDevState, SharedFolders.ILeds) );
return VINF_SUCCESS;
return VERR_PDM_LUN_NOT_FOUND;
#define IVMMDEVPORT_2_VMMDEVSTATE(pInterface) ( (VMMDevState*)((uintptr_t)pInterface - RT_OFFSETOF(VMMDevState, IPort)) )
static DECLCALLBACK(int) vmmdevQueryAbsoluteMouse(PPDMIVMMDEVPORT pInterface, int32_t *pAbsX, int32_t *pAbsY)
if (pAbsX)
if (pAbsY)
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevSetAbsoluteMouse(PPDMIVMMDEVPORT pInterface, int32_t absX, int32_t absY)
return VINF_SUCCESS;
return VINF_SUCCESS;
if (!pfCaps)
return VERR_INVALID_PARAMETER;
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevUpdateMouseCapabilities(PPDMIVMMDEVPORT pInterface, uint32_t fCapsAdded, uint32_t fCapsRemoved)
if (fNotify)
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevRequestDisplayChange(PPDMIVMMDEVPORT pInterface, uint32_t xres, uint32_t yres,
return VERR_INVALID_PARAMETER;
fSameResolution = false;
if (!fSameResolution)
return VINF_SUCCESS;
if (!fSameMode)
return VINF_SUCCESS;
if (!fSame)
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevVRDPChange(PPDMIVMMDEVPORT pInterface, bool fVRDPEnabled, uint32_t u32VRDPExperienceLevel)
if (!fSame)
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevSetStatisticsInterval(PPDMIVMMDEVPORT pInterface, uint32_t ulStatInterval)
Log(("vmmdevSetStatisticsInterval: old=%d. new=%d\n", pThis->u32LastStatIntervalSize, ulStatInterval));
if (!fSame)
return VINF_SUCCESS;
pThis->pCredentials->Logon.fAllowInteractiveLogon = !(u32Flags & VMMDEV_SETCREDENTIALS_NOLOCALLOGON);
return rc;
if (pThis)
static DECLCALLBACK(int) vmmdevCpuHotUnplug(PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage)
return rc;
static DECLCALLBACK(int) vmmdevCpuHotPlug(PPDMIVMMDEVPORT pInterface, uint32_t idCpuCore, uint32_t idCpuPackage)
return rc;
return VINF_SSM_DONT_CALL_AGAIN;
/* The following is not strictly necessary as PGM restores MMIO2, keeping it for historical reasons. */
#ifdef VBOX_WITH_HGCM
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
int rc;
LogRel(("VMMDev: Config mismatch - fGetHostTimeDisabled: config=%RTbool saved=%RTbool\n", pThis->fGetHostTimeDisabled, f));
LogRel(("VMMDev: Config mismatch - fBackdoorLogDisabled: config=%RTbool saved=%RTbool\n", pThis->fBackdoorLogDisabled, f));
return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Config mismatch - fKeepCredentials: config=%RTbool saved=%RTbool"),
return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Config mismatch - fHeapEnabled: config=%RTbool saved=%RTbool"),
return VINF_SUCCESS;
#ifdef VBOX_WITH_HGCM
("VMMDev: Ran out of entries restoring the guest facility statuses. Saved state has %u.\n", cFacilityStatuses),
Log(("vmmdevLoadState: capabilities changed (%x), informing connector\n", pThis->mouseCapabilities));
pThis->pDrv->pfnVideoAccelEnable(pThis->pDrv, !!pThis->u32VideoAccelEnabled, &pThis->pVMMDevRAMR3->vbvaMemory);
pThis->pDrv->pfnUpdateGuestInfo2(pThis->pDrv, pThis->guestInfo2.uFullVersion, pThis->guestInfo2.szName,
return VINF_SUCCESS;
#ifdef VBOX_WITH_HGCM
return VINF_SUCCESS;
if (fVersionChanged)
while (iFacility-- > 0)
memset (&pRequest->lastReadDisplayChangeRequest, 0, sizeof (pRequest->lastReadDisplayChangeRequest));
/* This is the default, as Windows and OS/2 guests take this for granted. (Actually, neither does...) */
if (fCapsChanged)
pThis->guestCaps = VMMDEV_GUEST_SUPPORTS_GRAPHICS; /** @todo r=bird: why? I cannot see this being done at construction?*/
return VINF_SUCCESS;
int rc;
vmmdevAllocFacilityStatusEntry(pThis, VBoxGuestFacilityType_VBoxGuestDriver, true /*fFixed*/, &TimeStampNow);
vmmdevAllocFacilityStatusEntry(pThis, VBoxGuestFacilityType_VBoxService, true /*fFixed*/, &TimeStampNow);
vmmdevAllocFacilityStatusEntry(pThis, VBoxGuestFacilityType_VBoxTrayClient, true /*fFixed*/, &TimeStampNow);
vmmdevAllocFacilityStatusEntry(pThis, VBoxGuestFacilityType_Seamless, true /*fFixed*/, &TimeStampNow);
vmmdevAllocFacilityStatusEntry(pThis, VBoxGuestFacilityType_Graphics, true /*fFixed*/, &TimeStampNow);
#ifdef VBOX_WITH_HGCM
return VERR_NO_MEMORY;
#ifndef VBOX_WITHOUT_TESTING_FEATURES
rc = PDMDevHlpIOPortRegister(pDevIns, RTLOG_DEBUG_PORT, 1, NULL, vmmdevBackdoorLog, NULL, NULL, NULL, "VMMDev backdoor logging");
#ifdef TIMESYNC_BACKDOOR
rc = PDMDevHlpIOPortRegister(pDevIns, 0x505, 1, NULL, vmmdevTimesyncBackdoorWrite, vmmdevTimesyncBackdoorRead, NULL, NULL, "VMMDev timesync backdoor");
rc = PDMDevHlpMMIO2Register(pDevIns, 1 /*iRegion*/, VMMDEV_RAM_SIZE, 0 /*fFlags*/, (void **)&pThis->pVMMDevRAMR3, "VMMDev");
rc = PDMDevHlpMMIO2Register(pDevIns, 2 /*iRegion*/, VMMDEV_HEAP_SIZE, 0 /*fFlags*/, (void **)&pThis->pVMMDevHeapR3, "VMMDev Heap");
return rc;
Log(("!!WARNING!!: pThis->dev.devfn=%d (ignore if testcase or no started by Main)\n", pThis->dev.devfn));
return rc;
rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, VMMDEV_RAM_SIZE, PCI_ADDRESS_SPACE_MEM, vmmdevIORAMRegionMap);
return rc;
rc = PDMDevHlpPCIIORegionRegister(pDevIns, 2, VMMDEV_HEAP_SIZE, PCI_ADDRESS_SPACE_MEM_PREFETCH, vmmdevIORAMRegionMap);
return rc;
#ifndef VBOX_WITHOUT_TESTING_FEATURES
return rc;
AssertMsgReturn(pThis->pDrv, ("LUN #0 doesn't have a VMMDev connector interface!\n"), VERR_PDM_MISSING_INTERFACE);
#ifdef VBOX_WITH_HGCM
Log(("%s/%d: warning: no driver attached to LUN #0!\n", pDevIns->pReg->szName, pDevIns->iInstance));
return rc;
#ifdef VBOX_WITH_HGCM
PDMDevHlpSTAMRegisterF(pDevIns, &pThis->StatMemBalloonChunks, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Memory balloon size", "/Devices/VMMDev/BalloonChunks");
return rc;
PDM_DEVREG_FLAGS_HOST_BITS_DEFAULT | PDM_DEVREG_FLAGS_GUEST_BITS_DEFAULT | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0,
sizeof(VMMDevState),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,