Patchwork [06/13] cpuid: list all known x86 CPUID feature flags

login
register
mail settings
Submitter Andre Przywara
Date Feb. 2, 2010, 10:08 a.m.
Message ID <1265105301-3455-7-git-send-email-andre.przywara@amd.com>
Download mbox | patch
Permalink /patch/44278/
State New
Headers show

Comments

Andre Przywara - Feb. 2, 2010, 10:08 a.m.
-cpu ? currently gives us a list of known CPU models. Add "host" if
using KVM and a list of known CPUID feature flags to the output.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
---
 target-i386/cpuid.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

Patch

diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index 19d58e1..3f56c50 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -573,10 +573,30 @@  error:
 
 void x86_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
 {
-    unsigned int i;
+    unsigned int i, j;
+    const char **stringlist[] = {feature_name, ext_feature_name,
+                                 ext2_feature_name, ext3_feature_name};
 
     for (i = 0; i < ARRAY_SIZE(x86_defs); i++)
         (*cpu_fprintf)(f, "x86 %16s\n", x86_defs[i].name);
+    if (kvm_enabled()) {
+        (*cpu_fprintf)(f, "x86 %16s\n", "host");
+    }
+
+    (*cpu_fprintf)(f, "x86 recognized feature flags:\n    ");
+    for (j = 0; j < 4; j++) {
+        for (i = 0; i < 32; i++) {
+            if (j == 2 && ((1 << i) & EXT2_FEATURE_MASK))
+                continue;
+            if (stringlist[j][i] == NULL)
+                continue;
+            (*cpu_fprintf)(f, "%s ", stringlist[j][i]);
+            if (i == 15)
+                (*cpu_fprintf)(f, "\n    ");
+        }
+        (*cpu_fprintf)(f, "\n    ");
+    }
+    return;
 }
 
 int cpu_x86_register (CPUX86State *env, const char *cpu_model)