devel/cpu_features: update to 0.7.0
Changes: - https://github.com/google/cpu_features/releases/tag/v0.7.0 PR: 269107 Reported by: Yuri Victorovich <yuri@freebsd.org>
This commit is contained in:
parent
6fb01cd31f
commit
441e719340
6 changed files with 5 additions and 121 deletions
|
@ -1,7 +1,6 @@
|
|||
PORTNAME= cpu_features
|
||||
DISTVERSION= 0.6.0
|
||||
PORTREVISION= 2
|
||||
DISTVERSIONPREFIX= v
|
||||
DISTVERSION= 0.7.0
|
||||
CATEGORIES= devel
|
||||
|
||||
MAINTAINER= skreuzer@FreeBSD.org
|
||||
|
@ -19,6 +18,7 @@ USE_GITHUB= yes
|
|||
GH_ACCOUNT= google
|
||||
|
||||
CMAKE_ON= BUILD_SHARED_LIBS
|
||||
CMAKE_OFF= BUILD_TESTING
|
||||
|
||||
CFLAGS+= -fPIC
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1631796486
|
||||
SHA256 (google-cpu_features-v0.6.0_GH0.tar.gz) = 95a1cf6f24948031df114798a97eea2a71143bd38a4d07d9a758dda3924c1932
|
||||
SIZE (google-cpu_features-v0.6.0_GH0.tar.gz) = 63255
|
||||
TIMESTAMP = 1674435781
|
||||
SHA256 (google-cpu_features-v0.7.0_GH0.tar.gz) = df80d9439abf741c7d2fdcdfd2d26528b136e6c52976be8bd0cd5e45a27262c0
|
||||
SIZE (google-cpu_features-v0.7.0_GH0.tar.gz) = 85986
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
--- cmake/googletest.CMakeLists.txt.in.orig 2022-01-16 19:20:55 UTC
|
||||
+++ cmake/googletest.CMakeLists.txt.in
|
||||
@@ -5,11 +5,11 @@ project(googletest-download NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
- GIT_TAG master
|
||||
+ GIT_TAG main
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
|
||||
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
-)
|
||||
\ No newline at end of file
|
||||
+)
|
|
@ -1,13 +0,0 @@
|
|||
--- include/cpu_features_macros.h.orig 2021-09-16 15:06:15 UTC
|
||||
+++ include/cpu_features_macros.h
|
||||
@@ -83,6 +83,10 @@
|
||||
#define CPU_FEATURES_OS_DARWIN
|
||||
#endif
|
||||
|
||||
+#if (defined(__freebsd__) || defined(__FreeBSD__))
|
||||
+#define CPU_FEATURES_OS_FREEBSD
|
||||
+#endif
|
||||
+
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Compilers
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -1,10 +0,0 @@
|
|||
--- include/cpuinfo_x86.h.orig 2021-09-16 15:51:24 UTC
|
||||
+++ include/cpuinfo_x86.h
|
||||
@@ -137,6 +137,7 @@ typedef enum {
|
||||
AMD_BULLDOZER, // K15
|
||||
AMD_JAGUAR, // K16
|
||||
AMD_ZEN, // K17
|
||||
+ AMD_ZEN3, // K19
|
||||
} X86Microarchitecture;
|
||||
|
||||
// Returns the underlying microarchitecture by looking at X86Info's vendor,
|
|
@ -1,76 +0,0 @@
|
|||
--- src/cpuinfo_x86.c.orig 2020-10-15 09:09:51 UTC
|
||||
+++ src/cpuinfo_x86.c
|
||||
@@ -97,7 +97,8 @@
|
||||
// microarchitectures.
|
||||
#if defined(CPU_FEATURES_OS_WINDOWS)
|
||||
#include <windows.h> // IsProcessorFeaturePresent
|
||||
-#elif defined(CPU_FEATURES_OS_LINUX_OR_ANDROID)
|
||||
+#elif defined(CPU_FEATURES_OS_LINUX_OR_ANDROID) || \
|
||||
+ defined(CPU_FEATURES_OS_FREEBSD)
|
||||
#include "internal/filesystem.h" // Needed to parse /proc/cpuinfo
|
||||
#include "internal/stack_line_reader.h" // Needed to parse /proc/cpuinfo
|
||||
#include "internal/string_view.h" // Needed to parse /proc/cpuinfo
|
||||
@@ -1239,6 +1240,45 @@ static void DetectSseViaOs(X86Features* features) {
|
||||
features->ssse3 = GetDarwinSysCtlByName("hw.optional.supplementalsse3");
|
||||
features->sse4_1 = GetDarwinSysCtlByName("hw.optional.sse4_1");
|
||||
features->sse4_2 = GetDarwinSysCtlByName("hw.optional.sse4_2");
|
||||
+#elif defined(CPU_FEATURES_OS_FREEBSD)
|
||||
+ // Handling FreeBSD platform through parsing /var/run/dmesg.boot.
|
||||
+ const int fd = CpuFeatures_OpenFile("/var/run/dmesg.boot");
|
||||
+ if (fd >= 0) {
|
||||
+ StackLineReader reader;
|
||||
+ StackLineReader_Initialize(&reader, fd);
|
||||
+ for (;;) {
|
||||
+ const LineResult result = StackLineReader_NextLine(&reader);
|
||||
+ const StringView line = result.line;
|
||||
+ const bool is_feature =
|
||||
+ CpuFeatures_StringView_StartsWith(line, str(" Features="));
|
||||
+ const bool is_feature2 =
|
||||
+ CpuFeatures_StringView_StartsWith(line, str(" Features2="));
|
||||
+ if (is_feature || is_feature2) {
|
||||
+ // Lines of interests are of the following form:
|
||||
+ // " Features=0x1783fbff<PSE36,MMX,FXSR,SSE,SSE2,HTT>"
|
||||
+ // We replace '<', '>' and ',' with space so we can search by
|
||||
+ // whitespace separated word.
|
||||
+ // TODO: Fix CpuFeatures_StringView_HasWord to allow for different
|
||||
+ // separators.
|
||||
+ for (size_t i = 0; i < line.size; ++i) {
|
||||
+ char* c = (char*)(&(line.ptr[i]));
|
||||
+ if (*c == '<' || *c == '>' || *c == ',') *c = ' ';
|
||||
+ }
|
||||
+ if (is_feature) {
|
||||
+ features->sse = CpuFeatures_StringView_HasWord(line, "SSE");
|
||||
+ features->sse2 = CpuFeatures_StringView_HasWord(line, "SSE2");
|
||||
+ }
|
||||
+ if (is_feature2) {
|
||||
+ features->sse3 = CpuFeatures_StringView_HasWord(line, "SSE3");
|
||||
+ features->ssse3 = CpuFeatures_StringView_HasWord(line, "SSSE3");
|
||||
+ features->sse4_1 = CpuFeatures_StringView_HasWord(line, "SSE4.1");
|
||||
+ features->sse4_2 = CpuFeatures_StringView_HasWord(line, "SSE4.2");
|
||||
+ }
|
||||
+ }
|
||||
+ if (result.eof) break;
|
||||
+ }
|
||||
+ CpuFeatures_CloseFile(fd);
|
||||
+ }
|
||||
#elif defined(CPU_FEATURES_OS_LINUX_OR_ANDROID)
|
||||
// Handling Linux platform through /proc/cpuinfo.
|
||||
const int fd = CpuFeatures_OpenFile("/proc/cpuinfo");
|
||||
@@ -1525,6 +1565,8 @@ X86Microarchitecture GetX86Microarchitecture(const X86
|
||||
return AMD_JAGUAR;
|
||||
case 0x17:
|
||||
return AMD_ZEN;
|
||||
+ case 0x19:
|
||||
+ return AMD_ZEN3;
|
||||
default:
|
||||
return X86_UNKNOWN;
|
||||
}
|
||||
@@ -1617,6 +1659,8 @@ const char* GetX86MicroarchitectureName(X86Microarchit
|
||||
return "AMD_JAGUAR";
|
||||
case AMD_ZEN:
|
||||
return "AMD_ZEN";
|
||||
+ case AMD_ZEN3:
|
||||
+ return "AMD_ZEN3";
|
||||
}
|
||||
return "unknown microarchitecture";
|
||||
}
|
Loading…
Reference in a new issue