win-pvdrivers

changeset 133:e5e6978fd09e

Created a macro to avoid warnings when casting int variables to pointers under different arch's
author James Harper <james.harper@bendigoit.com.au>
date Fri Jan 18 20:25:32 2008 +1100 (2008-01-18)
parents 1f482a9da56e
children f3f156c524ee
files xennet/xennet.c
line diff
     1.1 --- a/xennet/xennet.c	Fri Jan 18 20:11:03 2008 +1100
     1.2 +++ b/xennet/xennet.c	Fri Jan 18 20:25:32 2008 +1100
     1.3 @@ -41,6 +41,14 @@ Foundation, Inc., 51 Franklin Street, Fi
     1.4  #define NET_TX_RING_SIZE __NET_RING_SIZE(netif_tx, PAGE_SIZE)
     1.5  #define NET_RX_RING_SIZE __NET_RING_SIZE(netif_rx, PAGE_SIZE)
     1.6  
     1.7 +#if defined(_X86_)
     1.8 + #define INT_TO_PTR(x) ((PVOID)(LONG)(x))
     1.9 +#else
    1.10 + #if defined(_AMD64_)
    1.11 +  #define INT_TO_PTR(x) ((PVOID)(LONGLONG)(x))
    1.12 + #endif
    1.13 +#endif
    1.14 +
    1.15  #pragma warning(disable: 4127) // conditional expression is constant
    1.16  
    1.17  struct xennet_info
    1.18 @@ -156,7 +164,7 @@ static void
    1.19  add_id_to_freelist(struct xennet_info *xi, unsigned short id)
    1.20  {
    1.21    xi->tx_pkts[id] = xi->tx_pkts[0];
    1.22 -  xi->tx_pkts[0]  = (void *)id;
    1.23 +  xi->tx_pkts[0]  = INT_TO_PTR(id);
    1.24    xi->tx_pkt_ids_used--;
    1.25  }
    1.26  
    1.27 @@ -782,7 +790,7 @@ XenNet_Init(
    1.28  
    1.29    /* Initialize tx_pkts as a free chain containing every entry. */
    1.30    for (i = 0; i < NET_TX_RING_SIZE+1; i++) {
    1.31 -    xi->tx_pkts[i] = i + 1;
    1.32 +    xi->tx_pkts[i] = INT_TO_PTR(i + 1);
    1.33      xi->grant_tx_ref[i] = GRANT_INVALID_REF;
    1.34    }
    1.35