win-pvdrivers
changeset 1100:86a97ef8cdf9
Fix crash in xennet under xen 4.3 where NdisSystemProcessorCount returns an unexpected value
author | James Harper <james.harper@bendigoit.com.au> |
---|---|
date | Tue Jul 08 11:50:11 2014 +1000 (2014-07-08) |
parents | 27bd2a5a4704 |
children | 99ce7ae22363 |
files | xennet/xennet_rx.c |
line diff
1.1 --- a/xennet/xennet_rx.c Thu Mar 13 13:38:31 2014 +1100 1.2 +++ b/xennet/xennet_rx.c Tue Jul 08 11:50:11 2014 +1000 1.3 @@ -1161,13 +1161,22 @@ XenNet_RxInit(xennet_info_t *xi) { 1.4 // this stuff needs to be done once only... 1.5 KeInitializeSpinLock(&xi->rx_lock); 1.6 KeInitializeEvent(&xi->rx_idle_event, SynchronizationEvent, FALSE); 1.7 + #if NTDDI_VERSION < NTDDI_VISTA 1.8 + FUNCTION_MSG("NdisSystemProcessorCount = %d\n", NdisSystemProcessorCount()); 1.9 xi->rxpi = ExAllocatePoolWithTagPriority(NonPagedPool, sizeof(packet_info_t) * NdisSystemProcessorCount(), XENNET_POOL_TAG, NormalPoolPriority); 1.10 + #else 1.11 + FUNCTION_MSG("KeQueryActiveProcessorCount = %d\n", KeQueryActiveProcessorCount(NULL)); 1.12 + xi->rxpi = ExAllocatePoolWithTagPriority(NonPagedPool, sizeof(packet_info_t) * KeQueryActiveProcessorCount(NULL), XENNET_POOL_TAG, NormalPoolPriority); 1.13 + #endif 1.14 if (!xi->rxpi) { 1.15 FUNCTION_MSG("ExAllocatePoolWithTagPriority failed\n"); 1.16 return FALSE; 1.17 } 1.18 + #if NTDDI_VERSION < NTDDI_VISTA 1.19 NdisZeroMemory(xi->rxpi, sizeof(packet_info_t) * NdisSystemProcessorCount()); 1.20 - 1.21 + #else 1.22 + NdisZeroMemory(xi->rxpi, sizeof(packet_info_t) * KeQueryActiveProcessorCount(NULL)); 1.23 + #endif 1.24 ret = stack_new(&xi->rx_pb_stack, NET_RX_RING_SIZE * 4); 1.25 if (!ret) { 1.26 FUNCTION_MSG("Failed to allocate rx_pb_stack\n");