1
0
mirror of https://github.com/google/cpu_features.git synced 2025-07-05 15:00:40 +02:00

Support disabling of extensions

Fixes #101
This commit is contained in:
Guillaume Chatelet
2020-01-17 16:53:37 +01:00
parent 24b8a1de17
commit eb59787849
5 changed files with 70 additions and 0 deletions

View File

@ -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;
}