[PATCH] x86: i486: stub out init-arch logic
Mike Frysinger
vapier@gentoo.org
Tue Aug 11 09:28:00 GMT 2015
The common x86 init-arch logic hardcodes the usage of cpuid which breaks
running on i486 and older systems. Rather than add more checking to the
common case only for old cpus, stub it out for i486 systems entirely.
Reported-by: Daniel Goertzen <daniel.goertzen@gmail.com>
URL: https://bugs.gentoo.org/523830
2015-08-11 Mike Frysinger <vapier@gentoo.org>
* sysdeps/unix/sysv/linux/i386/i486/init-arch.c: New file.
---
sysdeps/unix/sysv/linux/i386/i486/init-arch.c | 44 +++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 sysdeps/unix/sysv/linux/i386/i486/init-arch.c
diff --git a/sysdeps/unix/sysv/linux/i386/i486/init-arch.c b/sysdeps/unix/sysv/linux/i386/i486/init-arch.c
new file mode 100644
index 0000000..c95979d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/i486/init-arch.c
@@ -0,0 +1,44 @@
+/* Initialize CPU feature data.
+ This file is part of the GNU C Library.
+ Copyright (C) 2015 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <atomic.h>
+#include "init-arch.h"
+
+
+struct cpu_features __cpu_features attribute_hidden;
+
+
+void
+__init_cpu_features (void)
+{
+ __cpu_features.family = 0;
+ __cpu_features.model = 0;
+ atomic_write_barrier ();
+ __cpu_features.kind = arch_kind_other;
+}
+
+#undef __get_cpu_features
+
+const struct cpu_features *
+__get_cpu_features (void)
+{
+ if (__cpu_features.kind == arch_kind_unknown)
+ __init_cpu_features ();
+
+ return &__cpu_features;
+}
--
2.4.4
More information about the Libc-alpha
mailing list