Patchwork [07/12] cpuid: list all known x86 CPUID feature flags

login
register
mail settings
Submitter Andre Przywara
Date Sept. 10, 2009, 10:20 p.m.
Message ID <1252621257-26364-8-git-send-email-andre.przywara@amd.com>
Download mbox | patch
Permalink /patch/33401/
State Superseded
Headers show

Comments

Andre Przywara - Sept. 10, 2009, 10:20 p.m.
-cpu ? currently gives us a list of known CPU models. Add a list
of known CPUID feature flags to the output.

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

Patch

diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index ab3565e..e62dc04 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -543,10 +543,27 @@  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);
+
+    (*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)