diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-08-11 06:50:14 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-08-13 02:20:23 -0700 |
commit | aad3e1ecc0c470f4662ea23e6695316ac0f9852b (patch) | |
tree | 44f012622c88737c7afe3d68d98d04efdaed5a35 | |
parent | eaba752cc8ab4558b455ceee98f2594c13be5acc (diff) | |
download | glibc-aad3e1ecc0c470f4662ea23e6695316ac0f9852b.tar.gz |
Check if cpuid is available in init_cpu_features
Since not all i486 processors support cpuid, we call __get_cpuid_max to
check if cpuid is available before using it if not compiling for i586,
i686 nor x86-64.
* sysdeps/x86/cpu-features.c (init_cpu_features): Call
__get_cpuid_max if not compiling for i586, i686 nor x86-64.
-rw-r--r-- | sysdeps/x86/cpu-features.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c index 587080c1a4..582a8f5f79 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -40,6 +40,14 @@ init_cpu_features (struct cpu_features *cpu_features) unsigned int model = 0; enum cpu_features_kind kind; +#if !defined __i586__ && !defined __i686__ && !defined __x86_64__ + if (__get_cpuid_max (0, 0) == 0) + { + kind = arch_kind_other; + goto no_cpuid; + } +#endif + __cpuid (0, cpu_features->max_cpuid, ebx, ecx, edx); /* This spells out "GenuineIntel". */ @@ -196,6 +204,10 @@ init_cpu_features (struct cpu_features *cpu_features) } } +#if !defined __i586__ && !defined __i686__ && !defined __x86_64__ +no_cpuid: +#endif + cpu_features->family = family; cpu_features->model = model; cpu_features->kind = kind; |