VMMDevInterface.cpp revision c371f5678fdb6832ffb56bbf7a63039e68c1eeef
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * VirtualBox Driver Interface to VMM device.
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * Copyright (C) 2006-2012 Oracle Corporation
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * This file is part of VirtualBox Open Source Edition (OSE), as
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * available from http://www.virtualbox.org. This file is free software;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * you can redistribute it and/or modify it under the terms of the GNU
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * General Public License (GPL) as published by the Free Software
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Foundation, in version 2 as it comes in the "COPYING" file of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * VMMDev driver instance data.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct DRVMAINVMMDEV
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /** Pointer to the VMMDev object. */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /** Pointer to the driver instance structure. */
#ifdef VBOX_WITH_HGCM
#define PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface) ( (PDRVMAINVMMDEV) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINVMMDEV, Connector)) )
#ifdef VBOX_WITH_HGCM
#define PDMIHGCMCONNECTOR_2_MAINVMMDEV(pInterface) ( (PDRVMAINVMMDEV) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINVMMDEV, HGCMConnector)) )
#ifdef VBOX_WITH_HGCM
m_fHGCMActive = true;
mu32CredentialsFlags = 0;
#ifdef VBOX_WITH_HGCM
if (hgcmIsActive())
if (mpDrv)
if (!mpDrv)
return NULL;
if (u32Timeout == 0)
return rc;
return rc;
DECLCALLBACK(void) vmmdevUpdateGuestStatus(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFacility, uint16_t uStatus,
if (!guest)
guest->setAdditionsStatus((VBoxGuestFacilityType)uFacility, (VBoxGuestFacilityStatus)uStatus, fFlags, pTimeSpecTS);
if (!pGuest)
DECLCALLBACK(void) vmmdevUpdateGuestInfo(PPDMIVMMDEVCONNECTOR pInterface, const VBoxGuestInfo *guestInfo)
if (!guestInfo)
if (!guest)
/** @todo Would be better if GuestImpl.cpp did all this in the above method call
guest->setAdditionsStatus(VBoxGuestFacilityType_All, VBoxGuestFacilityStatus_Inactive, 0 /*fFlags*/, &TimeSpecTS);
if (!pGuest)
DECLCALLBACK(void) vmmdevUpdateGuestCapabilities(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities)
if (!pGuest)
DECLCALLBACK(void) vmmdevUpdateMouseCapabilities(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fNewCaps)
* This is called when the mouse pointer shape changes or pointer is hidden/displaying.
DECLCALLBACK(void) vmmdevUpdatePointerShape(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
void *pShape)
if (pShape)
if (pShape)
pConsole->onMousePointerShapeChange(fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayAsInParam(shapeData));
DECLCALLBACK(int) iface_VideoAccelEnable(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, VBVAMEMORY *pVbvaMemory)
if (display)
return VERR_NOT_SUPPORTED;
if (display)
DECLCALLBACK(int) vmmdevVideoModeSupported(PPDMIVMMDEVCONNECTOR pInterface, uint32_t display, uint32_t width, uint32_t height,
if (!fSupported)
return VERR_INVALID_PARAMETER;
#ifdef DEBUG_sunlover
#ifdef DEBUG_sunlover
*fSupported = true;
return VINF_SUCCESS;
DECLCALLBACK(int) vmmdevGetHeightReduction(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *heightReduction)
if (!heightReduction)
return VERR_INVALID_PARAMETER;
if (framebuffer)
*heightReduction = 0;
return VINF_SUCCESS;
DECLCALLBACK(int) vmmdevSetCredentialsJudgementResult(PPDMIVMMDEVCONNECTOR pInterface, uint32_t u32Flags)
return VERR_GENERAL_FAILURE;
DECLCALLBACK(int) vmmdevSetVisibleRegion(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect)
return VINF_SUCCESS;
DECLCALLBACK(int) vmmdevQueryVisibleRegion(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect)
return VINF_SUCCESS;
DECLCALLBACK(int) vmmdevQueryStatisticsInterval(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval)
if (!pulInterval)
return VERR_INVALID_POINTER;
if (!guest)
return VERR_GENERAL_FAILURE;
return VINF_SUCCESS;
if (!pcbBalloon)
return VERR_INVALID_POINTER;
if (!guest)
return VERR_GENERAL_FAILURE;
return VINF_SUCCESS;
DECLCALLBACK(int) vmmdevIsPageFusionEnabled(PPDMIVMMDEVCONNECTOR pInterface, bool *pfPageFusionEnabled)
if (!pfPageFusionEnabled)
return VERR_INVALID_POINTER;
if (!guest)
return VERR_GENERAL_FAILURE;
return VINF_SUCCESS;
DECLCALLBACK(int) vmmdevReportStatistics(PPDMIVMMDEVCONNECTOR pInterface, VBoxGuestStatistics *pGuestStats)
if (!pGuestStats)
return VERR_INVALID_POINTER;
if (!guest)
return VERR_GENERAL_FAILURE;
guest->setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_CPUKERNEL, pGuestStats->u32CpuLoad_Kernel);
guest->setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_MEMBALLOON, pGuestStats->u32PhysMemBalloon);
return VINF_SUCCESS;
#ifdef VBOX_WITH_HGCM
static DECLCALLBACK(int) iface_hgcmConnect (PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID)
if ( !pServiceLocation
return VERR_INVALID_PARAMETER;
return VERR_INVALID_STATE;
static DECLCALLBACK(int) iface_hgcmDisconnect (PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID)
return VERR_INVALID_STATE;
static DECLCALLBACK(int) iface_hgcmCall (PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
return VERR_INVALID_STATE;
static DECLCALLBACK(int) iface_hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
if (!hgcmIsActive())
return VERR_INVALID_STATE;
if (!hgcmIsActive())
return VERR_INVALID_STATE;
# ifdef VBOX_WITH_CRHGSMI
if (!hgcmIsActive())
return VERR_INVALID_STATE;
if (!hgcmIsActive())
return VERR_INVALID_STATE;
int VMMDev::hgcmHostFastCallAsync (HGCMCVSHANDLE hSvc, uint32_t function, PVBOXHGCMSVCPARM pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion)
if (!hgcmIsActive())
return VERR_INVALID_STATE;
#ifdef VBOX_WITH_HGCM
return NULL;
#ifdef VBOX_WITH_HGCM
HGCMHostReset ();
#ifdef VBOX_WITH_HGCM
#ifdef VBOX_WITH_HGCM
AssertMsgReturn(pThis->pUpPort, ("Configuration error: No VMMDev port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
#ifdef VBOX_WITH_HGCM
AssertMsgReturn(pThis->pHGCMPort, ("Configuration error: No HGCM port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
void *pv;
return rc;
#ifdef VBOX_WITH_HGCM
AssertMsgReturn(pLedPort, ("Configuration error: No LED port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
return rc;
return VINF_SUCCESS;
sizeof(DRVMAINVMMDEV),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,