Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/google/cpu_features.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpuinfo_x86.c')
-rw-r--r--src/cpuinfo_x86.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cpuinfo_x86.c b/src/cpuinfo_x86.c
index ab14053..dca285e 100644
--- a/src/cpuinfo_x86.c
+++ b/src/cpuinfo_x86.c
@@ -23,6 +23,12 @@
#error "Cannot compile cpuinfo_x86 on a non x86 platform."
#endif
+thread_local void (*X86InfoInterceptor)(X86Info*) = NULL;
+
+void RegisterX86InfoInterceptor(void (*ptr)(X86Info*)) {
+ X86InfoInterceptor = ptr;
+}
+
////////////////////////////////////////////////////////////////////////////////
// Definitions for CpuId and GetXCR0Eax.
////////////////////////////////////////////////////////////////////////////////
@@ -615,6 +621,7 @@ X86Info GetX86Info(void) {
if (IsVendor(leaf_0, "GenuineIntel") || IsVendor(leaf_0, "AuthenticAMD")) {
ParseCpuId(max_cpuid_leaf, &info);
}
+ if (X86InfoInterceptor) X86InfoInterceptor(&info);
return info;
}