VMMDevState.h revision 0defe73e08f591e32e92dfeb3de18ee84a180d2a
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync/* $Id$ */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync/** @file
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * VMMDev - Guest <-> VMM/Host communication device, internal header.
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync/*
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * Copyright (C) 2006-2007 Oracle Corporation
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync *
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * available from http://www.virtualbox.org. This file is free software;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * you can redistribute it and/or modify it under the terms of the GNU
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * General Public License (GPL) as published by the Free Software
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync#ifndef ___VMMDev_VMMDevState_h
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync#define ___VMMDev_VMMDevState_h
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync#include <VBox/VMMDev.h>
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync#include <VBox/vmm/pdmdev.h>
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync#include <VBox/vmm/pdmifs.h>
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync#define TIMESYNC_BACKDOOR
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsynctypedef struct DISPLAYCHANGEINFO
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync{
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t xres;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t yres;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t bpp;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t display;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t xOrigin;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t yOrigin;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync bool fEnabled;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync bool fChangeOrigin;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync} DISPLAYCHANGEINFO;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsynctypedef struct DISPLAYCHANGEREQUEST
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync{
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync bool fPending;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync bool afAlignment[3];
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync DISPLAYCHANGEINFO displayChangeRequest;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync DISPLAYCHANGEINFO lastReadDisplayChangeRequest;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync} DISPLAYCHANGEREQUEST;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsynctypedef struct DISPLAYCHANGEDATA
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync{
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /* Which monitor is being reported to the guest. */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync int iCurrentMonitor;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** true if the guest responded to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST at least once */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync bool fGuestSentChangeEventAck;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync bool afAlignment[3];
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync DISPLAYCHANGEREQUEST aRequests[64]; // @todo maxMonitors
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync} DISPLAYCHANGEDATA;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync/**
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * Credentials for automatic guest logon and host configured logon (?).
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync *
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * This is not stored in the same block as the instance data in order to make it
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * harder to access.
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsynctypedef struct VMMDEVCREDS
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync{
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** credentials for guest logon purposes */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync struct
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync {
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync bool fAllowInteractiveLogon;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync } Logon;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** credentials for verification by guest */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync struct
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync {
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync } Judge;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync} VMMDEVCREDS;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync/**
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync * Facility status entry.
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsynctypedef struct VMMDEVFACILITYSTATUSENTRY
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync{
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** The facility, see VBoxGuestFacilityType. */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t uFacility;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** The status, see VBoxGuestFacilityStatus. */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint16_t uStatus;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** Whether this entry is fixed and cannot be reused when inactive. */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync bool fFixed;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** Explicit alignment padding / reserved for future use. MBZ. */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync bool fPadding;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** The facility flags (yet to be defined). */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t fFlags;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** Explicit alignment padding / reserved for future use. MBZ. */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t uPadding;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** Last update timestamp. */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync RTTIMESPEC TimeSpecTS;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync} VMMDEVFACILITYSTATUSENTRY;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync/** Pointer to a facility status entry. */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsynctypedef VMMDEVFACILITYSTATUSENTRY *PVMMDEVFACILITYSTATUSENTRY;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync/** device structure containing all state information */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsynctypedef struct VMMDevState
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync{
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** The PCI device structure. */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync PCIDevice dev;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** The critical section for this device. */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync PDMCRITSECT CritSect;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** hypervisor address space size */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t hypervisorSize;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** mouse capabilities of host and guest */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t mouseCapabilities;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** absolute mouse position in pixels */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync int32_t mouseXAbs;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync int32_t mouseYAbs;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync /** Does the guest currently want the host pointer to be shown? */
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync uint32_t fHostCursorRequested;
74fe172698ba936102e120dae998c9ebd09cfbdfvboxsync
/** Alignment padding. */
uint32_t u32Alignment0;
/** Pointer to device instance. */
PPDMDEVINSR3 pDevIns;
/** LUN\#0 + Status: VMMDev port base interface. */
PDMIBASE IBase;
/** LUN\#0: VMMDev port interface. */
PDMIVMMDEVPORT IPort;
#ifdef VBOX_WITH_HGCM
/** LUN\#0: HGCM port interface. */
PDMIHGCMPORT IHGCMPort;
#endif
/** Pointer to base interface of the driver. */
R3PTRTYPE(PPDMIBASE) pDrvBase;
/** VMMDev connector interface */
R3PTRTYPE(PPDMIVMMDEVCONNECTOR) pDrv;
#ifdef VBOX_WITH_HGCM
/** HGCM connector interface */
R3PTRTYPE(PPDMIHGCMCONNECTOR) pHGCMDrv;
#endif
/** Alignment padding. */
RTR3PTR PtrR3Alignment1;
/** message buffer for backdoor logging. */
char szMsg[512];
/** message buffer index. */
uint32_t iMsg;
/** Base port in the assigned I/O space. */
RTIOPORT PortBase;
/** Alignment padding. */
RTIOPORT PortAlignment2;
/** IRQ number assigned to the device */
uint32_t irq;
/** Current host side event flags */
uint32_t u32HostEventFlags;
/** Mask of events guest is interested in. Note that the HGCM events
* are enabled automatically by the VMMDev device when guest issues
* HGCM commands.
*/
uint32_t u32GuestFilterMask;
/** Delayed mask of guest events */
uint32_t u32NewGuestFilterMask;
/** Flag whether u32NewGuestFilterMask is valid */
bool fNewGuestFilterMask;
/** Alignment padding. */
bool afAlignment3[3];
/** GC physical address of VMMDev RAM area */
RTGCPHYS32 GCPhysVMMDevRAM;
/** R3 pointer to VMMDev RAM area */
R3PTRTYPE(VMMDevMemory *) pVMMDevRAMR3;
/** R3 pointer to VMMDev Heap RAM area
*/
R3PTRTYPE(VMMDevMemory *) pVMMDevHeapR3;
/** GC physical address of VMMDev Heap RAM area */
RTGCPHYS32 GCPhysVMMDevHeap;
/** Information reported by guest via VMMDevReportGuestInfo generic request.
* Until this information is reported the VMMDev refuses any other requests.
*/
VBoxGuestInfo guestInfo;
/** Information report \#2, chewed a litte. */
struct
{
uint32_t uFullVersion; /**< non-zero if info is present. */
uint32_t uRevision;
uint32_t fFeatures;
char szName[128];
} guestInfo2;
/** Array of guest facility statuses. */
VMMDEVFACILITYSTATUSENTRY aFacilityStatuses[32];
/** The number of valid entries in the facility status array. */
uint32_t cFacilityStatuses;
/** Information reported by guest via VMMDevReportGuestCapabilities. */
uint32_t guestCaps;
/** "Additions are Ok" indicator, set to true after processing VMMDevReportGuestInfo,
* if additions version is compatible. This flag is here to avoid repeated comparing
* of the version in guestInfo.
*/
uint32_t fu32AdditionsOk;
/** Video acceleration status set by guest. */
uint32_t u32VideoAccelEnabled;
DISPLAYCHANGEDATA displayChangeData;
/** Pointer to the credentials. */
R3PTRTYPE(VMMDEVCREDS *) pCredentials;
bool afAlignment4[HC_ARCH_BITS == 32 ? 3 : 7];
/* memory balloon change request */
uint32_t u32MemoryBalloonSize, u32LastMemoryBalloonSize;
/* guest ram size */
uint64_t cbGuestRAM;
/* unique session id; the id will be different after each start, reset or restore of the VM. */
uint64_t idSession;
/* statistics interval change request */
uint32_t u32StatIntervalSize, u32LastStatIntervalSize;
/* seamless mode change request */
bool fLastSeamlessEnabled, fSeamlessEnabled;
bool afAlignment5[1];
bool fVRDPEnabled;
uint32_t u32VRDPExperienceLevel;
#ifdef TIMESYNC_BACKDOOR
uint64_t hostTime;
bool fTimesyncBackdoorLo;
bool afAlignment6[3];
#endif
/** Set if GetHostTime should fail.
* Loaded from the GetHostTimeDisabled configuration value. */
bool fGetHostTimeDisabled;
/** Set if backdoor logging should be disabled (output will be ignored then) */
bool fBackdoorLogDisabled;
/** Don't clear credentials */
bool fKeepCredentials;
/** Heap enabled. */
bool fHeapEnabled;
/** Guest Core Dumping enabled. */
bool fGuestCoreDumpEnabled;
/** Guest Core Dump location. */
char szGuestCoreDumpDir[RTPATH_MAX];
/** Number of additional cores to keep around. */
uint32_t cGuestCoreDumps;
bool afAlignment7[1];
#ifdef VBOX_WITH_HGCM
/** List of pending HGCM requests, used for saving the HGCM state. */
R3PTRTYPE(PVBOXHGCMCMD) pHGCMCmdList;
/** Critical section to protect the list. */
RTCRITSECT critsectHGCMCmdList;
/** Whether the HGCM events are already automatically enabled. */
uint32_t u32HGCMEnabled;
/** Alignment padding. */
uint32_t u32Alignment7;
#endif /* VBOX_WITH_HGCM */
/** Status LUN: Shared folders LED */
struct
{
/** The LED. */
PDMLED Led;
/** The LED ports. */
PDMILEDPORTS ILeds;
/** Partner of ILeds. */
R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
} SharedFolders;
/** FLag whether CPU hotplug events are monitored */
bool fCpuHotPlugEventsEnabled;
/** Alignment padding. */
bool afPadding8[3];
/** CPU hotplug event */
VMMDevCpuEventType enmCpuHotPlugEvent;
/** Core id of the CPU to change */
uint32_t idCpuCore;
/** Package id of the CPU to change */
uint32_t idCpuPackage;
uint32_t StatMemBalloonChunks;
/** Set if RC/R0 is enabled. */
bool fRZEnabled;
/** Set if testing is enabled. */
bool fTestingEnabled;
/** Alignment padding. */
bool afPadding9[HC_ARCH_BITS == 32 ? 2 : 6];
#ifndef VBOX_WITHOUT_TESTING_FEATURES
/** The high timestamp value. */
uint32_t u32TestingHighTimestamp;
/** The current testing command (VMMDEV_TESTING_CMD_XXX). */
uint32_t u32TestingCmd;
/** The testing data offset (command specific). */
uint32_t offTestingData;
/** For buffering the what comes in over the testing data port. */
union
{
char padding[1024];
/** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
* VMMDEV_TESTING_CMD_FAILED. */
struct
{
char sz[1024];
} String, Init, SubNew, Failed;
/** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
struct
{
uint32_t c;
} Error, Term, SubDone;
/** VMMDEV_TESTING_CMD_VALUE. */
struct
{
RTUINT64U u64Value;
uint32_t u32Unit;
char szName[1024 - 8 - 4];
} Value;
} TestingData;
#endif /* !VBOX_WITHOUT_TESTING_FEATURES */
} VMMDevState;
AssertCompileMemberAlignment(VMMDevState, CritSect, 8);
AssertCompileMemberAlignment(VMMDevState, cbGuestRAM, 8);
AssertCompileMemberAlignment(VMMDevState, enmCpuHotPlugEvent, 4);
AssertCompileMemberAlignment(VMMDevState, aFacilityStatuses, 8);
#ifndef VBOX_WITHOUT_TESTING_FEATURES
AssertCompileMemberAlignment(VMMDevState, TestingData.Value.u64Value, 8);
#endif
void VMMDevNotifyGuest (VMMDevState *pVMMDevState, uint32_t u32EventMask);
void VMMDevCtlSetGuestFilterMask (VMMDevState *pVMMDevState,
uint32_t u32OrMask,
uint32_t u32NotMask);
#endif /* !___VMMDev_VMMDevState_h */