From e3c27309fa45a6c50d0ed0e541dd82c406d4485a Mon Sep 17 00:00:00 2001
From: Erich Elsen <eriche@google.com>
Date: Thu, 25 May 2017 14:49:15 -0700
Subject: [PATCH] init_cacheinfo -> init_cacheinfo_impl which it is possible to
pass a cpu_features struct to for modularity.
---
sysdeps/x86/cacheinfo.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
@@ -482,9 +482,9 @@ int __x86_prefetchw attribute_hidden;
#endif
-static void
-__attribute__((constructor))
-init_cacheinfo (void)
+void
+attribute_hidden
+init_cacheinfo_impl (const struct cpu_features* cpu_features)
{
/* Find out what brand of processor. */
unsigned int eax;
@@ -496,7 +496,6 @@ init_cacheinfo (void)
long int shared = -1;
unsigned int level;
unsigned int threads = 0;
- const struct cpu_features *cpu_features = __get_cpu_features ();
int max_cpuid = cpu_features->max_cpuid;
if (cpu_features->kind == arch_kind_intel)
@@ -787,4 +786,10 @@ intel_bug_no_cache_info:
: __x86_shared_cache_size * 6);
}
+static void
+__attribute__((constructor))
+init_cacheinfo (void) {
+ const struct cpu_features *cpu_features = __get_cpu_features ();
+ init_cacheinfo_impl(cpu_features);
+}
#endif
--
2.13.0.219.gdb65acc882-goog