VBoxDev.cpp revision 548ca31b6b47c36bacce49bed3339cb8075b9681
5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync * VMMDev - Guest <-> VMM/Host communication device.
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync * available from http://www.virtualbox.org. This file is free software;
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * additional information or have any questions.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync/* #define LOG_ENABLED */
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync/* Enable dev_vmm Log3 statements to get IRQ-related logging. */
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync#define PCIDEV_2_VMMDEVSTATE(pPciDev) ( (VMMDevState *)(pPciDev) )
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync#define VMMDEVSTATE_2_DEVINS(pVMMDevState) ( (pVMMDevState)->pDevIns )
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync ((RT_HIWORD ((s)->guestInfo.additionsVersion) == 1) && \
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync (RT_LOWORD ((s)->guestInfo.additionsVersion) == 3))
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync#define VBOX_GUEST_ADDITIONS_VERSION_OK(additionsVersion) \
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync (RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync && RT_LOWORD(additionsVersion) <= RT_LOWORD(VMMDEV_VERSION))
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync#define VBOX_GUEST_ADDITIONS_VERSION_OLD(additionsVersion) \
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync ((RT_HIWORD(additionsVersion) < RT_HIWORD(VMMDEV_VERSION) \
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync || ((RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync && RT_LOWORD(additionsVersion) <= RT_LOWORD(VMMDEV_VERSION))
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync#define VBOX_GUEST_ADDITIONS_VERSION_TOO_OLD(additionsVersion) \
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync (RT_HIWORD(additionsVersion) < RT_HIWORD(VMMDEV_VERSION))
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync#define VBOX_GUEST_ADDITIONS_VERSION_NEW(additionsVersion) \
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync ((RT_HIWORD(additionsVersion) > RT_HIWORD(VMMDEV_VERSION) \
418b9db49fbc652ef9c3f030fdc0f1a322403d95vboxsync || ((RT_HIWORD(additionsVersion) == RT_HIWORD(VMMDEV_VERSION) \
418b9db49fbc652ef9c3f030fdc0f1a322403d95vboxsync && RT_LOWORD(additionsVersion) > RT_LOWORD(VMMDEV_VERSION))
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync/* Whenever host wants to inform guest about something
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * an IRQ notification will be raised.
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * VMMDev PDM interface will contain the guest notification method.
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync * There is a 32 bit event mask which will be read
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * by guest on an interrupt. A non zero bit in the mask
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * means that the specific event occured and requires
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * processing on guest side.
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * After reading the event mask guest must issue a
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync * generic request AcknowlegdeEvents.
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * IRQ line is set to 1 (request) if there are unprocessed
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * events, that is the event mask is not zero.
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * After receiving an interrupt and checking event mask,
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * the guest must process events using the event specific
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * mechanism.
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * That is if mouse capabilities were changed,
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * guest will use VMMDev_GetMouseStatus generic request.
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * Event mask is only a set of flags indicating that guest
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * must proceed with a procedure.
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * Unsupported events are therefore ignored.
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * The guest additions must inform host which events they
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * want to receive, to avoid unnecessary IRQ processing.
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * By default no events are signalled to guest.
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * This seems to be fast method. It requires
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync * only one context switch for an event processing.
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsyncstatic void vmmdevSetIRQ_Legacy_EMT (VMMDevState *pVMMDevState)
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync Log(("vmmdevSetIRQ: IRQ is not generated, guest has not yet reported to us.\n"));
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync /* Filter unsupported events */
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync & pVMMDevState->pVMMDevRAMHC->V.V1_03.u32GuestEventMask;
36c508c1569b4ff2c4392b32266d2bef62064242vboxsync "pVMMDevState->u32HostEventFlags = 0x%08X, "
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync "pVMMDevState->pVMMDevRAMHC->u32GuestEventMask = 0x%08X\n",
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync pVMMDevState->pVMMDevRAMHC->V.V1_03.u32GuestEventMask));
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync /* Move event flags to VMMDev RAM */
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync pVMMDevState->pVMMDevRAMHC->V.V1_03.u32HostEvents = u32EventFlags;
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync /* Clear host flags which will be delivered to guest. */
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync Log(("vmmdevSetIRQ: pVMMDevState->u32HostEventFlags = 0x%08X\n",
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync /* Set IRQ level for pin 0 */
36c508c1569b4ff2c4392b32266d2bef62064242vboxsync /** @todo make IRQ pin configurable, at least a symbolic constant */
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync PPDMDEVINS pDevIns = VMMDEVSTATE_2_DEVINS(pVMMDevState);
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsyncstatic void vmmdevMaybeSetIRQ_EMT (VMMDevState *pVMMDevState)
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync PPDMDEVINS pDevIns = VMMDEVSTATE_2_DEVINS (pVMMDevState);
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync Log3(("vmmdevMaybeSetIRQ_EMT: u32HostEventFlags = 0x%08X, u32GuestFilterMask = 0x%08X.\n",
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync pVMMDevState->u32HostEventFlags, pVMMDevState->u32GuestFilterMask));
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync if (pVMMDevState->u32HostEventFlags & pVMMDevState->u32GuestFilterMask)
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync pVMMDevState->pVMMDevRAMHC->V.V1_04.fHaveEvents = true;
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsyncstatic void vmmdevNotifyGuest_EMT (VMMDevState *pVMMDevState, uint32_t u32EventMask)
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync Log3(("VMMDevNotifyGuest_EMT: u32EventMask = 0x%08X.\n", u32EventMask));
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync if (VBOX_GUEST_ADDITIONS_VERSION_1_03 (pVMMDevState))
81a2bceb78e8b2f05efef55789b1689b31b3acacvboxsync Log3(("VMMDevNotifyGuest_EMT: Old additions detected.\n"));
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync Log3(("VMMDevNotifyGuest_EMT: New additions detected.\n"));
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync Log(("vmmdevNotifyGuest_EMT: IRQ is not generated, guest has not yet reported to us.\n"));
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync (pVMMDevState->u32HostEventFlags & pVMMDevState->u32GuestFilterMask) != 0;
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync Log3(("VMMDevNotifyGuest_EMT: fHadEvents = %d, u32HostEventFlags = 0x%08X, u32GuestFilterMask = 0x%08X.\n",
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync fHadEvents, pVMMDevState->u32HostEventFlags, pVMMDevState->u32GuestFilterMask));
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsyncstatic void vmmdevCtlGuestFilterMask_EMT (VMMDevState *pVMMDevState,
1198fb18b50cc20479302d19c0aa7ae93f69d359vboxsync (pVMMDevState->u32HostEventFlags & pVMMDevState->u32GuestFilterMask) != 0;
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync Log(("vmmdevCtlGuestFilterMask_EMT: u32OrMask = 0x%08X, u32NotMask = 0x%08X, fHadEvents = %d.\n", u32OrMask, u32NotMask, fHadEvents));
1198fb18b50cc20479302d19c0aa7ae93f69d359vboxsync pVMMDevState->u32NewGuestFilterMask = pVMMDevState->u32GuestFilterMask;
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync pVMMDevState->u32NewGuestFilterMask &= ~u32NotMask;
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsyncvoid VMMDevCtlSetGuestFilterMask (VMMDevState *pVMMDevState,
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync PPDMDEVINS pDevIns = VMMDEVSTATE_2_DEVINS(pVMMDevState);
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync Log(("VMMDevCtlSetGuestFilterMask: u32OrMask = 0x%08X, u32NotMask = 0x%08X.\n", u32OrMask, u32NotMask));
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync vmmdevCtlGuestFilterMask_EMT (pVMMDevState, u32OrMask, u32NotMask);
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync rc = VMR3ReqCallVoid (pVM, &pReq, RT_INDEFINITE_WAIT,
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsyncvoid VMMDevNotifyGuest (VMMDevState *pVMMDevState, uint32_t u32EventMask)
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync PPDMDEVINS pDevIns = VMMDEVSTATE_2_DEVINS(pVMMDevState);
67c26773eca4a576449ffa8f289fa344fc7b8176vboxsync Log3(("VMMDevNotifyGuest: u32EventMask = 0x%08X.\n", u32EventMask));
4c5ed14a824b5df6b1d5aee5f524eea7b0d9459fvboxsync rc = VMR3ReqCallVoid (pVM, &pReq, RT_INDEFINITE_WAIT,
e0e7da0420be1398d23ffa9953686d3a43619abdvboxsync * Port I/O Handler for OUT operations.
e0e7da0420be1398d23ffa9953686d3a43619abdvboxsync * @returns VBox status code.
e0e7da0420be1398d23ffa9953686d3a43619abdvboxsync * @param pDevIns The device instance.
static DECLCALLBACK(int) vmmdevBackdoorLog(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
switch (u32)
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 DECLCALLBACK(int) vmmdevRequestHandler(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
goto end;
Log(("VMMDev: guest header version (0x%08X) differs from ours (0x%08X)\n", requestHeader.version, VMMDEV_REQUEST_HEADER_VERSION));
goto end;
goto end;
goto end;
if (!pRequestHeader)
goto end;
case VMMDevReq_Idle:
case VMMDevReq_GetMouseStatus:
case VMMDevReq_SetMouseStatus:
bool bCapsChanged = false;
bCapsChanged = true;
bCapsChanged = true;
if (bCapsChanged)
Log(("VMMDevReq_SetMouseStatus: capabilities changed (%x), informing connector\n", pThis->mouseCapabilities));
AssertMsg(pRequestHeader->size == 0x10028 && pRequestHeader->version == 10000, /* don't bitch about legacy!!! */
fShape = false;
if (fShape)
NULL);
case VMMDevReq_GetHostTime:
case VMMDevReq_SetPowerStatus:
case VMMDevPowerState_Pause:
/* Remember which resolution the client has queried, subsequent reads will return the same values. */
pThis->displayChangeRequest.xres, pThis->displayChangeRequest.yres, pThis->displayChangeRequest.bpp));
/* Remember which resolution the client has queried, subsequent reads will return the same values. */
pThis->displayChangeRequest.xres, pThis->displayChangeRequest.yres, pThis->displayChangeRequest.bpp, pThis->displayChangeRequest.display));
VMMDevVideoModeSupportedRequest *videoModeSupportedRequest = (VMMDevVideoModeSupportedRequest*)pRequestHeader;
VMMDevGetHeightReductionRequest *heightReductionRequest = (VMMDevGetHeightReductionRequest*)pRequestHeader;
#ifdef VBOX_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:
Log(("VMMDevReq_VideoAccelEnable guest ring buffer size %d, should be %d!!!\n", ptr->cbRingBuffer, VBVA_RING_BUFFER_SIZE));
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 = pThis->pDrv->pfnChangeMemoryBalloon(pThis->pDrv, !!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/pGuestStats->u32PageSize)-1)/ (_1M/pGuestStats->u32PageSize)));
Log(("CPU%d: Free physical memory %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32PhysMemAvail / (_1M/pGuestStats->u32PageSize)));
Log(("CPU%d: Memory balloon size %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32PhysMemBalloon / (_1M/pGuestStats->u32PageSize)));
Log(("CPU%d: Committed memory %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32MemCommitTotal / (_1M/pGuestStats->u32PageSize)));
Log(("CPU%d: Total kernel memory %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32MemKernelTotal / (_1M/pGuestStats->u32PageSize)));
Log(("CPU%d: Paged kernel memory %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32MemKernelPaged / (_1M/pGuestStats->u32PageSize)));
Log(("CPU%d: Nonpaged kernel memory %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32MemKernelNonPaged / (_1M/pGuestStats->u32PageSize)));
Log(("CPU%d: System cache size %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32MemSystemCache / (_1M/pGuestStats->u32PageSize)));
Log(("CPU%d: Page file size %-4d MB\n", pGuestStats->u32CpuId, pGuestStats->u32PageFileSize / (_1M/pGuestStats->u32PageSize)));
#ifdef DEBUG
case VMMDevReq_LogString:
end:
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=%VGp cb=%#x enmType=%d\n", iRegion, GCPhysAddress, cb, enmType));
int rc;
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;
static DECLCALLBACK(void *) vmmdevPortQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
switch (enmInterface)
case PDMINTERFACE_BASE:
case PDMINTERFACE_VMMDEV_PORT:
#ifdef VBOX_HGCM
case PDMINTERFACE_HGCM_PORT:
case PDMINTERFACE_LED_PORTS:
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, Port)) )
static DECLCALLBACK(int) vmmdevQueryAbsoluteMouse(PPDMIVMMDEVPORT pInterface, uint32_t *pAbsX, uint32_t *pAbsY)
if (pAbsX)
if (pAbsY)
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevSetAbsoluteMouse(PPDMIVMMDEVPORT pInterface, uint32_t absX, uint32_t absY)
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevQueryMouseCapabilities(PPDMIVMMDEVPORT pInterface, uint32_t *pCapabilities)
if (!pCapabilities)
return VERR_INVALID_PARAMETER;
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevSetMouseCapabilities(PPDMIVMMDEVPORT pInterface, uint32_t capabilities)
if (bCapsChanged)
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevRequestDisplayChange(PPDMIVMMDEVPORT pInterface, uint32_t xres, uint32_t yres, uint32_t bpp, uint32_t display)
fSameResolution = false;
Log3(("vmmdevRequestDisplayChange: same=%d. new: xres=%d, yres=%d, bpp=%d, display=%d. old: xres=%d, yres=%d, bpp=%d, display=%d.\n",
fSameResolution, xres, yres, bpp, display, pThis->lastReadDisplayChangeRequest.xres, pThis->lastReadDisplayChangeRequest.yres, pThis->lastReadDisplayChangeRequest.bpp, pThis->lastReadDisplayChangeRequest.display));
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;
return VERR_INVALID_PARAMETER;
return VINF_SUCCESS;
if (pThis)
#define IHGCMPORT_2_VMMDEVSTATE(pInterface) ( (VMMDevState*)((uintptr_t)pInterface - RT_OFFSETOF(VMMDevState, HGCMPort)) )
#ifdef VBOX_HGCM
return VINF_SUCCESS;
static DECLCALLBACK(int) vmmdevLoadState(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
#ifdef VBOX_HGCM
Log(("vmmdevLoadState: capabilities changed (%x), informing connector\n", pThis->mouseCapabilities));
pThis->pDrv->pfnVideoAccelEnable (pThis->pDrv, !!pThis->u32VideoAccelEnabled, &pThis->pVMMDevRAMHC->vbvaMemory);
return VINF_SUCCESS;
#ifdef VBOX_HGCM
return VINF_SUCCESS;
int rc;
if (!CFGMR3AreValuesValid(pCfgHandle, "GetHostTimeDisabled\0BackdoorLogDisabled\0KeepCredentials\0"))
#ifdef VBOX_HGCM
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, (void **)&pThis->pVMMDevRAMHC, "VMMDev");
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;
pThis->pDrv = (PPDMIVMMDEVCONNECTOR)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase, PDMINTERFACE_VMMDEV_CONNECTOR);
AssertMsgFailedReturn(("LUN #0 doesn't have a VMMDev connector interface!\n"), VERR_PDM_MISSING_INTERFACE);
#ifdef VBOX_HGCM
pThis->pHGCMDrv = (PPDMIHGCMCONNECTOR)pThis->pDrvBase->pfnQueryInterface(pThis->pDrvBase, PDMINTERFACE_HGCM_CONNECTOR);
Log(("%s/%d: warning: no driver attached to LUN #0!\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
return rc;
#ifdef VBOX_HGCM
return rc;
if (fVersionChanged)
/* 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?*/
if (fVersionChanged)
if (fCapsChanged)
sizeof(VMMDevState),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,