aboutsummaryrefslogtreecommitdiff
path: root/modules/devices/x86/processor.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2017-04-09 22:08:37 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2017-04-10 06:54:33 -0700
commit91f07a0c09a349fd55659a18a5a6906c9ef969bb (patch)
tree0d152580f1f3a9446f297c9f5a62fad54ead1c4f /modules/devices/x86/processor.c
parent46299298286684ed0d64c84f782a53f11c6cacd8 (diff)
More "feature" flags to bug workarounds
Add some more bug "feature" flags from old kernels to the bug workaround list generated if no such list was available in /proc/cpuinfo. Also, fixes a crash if the first bug is not fdiv. Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/devices/x86/processor.c')
-rw-r--r--modules/devices/x86/processor.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/modules/devices/x86/processor.c b/modules/devices/x86/processor.c
index 9acd9e19..56968f41 100644
--- a/modules/devices/x86/processor.c
+++ b/modules/devices/x86/processor.c
@@ -213,6 +213,20 @@ fail:
g_free(endpoint);
}
+int processor_has_flag(gchar * strflags, gchar * strflag)
+{
+ gchar **flags;
+ gint ret = 0;
+
+ if (strflags == NULL || strflag == NULL)
+ return 0;
+
+ flags = g_strsplit(strflags, " ", 0);
+ ret = g_strv_contains((const gchar * const *)flags, strflag);
+ g_strfreev(flags);
+ return ret;
+}
+
GSList *processor_scan(void)
{
GSList *procs = NULL;
@@ -263,11 +277,20 @@ GSList *processor_scan(void)
if (processor->bugs == NULL || g_strcmp0(processor->bugs, "") == 0) {
g_free(processor->bugs);
/* make bugs list on old kernels that don't offer one */
- processor->bugs = g_strdup_printf("%s%s%s%s",
- processor->bug_fdiv ? "fdiv" : "",
+ processor->bugs = g_strdup_printf("%s%s%s%s%s%s%s%s%s%s",
+ /* the oldest bug workarounds indicated in /proc/cpuinfo */
+ processor->bug_fdiv ? " fdiv" : "",
processor->bug_hlt ? " _hlt" : "",
processor->bug_f00f ? " f00f" : "",
- processor->bug_coma ? " coma" : "");
+ processor->bug_coma ? " coma" : "",
+ /* these bug workarounds were reported as "features" in older kernels */
+ processor_has_flag(processor->flags, "fxsave_leak") ? " fxsave_leak" : "",
+ processor_has_flag(processor->flags, "clflush_monitor") ? " clflush_monitor" : "",
+ processor_has_flag(processor->flags, "11ap") ? " 11ap" : "",
+ processor_has_flag(processor->flags, "tlb_mmatch") ? " tlb_mmatch" : "",
+ processor_has_flag(processor->flags, "apic_c1e") ? " apic_c1e" : "",
+ ""); /* just to make adding lines easier */
+ g_strchug(processor->bugs);
}
get_int("model", processor->model);