WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] PVWin: Fix warnings

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] PVWin: Fix warnings
From: Andy Grover <andy@xxxxxxxxxxxxxxxx>
Date: Fri, 02 Nov 2007 11:17:32 -0700
Cc: James Harper <james.harper@xxxxxxxxxxxxxxxx>
Delivery-date: Fri, 02 Nov 2007 11:18:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)
This patch cleans up some 80-odd warnings I was seeing when compiling
the xenpci driver, all completely trivial. It also replaces the use of
asm for calling cpuid with the __cpuid compiler intrinsic, and modifies
calling code accordingly.

I'm pretty sure my mailer going to mangle the inline patch (below) so
I'm attaching the pristine version. (will try to fix for next time)

-- Andy

---------
diff -r b26bdba50c41 common/include/evtchn_public.h
--- a/common/include/evtchn_public.h    Thu Nov 01 16:21:24 2007 -0700
+++ b/common/include/evtchn_public.h    Fri Nov 02 09:52:30 2007 -0700
@@ -21,7 +21,7 @@ DEFINE_GUID( GUID_XEN_IFACE_EVTCHN, 0xD2
 //{D2D20756-DE69-4447-8A7D-9837197D6166}

 typedef evtchn_port_t
-(*PXEN_EVTCHN_ALLOCUNBOUND)(int Domain);
+(*PXEN_EVTCHN_ALLOCUNBOUND)(domid_t Domain);

 typedef NTSTATUS
 (*PXEN_EVTCHN_BIND)(evtchn_port_t Port, PKSERVICE_ROUTINE
ServiceRoutine, PVOID ServiceContext);
diff -r b26bdba50c41 common/include/hypercall.h
--- a/common/include/hypercall.h        Thu Nov 01 16:21:24 2007 -0700
+++ b/common/include/hypercall.h        Fri Nov 02 09:52:30 2007 -0700
@@ -102,7 +102,7 @@ HYPERVISOR_console_io(int cmd, int count
 }

 static __inline int
-HYPERVISOR_hvm_op(int op, char *arg)
+HYPERVISOR_hvm_op(int op, struct xen_hvm_param *arg)
 {
   long __res;
   __asm {
diff -r b26bdba50c41 xenpci/evtchn.c
--- a/xenpci/evtchn.c   Thu Nov 01 16:21:24 2007 -0700
+++ b/xenpci/evtchn.c   Fri Nov 02 09:52:30 2007 -0700
@@ -35,7 +35,6 @@ BOOLEAN
 BOOLEAN
 EvtChn_InterruptDpc(WDFINTERRUPT Interrupt, WDFOBJECT AssociatedObject)
 {
-  int i;
   int cpu = 0;
   vcpu_info_t *vcpu_info;
   unsigned long evt_words, evt_word;
@@ -50,7 +49,7 @@ EvtChn_InterruptDpc(WDFINTERRUPT Interru

   vcpu_info = &shared_info_area->vcpu_info[cpu];

-  evt_words = _InterlockedExchange(&vcpu_info->evtchn_pending_sel, 0);
+  evt_words = _InterlockedExchange((volatile LONG
*)&vcpu_info->evtchn_pending_sel, 0);

   while (_BitScanForward(&evt_word, evt_words))
   {
@@ -68,7 +67,7 @@ EvtChn_InterruptDpc(WDFINTERRUPT Interru
         KdPrint((__DRIVER_NAME "     Calling Handler for port %d\n",
port));
         ev_action->ServiceRoutine(NULL, ev_action->ServiceContext);
       }
-      _interlockedbittestandreset(&shared_info_area->evtchn_pending[0],
port);
+      _interlockedbittestandreset((volatile LONG
*)&shared_info_area->evtchn_pending[0], port);
     }
   }
   KdPrint((__DRIVER_NAME " <-- InterruptDpc\n"));
@@ -81,7 +80,6 @@ EvtChn_Interrupt(WDFINTERRUPT Interrupt,
 {
   int cpu = 0;
   vcpu_info_t *vcpu_info;
-  int i;
   unsigned long evt_words, evt_word;
   unsigned long evt_bit;
   unsigned long port;
@@ -96,8 +94,8 @@ EvtChn_Interrupt(WDFINTERRUPT Interrupt,

   vcpu_info->evtchn_upcall_pending = 0;

-  evt_words = _InterlockedExchange(&vcpu_info->evtchn_pending_sel, 0);
-
+  evt_words = _InterlockedExchange((volatile LONG
*)&vcpu_info->evtchn_pending_sel, 0);
+
   while (_BitScanForward(&evt_word, evt_words))
   {
     evt_words &= ~(1 << evt_word);
@@ -114,7 +112,7 @@ EvtChn_Interrupt(WDFINTERRUPT Interrupt,
         KdPrint((__DRIVER_NAME "     Calling Handler for port %d\n",
port));
         ev_action->ServiceRoutine(NULL, ev_action->ServiceContext);
       }
-      _interlockedbittestandreset(&shared_info_area->evtchn_pending[0],
port);
+      _interlockedbittestandreset((volatile LONG
*)&shared_info_area->evtchn_pending[0], port);
     }
   }

@@ -124,7 +122,7 @@ EvtChn_Interrupt(WDFINTERRUPT Interrupt,
 }

 evtchn_port_t
-EvtChn_AllocUnbound(int Domain)
+EvtChn_AllocUnbound(domid_t Domain)
 {
   evtchn_alloc_unbound_t op;

@@ -178,7 +176,7 @@ EvtChn_Mask(evtchn_port_t Port)
 {
   //KdPrint((__DRIVER_NAME " --> EvtChn_Mask\n"));

-  _interlockedbittestandset(&shared_info_area->evtchn_mask[0], Port);
+  _interlockedbittestandset((volatile LONG
*)&shared_info_area->evtchn_mask[0], Port);

   //KdPrint((__DRIVER_NAME " <-- EvtChn_Mask\n"));

@@ -190,7 +188,7 @@ EvtChn_Unmask(evtchn_port_t Port)
 {
   KdPrint((__DRIVER_NAME " --> EvtChn_Unmask\n"));

-  _interlockedbittestandreset(&shared_info_area->evtchn_mask[0], Port);
+  _interlockedbittestandreset((volatile LONG
*)&shared_info_area->evtchn_mask[0], Port);
   // should we kick off pending interrupts here too???

   KdPrint((__DRIVER_NAME " <-- EvtChn_Unmask\n"));
@@ -242,7 +240,7 @@ EvtChn_GetXenStoreRingAddr()
   xen_store_mfn = (ULONG)hvm_get_parameter(HVM_PARAM_STORE_PFN);

   pa_xen_store_interface.QuadPart = xen_store_mfn << PAGE_SHIFT;
-  xen_store_interface = (struct xenstore_domain_interface
*)MmMapIoSpace(pa_xen_store_interface, PAGE_SIZE, MmNonCached);
+  xen_store_interface = MmMapIoSpace(pa_xen_store_interface, PAGE_SIZE,
MmNonCached);

   //KdPrint((__DRIVER_NAME " xen_store_mfn = %08x\n", xen_store_mfn));
   //KdPrint((__DRIVER_NAME " xen_store_evtchn = %08x\n",
xen_store_evtchn));
@@ -273,6 +271,8 @@ EvtChn_Init()
   }
   shared_info_area->vcpu_info[0].evtchn_upcall_pending = 0;
   shared_info_area->vcpu_info[0].evtchn_pending_sel = 0;
+
+  return STATUS_SUCCESS;
 }

 static ev_action_t ev_actions[NR_EVENTS];
diff -r b26bdba50c41 xenpci/gnttbl.c
--- a/xenpci/gnttbl.c   Thu Nov 01 16:21:24 2007 -0700
+++ b/xenpci/gnttbl.c   Fri Nov 02 09:52:30 2007 -0700
@@ -63,7 +63,7 @@ GntTab_Map(unsigned int start_idx, unsig
     xatp.domid = DOMID_SELF;
     xatp.idx = i;
     xatp.space = XENMAPSPACE_grant_table;
-    xatp.gpfn = (gnttab_table_physical.QuadPart >> PAGE_SHIFT) + i;
+    xatp.gpfn = (xen_pfn_t)(gnttab_table_physical.QuadPart >>
PAGE_SHIFT) + i;
     if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
       KdPrint((__DRIVER_NAME "     ***ERROR MAPPING FRAME***\n"));
   } while (i-- > start_idx);
@@ -74,11 +74,7 @@ VOID
 VOID
 GntTbl_Init()
 {
-  struct gnttab_setup_table setup;
-  unsigned long *frames;
   int i;
-  PMDL Mdl;
-  ULONG ret;

   KdPrint((__DRIVER_NAME " --> GntTbl_Init\n"));

@@ -108,7 +104,7 @@ GntTbl_GrantAccess(domid_t domid, unsign
   gnttab_table[ref].domid = domid;
   _WriteBarrier();
   readonly *= GTF_readonly;
-  gnttab_table[ref].flags = GTF_permit_access | readonly;
+  gnttab_table[ref].flags = GTF_permit_access | (uint16_t)readonly;

   KdPrint((__DRIVER_NAME " <-- GntTbl_GrantAccess (ref = %d)\n", ref));

@@ -128,7 +124,7 @@ GntTbl_EndAccess(grant_ref_t ref)
       KdPrint((__DRIVER_NAME "WARNING: g.e. still in use!\n"));
       return FALSE;
     }
-  } while ((nflags =
InterlockedCompareExchange16(&gnttab_table[ref].flags, flags, 0)) != flags);
+  } while ((nflags = InterlockedCompareExchange16((volatile SHORT
*)&gnttab_table[ref].flags, flags, 0)) != flags);

   put_free_entry(ref);
   return TRUE;
diff -r b26bdba50c41 xenpci/xenbus.c
--- a/xenpci/xenbus.c   Thu Nov 01 16:21:24 2007 -0700
+++ b/xenpci/xenbus.c   Fri Nov 02 09:52:30 2007 -0700
@@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fi
 #include "xenpci.h"
 #include "io/xs_wire.h"
 #include <stdlib.h>
+
+#pragma warning( disable : 4204 )
+#pragma warning( disable : 4221 )

 struct xenbus_req_info
 {
@@ -85,7 +88,7 @@ static int allocate_xenbus_id(void)

   KdPrint((__DRIVER_NAME " --> allocate_xenbus_id\n"));

-  while (1)
+  for (;;)
   {
 //    spin_lock(&req_lock);
     if (nr_live_reqs < NR_REQS)
@@ -95,6 +98,7 @@ static int allocate_xenbus_id(void)
   }

   o_probe = probe;
+
   for (;;)
   {
     if (!req_info[o_probe].In_Use)
@@ -179,11 +183,11 @@ static void xb_write(int type, int req_i
 {
   XENSTORE_RING_IDX prod;
   int r;
-  int len = 0;
+  size_t len = 0;
   const struct write_req *cur_req;
-  int req_off;
-  int total_off;
-  int this_chunk;
+  size_t req_off;
+  size_t total_off;
+  size_t this_chunk;
   struct xsd_sockmsg m = {type, req_id, trans_id };
   struct write_req header_req = { &m, sizeof(m) };

@@ -347,16 +351,15 @@ char* xenbus_wait_for_value(const char*
 //    else
 //      wait_for_watch();
 //    }
-    return NULL;
+  UNREFERENCED_PARAMETER(path);
+  UNREFERENCED_PARAMETER(value);
+
+  return NULL;
 }

 NTSTATUS
 XenBus_Init()
 {
-  OBJECT_ATTRIBUTES oa;
-  NTSTATUS status;
-  int i;
-
   KdPrint((__DRIVER_NAME " --> XenBus_Init\n"));

   xen_store_evtchn = EvtChn_GetXenStorePort();
@@ -417,6 +420,8 @@ XenBus_Stop()
   // Does this actually stop the threads???
   ZwClose(XenBus_WatchThreadHandle);
   ZwClose(XenBus_ReadThreadHandle);
+
+  return STATUS_SUCCESS;
 }

 char *
@@ -424,7 +429,7 @@ XenBus_List(xenbus_transaction_t xbt, co
 {
   struct xsd_sockmsg *reply, *repmsg;
   struct write_req req[] = { { pre, strlen(pre)+1 } };
-  int nr_elems, x, i;
+  ULONG nr_elems, x, i;
   char **res;
   char *msg;

@@ -488,7 +493,10 @@ XenBus_ReadThreadProc(PVOID StartContext
   char *payload;
   char *path, *token;

-  while(TRUE) {
+  UNREFERENCED_PARAMETER(StartContext);
+
+  for (;;)
+  {
     KeWaitForSingleObject(&XenBus_ReadThreadEvent, Executive,
KernelMode, FALSE, NULL);
     KdPrint((__DRIVER_NAME "     ReadThread Woken (Count = %d)\n",
ReadThreadWaitCount++));
     while (xen_store_interface->rsp_prod !=
xen_store_interface->rsp_cons) {
@@ -553,7 +561,9 @@ XenBus_WatchThreadProc(PVOID StartContex
   int index;
   PXENBUS_WATCH_ENTRY entry;

-  while(TRUE)
+  UNREFERENCED_PARAMETER(StartContext);
+
+  for (;;)
   {
     KeWaitForSingleObject(&XenBus_WatchThreadEvent, Executive,
KernelMode, FALSE, NULL);
     while (XenBus_WatchRingReadIndex != XenBus_WatchRingWriteIndex)
@@ -606,7 +616,7 @@ XenBus_AddWatch(xenbus_transaction_t xbt
   req[0].data = Path;
   req[0].len = strlen(Path) + 1;

-  sprintf(Token, "%d", i);
+  RtlStringCbPrintfA(Token, ARRAY_SIZE(Token), "%d", i);
   req[1].data = Token;
   req[1].len = strlen(Token) + 1;

@@ -656,7 +666,7 @@ XenBus_RemWatch(xenbus_transaction_t xbt
   req[0].data = Path;
   req[0].len = strlen(Path) + 1;

-  sprintf(Token, "%d", i);
+  RtlStringCbPrintfA(Token, ARRAY_SIZE(Token), "%d", i);
   req[1].data = Token;
   req[1].len = strlen(Token) + 1;

@@ -755,6 +765,9 @@ XenBus_Interrupt(PKINTERRUPT Interrupt,
   KeSetEvent(&XenBus_ReadThreadEvent, 1, FALSE);

   KdPrint((__DRIVER_NAME " <-- XenBus_Interrupt\n"));
+
+  /* is this right? */
+  return TRUE;
 }

 char *
@@ -764,7 +777,7 @@ XenBus_Printf(xenbus_transaction_t xbt,
   char buf[1024];

   va_start(ap, fmt);
-  vsprintf(buf, fmt, ap);
+  RtlStringCbVPrintfA(buf, ARRAY_SIZE(buf), fmt, ap);
   va_end(ap);
   return XenBus_Write(xbt, path, buf);
 }
\ No newline at end of file
diff -r b26bdba50c41 xenpci/xenpci.c
--- a/xenpci/xenpci.c   Thu Nov 01 16:21:24 2007 -0700
+++ b/xenpci/xenpci.c   Fri Nov 02 09:52:30 2007 -0700
@@ -96,29 +96,6 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   return status;
 }

-typedef struct {
-     unsigned nEAX;
-     unsigned nEBX;
-     unsigned nECX;
-     unsigned nEDX;
-} CPUID_Output, *PCPUID_Output;
-
-static void CPUID(PCPUID_Output pResult, int nFunction)
-{
-  __asm {
-    mov eax, nFunction
-    xor ebx, ebx
-    xor ecx, ebx
-    xor edx, ebx
-    cpuid
-    mov edi, pResult
-    mov [edi.nEAX], eax
-    mov [edi.nEBX], ebx
-    mov [edi.nECX], ecx
-    mov [edi.nEDX], edx
-  }
-}
-
 static void WRMSR(unsigned int msr, ULONGLONG val)
 {
   ULONG lo, hi;
@@ -135,22 +112,22 @@ static int
 static int
 get_hypercall_stubs()
 {
-  CPUID_Output cpuid_output;
+  DWORD32 cpuid_output[4];
   char xensig[13];
   ULONG i;
   ULONG pages;
   ULONG msr;

-  CPUID(&cpuid_output, 0x40000000);
-  *(ULONG*)(xensig + 0) = cpuid_output.nEBX;
-  *(ULONG*)(xensig + 4) = cpuid_output.nECX;
-  *(ULONG*)(xensig + 8) = cpuid_output.nEDX;
-  xensig[12] = 0;
-  KdPrint((__DRIVER_NAME " Xen Signature = %s, EAX = 0x%08x\n", xensig,
cpuid_output.nEAX));
+  __cpuid(cpuid_output, 0x40000000);
+  *(ULONG*)(xensig + 0) = cpuid_output[1];
+  *(ULONG*)(xensig + 4) = cpuid_output[2];
+  *(ULONG*)(xensig + 8) = cpuid_output[3];
+  xensig[12] = '\0';
+  KdPrint((__DRIVER_NAME " Xen Signature = %s, EAX = 0x%08x\n", xensig,
cpuid_output[0]));

-  CPUID(&cpuid_output, 0x40000002);
-  pages = cpuid_output.nEAX;
-  msr = cpuid_output.nEBX;
+  __cpuid(cpuid_output, 0x40000002);
+  pages = cpuid_output[0];
+  msr = cpuid_output[1];
   KdPrint((__DRIVER_NAME " Hypercall area is %u pages.\n", pages));

   hypercall_stubs = ExAllocatePoolWithTag(NonPagedPool, pages *
PAGE_SIZE, XENPCI_POOL_TAG);
@@ -261,7 +238,6 @@ XenPCI_AddDevice(
   WDF_IO_QUEUE_CONFIG ioQConfig;
   WDF_INTERRUPT_CONFIG interruptConfig;
   PNP_BUS_INFORMATION busInfo;
-  WDF_FDO_EVENT_CALLBACKS FdoCallbacks;

   //PDEVICE_OBJECT pdo;
   //ULONG propertyAddress, length;
@@ -371,7 +347,8 @@ XenPCI_PrepareHardware(
   NTSTATUS status = STATUS_SUCCESS;
   PCM_PARTIAL_RESOURCE_DESCRIPTOR descriptor;
   ULONG i;
-  PXENPCI_DEVICE_DATA deviceData = GetDeviceData(Device);
+
+  UNREFERENCED_PARAMETER(Device);

   KdPrint((__DRIVER_NAME " --> EvtDevicePrepareHardware\n"));

@@ -457,6 +434,8 @@ XenPCI_ReleaseHardware(WDFDEVICE Device,
 {
   UNREFERENCED_PARAMETER(Device);
   UNREFERENCED_PARAMETER(ResourcesTranslated);
+
+  return STATUS_SUCCESS;
 }

 static NTSTATUS
@@ -483,13 +462,13 @@ XenPCI_D0EntryPostInterruptsEnabled(WDFD
 XenPCI_D0EntryPostInterruptsEnabled(WDFDEVICE  Device,
WDF_POWER_DEVICE_STATE PreviousState)
 {
   NTSTATUS status = STATUS_SUCCESS;
-  OBJECT_ATTRIBUTES oa;
+  //OBJECT_ATTRIBUTES oa;
   char *response;
   char *msgTypes;
   char **Types;
-  char *msgInstances;
-  char **Instances;
-  int i, j;
+  //char *msgInstances;
+  //char **Instances;
+  int i;
   char buffer[128];

   UNREFERENCED_PARAMETER(Device);
@@ -513,7 +492,7 @@ XenPCI_D0EntryPostInterruptsEnabled(WDFD
   if (!msgTypes) {
     for (i = 0; Types[i]; i++)
     {
-      sprintf(buffer, "device/%s", Types[i]);
+      RtlStringCbPrintfA(buffer, ARRAY_SIZE(buffer), "device/%s",
Types[i]);
       KdPrint((__DRIVER_NAME "     ls device[%d] -> %s\n", i, Types[i]));
       XenPCI_XenBusWatchHandler(buffer, NULL);
       ExFreePoolWithTag(Types[i], XENPCI_POOL_TAG);
@@ -536,9 +515,12 @@ XenPCI_D0EntryPostInterruptsEnabled(WDFD
 }

 static NTSTATUS
-XenPCI_D0ExitPreInterruptsDisabled(WDFDEVICE  Device,
WDF_POWER_DEVICE_STATE TargetState)
+XenPCI_D0ExitPreInterruptsDisabled(WDFDEVICE Device,
WDF_POWER_DEVICE_STATE TargetState)
 {
   NTSTATUS status = STATUS_SUCCESS;
+
+  UNREFERENCED_PARAMETER(Device);
+  UNREFERENCED_PARAMETER(TargetState);

   XenBus_Stop();

@@ -586,6 +568,8 @@ XenPCI_InterruptEnable(WDFINTERRUPT Inte
   shared_info_area->vcpu_info[0].evtchn_upcall_mask = 0;

   KdPrint((__DRIVER_NAME " <-- EvtInterruptEnable\n"));
+
+  return STATUS_SUCCESS;
 }

 static NTSTATUS
@@ -599,6 +583,8 @@ XenPCI_InterruptDisable(WDFINTERRUPT Int
   shared_info_area->vcpu_info[0].evtchn_upcall_mask = 1;

   KdPrint((__DRIVER_NAME " <-- EvtInterruptDisable\n"));
+
+  return STATUS_SUCCESS;
 }

 static NTSTATUS
@@ -611,13 +597,14 @@ XenPCI_ChildListCreateDevice(WDFCHILDLIS
   XEN_IFACE_XENBUS XenBusInterface;
   XEN_IFACE_XEN XenInterface;
   XEN_IFACE_GNTTBL GntTblInterface;
-  UNICODE_STRING DeviceId;
   DECLARE_UNICODE_STRING_SIZE(buffer, 20);
   WDF_OBJECT_ATTRIBUTES PdoAttributes;
   DECLARE_CONST_UNICODE_STRING(DeviceLocation, L"Xen Bus");
   WDF_QUERY_INTERFACE_CONFIG  qiConfig;
-  WDF_PDO_EVENT_CALLBACKS PdoCallbacks;
   PXENPCI_XEN_DEVICE_DATA ChildDeviceData = NULL;
+  size_t path_len;
+
+  UNREFERENCED_PARAMETER(ChildList);

   KdPrint((__DRIVER_NAME " --> ChildListCreateDevice\n"));

@@ -704,8 +691,12 @@ XenPCI_ChildListCreateDevice(WDFCHILDLIS

   XenBusInterface.InterfaceHeader.Size = sizeof(XenBusInterface);
   XenBusInterface.InterfaceHeader.Version = 1;
-  XenBusInterface.InterfaceHeader.Context =
ExAllocatePoolWithTag(NonPagedPool, (strlen(XenIdentificationDesc->Path)
+ 1), XENPCI_POOL_TAG);
-  strcpy(XenBusInterface.InterfaceHeader.Context,
XenIdentificationDesc->Path);
+  path_len = strlen(XenIdentificationDesc->Path) + 1;
+  XenBusInterface.InterfaceHeader.Context =
ExAllocatePoolWithTag(NonPagedPool,
+    path_len, XENPCI_POOL_TAG);
+  /* TODO: check for alloc fail here */
+  RtlStringCbCopyA(XenBusInterface.InterfaceHeader.Context, path_len,
+    XenIdentificationDesc->Path);
   XenBusInterface.Read = XenBus_Read;
   XenBusInterface.Write = XenBus_Write;
   XenBusInterface.Printf = XenBus_Printf;
@@ -765,7 +756,6 @@ XenPCI_XenBusWatchHandler(char *Path, PV
   XENPCI_IDENTIFICATION_DESCRIPTION description;
   NTSTATUS status;
   int i;
-  char *NamePtr;
   char **Bits;
   int Count;
   WDFCHILDLIST ChildList;
@@ -773,8 +763,9 @@ XenPCI_XenBusWatchHandler(char *Path, PV
   WDFDEVICE ChildDevice;
   PXENPCI_XEN_DEVICE_DATA ChildDeviceData;

-
   ANSI_STRING AnsiBuf;
+
+  UNREFERENCED_PARAMETER(Data);

   KdPrint((__DRIVER_NAME " --> HotPlugHandler\n"));

@@ -830,8 +821,6 @@ XenPCI_XenBusWatchHandler(char *Path, PV
   ExFreePoolWithTag(Bits, XENPCI_POOL_TAG);

   KdPrint((__DRIVER_NAME " <-- HotPlugHandler\n"));
-
-  return status;
 }

 static void
@@ -840,6 +829,9 @@ XenBus_ShutdownHandler(char *Path, PVOID
   char *value;
   xenbus_transaction_t xbt;
   int retry;
+
+  UNREFERENCED_PARAMETER(Path);
+  UNREFERENCED_PARAMETER(StartContext);

   KdPrint((__DRIVER_NAME " --> XenBus_ShutdownHandler\n"));

@@ -853,7 +845,7 @@ XenBus_ShutdownHandler(char *Path, PVOID
   if (value != NULL && strlen(value) != 0)
     XenBus_Write(XBT_NIL, SHUTDOWN_PATH, "");

-  XenBus_EndTransaction(&xbt, 0, &retry);
+  XenBus_EndTransaction(xbt, 0, &retry);

   KdPrint((__DRIVER_NAME " <-- XenBus_ShutdownHandler\n"));
 }
@@ -867,8 +859,11 @@ XenPCI_FilterRemoveResourceRequirements(
   WDFIORESLIST ResourceList;
   PIO_RESOURCE_DESCRIPTOR Descriptor;

-  int i, j;
+  ULONG i;
+  ULONG j;
   int offset;
+
+  UNREFERENCED_PARAMETER(Device);

   KdPrint((__DRIVER_NAME " --> FilterRemoveResourceRequirements\n"));

@@ -927,7 +922,10 @@ XenPCI_FilterAddResourceRequirements(WDF
   WDFIORESLIST ResourceList;
   PIO_RESOURCE_DESCRIPTOR Descriptor;

-  int i, j;
+  ULONG i;
+  ULONG j;
+
+  UNREFERENCED_PARAMETER(Device);

   KdPrint((__DRIVER_NAME " --> FilterAddResourceRequirements\n"));

@@ -981,6 +979,10 @@ static NTSTATUS
 static NTSTATUS
 XenPCI_RemoveAddedResources(WDFDEVICE Device, WDFCMRESLIST
ResourcesRaw, WDFCMRESLIST ResourcesTranslated)
 {
+  UNREFERENCED_PARAMETER(Device);
+  UNREFERENCED_PARAMETER(ResourcesRaw);
+  UNREFERENCED_PARAMETER(ResourcesTranslated);
+
   KdPrint((__DRIVER_NAME " --> RemoveAddedResources\n"));
   KdPrint((__DRIVER_NAME " <-- RemoveAddedResources\n"));

@@ -993,6 +995,8 @@ XenPCI_DeviceResourceRequirementsQuery(W
   NTSTATUS  status;
   WDFIORESLIST resourceList;
   IO_RESOURCE_DESCRIPTOR descriptor;
+
+  UNREFERENCED_PARAMETER(Device);

   KdPrint((__DRIVER_NAME " --> DeviceResourceRequirementsQuery\n"));

diff -r b26bdba50c41 xenpci/xenpci.h
--- a/xenpci/xenpci.h   Thu Nov 01 16:21:24 2007 -0700
+++ b/xenpci/xenpci.h   Fri Nov 02 09:52:30 2007 -0700
@@ -193,7 +193,7 @@ NTSTATUS
 NTSTATUS
 EvtChn_Notify(evtchn_port_t Port);
 evtchn_port_t
-EvtChn_AllocUnbound(int Domain);
+EvtChn_AllocUnbound(domid_t Domain);
 NTSTATUS
 EvtChn_Init();

@@ -202,7 +202,7 @@ BOOLEAN
 BOOLEAN
 GntTbl_EndAccess(grant_ref_t ref);

-NTSTATUS
+evtchn_port_t
 EvtChn_GetXenStorePort();
 PVOID
 EvtChn_GetXenStoreRingAddr();
diff -r b26bdba50c41 common/include/evtchn_public.h
--- a/common/include/evtchn_public.h    Thu Nov 01 16:21:24 2007 -0700
+++ b/common/include/evtchn_public.h    Fri Nov 02 09:52:30 2007 -0700
@@ -21,7 +21,7 @@ DEFINE_GUID( GUID_XEN_IFACE_EVTCHN, 0xD2
 //{D2D20756-DE69-4447-8A7D-9837197D6166}
 
 typedef evtchn_port_t
-(*PXEN_EVTCHN_ALLOCUNBOUND)(int Domain);
+(*PXEN_EVTCHN_ALLOCUNBOUND)(domid_t Domain);
 
 typedef NTSTATUS
 (*PXEN_EVTCHN_BIND)(evtchn_port_t Port, PKSERVICE_ROUTINE ServiceRoutine, 
PVOID ServiceContext);
diff -r b26bdba50c41 common/include/hypercall.h
--- a/common/include/hypercall.h        Thu Nov 01 16:21:24 2007 -0700
+++ b/common/include/hypercall.h        Fri Nov 02 09:52:30 2007 -0700
@@ -102,7 +102,7 @@ HYPERVISOR_console_io(int cmd, int count
 }
 
 static __inline int
-HYPERVISOR_hvm_op(int op, char *arg)
+HYPERVISOR_hvm_op(int op, struct xen_hvm_param *arg)
 {
   long __res;
   __asm {
diff -r b26bdba50c41 xenpci/evtchn.c
--- a/xenpci/evtchn.c   Thu Nov 01 16:21:24 2007 -0700
+++ b/xenpci/evtchn.c   Fri Nov 02 09:52:30 2007 -0700
@@ -35,7 +35,6 @@ BOOLEAN
 BOOLEAN
 EvtChn_InterruptDpc(WDFINTERRUPT Interrupt, WDFOBJECT AssociatedObject)
 {
-  int i;
   int cpu = 0;
   vcpu_info_t *vcpu_info;
   unsigned long evt_words, evt_word;
@@ -50,7 +49,7 @@ EvtChn_InterruptDpc(WDFINTERRUPT Interru
 
   vcpu_info = &shared_info_area->vcpu_info[cpu];
 
-  evt_words = _InterlockedExchange(&vcpu_info->evtchn_pending_sel, 0);
+  evt_words = _InterlockedExchange((volatile LONG 
*)&vcpu_info->evtchn_pending_sel, 0);
   
   while (_BitScanForward(&evt_word, evt_words))
   {
@@ -68,7 +67,7 @@ EvtChn_InterruptDpc(WDFINTERRUPT Interru
         KdPrint((__DRIVER_NAME "     Calling Handler for port %d\n", port));
         ev_action->ServiceRoutine(NULL, ev_action->ServiceContext);
       }
-      _interlockedbittestandreset(&shared_info_area->evtchn_pending[0], port);
+      _interlockedbittestandreset((volatile LONG 
*)&shared_info_area->evtchn_pending[0], port);
     }
   }
   KdPrint((__DRIVER_NAME " <-- InterruptDpc\n"));
@@ -81,7 +80,6 @@ EvtChn_Interrupt(WDFINTERRUPT Interrupt,
 {
   int cpu = 0;
   vcpu_info_t *vcpu_info;
-  int i;
   unsigned long evt_words, evt_word;
   unsigned long evt_bit;
   unsigned long port;
@@ -96,8 +94,8 @@ EvtChn_Interrupt(WDFINTERRUPT Interrupt,
 
   vcpu_info->evtchn_upcall_pending = 0;
 
-  evt_words = _InterlockedExchange(&vcpu_info->evtchn_pending_sel, 0);
-  
+  evt_words = _InterlockedExchange((volatile LONG 
*)&vcpu_info->evtchn_pending_sel, 0);
+
   while (_BitScanForward(&evt_word, evt_words))
   {
     evt_words &= ~(1 << evt_word);
@@ -114,7 +112,7 @@ EvtChn_Interrupt(WDFINTERRUPT Interrupt,
         KdPrint((__DRIVER_NAME "     Calling Handler for port %d\n", port));
         ev_action->ServiceRoutine(NULL, ev_action->ServiceContext);
       }
-      _interlockedbittestandreset(&shared_info_area->evtchn_pending[0], port);
+      _interlockedbittestandreset((volatile LONG 
*)&shared_info_area->evtchn_pending[0], port);
     }
   }
 
@@ -124,7 +122,7 @@ EvtChn_Interrupt(WDFINTERRUPT Interrupt,
 }
 
 evtchn_port_t
-EvtChn_AllocUnbound(int Domain)
+EvtChn_AllocUnbound(domid_t Domain)
 {
   evtchn_alloc_unbound_t op;
 
@@ -178,7 +176,7 @@ EvtChn_Mask(evtchn_port_t Port)
 {
   //KdPrint((__DRIVER_NAME " --> EvtChn_Mask\n"));
 
-  _interlockedbittestandset(&shared_info_area->evtchn_mask[0], Port);
+  _interlockedbittestandset((volatile LONG 
*)&shared_info_area->evtchn_mask[0], Port);
 
   //KdPrint((__DRIVER_NAME " <-- EvtChn_Mask\n"));
 
@@ -190,7 +188,7 @@ EvtChn_Unmask(evtchn_port_t Port)
 {
   KdPrint((__DRIVER_NAME " --> EvtChn_Unmask\n"));
 
-  _interlockedbittestandreset(&shared_info_area->evtchn_mask[0], Port);
+  _interlockedbittestandreset((volatile LONG 
*)&shared_info_area->evtchn_mask[0], Port);
   // should we kick off pending interrupts here too???
 
   KdPrint((__DRIVER_NAME " <-- EvtChn_Unmask\n"));
@@ -242,7 +240,7 @@ EvtChn_GetXenStoreRingAddr()
   xen_store_mfn = (ULONG)hvm_get_parameter(HVM_PARAM_STORE_PFN);
 
   pa_xen_store_interface.QuadPart = xen_store_mfn << PAGE_SHIFT;
-  xen_store_interface = (struct xenstore_domain_interface 
*)MmMapIoSpace(pa_xen_store_interface, PAGE_SIZE, MmNonCached);
+  xen_store_interface = MmMapIoSpace(pa_xen_store_interface, PAGE_SIZE, 
MmNonCached);
 
   //KdPrint((__DRIVER_NAME " xen_store_mfn = %08x\n", xen_store_mfn));
   //KdPrint((__DRIVER_NAME " xen_store_evtchn = %08x\n", xen_store_evtchn));
@@ -273,6 +271,8 @@ EvtChn_Init()
   }
   shared_info_area->vcpu_info[0].evtchn_upcall_pending = 0;
   shared_info_area->vcpu_info[0].evtchn_pending_sel = 0;
+
+  return STATUS_SUCCESS;
 }
 
 static ev_action_t ev_actions[NR_EVENTS];
diff -r b26bdba50c41 xenpci/gnttbl.c
--- a/xenpci/gnttbl.c   Thu Nov 01 16:21:24 2007 -0700
+++ b/xenpci/gnttbl.c   Fri Nov 02 09:52:30 2007 -0700
@@ -63,7 +63,7 @@ GntTab_Map(unsigned int start_idx, unsig
     xatp.domid = DOMID_SELF;
     xatp.idx = i;
     xatp.space = XENMAPSPACE_grant_table;
-    xatp.gpfn = (gnttab_table_physical.QuadPart >> PAGE_SHIFT) + i;
+    xatp.gpfn = (xen_pfn_t)(gnttab_table_physical.QuadPart >> PAGE_SHIFT) + i;
     if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
       KdPrint((__DRIVER_NAME "     ***ERROR MAPPING FRAME***\n"));
   } while (i-- > start_idx);
@@ -74,11 +74,7 @@ VOID
 VOID
 GntTbl_Init()
 {
-  struct gnttab_setup_table setup;
-  unsigned long *frames;
   int i;
-  PMDL Mdl;
-  ULONG ret;
 
   KdPrint((__DRIVER_NAME " --> GntTbl_Init\n"));
 
@@ -108,7 +104,7 @@ GntTbl_GrantAccess(domid_t domid, unsign
   gnttab_table[ref].domid = domid;
   _WriteBarrier();
   readonly *= GTF_readonly;
-  gnttab_table[ref].flags = GTF_permit_access | readonly;
+  gnttab_table[ref].flags = GTF_permit_access | (uint16_t)readonly;
 
   KdPrint((__DRIVER_NAME " <-- GntTbl_GrantAccess (ref = %d)\n", ref));
 
@@ -128,7 +124,7 @@ GntTbl_EndAccess(grant_ref_t ref)
       KdPrint((__DRIVER_NAME "WARNING: g.e. still in use!\n"));
       return FALSE;
     }
-  } while ((nflags = InterlockedCompareExchange16(&gnttab_table[ref].flags, 
flags, 0)) != flags);
+  } while ((nflags = InterlockedCompareExchange16((volatile SHORT 
*)&gnttab_table[ref].flags, flags, 0)) != flags);
 
   put_free_entry(ref);
   return TRUE;
diff -r b26bdba50c41 xenpci/xenbus.c
--- a/xenpci/xenbus.c   Thu Nov 01 16:21:24 2007 -0700
+++ b/xenpci/xenbus.c   Fri Nov 02 09:52:30 2007 -0700
@@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fi
 #include "xenpci.h"
 #include "io/xs_wire.h"
 #include <stdlib.h>
+
+#pragma warning( disable : 4204 ) 
+#pragma warning( disable : 4221 ) 
 
 struct xenbus_req_info
 {
@@ -85,7 +88,7 @@ static int allocate_xenbus_id(void)
 
   KdPrint((__DRIVER_NAME " --> allocate_xenbus_id\n"));
 
-  while (1)
+  for (;;)
   {
 //    spin_lock(&req_lock);
     if (nr_live_reqs < NR_REQS)
@@ -95,6 +98,7 @@ static int allocate_xenbus_id(void)
   }
 
   o_probe = probe;
+
   for (;;)
   {
     if (!req_info[o_probe].In_Use)
@@ -179,11 +183,11 @@ static void xb_write(int type, int req_i
 {
   XENSTORE_RING_IDX prod;
   int r;
-  int len = 0;
+  size_t len = 0;
   const struct write_req *cur_req;
-  int req_off;
-  int total_off;
-  int this_chunk;
+  size_t req_off;
+  size_t total_off;
+  size_t this_chunk;
   struct xsd_sockmsg m = {type, req_id, trans_id };
   struct write_req header_req = { &m, sizeof(m) };
 
@@ -347,16 +351,15 @@ char* xenbus_wait_for_value(const char* 
 //    else
 //      wait_for_watch();
 //    }
-    return NULL;
+  UNREFERENCED_PARAMETER(path);
+  UNREFERENCED_PARAMETER(value);
+
+  return NULL;
 }
 
 NTSTATUS
 XenBus_Init()
 {
-  OBJECT_ATTRIBUTES oa;
-  NTSTATUS status;
-  int i;
-
   KdPrint((__DRIVER_NAME " --> XenBus_Init\n"));
 
   xen_store_evtchn = EvtChn_GetXenStorePort();
@@ -417,6 +420,8 @@ XenBus_Stop()
   // Does this actually stop the threads???
   ZwClose(XenBus_WatchThreadHandle);
   ZwClose(XenBus_ReadThreadHandle);
+
+  return STATUS_SUCCESS;
 }
 
 char *
@@ -424,7 +429,7 @@ XenBus_List(xenbus_transaction_t xbt, co
 {
   struct xsd_sockmsg *reply, *repmsg;
   struct write_req req[] = { { pre, strlen(pre)+1 } };
-  int nr_elems, x, i;
+  ULONG nr_elems, x, i;
   char **res;
   char *msg;
 
@@ -488,7 +493,10 @@ XenBus_ReadThreadProc(PVOID StartContext
   char *payload;
   char *path, *token;
 
-  while(TRUE) {
+  UNREFERENCED_PARAMETER(StartContext);
+
+  for (;;)
+  {
     KeWaitForSingleObject(&XenBus_ReadThreadEvent, Executive, KernelMode, 
FALSE, NULL);
     KdPrint((__DRIVER_NAME "     ReadThread Woken (Count = %d)\n", 
ReadThreadWaitCount++));
     while (xen_store_interface->rsp_prod != xen_store_interface->rsp_cons) {
@@ -553,7 +561,9 @@ XenBus_WatchThreadProc(PVOID StartContex
   int index;
   PXENBUS_WATCH_ENTRY entry;
 
-  while(TRUE)
+  UNREFERENCED_PARAMETER(StartContext);
+
+  for (;;)
   {
     KeWaitForSingleObject(&XenBus_WatchThreadEvent, Executive, KernelMode, 
FALSE, NULL);
     while (XenBus_WatchRingReadIndex != XenBus_WatchRingWriteIndex)
@@ -606,7 +616,7 @@ XenBus_AddWatch(xenbus_transaction_t xbt
   req[0].data = Path;
   req[0].len = strlen(Path) + 1;
 
-  sprintf(Token, "%d", i);
+  RtlStringCbPrintfA(Token, ARRAY_SIZE(Token), "%d", i);
   req[1].data = Token;
   req[1].len = strlen(Token) + 1;
 
@@ -656,7 +666,7 @@ XenBus_RemWatch(xenbus_transaction_t xbt
   req[0].data = Path;
   req[0].len = strlen(Path) + 1;
 
-  sprintf(Token, "%d", i);
+  RtlStringCbPrintfA(Token, ARRAY_SIZE(Token), "%d", i);
   req[1].data = Token;
   req[1].len = strlen(Token) + 1;
 
@@ -755,6 +765,9 @@ XenBus_Interrupt(PKINTERRUPT Interrupt, 
   KeSetEvent(&XenBus_ReadThreadEvent, 1, FALSE);
 
   KdPrint((__DRIVER_NAME " <-- XenBus_Interrupt\n"));
+
+  /* is this right? */
+  return TRUE;
 }
 
 char *
@@ -764,7 +777,7 @@ XenBus_Printf(xenbus_transaction_t xbt, 
   char buf[1024];
 
   va_start(ap, fmt);
-  vsprintf(buf, fmt, ap);
+  RtlStringCbVPrintfA(buf, ARRAY_SIZE(buf), fmt, ap);
   va_end(ap);
   return XenBus_Write(xbt, path, buf);
 }
\ No newline at end of file
diff -r b26bdba50c41 xenpci/xenpci.c
--- a/xenpci/xenpci.c   Thu Nov 01 16:21:24 2007 -0700
+++ b/xenpci/xenpci.c   Fri Nov 02 09:52:30 2007 -0700
@@ -96,29 +96,6 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   return status;
 }
 
-typedef struct {
-     unsigned nEAX;
-     unsigned nEBX;
-     unsigned nECX;
-     unsigned nEDX;
-} CPUID_Output, *PCPUID_Output;
-
-static void CPUID(PCPUID_Output pResult, int nFunction)
-{
-  __asm {
-    mov eax, nFunction
-    xor ebx, ebx
-    xor ecx, ebx
-    xor edx, ebx
-    cpuid
-    mov edi, pResult
-    mov [edi.nEAX], eax
-    mov [edi.nEBX], ebx
-    mov [edi.nECX], ecx
-    mov [edi.nEDX], edx
-  }
-}
-
 static void WRMSR(unsigned int msr, ULONGLONG val)
 {
   ULONG lo, hi;
@@ -135,22 +112,22 @@ static int
 static int
 get_hypercall_stubs()
 {
-  CPUID_Output cpuid_output;
+  DWORD32 cpuid_output[4];
   char xensig[13];
   ULONG i;
   ULONG pages;
   ULONG msr;  
 
-  CPUID(&cpuid_output, 0x40000000);
-  *(ULONG*)(xensig + 0) = cpuid_output.nEBX;
-  *(ULONG*)(xensig + 4) = cpuid_output.nECX;
-  *(ULONG*)(xensig + 8) = cpuid_output.nEDX;
-  xensig[12] = 0;
-  KdPrint((__DRIVER_NAME " Xen Signature = %s, EAX = 0x%08x\n", xensig, 
cpuid_output.nEAX));
+  __cpuid(cpuid_output, 0x40000000);
+  *(ULONG*)(xensig + 0) = cpuid_output[1];
+  *(ULONG*)(xensig + 4) = cpuid_output[2];
+  *(ULONG*)(xensig + 8) = cpuid_output[3];
+  xensig[12] = '\0';
+  KdPrint((__DRIVER_NAME " Xen Signature = %s, EAX = 0x%08x\n", xensig, 
cpuid_output[0]));
 
-  CPUID(&cpuid_output, 0x40000002);
-  pages = cpuid_output.nEAX;
-  msr = cpuid_output.nEBX;
+  __cpuid(cpuid_output, 0x40000002);
+  pages = cpuid_output[0];
+  msr = cpuid_output[1];
   KdPrint((__DRIVER_NAME " Hypercall area is %u pages.\n", pages));
 
   hypercall_stubs = ExAllocatePoolWithTag(NonPagedPool, pages * PAGE_SIZE, 
XENPCI_POOL_TAG);
@@ -261,7 +238,6 @@ XenPCI_AddDevice(
   WDF_IO_QUEUE_CONFIG ioQConfig;
   WDF_INTERRUPT_CONFIG interruptConfig;
   PNP_BUS_INFORMATION busInfo;
-  WDF_FDO_EVENT_CALLBACKS FdoCallbacks;
 
   //PDEVICE_OBJECT pdo;
   //ULONG propertyAddress, length;
@@ -371,7 +347,8 @@ XenPCI_PrepareHardware(
   NTSTATUS status = STATUS_SUCCESS;
   PCM_PARTIAL_RESOURCE_DESCRIPTOR descriptor;
   ULONG i;  
-  PXENPCI_DEVICE_DATA deviceData = GetDeviceData(Device);
+
+  UNREFERENCED_PARAMETER(Device);
 
   KdPrint((__DRIVER_NAME " --> EvtDevicePrepareHardware\n"));
 
@@ -457,6 +434,8 @@ XenPCI_ReleaseHardware(WDFDEVICE Device,
 {
   UNREFERENCED_PARAMETER(Device);
   UNREFERENCED_PARAMETER(ResourcesTranslated);
+
+  return STATUS_SUCCESS;
 }
 
 static NTSTATUS
@@ -483,13 +462,13 @@ XenPCI_D0EntryPostInterruptsEnabled(WDFD
 XenPCI_D0EntryPostInterruptsEnabled(WDFDEVICE  Device, WDF_POWER_DEVICE_STATE 
PreviousState)
 {
   NTSTATUS status = STATUS_SUCCESS;
-  OBJECT_ATTRIBUTES oa;
+  //OBJECT_ATTRIBUTES oa;
   char *response;
   char *msgTypes;
   char **Types;
-  char *msgInstances;
-  char **Instances;
-  int i, j;
+  //char *msgInstances;
+  //char **Instances;
+  int i;
   char buffer[128];
 
   UNREFERENCED_PARAMETER(Device);
@@ -513,7 +492,7 @@ XenPCI_D0EntryPostInterruptsEnabled(WDFD
   if (!msgTypes) {
     for (i = 0; Types[i]; i++)
     {
-      sprintf(buffer, "device/%s", Types[i]);
+      RtlStringCbPrintfA(buffer, ARRAY_SIZE(buffer), "device/%s", Types[i]);
       KdPrint((__DRIVER_NAME "     ls device[%d] -> %s\n", i, Types[i]));
       XenPCI_XenBusWatchHandler(buffer, NULL);
       ExFreePoolWithTag(Types[i], XENPCI_POOL_TAG);
@@ -536,9 +515,12 @@ XenPCI_D0EntryPostInterruptsEnabled(WDFD
 }
 
 static NTSTATUS
-XenPCI_D0ExitPreInterruptsDisabled(WDFDEVICE  Device, WDF_POWER_DEVICE_STATE 
TargetState)
+XenPCI_D0ExitPreInterruptsDisabled(WDFDEVICE Device, WDF_POWER_DEVICE_STATE 
TargetState)
 {
   NTSTATUS status = STATUS_SUCCESS;
+
+  UNREFERENCED_PARAMETER(Device);
+  UNREFERENCED_PARAMETER(TargetState);
 
   XenBus_Stop();
 
@@ -586,6 +568,8 @@ XenPCI_InterruptEnable(WDFINTERRUPT Inte
   shared_info_area->vcpu_info[0].evtchn_upcall_mask = 0;
 
   KdPrint((__DRIVER_NAME " <-- EvtInterruptEnable\n"));
+
+  return STATUS_SUCCESS;
 }
 
 static NTSTATUS
@@ -599,6 +583,8 @@ XenPCI_InterruptDisable(WDFINTERRUPT Int
   shared_info_area->vcpu_info[0].evtchn_upcall_mask = 1;
 
   KdPrint((__DRIVER_NAME " <-- EvtInterruptDisable\n"));
+
+  return STATUS_SUCCESS;
 }
 
 static NTSTATUS
@@ -611,13 +597,14 @@ XenPCI_ChildListCreateDevice(WDFCHILDLIS
   XEN_IFACE_XENBUS XenBusInterface;
   XEN_IFACE_XEN XenInterface;
   XEN_IFACE_GNTTBL GntTblInterface;
-  UNICODE_STRING DeviceId;
   DECLARE_UNICODE_STRING_SIZE(buffer, 20);
   WDF_OBJECT_ATTRIBUTES PdoAttributes;
   DECLARE_CONST_UNICODE_STRING(DeviceLocation, L"Xen Bus");
   WDF_QUERY_INTERFACE_CONFIG  qiConfig;
-  WDF_PDO_EVENT_CALLBACKS PdoCallbacks;
   PXENPCI_XEN_DEVICE_DATA ChildDeviceData = NULL;
+  size_t path_len;
+
+  UNREFERENCED_PARAMETER(ChildList);
 
   KdPrint((__DRIVER_NAME " --> ChildListCreateDevice\n"));
 
@@ -704,8 +691,12 @@ XenPCI_ChildListCreateDevice(WDFCHILDLIS
 
   XenBusInterface.InterfaceHeader.Size = sizeof(XenBusInterface);
   XenBusInterface.InterfaceHeader.Version = 1;
-  XenBusInterface.InterfaceHeader.Context = 
ExAllocatePoolWithTag(NonPagedPool, (strlen(XenIdentificationDesc->Path) + 1), 
XENPCI_POOL_TAG);
-  strcpy(XenBusInterface.InterfaceHeader.Context, XenIdentificationDesc->Path);
+  path_len = strlen(XenIdentificationDesc->Path) + 1;
+  XenBusInterface.InterfaceHeader.Context = ExAllocatePoolWithTag(NonPagedPool,
+    path_len, XENPCI_POOL_TAG);
+  /* TODO: check for alloc fail here */
+  RtlStringCbCopyA(XenBusInterface.InterfaceHeader.Context, path_len, 
+    XenIdentificationDesc->Path);
   XenBusInterface.Read = XenBus_Read;
   XenBusInterface.Write = XenBus_Write;
   XenBusInterface.Printf = XenBus_Printf;
@@ -765,7 +756,6 @@ XenPCI_XenBusWatchHandler(char *Path, PV
   XENPCI_IDENTIFICATION_DESCRIPTION description;
   NTSTATUS status;
   int i;
-  char *NamePtr;
   char **Bits;
   int Count;
   WDFCHILDLIST ChildList;
@@ -773,8 +763,9 @@ XenPCI_XenBusWatchHandler(char *Path, PV
   WDFDEVICE ChildDevice;
   PXENPCI_XEN_DEVICE_DATA ChildDeviceData;
 
-  
   ANSI_STRING AnsiBuf;
+
+  UNREFERENCED_PARAMETER(Data);
 
   KdPrint((__DRIVER_NAME " --> HotPlugHandler\n"));
 
@@ -830,8 +821,6 @@ XenPCI_XenBusWatchHandler(char *Path, PV
   ExFreePoolWithTag(Bits, XENPCI_POOL_TAG);
   
   KdPrint((__DRIVER_NAME " <-- HotPlugHandler\n"));  
-
-  return status;
 }
 
 static void
@@ -840,6 +829,9 @@ XenBus_ShutdownHandler(char *Path, PVOID
   char *value;
   xenbus_transaction_t xbt;
   int retry;
+
+  UNREFERENCED_PARAMETER(Path);
+  UNREFERENCED_PARAMETER(StartContext);
 
   KdPrint((__DRIVER_NAME " --> XenBus_ShutdownHandler\n"));
 
@@ -853,7 +845,7 @@ XenBus_ShutdownHandler(char *Path, PVOID
   if (value != NULL && strlen(value) != 0)
     XenBus_Write(XBT_NIL, SHUTDOWN_PATH, "");
 
-  XenBus_EndTransaction(&xbt, 0, &retry);
+  XenBus_EndTransaction(xbt, 0, &retry);
   
   KdPrint((__DRIVER_NAME " <-- XenBus_ShutdownHandler\n"));
 }
@@ -867,8 +859,11 @@ XenPCI_FilterRemoveResourceRequirements(
   WDFIORESLIST ResourceList;
   PIO_RESOURCE_DESCRIPTOR Descriptor;
 
-  int i, j;
+  ULONG i;
+  ULONG j;
   int offset;
+
+  UNREFERENCED_PARAMETER(Device);
 
   KdPrint((__DRIVER_NAME " --> FilterRemoveResourceRequirements\n"));
 
@@ -927,7 +922,10 @@ XenPCI_FilterAddResourceRequirements(WDF
   WDFIORESLIST ResourceList;
   PIO_RESOURCE_DESCRIPTOR Descriptor;
 
-  int i, j;
+  ULONG i;
+  ULONG j;
+
+  UNREFERENCED_PARAMETER(Device);
 
   KdPrint((__DRIVER_NAME " --> FilterAddResourceRequirements\n"));
 
@@ -981,6 +979,10 @@ static NTSTATUS
 static NTSTATUS
 XenPCI_RemoveAddedResources(WDFDEVICE Device, WDFCMRESLIST ResourcesRaw, 
WDFCMRESLIST ResourcesTranslated)
 {
+  UNREFERENCED_PARAMETER(Device);
+  UNREFERENCED_PARAMETER(ResourcesRaw);
+  UNREFERENCED_PARAMETER(ResourcesTranslated);
+
   KdPrint((__DRIVER_NAME " --> RemoveAddedResources\n"));
   KdPrint((__DRIVER_NAME " <-- RemoveAddedResources\n"));
 
@@ -993,6 +995,8 @@ XenPCI_DeviceResourceRequirementsQuery(W
   NTSTATUS  status;
   WDFIORESLIST resourceList;
   IO_RESOURCE_DESCRIPTOR descriptor;
+
+  UNREFERENCED_PARAMETER(Device);
 
   KdPrint((__DRIVER_NAME " --> DeviceResourceRequirementsQuery\n"));
 
diff -r b26bdba50c41 xenpci/xenpci.h
--- a/xenpci/xenpci.h   Thu Nov 01 16:21:24 2007 -0700
+++ b/xenpci/xenpci.h   Fri Nov 02 09:52:30 2007 -0700
@@ -193,7 +193,7 @@ NTSTATUS
 NTSTATUS
 EvtChn_Notify(evtchn_port_t Port);
 evtchn_port_t
-EvtChn_AllocUnbound(int Domain);
+EvtChn_AllocUnbound(domid_t Domain);
 NTSTATUS
 EvtChn_Init();
 
@@ -202,7 +202,7 @@ BOOLEAN
 BOOLEAN
 GntTbl_EndAccess(grant_ref_t ref);
 
-NTSTATUS
+evtchn_port_t
 EvtChn_GetXenStorePort();
 PVOID
 EvtChn_GetXenStoreRingAddr();
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] PVWin: Fix warnings, Andy Grover <=