win-pvdrivers

view liblfds.6/test/src/abstraction_cpu_count.c @ 766:6300617040e0

Big changes - not ready for production use.
Removed all the custom DMA handling code as it was completely incompatible with the Windows verifier.
Added liblfds (using the lock free stack) from liblfds.org so that grant's can be obtained at DIRQL.
Fixed xennet and xenvbd to support the changes.
xenusb and xenscsi almost certainly will not yet work after the changes.
author James Harper <james.harper@bendigoit.com.au>
date Sun Jan 31 21:28:42 2010 +1100 (2010-01-31)
parents
children
line source
1 #include "internal.h"
7 /****************************************************************************/
8 #if (defined _WIN32 && defined _MSC_VER && !defined WIN_KERNEL_BUILD)
10 /* TRD : any Windows (user-mode) on any CPU with the Microsoft C compiler
12 _WIN32 indicates 64-bit or 32-bit Windows
13 _MSC_VER indicates Microsoft C compiler
14 !WIN_KERNEL_BUILD indicates Windows user-mode
15 */
17 unsigned int abstraction_cpu_count()
18 {
19 SYSTEM_INFO
20 si;
22 GetNativeSystemInfo( &si );
24 return( (unsigned int) si.dwNumberOfProcessors );
25 }
27 #endif
33 /****************************************************************************/
34 #if (defined _WIN32 && defined _MSC_VER && defined WIN_KERNEL_BUILD)
36 /* TRD : any Windows on any CPU with the Microsoft C compiler
38 _WIN32 indicates 64-bit or 32-bit Windows
39 _MSC_VER indicates Microsoft C compiler
40 WIN_KERNEL_BUILD indicates Windows kernel
41 */
43 unsigned int abstraction_cpu_count()
44 {
45 unsigned int
46 active_processor_count;
48 active_processor_count = KeQueryActiveProcessorCount( NULL );
50 return( active_processor_count );
51 }
53 #endif
59 /****************************************************************************/
60 #if (defined __linux__ && __GNUC__)
62 /* TRD : Linux on any CPU with GCC
64 this function I believe is Linux specific and varies by UNIX flavour
66 __linux__ indicates Linux
67 __GNUC__ indicates GCC
68 */
70 unsigned int abstraction_cpu_count()
71 {
72 long int
73 cpu_count;
75 cpu_count = sysconf( _SC_NPROCESSORS_ONLN );
77 return( (unsigned int) cpu_count );
78 }
80 #endif