[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH xeniface] Update XENBUS interfaces and use new XENBUS_SHARED_INFO GetTime...
...to determine how to interpret Xen wall-clock. The Xen wall-clock value may be interpreted as local time or UTC, depending on how Windows programs the emulated RTC. The updated method provides this extra information, so used this rather than reading the registry directly. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- include/cache_interface.h | 34 ++++++++++++- include/evtchn_interface.h | 108 ++++++++++++++++++++++++++-------------- include/gnttab_interface.h | 75 ++++++++++++++++++++++++++-- include/shared_info_interface.h | 46 +++++++++-------- include/xeniface_ioctls.h | 8 +++ src/xenagent/service.cpp | 49 +++++------------- src/xenagent/xenifacedevice.cpp | 13 +++-- src/xenagent/xenifacedevice.h | 2 +- src/xeniface.inf | 6 +-- src/xeniface/fdo.c | 1 + src/xeniface/ioctl_evtchn.c | 36 ++++++++------ src/xeniface/ioctl_sharedinfo.c | 28 +++++++---- src/xeniface/wmi.c | 14 +++--- 13 files changed, 277 insertions(+), 143 deletions(-) diff --git a/include/cache_interface.h b/include/cache_interface.h index ac50a82..048e06b 100644 --- a/include/cache_interface.h +++ b/include/cache_interface.h @@ -123,6 +123,20 @@ typedef VOID IN PVOID Argument ); +typedef NTSTATUS +(*XENBUS_CACHE_CREATE_V1)( + IN PINTERFACE Interface, + IN const CHAR *Name, + IN ULONG Size, + IN ULONG Reservation, + IN XENBUS_CACHE_CTOR Ctor, + IN XENBUS_CACHE_DTOR Dtor, + IN XENBUS_CACHE_ACQUIRE_LOCK AcquireLock, + IN XENBUS_CACHE_RELEASE_LOCK ReleaseLock, + IN PVOID Argument OPTIONAL, + OUT PXENBUS_CACHE *Cache + ); + /*! \typedef XENBUS_CACHE_CREATE \brief Create a cache of objects of the given \a Size @@ -130,6 +144,7 @@ typedef VOID \param Name A name for the cache which will be used in debug output \param Size The size of each object in bytes \param Reservation The target minimum population of the cache + \param Cap The maximum population of the cache \param Ctor A callback which is invoked when a new object created \param Dtor A callback which is invoked when an object is destroyed \param AcquireLock A callback invoked to acquire a spinlock @@ -146,6 +161,7 @@ typedef NTSTATUS IN const CHAR *Name, IN ULONG Size, IN ULONG Reservation, + IN ULONG Cap, IN XENBUS_CACHE_CTOR Ctor, IN XENBUS_CACHE_DTOR Dtor, IN XENBUS_CACHE_ACQUIRE_LOCK AcquireLock, @@ -211,13 +227,27 @@ struct _XENBUS_CACHE_INTERFACE_V1 { INTERFACE Interface; XENBUS_CACHE_ACQUIRE CacheAcquire; XENBUS_CACHE_RELEASE CacheRelease; + XENBUS_CACHE_CREATE_V1 CacheCreateVersion1; + XENBUS_CACHE_GET CacheGet; + XENBUS_CACHE_PUT CachePut; + XENBUS_CACHE_DESTROY CacheDestroy; +}; + +/*! \struct _XENBUS_CACHE_INTERFACE_V2 + \brief CACHE interface version 1 + \ingroup interfaces +*/ +struct _XENBUS_CACHE_INTERFACE_V2 { + INTERFACE Interface; + XENBUS_CACHE_ACQUIRE CacheAcquire; + XENBUS_CACHE_RELEASE CacheRelease; XENBUS_CACHE_CREATE CacheCreate; XENBUS_CACHE_GET CacheGet; XENBUS_CACHE_PUT CachePut; XENBUS_CACHE_DESTROY CacheDestroy; }; -typedef struct _XENBUS_CACHE_INTERFACE_V1 XENBUS_CACHE_INTERFACE, *PXENBUS_CACHE_INTERFACE; +typedef struct _XENBUS_CACHE_INTERFACE_V2 XENBUS_CACHE_INTERFACE, *PXENBUS_CACHE_INTERFACE; /*! \def XENBUS_CACHE \brief Macro at assist in method invocation @@ -228,6 +258,6 @@ typedef struct _XENBUS_CACHE_INTERFACE_V1 XENBUS_CACHE_INTERFACE, *PXENBUS_CACHE #endif // _WINDLL #define XENBUS_CACHE_INTERFACE_VERSION_MIN 1 -#define XENBUS_CACHE_INTERFACE_VERSION_MAX 1 +#define XENBUS_CACHE_INTERFACE_VERSION_MAX 2 #endif // _XENBUS_CACHE_INTERFACE_H diff --git a/include/evtchn_interface.h b/include/evtchn_interface.h index 9edd88d..76a9256 100644 --- a/include/evtchn_interface.h +++ b/include/evtchn_interface.h @@ -112,13 +112,6 @@ typedef PXENBUS_EVTCHN_CHANNEL ... ); -typedef NTSTATUS -(*XENBUS_EVTCHN_BIND_V2)( - IN PINTERFACE Interface, - IN PXENBUS_EVTCHN_CHANNEL Channel, - IN ULONG Cpu - ); - /*! \typedef XENBUS_EVTCHN_BIND \brief Bind an event channel to a specific CPU @@ -135,8 +128,8 @@ typedef NTSTATUS IN UCHAR Number ); -typedef BOOLEAN -(*XENBUS_EVTCHN_UNMASK_V1)( +typedef VOID +(*XENBUS_EVTCHN_UNMASK_V4)( IN PINTERFACE Interface, IN PXENBUS_EVTCHN_CHANNEL Channel, IN BOOLEAN InCallback @@ -148,17 +141,28 @@ typedef BOOLEAN \param Interface The interface header \param Channel The channel handle \param InCallback Set to TRUE if this method is invoked in context of the channel callback + \param Force Set to TRUE if the unmask must succeed, otherwise set to FALSE and the function will return TRUE if the unmask did not complete and there is still an event pending. */ -typedef VOID +typedef BOOLEAN (*XENBUS_EVTCHN_UNMASK)( IN PINTERFACE Interface, IN PXENBUS_EVTCHN_CHANNEL Channel, - IN BOOLEAN InCallback + IN BOOLEAN InCallback, + IN BOOLEAN Force + ); + +typedef VOID +(*XENBUS_EVTCHN_SEND_V1)( + IN PINTERFACE Interface, + IN PXENBUS_EVTCHN_CHANNEL Channel ); /*! \typedef XENBUS_EVTCHN_SEND \brief Send an event to the remote end of the channel + It is assumed that the domain cannot suspend during this call so + IRQL must be >= DISPATCH_LEVEL. + \param Interface The interface header \param Channel The channel handle */ @@ -180,17 +184,39 @@ typedef VOID IN PXENBUS_EVTCHN_CHANNEL Channel ); +/*! \typedef XENBUS_EVTCHN_GET_COUNT + \brief Get the number of events received by the channel since it was opened + + \param Interface The interface header + \param Channel The channel handle + \return The number of events +*/ +typedef ULONG +(*XENBUS_EVTCHN_GET_COUNT)( + IN PINTERFACE Interface, + IN PXENBUS_EVTCHN_CHANNEL Channel + ); + +typedef NTSTATUS +(*XENBUS_EVTCHN_WAIT_V5)( + IN PINTERFACE Interface, + IN PXENBUS_EVTCHN_CHANNEL Channel, + IN PLARGE_INTEGER Timeout OPTIONAL + ); + /*! \typedef XENBUS_EVTCHN_WAIT - \brief Wait for an event to the local end of the channel + \brief Wait for events to the local end of the channel \param Interface The interface header \param Channel The channel handle + \param Count The event count to wait for \param Timeout An optional timeout value (similar to KeWaitForSingleObject(), but non-zero values are allowed at DISPATCH_LEVEL). */ typedef NTSTATUS (*XENBUS_EVTCHN_WAIT)( IN PINTERFACE Interface, IN PXENBUS_EVTCHN_CHANNEL Channel, + IN ULONG Count, IN PLARGE_INTEGER Timeout OPTIONAL ); @@ -223,78 +249,83 @@ typedef VOID DEFINE_GUID(GUID_XENBUS_EVTCHN_INTERFACE, 0xbe2440ac, 0x1098, 0x4150, 0xaf, 0x4d, 0x45, 0x2f, 0xad, 0xce, 0xf9, 0x23); -/*! \struct _XENBUS_EVTCHN_INTERFACE_V1 - \brief EVTCHN interface version 1 +/*! \struct _XENBUS_EVTCHN_INTERFACE_V4 + \brief EVTCHN interface version 4 \ingroup interfaces */ -struct _XENBUS_EVTCHN_INTERFACE_V1 { +struct _XENBUS_EVTCHN_INTERFACE_V4 { INTERFACE Interface; XENBUS_EVTCHN_ACQUIRE EvtchnAcquire; XENBUS_EVTCHN_RELEASE EvtchnRelease; XENBUS_EVTCHN_OPEN EvtchnOpen; - XENBUS_EVTCHN_UNMASK_V1 EvtchnUnmaskVersion1; - XENBUS_EVTCHN_SEND EvtchnSend; + XENBUS_EVTCHN_BIND EvtchnBind; + XENBUS_EVTCHN_UNMASK_V4 EvtchnUnmaskVersion4; + XENBUS_EVTCHN_SEND_V1 EvtchnSendVersion1; XENBUS_EVTCHN_TRIGGER EvtchnTrigger; XENBUS_EVTCHN_GET_PORT EvtchnGetPort; XENBUS_EVTCHN_CLOSE EvtchnClose; }; -/*! \struct _XENBUS_EVTCHN_INTERFACE_V2 - \brief EVTCHN interface version 2 +/*! \struct _XENBUS_EVTCHN_INTERFACE_V5 + \brief EVTCHN interface version 5 \ingroup interfaces */ -struct _XENBUS_EVTCHN_INTERFACE_V2 { +struct _XENBUS_EVTCHN_INTERFACE_V5 { INTERFACE Interface; XENBUS_EVTCHN_ACQUIRE EvtchnAcquire; XENBUS_EVTCHN_RELEASE EvtchnRelease; XENBUS_EVTCHN_OPEN EvtchnOpen; - XENBUS_EVTCHN_BIND_V2 EvtchnBindVersion2; - XENBUS_EVTCHN_UNMASK_V1 EvtchnUnmaskVersion1; - XENBUS_EVTCHN_SEND EvtchnSend; + XENBUS_EVTCHN_BIND EvtchnBind; + XENBUS_EVTCHN_UNMASK_V4 EvtchnUnmaskVersion4; + XENBUS_EVTCHN_SEND_V1 EvtchnSendVersion1; XENBUS_EVTCHN_TRIGGER EvtchnTrigger; + XENBUS_EVTCHN_WAIT_V5 EvtchnWaitVersion5; XENBUS_EVTCHN_GET_PORT EvtchnGetPort; XENBUS_EVTCHN_CLOSE EvtchnClose; }; -/*! \struct _XENBUS_EVTCHN_INTERFACE_V3 - \brief EVTCHN interface version 3 +/*! \struct _XENBUS_EVTCHN_INTERFACE_V6 + \brief EVTCHN interface version 6 \ingroup interfaces */ -struct _XENBUS_EVTCHN_INTERFACE_V3 { +struct _XENBUS_EVTCHN_INTERFACE_V6 { INTERFACE Interface; XENBUS_EVTCHN_ACQUIRE EvtchnAcquire; XENBUS_EVTCHN_RELEASE EvtchnRelease; XENBUS_EVTCHN_OPEN EvtchnOpen; - XENBUS_EVTCHN_BIND_V2 EvtchnBindVersion2; - XENBUS_EVTCHN_UNMASK EvtchnUnmask; + XENBUS_EVTCHN_BIND EvtchnBind; + XENBUS_EVTCHN_UNMASK_V4 EvtchnUnmaskVersion4; XENBUS_EVTCHN_SEND EvtchnSend; XENBUS_EVTCHN_TRIGGER EvtchnTrigger; + XENBUS_EVTCHN_WAIT_V5 EvtchnWaitVersion5; XENBUS_EVTCHN_GET_PORT EvtchnGetPort; XENBUS_EVTCHN_CLOSE EvtchnClose; }; -/*! \struct _XENBUS_EVTCHN_INTERFACE_V4 - \brief EVTCHN interface version 4 +/*! \struct _XENBUS_EVTCHN_INTERFACE_V7 + \brief EVTCHN interface version 7 \ingroup interfaces */ -struct _XENBUS_EVTCHN_INTERFACE_V4 { +struct _XENBUS_EVTCHN_INTERFACE_V7 { INTERFACE Interface; XENBUS_EVTCHN_ACQUIRE EvtchnAcquire; XENBUS_EVTCHN_RELEASE EvtchnRelease; XENBUS_EVTCHN_OPEN EvtchnOpen; XENBUS_EVTCHN_BIND EvtchnBind; - XENBUS_EVTCHN_UNMASK EvtchnUnmask; + XENBUS_EVTCHN_UNMASK_V4 EvtchnUnmaskVersion4; XENBUS_EVTCHN_SEND EvtchnSend; XENBUS_EVTCHN_TRIGGER EvtchnTrigger; + XENBUS_EVTCHN_GET_COUNT EvtchnGetCount; + XENBUS_EVTCHN_WAIT EvtchnWait; XENBUS_EVTCHN_GET_PORT EvtchnGetPort; XENBUS_EVTCHN_CLOSE EvtchnClose; }; -/*! \struct _XENBUS_EVTCHN_INTERFACE_V5 - \brief EVTCHN interface version 5 +/*! \struct _XENBUS_EVTCHN_INTERFACE_V8 + \brief EVTCHN interface version 8 \ingroup interfaces */ -struct _XENBUS_EVTCHN_INTERFACE_V5 { +struct _XENBUS_EVTCHN_INTERFACE_V8 { INTERFACE Interface; XENBUS_EVTCHN_ACQUIRE EvtchnAcquire; XENBUS_EVTCHN_RELEASE EvtchnRelease; @@ -303,12 +334,13 @@ struct _XENBUS_EVTCHN_INTERFACE_V5 { XENBUS_EVTCHN_UNMASK EvtchnUnmask; XENBUS_EVTCHN_SEND EvtchnSend; XENBUS_EVTCHN_TRIGGER EvtchnTrigger; + XENBUS_EVTCHN_GET_COUNT EvtchnGetCount; XENBUS_EVTCHN_WAIT EvtchnWait; XENBUS_EVTCHN_GET_PORT EvtchnGetPort; XENBUS_EVTCHN_CLOSE EvtchnClose; }; -typedef struct _XENBUS_EVTCHN_INTERFACE_V5 XENBUS_EVTCHN_INTERFACE, *PXENBUS_EVTCHN_INTERFACE; +typedef struct _XENBUS_EVTCHN_INTERFACE_V8 XENBUS_EVTCHN_INTERFACE, *PXENBUS_EVTCHN_INTERFACE; /*! \def XENBUS_EVTCHN \brief Macro at assist in method invocation @@ -318,7 +350,7 @@ typedef struct _XENBUS_EVTCHN_INTERFACE_V5 XENBUS_EVTCHN_INTERFACE, *PXENBUS_EVT #endif // _WINDLL -#define XENBUS_EVTCHN_INTERFACE_VERSION_MIN 1 -#define XENBUS_EVTCHN_INTERFACE_VERSION_MAX 5 +#define XENBUS_EVTCHN_INTERFACE_VERSION_MIN 4 +#define XENBUS_EVTCHN_INTERFACE_VERSION_MAX 8 #endif // _XENBUS_EVTCHN_INTERFACE_H diff --git a/include/gnttab_interface.h b/include/gnttab_interface.h index de6d72f..48a555a 100644 --- a/include/gnttab_interface.h +++ b/include/gnttab_interface.h @@ -72,12 +72,24 @@ typedef VOID IN PINTERFACE Interface ); +typedef NTSTATUS +(*XENBUS_GNTTAB_CREATE_CACHE_V1)( + IN PINTERFACE Interface, + IN const CHAR *Name, + IN ULONG Reservation, + IN XENBUS_CACHE_ACQUIRE_LOCK AcquireLock, + IN XENBUS_CACHE_RELEASE_LOCK ReleaseLock, + IN PVOID Argument OPTIONAL, + OUT PXENBUS_GNTTAB_CACHE *Cache + ); + /*! \typedef XENBUS_GNTTAB_CREATE_CACHE \brief Create a cache of grant table entries \param Interface The interface header \param Name A name for the cache which will be used in debug output \param Reservation The target minimum population of the cache + \param Cap The maximum population of the cache \param AcquireLock A callback invoked to acquire a spinlock \param ReleaseLock A callback invoked to release the spinlock \param Argument An optional context argument passed to the callbacks @@ -88,6 +100,7 @@ typedef NTSTATUS IN PINTERFACE Interface, IN const CHAR *Name, IN ULONG Reservation, + IN ULONG Cap, IN XENBUS_CACHE_ACQUIRE_LOCK AcquireLock, IN XENBUS_CACHE_RELEASE_LOCK ReleaseLock, IN PVOID Argument OPTIONAL, @@ -148,6 +161,26 @@ typedef ULONG IN PXENBUS_GNTTAB_ENTRY Entry ); +/*! \typedef XENBUS_GNTTAB_QUERY_REFERENCE + \brief Get the reference number of the entry + + \param Interface The interface header + \param Reference The reference number + \param Pfn An optional pointer to receive the value of the reference frame number + \param ReadOnly An optional pointer to receive the boolean value of the read-only flag +*/ +typedef NTSTATUS +(*XENBUS_GNTTAB_QUERY_REFERENCE)( + IN PINTERFACE Interface, + IN ULONG Reference, + OUT PPFN_NUMBER Pfn OPTIONAL, + OUT PBOOLEAN ReadOnly OPTIONAL + ); + +#define XENBUS_GNTTAB_CONSOLE_REFERENCE 0 +#define XENBUS_GNTTAB_STORE_REFERENCE 1 + + /*! \typedef XENBUS_GNTTAB_DESTROY_CACHE \brief Destroy a cache of grant table entries @@ -208,7 +241,7 @@ struct _XENBUS_GNTTAB_INTERFACE_V1 { INTERFACE Interface; XENBUS_GNTTAB_ACQUIRE GnttabAcquire; XENBUS_GNTTAB_RELEASE GnttabRelease; - XENBUS_GNTTAB_CREATE_CACHE GnttabCreateCache; + XENBUS_GNTTAB_CREATE_CACHE_V1 GnttabCreateCacheVersion1; XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS GnttabPermitForeignAccess; XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS GnttabRevokeForeignAccess; XENBUS_GNTTAB_GET_REFERENCE GnttabGetReference; @@ -223,16 +256,52 @@ struct _XENBUS_GNTTAB_INTERFACE_V2 { INTERFACE Interface; XENBUS_GNTTAB_ACQUIRE GnttabAcquire; XENBUS_GNTTAB_RELEASE GnttabRelease; + XENBUS_GNTTAB_CREATE_CACHE_V1 GnttabCreateCacheVersion1; + XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS GnttabPermitForeignAccess; + XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS GnttabRevokeForeignAccess; + XENBUS_GNTTAB_GET_REFERENCE GnttabGetReference; + XENBUS_GNTTAB_DESTROY_CACHE GnttabDestroyCache; + XENBUS_GNTTAB_MAP_FOREIGN_PAGES GnttabMapForeignPages; + XENBUS_GNTTAB_UNMAP_FOREIGN_PAGES GnttabUnmapForeignPages; +}; + +/*! \struct _XENBUS_GNTTAB_INTERFACE_V3 + \brief GNTTAB interface version 3 + \ingroup interfaces +*/ +struct _XENBUS_GNTTAB_INTERFACE_V3 { + INTERFACE Interface; + XENBUS_GNTTAB_ACQUIRE GnttabAcquire; + XENBUS_GNTTAB_RELEASE GnttabRelease; + XENBUS_GNTTAB_CREATE_CACHE_V1 GnttabCreateCacheVersion1; + XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS GnttabPermitForeignAccess; + XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS GnttabRevokeForeignAccess; + XENBUS_GNTTAB_GET_REFERENCE GnttabGetReference; + XENBUS_GNTTAB_QUERY_REFERENCE GnttabQueryReference; + XENBUS_GNTTAB_DESTROY_CACHE GnttabDestroyCache; + XENBUS_GNTTAB_MAP_FOREIGN_PAGES GnttabMapForeignPages; + XENBUS_GNTTAB_UNMAP_FOREIGN_PAGES GnttabUnmapForeignPages; +}; + +/*! \struct _XENBUS_GNTTAB_INTERFACE_V4 + \brief GNTTAB interface version 4 + \ingroup interfaces +*/ +struct _XENBUS_GNTTAB_INTERFACE_V4 { + INTERFACE Interface; + XENBUS_GNTTAB_ACQUIRE GnttabAcquire; + XENBUS_GNTTAB_RELEASE GnttabRelease; XENBUS_GNTTAB_CREATE_CACHE GnttabCreateCache; XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS GnttabPermitForeignAccess; XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS GnttabRevokeForeignAccess; XENBUS_GNTTAB_GET_REFERENCE GnttabGetReference; + XENBUS_GNTTAB_QUERY_REFERENCE GnttabQueryReference; XENBUS_GNTTAB_DESTROY_CACHE GnttabDestroyCache; XENBUS_GNTTAB_MAP_FOREIGN_PAGES GnttabMapForeignPages; XENBUS_GNTTAB_UNMAP_FOREIGN_PAGES GnttabUnmapForeignPages; }; -typedef struct _XENBUS_GNTTAB_INTERFACE_V2 XENBUS_GNTTAB_INTERFACE, *PXENBUS_GNTTAB_INTERFACE; +typedef struct _XENBUS_GNTTAB_INTERFACE_V4 XENBUS_GNTTAB_INTERFACE, *PXENBUS_GNTTAB_INTERFACE; /*! \def XENBUS_GNTTAB \brief Macro at assist in method invocation @@ -243,6 +312,6 @@ typedef struct _XENBUS_GNTTAB_INTERFACE_V2 XENBUS_GNTTAB_INTERFACE, *PXENBUS_GNT #endif // _WINDLL #define XENBUS_GNTTAB_INTERFACE_VERSION_MIN 1 -#define XENBUS_GNTTAB_INTERFACE_VERSION_MAX 2 +#define XENBUS_GNTTAB_INTERFACE_VERSION_MAX 4 #endif // _XENBUS_GNTTAB_INTERFACE_H diff --git a/include/shared_info_interface.h b/include/shared_info_interface.h index 287feab..f99bcb6 100644 --- a/include/shared_info_interface.h +++ b/include/shared_info_interface.h @@ -86,13 +86,6 @@ typedef BOOLEAN IN PVOID Argument ); -typedef BOOLEAN -(*XENBUS_SHARED_INFO_EVTCHN_POLL_V1)( - IN PINTERFACE Interface, - IN BOOLEAN (*Function)(PVOID, ULONG), - IN PVOID Argument - ); - /*! \typedef XENBUS_SHARED_INFO_EVTCHN_ACK \brief Private method for EVTCHN inerface */ @@ -120,41 +113,50 @@ typedef BOOLEAN IN ULONG Port ); +typedef LARGE_INTEGER +(*XENBUS_SHARED_INFO_GET_TIME_V2)( + IN PINTERFACE Interface + ); + /*! \typedef XENBUS_SHARED_INFO_GET_TIME - \brief Return the wallclock time from the shared info + \brief Retrieve the wallclock time from the shared info \param Interface The interface header - \return The wallclock time in units of 100ns + \param Time The wallclock time + \param Local Set, on return, if the wallclock is in local time */ -typedef LARGE_INTEGER +typedef VOID (*XENBUS_SHARED_INFO_GET_TIME)( - IN PINTERFACE Interface + IN PINTERFACE Interface, + OUT PLARGE_INTEGER Time, + OUT PBOOLEAN Local ); // {7E73C34F-1640-4649-A8F3-263BC930A004} DEFINE_GUID(GUID_XENBUS_SHARED_INFO_INTERFACE, 0x7e73c34f, 0x1640, 0x4649, 0xa8, 0xf3, 0x26, 0x3b, 0xc9, 0x30, 0xa0, 0x4); -/*! \struct _XENBUS_SHARED_INFO_INTERFACE_V1 - \brief SHARED_INFO interface version 1 +/*! \struct _XENBUS_SHARED_INFO_INTERFACE_V2 + \brief SHARED_INFO interface version 2 \ingroup interfaces */ -struct _XENBUS_SHARED_INFO_INTERFACE_V1 { +struct _XENBUS_SHARED_INFO_INTERFACE_V2 { INTERFACE Interface; XENBUS_SHARED_INFO_ACQUIRE SharedInfoAcquire; XENBUS_SHARED_INFO_RELEASE SharedInfoRelease; - XENBUS_SHARED_INFO_EVTCHN_POLL_V1 SharedInfoEvtchnPollVersion1; + XENBUS_SHARED_INFO_UPCALL_PENDING SharedInfoUpcallPending; + XENBUS_SHARED_INFO_EVTCHN_POLL SharedInfoEvtchnPoll; XENBUS_SHARED_INFO_EVTCHN_ACK SharedInfoEvtchnAck; XENBUS_SHARED_INFO_EVTCHN_MASK SharedInfoEvtchnMask; XENBUS_SHARED_INFO_EVTCHN_UNMASK SharedInfoEvtchnUnmask; - XENBUS_SHARED_INFO_GET_TIME SharedInfoGetTime; + XENBUS_SHARED_INFO_GET_TIME_V2 SharedInfoGetTimeVersion2; }; -/*! \struct _XENBUS_SHARED_INFO_INTERFACE_V2 - \brief SHARED_INFO interface version 2 +/*! \struct _XENBUS_SHARED_INFO_INTERFACE_V3 + \brief SHARED_INFO interface version 3 \ingroup interfaces */ -struct _XENBUS_SHARED_INFO_INTERFACE_V2 { +struct _XENBUS_SHARED_INFO_INTERFACE_V3 { INTERFACE Interface; XENBUS_SHARED_INFO_ACQUIRE SharedInfoAcquire; XENBUS_SHARED_INFO_RELEASE SharedInfoRelease; @@ -166,7 +168,7 @@ struct _XENBUS_SHARED_INFO_INTERFACE_V2 { XENBUS_SHARED_INFO_GET_TIME SharedInfoGetTime; }; -typedef struct _XENBUS_SHARED_INFO_INTERFACE_V2 XENBUS_SHARED_INFO_INTERFACE, *PXENBUS_SHARED_INFO_INTERFACE; +typedef struct _XENBUS_SHARED_INFO_INTERFACE_V3 XENBUS_SHARED_INFO_INTERFACE, *PXENBUS_SHARED_INFO_INTERFACE; /*! \def XENBUS_SHARED_INFO \brief Macro at assist in method invocation @@ -176,7 +178,7 @@ typedef struct _XENBUS_SHARED_INFO_INTERFACE_V2 XENBUS_SHARED_INFO_INTERFACE, *P #endif // _WINDLL -#define XENBUS_SHARED_INFO_INTERFACE_VERSION_MIN 1 -#define XENBUS_SHARED_INFO_INTERFACE_VERSION_MAX 2 +#define XENBUS_SHARED_INFO_INTERFACE_VERSION_MIN 2 +#define XENBUS_SHARED_INFO_INTERFACE_VERSION_MAX 3 #endif // _XENBUS_SHARED_INFO_H diff --git a/include/xeniface_ioctls.h b/include/xeniface_ioctls.h index dfb91da..5d09971 100644 --- a/include/xeniface_ioctls.h +++ b/include/xeniface_ioctls.h @@ -37,6 +37,8 @@ #ifndef _XENIFACE_IOCTLS_H_ #define _XENIFACE_IOCTLS_H_ +#include <windef.h> + /*! \brief XENIFACE device GUID */ DEFINE_GUID(GUID_INTERFACE_XENIFACE, \ 0xb2cfb085, 0xaa5e, 0x47e1, 0x8b, 0xf7, 0x97, 0x93, 0xf3, 0x15, 0x45, 0x65); @@ -369,6 +371,12 @@ typedef struct _XENIFACE_SUSPEND_REGISTER_OUT { #define IOCTL_XENIFACE_SHAREDINFO_GET_TIME \ CTL_CODE(FILE_DEVICE_UNKNOWN, 0x840, METHOD_BUFFERED, FILE_ANY_ACCESS) +/*! \brief Output for IOCTL_XENIFACE_GNTTAB_UNMAP_FOREIGN_PAGES */ +typedef struct _XENIFACE_SHAREDINFO_GET_TIME_OUT { + FILETIME Time; /*!< Current wallclock time */ + BOOLEAN Local; /*!< TRUE is wallclock is in local time, FALSE if it is in UTC */ +} XENIFACE_SHAREDINFO_GET_TIME_OUT, *PXENIFACE_SHAREDINFO_GET_TIME_OUT; + /*! \brief Logs a message to Dom0 Input: NUL-terminated CHAR array containing the message to log diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp index 8f8f445..4d62e09 100644 --- a/src/xenagent/service.cpp +++ b/src/xenagent/service.cpp @@ -379,45 +379,20 @@ void CXenIfaceCreator::AcquireShutdownPrivilege() CloseHandle(token); } -bool CXenIfaceCreator::IsRTCInUTC() -{ - HKEY key; - std::string path; - DWORD val = 0; - DWORD length = sizeof(val); - LRESULT lr; - - path = "SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation"; - - lr = RegOpenKeyEx(HKEY_LOCAL_MACHINE, path.c_str(), 0, KEY_READ, &key); - if (lr != ERROR_SUCCESS) - return false; - - lr = RegQueryValueEx(key, "RealTimeIsUniversal", NULL, NULL, - (LPBYTE)&val, &length); - RegCloseKey(key); - - // A non-present value -> false - if (lr != ERROR_SUCCESS) - return false; - - return val; -} - void CXenIfaceCreator::SetXenTime() { - bool IsUTC = IsRTCInUTC(); - - SYSTEMTIME cur = { 0 }; - if (IsUTC) - GetSystemTime(&cur); - else - GetLocalTime(&cur); + bool local; FILETIME now = { 0 }; - if (!m_device->SharedInfoGetTime(&now)) + if (!m_device->SharedInfoGetTime(&now, &local)) return; + SYSTEMTIME cur = { 0 }; + if (local) + GetLocalTime(&cur); + else + GetSystemTime(&cur); + SYSTEMTIME sys = { 0 }; if (!FileTimeToSystemTime(&now, &sys)) return; @@ -425,7 +400,7 @@ void CXenIfaceCreator::SetXenTime() if (memcmp(&cur, &sys, sizeof(SYSTEMTIME)) == 0) return; - CXenAgent::Log("RTC is in %s\n", IsUTC ? "UTC" : "local time"); + CXenAgent::Log("RTC is in %s\n", local ? "local time" : "UTC"); CXenAgent::Log("Time Now = %d/%d/%d %d:%02d:%02d.%d\n", cur.wYear, cur.wMonth, cur.wDay, cur.wHour, cur.wMinute, cur.wSecond, cur.wMilliseconds); @@ -433,10 +408,10 @@ void CXenIfaceCreator::SetXenTime() sys.wYear, sys.wMonth, sys.wDay, sys.wHour, sys.wMinute, sys.wSecond, sys.wMilliseconds); - if (IsUTC) - SetSystemTime(&sys); - else + if (local) SetLocalTime(&sys); + else + SetSystemTime(&sys); } /* 317fc439-3f77-41c8-b09e-08ad63272aa3 */ diff --git a/src/xenagent/xenifacedevice.cpp b/src/xenagent/xenifacedevice.cpp index 9c2008d..6ebf163 100644 --- a/src/xenagent/xenifacedevice.cpp +++ b/src/xenagent/xenifacedevice.cpp @@ -150,11 +150,16 @@ bool CXenIfaceDevice::SuspendGetCount(DWORD *count) } // sharedinfo interface -bool CXenIfaceDevice::SharedInfoGetTime(FILETIME* time) +bool CXenIfaceDevice::SharedInfoGetTime(FILETIME* time, bool* local) { - return Ioctl(IOCTL_XENIFACE_SHAREDINFO_GET_TIME, - NULL, 0, - time, sizeof(FILETIME)); + XENIFACE_SHAREDINFO_GET_TIME_OUT out = { NULL }; + if (!Ioctl(IOCTL_XENIFACE_SHAREDINFO_GET_TIME, + NULL, 0, + &out, sizeof(out))) + return false; + *time = out.Time; + *local = out.Local; + return true; } // logging diff --git a/src/xenagent/xenifacedevice.h b/src/xenagent/xenifacedevice.h index 7ea2f0e..b89b8b1 100644 --- a/src/xenagent/xenifacedevice.h +++ b/src/xenagent/xenifacedevice.h @@ -55,7 +55,7 @@ public: // suspend interface bool SuspendGetCount(DWORD *count); public: // sharedinfo interface - bool SharedInfoGetTime(FILETIME* time); + bool SharedInfoGetTime(FILETIME* time, bool *local); public: // logging bool Log(const std::string& msg); diff --git a/src/xeniface.inf b/src/xeniface.inf index 7215b9e..14ebdb2 100644 --- a/src/xeniface.inf +++ b/src/xeniface.inf @@ -49,9 +49,9 @@ ServiceDestDir.Copy = 11 ; DisplayName Section DeviceID ; ----------- ------- -------- -%XenIfaceDevice.DeviceDesc% =XenIface_Device, XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_IFACE&REV_09000000 -%XenIfaceDevice.DeviceDesc% =XenIface_Device, XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_IFACE&REV_09000000 -%XenIfaceDevice.DeviceDesc% =XenIface_Device, XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_IFACE&REV_09000000 +%XenIfaceDevice.DeviceDesc% =XenIface_Device, XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_IFACE&REV_09000006 +%XenIfaceDevice.DeviceDesc% =XenIface_Device, XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_IFACE&REV_09000006 +%XenIfaceDevice.DeviceDesc% =XenIface_Device, XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_IFACE&REV_09000006 [XenIface_Device] CopyFiles=XenIface_Device.Copy diff --git a/src/xeniface/fdo.c b/src/xeniface/fdo.c index 25b449d..1f859cd 100644 --- a/src/xeniface/fdo.c +++ b/src/xeniface/fdo.c @@ -969,6 +969,7 @@ FdoD3ToD0( &Fdo->GnttabInterface, "xeniface-gnttab", 0, + 0, GnttabAcquireLock, GnttabReleaseLock, Fdo, diff --git a/src/xeniface/ioctl_evtchn.c b/src/xeniface/ioctl_evtchn.c index 0e51855..85b66af 100644 --- a/src/xeniface/ioctl_evtchn.c +++ b/src/xeniface/ioctl_evtchn.c @@ -57,10 +57,11 @@ EvtchnNotificationDpc( KeSetEvent(Context->Event, 0, FALSE); - XENBUS_EVTCHN(Unmask, - &Context->Fdo->EvtchnInterface, - Context->Channel, - FALSE); + (VOID) XENBUS_EVTCHN(Unmask, + &Context->Fdo->EvtchnInterface, + Context->Channel, + FALSE, + TRUE); } _Function_class_(KSERVICE_ROUTINE) @@ -213,10 +214,11 @@ IoctlEvtchnBindUnbound( *Info = sizeof(XENIFACE_EVTCHN_BIND_UNBOUND_OUT); if (!In->Mask) { - XENBUS_EVTCHN(Unmask, - &Fdo->EvtchnInterface, - Context->Channel, - FALSE); + (VOID) XENBUS_EVTCHN(Unmask, + &Fdo->EvtchnInterface, + Context->Channel, + FALSE, + TRUE); } Trace("< LocalPort %lu, Context %p\n", Context->LocalPort, Context); @@ -307,10 +309,11 @@ IoctlEvtchnBindInterdomain( *Info = sizeof(XENIFACE_EVTCHN_BIND_INTERDOMAIN_OUT); if (!In->Mask) { - XENBUS_EVTCHN(Unmask, - &Fdo->EvtchnInterface, - Context->Channel, - FALSE); + (VOID) XENBUS_EVTCHN(Unmask, + &Fdo->EvtchnInterface, + Context->Channel, + FALSE, + TRUE); } Trace("< LocalPort %lu, Context %p\n", Context->LocalPort, Context); @@ -474,10 +477,11 @@ IoctlEvtchnUnmask( if (Context == NULL) goto fail2; - XENBUS_EVTCHN(Unmask, - &Fdo->EvtchnInterface, - Context->Channel, - FALSE); + (VOID) XENBUS_EVTCHN(Unmask, + &Fdo->EvtchnInterface, + Context->Channel, + FALSE, + TRUE); KeReleaseSpinLock(&Fdo->EvtchnLock, Irql); diff --git a/src/xeniface/ioctl_sharedinfo.c b/src/xeniface/ioctl_sharedinfo.c index 91a9a88..7870732 100644 --- a/src/xeniface/ioctl_sharedinfo.c +++ b/src/xeniface/ioctl_sharedinfo.c @@ -37,26 +37,32 @@ DECLSPEC_NOINLINE NTSTATUS IoctlSharedInfoGetTime( - __in PXENIFACE_FDO Fdo, - __in PCHAR Buffer, - __in ULONG InLen, - __in ULONG OutLen, - __out PULONG_PTR Info + __in PXENIFACE_FDO Fdo, + __in PCHAR Buffer, + __in ULONG InLen, + __in ULONG OutLen, + __out PULONG_PTR Info ) { - NTSTATUS status; - PLARGE_INTEGER Value; + PXENIFACE_SHAREDINFO_GET_TIME_OUT Out; + LARGE_INTEGER Time; + BOOLEAN Local; + NTSTATUS status; status = STATUS_INVALID_BUFFER_SIZE; if (InLen != 0) goto fail1; - if (OutLen != sizeof(LARGE_INTEGER)) + if (OutLen != sizeof(XENIFACE_SHAREDINFO_GET_TIME_OUT)) goto fail2; - Value = (PLARGE_INTEGER)Buffer; - *Value = XENBUS_SHARED_INFO(GetTime, &Fdo->SharedInfoInterface); - *Info = (ULONG_PTR)sizeof(LARGE_INTEGER); + Out = (PXENIFACE_SHAREDINFO_GET_TIME_OUT)Buffer; + XENBUS_SHARED_INFO(GetTime, &Fdo->SharedInfoInterface, &Time, + &Local); + Out->Time.dwHighDateTime = Time.HighPart; + Out->Time.dwLowDateTime = Time.LowPart; + Out->Local = Local; + *Info = (ULONG_PTR)sizeof(XENIFACE_SHAREDINFO_GET_TIME_OUT); return STATUS_SUCCESS; diff --git a/src/xeniface/wmi.c b/src/xeniface/wmi.c index d7e4bb7..f250429 100644 --- a/src/xeniface/wmi.c +++ b/src/xeniface/wmi.c @@ -1195,15 +1195,11 @@ RemoveSession(XENIFACE_FDO *fdoData, } void SessionsRemoveAll(XENIFACE_FDO *fdoData) { - Trace("lock"); LockSessions(fdoData); - Trace("in lock"); while (fdoData->SessionHead.Flink != &fdoData->SessionHead) { RemoveSessionLocked(fdoData, (XenStoreSession *)fdoData->SessionHead.Flink); } - Trace("unlock"); UnlockSessions(fdoData); - Trace("unlocked"); } @@ -2728,7 +2724,10 @@ GenerateBaseBlock( XENIFACE_FDO *fdoData, WNODE_FLAG_FIXED_INSTANCE_SIZE | WNODE_FLAG_PDO_INSTANCE_NAMES; if (fdoData->InterfacesAcquired) { - *time = XENBUS_SHARED_INFO(GetTime, &fdoData->SharedInfoInterface).QuadPart; + LARGE_INTEGER info; + + XENBUS_SHARED_INFO(GetTime, &fdoData->SharedInfoInterface, &info, NULL); + *time = info.QuadPart; } else { *time = 0; @@ -2772,7 +2771,10 @@ GenerateBaseInstance( return STATUS_WMI_ITEMID_NOT_FOUND; } if (fdoData->InterfacesAcquired) { - *time = XENBUS_SHARED_INFO(GetTime, &fdoData->SharedInfoInterface).QuadPart; + LARGE_INTEGER info; + + XENBUS_SHARED_INFO(GetTime, &fdoData->SharedInfoInterface, &info, NULL); + *time = info.QuadPart; } else { *time = 0; -- 2.5.3 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |