void x86_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...),

                  const char *optarg)

{

    unsigned char model = !strcmp("?model", optarg);

    unsigned char dump = !strcmp("?dump", optarg);

    unsigned char cpuid = !strcmp("?cpuid", optarg);

    x86_def_t *def;

    char buf[256];



    if (cpuid) {

        (*cpu_fprintf)(f, "Recognized CPUID flags:\n");

        listflags(buf, sizeof (buf), (uint32_t)~0, feature_name, 1);

        (*cpu_fprintf)(f, "  f_edx: %s\n", buf);

        listflags(buf, sizeof (buf), (uint32_t)~0, ext_feature_name, 1);

        (*cpu_fprintf)(f, "  f_ecx: %s\n", buf);

        listflags(buf, sizeof (buf), (uint32_t)~0, ext2_feature_name, 1);

        (*cpu_fprintf)(f, "  extf_edx: %s\n", buf);

        listflags(buf, sizeof (buf), (uint32_t)~0, ext3_feature_name, 1);

        (*cpu_fprintf)(f, "  extf_ecx: %s\n", buf);

        return;

    }

    for (def = x86_defs; def; def = def->next) {

        snprintf(buf, sizeof (buf), def->flags ? "[%s]": "%s", def->name);

        if (model || dump) {

            (*cpu_fprintf)(f, "x86 %16s  %-48s\n", buf, def->model_id);

        } else {

            (*cpu_fprintf)(f, "x86 %16s\n", buf);

        }

        if (dump) {

            memcpy(buf, &def->vendor1, sizeof (def->vendor1));

            memcpy(buf + 4, &def->vendor2, sizeof (def->vendor2));

            memcpy(buf + 8, &def->vendor3, sizeof (def->vendor3));

            buf[12] = '\0';

            (*cpu_fprintf)(f,

                "  family %d model %d stepping %d level %d xlevel 0x%x"

                " vendor \"%s\"\n",

                def->family, def->model, def->stepping, def->level,

                def->xlevel, buf);

            listflags(buf, sizeof (buf), def->features, feature_name, 0);

            (*cpu_fprintf)(f, "  feature_edx %08x (%s)\n", def->features,

                buf);

            listflags(buf, sizeof (buf), def->ext_features, ext_feature_name,

                0);

            (*cpu_fprintf)(f, "  feature_ecx %08x (%s)\n", def->ext_features,

                buf);

            listflags(buf, sizeof (buf), def->ext2_features, ext2_feature_name,

                0);

            (*cpu_fprintf)(f, "  extfeature_edx %08x (%s)\n",

                def->ext2_features, buf);

            listflags(buf, sizeof (buf), def->ext3_features, ext3_feature_name,

                0);

            (*cpu_fprintf)(f, "  extfeature_ecx %08x (%s)\n",

                def->ext3_features, buf);

            (*cpu_fprintf)(f, "\n");

        }

    }

    if (kvm_enabled()) {

        (*cpu_fprintf)(f, "x86 %16s\n", "[host]");

    }

}

void x86_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...),

                  const char *optarg)

{

    unsigned char model = !strcmp("?model", optarg);

    unsigned char dump = !strcmp("?dump", optarg);

    unsigned char cpuid = !strcmp("?cpuid", optarg);

    x86_def_t *def;

    char buf[256];



    if (cpuid) {

        (*cpu_fprintf)(f, "Recognized CPUID flags:\n");

        listflags(buf, sizeof (buf), (uint32_t)~0, feature_name, 1);

        (*cpu_fprintf)(f, "  f_edx: %s\n", buf);

        listflags(buf, sizeof (buf), (uint32_t)~0, ext_feature_name, 1);

        (*cpu_fprintf)(f, "  f_ecx: %s\n", buf);

        listflags(buf, sizeof (buf), (uint32_t)~0, ext2_feature_name, 1);

        (*cpu_fprintf)(f, "  extf_edx: %s\n", buf);

        listflags(buf, sizeof (buf), (uint32_t)~0, ext3_feature_name, 1);

        (*cpu_fprintf)(f, "  extf_ecx: %s\n", buf);

        return;

    }

    for (def = x86_defs; def; def = def->next) {

        snprintf(buf, sizeof (buf), def->flags ? "[%s]": "%s", def->name);

        if (model || dump) {

            (*cpu_fprintf)(f, "x86 %16s  %-48s\n", buf, def->model_id);

        } else {

            (*cpu_fprintf)(f, "x86 %16s\n", buf);

        }

        if (dump) {

            memcpy(buf, &def->vendor1, sizeof (def->vendor1));

            memcpy(buf + 4, &def->vendor2, sizeof (def->vendor2));

            memcpy(buf + 8, &def->vendor3, sizeof (def->vendor3));

            buf[12] = '\0';

            (*cpu_fprintf)(f,

                "  family %d model %d stepping %d level %d xlevel 0x%x"

                " vendor \"%s\"\n",

                def->family, def->model, def->stepping, def->level,

                def->xlevel, buf);

            listflags(buf, sizeof (buf), def->features, feature_name, 0);

            (*cpu_fprintf)(f, "  feature_edx %08x (%s)\n", def->features,

                buf);

            listflags(buf, sizeof (buf), def->ext_features, ext_feature_name,

                0);

            (*cpu_fprintf)(f, "  feature_ecx %08x (%s)\n", def->ext_features,

                buf);

            listflags(buf, sizeof (buf), def->ext2_features, ext2_feature_name,

                0);

            (*cpu_fprintf)(f, "  extfeature_edx %08x (%s)\n",

                def->ext2_features, buf);

            listflags(buf, sizeof (buf), def->ext3_features, ext3_feature_name,

                0);

            (*cpu_fprintf)(f, "  extfeature_ecx %08x (%s)\n",

                def->ext3_features, buf);

            (*cpu_fprintf)(f, "\n");

        }

    }

    if (kvm_enabled()) {

        (*cpu_fprintf)(f, "x86 %16s\n", "[host]");

    }

}

void FUNC_0 (FILE *VAR_2, int (*VAR_1)(FILE *VAR_2, const char *VAR_2, ...),

                  const char *VAR_3)

{

    unsigned char VAR_4 = !strcmp("?VAR_4", VAR_3);

    unsigned char VAR_5 = !strcmp("?VAR_5", VAR_3);

    unsigned char VAR_6 = !strcmp("?VAR_6", VAR_3);

    x86_def_t *def;

    char VAR_7[256];



    if (VAR_6) {

        (*VAR_1)(VAR_2, "Recognized CPUID flags:\n");

        listflags(VAR_7, sizeof (VAR_7), (uint32_t)~0, feature_name, 1);

        (*VAR_1)(VAR_2, "  f_edx: %s\n", VAR_7);

        listflags(VAR_7, sizeof (VAR_7), (uint32_t)~0, ext_feature_name, 1);

        (*VAR_1)(VAR_2, "  f_ecx: %s\n", VAR_7);

        listflags(VAR_7, sizeof (VAR_7), (uint32_t)~0, ext2_feature_name, 1);

        (*VAR_1)(VAR_2, "  extf_edx: %s\n", VAR_7);

        listflags(VAR_7, sizeof (VAR_7), (uint32_t)~0, ext3_feature_name, 1);

        (*VAR_1)(VAR_2, "  extf_ecx: %s\n", VAR_7);

        return;

    }

    for (def = x86_defs; def; def = def->next) {

        snprintf(VAR_7, sizeof (VAR_7), def->flags ? "[%s]": "%s", def->name);

        if (VAR_4 || VAR_5) {

            (*VAR_1)(VAR_2, "x86 %16s  %-48s\n", VAR_7, def->model_id);

        } else {

            (*VAR_1)(VAR_2, "x86 %16s\n", VAR_7);

        }

        if (VAR_5) {

            memcpy(VAR_7, &def->vendor1, sizeof (def->vendor1));

            memcpy(VAR_7 + 4, &def->vendor2, sizeof (def->vendor2));

            memcpy(VAR_7 + 8, &def->vendor3, sizeof (def->vendor3));

            VAR_7[12] = '\0';

            (*VAR_1)(VAR_2,

                "  family %d VAR_4 %d stepping %d level %d xlevel 0x%x"

                " vendor \"%s\"\n",

                def->family, def->VAR_4, def->stepping, def->level,

                def->xlevel, VAR_7);

            listflags(VAR_7, sizeof (VAR_7), def->features, feature_name, 0);

            (*VAR_1)(VAR_2, "  feature_edx %08x (%s)\n", def->features,

                VAR_7);

            listflags(VAR_7, sizeof (VAR_7), def->ext_features, ext_feature_name,

                0);

            (*VAR_1)(VAR_2, "  feature_ecx %08x (%s)\n", def->ext_features,

                VAR_7);

            listflags(VAR_7, sizeof (VAR_7), def->ext2_features, ext2_feature_name,

                0);

            (*VAR_1)(VAR_2, "  extfeature_edx %08x (%s)\n",

                def->ext2_features, VAR_7);

            listflags(VAR_7, sizeof (VAR_7), def->ext3_features, ext3_feature_name,

                0);

            (*VAR_1)(VAR_2, "  extfeature_ecx %08x (%s)\n",

                def->ext3_features, VAR_7);

            (*VAR_1)(VAR_2, "\n");

        }

    }

    if (kvm_enabled()) {

        (*VAR_1)(VAR_2, "x86 %16s\n", "[host]");

    }

}

void FUNC_0 (FILE *VAR_2, int (*VAR_1)(FILE *VAR_2, const char *VAR_2, ...),
const char *VAR_3)
{ unsigned char VAR_4 = !strcmp("?VAR_4", VAR_3); unsigned char VAR_5 = !strcmp("?VAR_5", VAR_3); unsigned char VAR_6 = !strcmp("?VAR_6", VAR_3); x86_def_t *def; char VAR_7[256]; if (VAR_6) { (*VAR_1)(VAR_2, "Recognized CPUID flags:\n"); listflags(VAR_7, sizeof (VAR_7), (uint32_t)~0, feature_name, 1); (*VAR_1)(VAR_2, "  f_edx: %s\n", VAR_7); listflags(VAR_7, sizeof (VAR_7), (uint32_t)~0, ext_feature_name, 1); (*VAR_1)(VAR_2, "  f_ecx: %s\n", VAR_7); listflags(VAR_7, sizeof (VAR_7), (uint32_t)~0, ext2_feature_name, 1); (*VAR_1)(VAR_2, "  extf_edx: %s\n", VAR_7); listflags(VAR_7, sizeof (VAR_7), (uint32_t)~0, ext3_feature_name, 1); (*VAR_1)(VAR_2, "  extf_ecx: %s\n", VAR_7); return; } for (def = x86_defs; def; def = def->next) { snprintf(VAR_7, sizeof (VAR_7), def->flags ? "[%s]": "%s", def->name); if (VAR_4 || VAR_5) { (*VAR_1)(VAR_2, "x86 %16s  %-48s\n", VAR_7, def->model_id); } else { (*VAR_1)(VAR_2, "x86 %16s\n", VAR_7); } if (VAR_5) { memcpy(VAR_7, &def->vendor1, sizeof (def->vendor1)); memcpy(VAR_7 + 4, &def->vendor2, sizeof (def->vendor2)); memcpy(VAR_7 + 8, &def->vendor3, sizeof (def->vendor3)); VAR_7[12] = '\0'; (*VAR_1)(VAR_2,
"  family %d VAR_4 %d stepping %d level %d xlevel 0x%x"
" vendor \"%s\"\n",
def->family, def->VAR_4, def->stepping, def->level,
def->xlevel, VAR_7); listflags(VAR_7, sizeof (VAR_7), def->features, feature_name, 0); (*VAR_1)(VAR_2, "  feature_edx %08x (%s)\n", def->features,
VAR_7); listflags(VAR_7, sizeof (VAR_7), def->ext_features, ext_feature_name,
0); (*VAR_1)(VAR_2, "  feature_ecx %08x (%s)\n", def->ext_features,
VAR_7); listflags(VAR_7, sizeof (VAR_7), def->ext2_features, ext2_feature_name,
0); (*VAR_1)(VAR_2, "  extfeature_edx %08x (%s)\n",
def->ext2_features, VAR_7); listflags(VAR_7, sizeof (VAR_7), def->ext3_features, ext3_feature_name,
0); (*VAR_1)(VAR_2, "  extfeature_ecx %08x (%s)\n",
def->ext3_features, VAR_7); (*VAR_1)(VAR_2, "\n"); } } if (kvm_enabled()) { (*VAR_1)(VAR_2, "x86 %16s\n", "[host]"); } }