Skip to content

Commit

Permalink
Merge pull request #571 from compnerd/slpi-5.5
Browse files Browse the repository at this point in the history
shims: correct the check for newer SLPI enumerators
  • Loading branch information
compnerd authored Sep 13, 2021
2 parents 34f383d + c2a57f0 commit f9fdaee
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
include_directories(BEFORE SYSTEM ${DISPATCH_INCLUDES})
dispatch_windows_lib_for_arch(${CMAKE_SYSTEM_PROCESSOR} DISPATCH_LIBDIR)
link_directories(${DISPATCH_LIBDIR})

include(CheckCSourceCompiles)
check_c_source_compiles([=[
#include <Windows.h>
int main(int argc, char *argv[]) {
switch ((LOGICAL_PROCESSOR_RELATIONSHIP)0) {
case RelationProcessorDie:
case RelationNumaNodeEx:
return 0;
}
return 0;
}
]=] DISPATCH_HAVE_EXTENDED_SLPI_20348)
if(DISPATCH_HAVE_EXTENDED_SLPI_20348)
add_compile_definitions(DISPATCH_HAVE_EXTENDED_SLPI_20348)
endif()
endif()

set(CMAKE_C_STANDARD 11)
Expand Down
6 changes: 6 additions & 0 deletions src/shims/hw_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,14 @@ _dispatch_hw_get_config(_dispatch_hw_config_t c)
++dwProcessorPhysicalCount;
dwProcessorLogicalCount += __popcnt64(slpiCurrent->ProcessorMask);
break;
#if defined(DISPATCH_HAVE_EXTENDED_SLPI_20348)
case RelationProcessorDie:
#endif
case RelationProcessorPackage:
case RelationNumaNode:
#if defined(DISPATCH_HAVE_EXTENDED_SLPI_20348)
case RelationNumaNodeEx:
#endif
case RelationCache:
case RelationGroup:
case RelationAll:
Expand Down

0 comments on commit f9fdaee

Please sign in to comment.