static void x86_cpu_parse_featurestr(CPUState *cs, char *features,

                                     Error **errp)

{

    X86CPU *cpu = X86_CPU(cs);

    char *featurestr; /* Single 'key=value" string being parsed */

    /* Features to be added */

    FeatureWordArray plus_features = { 0 };

    /* Features to be removed */

    FeatureWordArray minus_features = { 0 };

    uint32_t numvalue;

    CPUX86State *env = &cpu->env;

    Error *local_err = NULL;



    featurestr = features ? strtok(features, ",") : NULL;



    while (featurestr) {

        char *val;

        if (featurestr[0] == '+') {

            add_flagname_to_bitmaps(featurestr + 1, plus_features);

        } else if (featurestr[0] == '-') {

            add_flagname_to_bitmaps(featurestr + 1, minus_features);

        } else if ((val = strchr(featurestr, '='))) {

            *val = 0; val++;

            feat2prop(featurestr);

            if (!strcmp(featurestr, "xlevel")) {

                char *err;

                char num[32];



                numvalue = strtoul(val, &err, 0);

                if (!*val || *err) {

                    error_setg(&local_err, "bad numerical value %s", val);

                    goto out;

                }

                if (numvalue < 0x80000000) {

                    error_report("xlevel value shall always be >= 0x80000000"

                                 ", fixup will be removed in future versions");

                    numvalue += 0x80000000;

                }

                snprintf(num, sizeof(num), "%" PRIu32, numvalue);

                object_property_parse(OBJECT(cpu), num, featurestr, &local_err);

            } else if (!strcmp(featurestr, "tsc-freq")) {

                int64_t tsc_freq;

                char *err;

                char num[32];



                tsc_freq = strtosz_suffix_unit(val, &err,

                                               STRTOSZ_DEFSUFFIX_B, 1000);

                if (tsc_freq < 0 || *err) {

                    error_setg(&local_err, "bad numerical value %s", val);

                    goto out;

                }

                snprintf(num, sizeof(num), "%" PRId64, tsc_freq);

                object_property_parse(OBJECT(cpu), num, "tsc-frequency",

                                      &local_err);

            } else if (!strcmp(featurestr, "hv-spinlocks")) {

                char *err;

                const int min = 0xFFF;

                char num[32];

                numvalue = strtoul(val, &err, 0);

                if (!*val || *err) {

                    error_setg(&local_err, "bad numerical value %s", val);

                    goto out;

                }

                if (numvalue < min) {

                    error_report("hv-spinlocks value shall always be >= 0x%x"

                            ", fixup will be removed in future versions",

                            min);

                    numvalue = min;

                }

                snprintf(num, sizeof(num), "%" PRId32, numvalue);

                object_property_parse(OBJECT(cpu), num, featurestr, &local_err);

            } else {

                object_property_parse(OBJECT(cpu), val, featurestr, &local_err);

            }

        } else {

            feat2prop(featurestr);

            object_property_parse(OBJECT(cpu), "on", featurestr, &local_err);

        }

        if (local_err) {

            error_propagate(errp, local_err);

            goto out;

        }

        featurestr = strtok(NULL, ",");

    }

    env->features[FEAT_1_EDX] |= plus_features[FEAT_1_EDX];

    env->features[FEAT_1_ECX] |= plus_features[FEAT_1_ECX];

    env->features[FEAT_8000_0001_EDX] |= plus_features[FEAT_8000_0001_EDX];

    env->features[FEAT_8000_0001_ECX] |= plus_features[FEAT_8000_0001_ECX];

    env->features[FEAT_C000_0001_EDX] |= plus_features[FEAT_C000_0001_EDX];

    env->features[FEAT_KVM] |= plus_features[FEAT_KVM];

    env->features[FEAT_SVM] |= plus_features[FEAT_SVM];

    env->features[FEAT_7_0_EBX] |= plus_features[FEAT_7_0_EBX];

    env->features[FEAT_1_EDX] &= ~minus_features[FEAT_1_EDX];

    env->features[FEAT_1_ECX] &= ~minus_features[FEAT_1_ECX];

    env->features[FEAT_8000_0001_EDX] &= ~minus_features[FEAT_8000_0001_EDX];

    env->features[FEAT_8000_0001_ECX] &= ~minus_features[FEAT_8000_0001_ECX];

    env->features[FEAT_C000_0001_EDX] &= ~minus_features[FEAT_C000_0001_EDX];

    env->features[FEAT_KVM] &= ~minus_features[FEAT_KVM];

    env->features[FEAT_SVM] &= ~minus_features[FEAT_SVM];

    env->features[FEAT_7_0_EBX] &= ~minus_features[FEAT_7_0_EBX];



out:

    return;

}

static void x86_cpu_parse_featurestr(CPUState *cs, char *features,

                                     Error **errp)

{

    X86CPU *cpu = X86_CPU(cs);

    char *featurestr; 

    

    FeatureWordArray plus_features = { 0 };

    

    FeatureWordArray minus_features = { 0 };

    uint32_t numvalue;

    CPUX86State *env = &cpu->env;

    Error *local_err = NULL;



    featurestr = features ? strtok(features, ",") : NULL;



    while (featurestr) {

        char *val;

        if (featurestr[0] == '+') {

            add_flagname_to_bitmaps(featurestr + 1, plus_features);

        } else if (featurestr[0] == '-') {

            add_flagname_to_bitmaps(featurestr + 1, minus_features);

        } else if ((val = strchr(featurestr, '='))) {

            *val = 0; val++;

            feat2prop(featurestr);

            if (!strcmp(featurestr, "xlevel")) {

                char *err;

                char num[32];



                numvalue = strtoul(val, &err, 0);

                if (!*val || *err) {

                    error_setg(&local_err, "bad numerical value %s", val);

                    goto out;

                }

                if (numvalue < 0x80000000) {

                    error_report("xlevel value shall always be >= 0x80000000"

                                 ", fixup will be removed in future versions");

                    numvalue += 0x80000000;

                }

                snprintf(num, sizeof(num), "%" PRIu32, numvalue);

                object_property_parse(OBJECT(cpu), num, featurestr, &local_err);

            } else if (!strcmp(featurestr, "tsc-freq")) {

                int64_t tsc_freq;

                char *err;

                char num[32];



                tsc_freq = strtosz_suffix_unit(val, &err,

                                               STRTOSZ_DEFSUFFIX_B, 1000);

                if (tsc_freq < 0 || *err) {

                    error_setg(&local_err, "bad numerical value %s", val);

                    goto out;

                }

                snprintf(num, sizeof(num), "%" PRId64, tsc_freq);

                object_property_parse(OBJECT(cpu), num, "tsc-frequency",

                                      &local_err);

            } else if (!strcmp(featurestr, "hv-spinlocks")) {

                char *err;

                const int min = 0xFFF;

                char num[32];

                numvalue = strtoul(val, &err, 0);

                if (!*val || *err) {

                    error_setg(&local_err, "bad numerical value %s", val);

                    goto out;

                }

                if (numvalue < min) {

                    error_report("hv-spinlocks value shall always be >= 0x%x"

                            ", fixup will be removed in future versions",

                            min);

                    numvalue = min;

                }

                snprintf(num, sizeof(num), "%" PRId32, numvalue);

                object_property_parse(OBJECT(cpu), num, featurestr, &local_err);

            } else {

                object_property_parse(OBJECT(cpu), val, featurestr, &local_err);

            }

        } else {

            feat2prop(featurestr);

            object_property_parse(OBJECT(cpu), "on", featurestr, &local_err);

        }

        if (local_err) {

            error_propagate(errp, local_err);

            goto out;

        }

        featurestr = strtok(NULL, ",");

    }

    env->features[FEAT_1_EDX] |= plus_features[FEAT_1_EDX];

    env->features[FEAT_1_ECX] |= plus_features[FEAT_1_ECX];

    env->features[FEAT_8000_0001_EDX] |= plus_features[FEAT_8000_0001_EDX];

    env->features[FEAT_8000_0001_ECX] |= plus_features[FEAT_8000_0001_ECX];

    env->features[FEAT_C000_0001_EDX] |= plus_features[FEAT_C000_0001_EDX];

    env->features[FEAT_KVM] |= plus_features[FEAT_KVM];

    env->features[FEAT_SVM] |= plus_features[FEAT_SVM];

    env->features[FEAT_7_0_EBX] |= plus_features[FEAT_7_0_EBX];

    env->features[FEAT_1_EDX] &= ~minus_features[FEAT_1_EDX];

    env->features[FEAT_1_ECX] &= ~minus_features[FEAT_1_ECX];

    env->features[FEAT_8000_0001_EDX] &= ~minus_features[FEAT_8000_0001_EDX];

    env->features[FEAT_8000_0001_ECX] &= ~minus_features[FEAT_8000_0001_ECX];

    env->features[FEAT_C000_0001_EDX] &= ~minus_features[FEAT_C000_0001_EDX];

    env->features[FEAT_KVM] &= ~minus_features[FEAT_KVM];

    env->features[FEAT_SVM] &= ~minus_features[FEAT_SVM];

    env->features[FEAT_7_0_EBX] &= ~minus_features[FEAT_7_0_EBX];



out:

    return;

}

                    error_setg(&local_err, "bad numerical value %s", val);                     goto out;                     error_setg(&local_err, "bad numerical value %s", val);                     goto out;                     error_setg(&local_err, "bad numerical value %s", val);                     goto out;             goto out; out:
static void FUNC_0(CPUState *VAR_0, char *VAR_1,

                                     Error **VAR_2)

{

    X86CPU *cpu = X86_CPU(VAR_0);

    char *VAR_3; 

    

    FeatureWordArray plus_features = { 0 };

    

    FeatureWordArray minus_features = { 0 };

    uint32_t numvalue;

    CPUX86State *env = &cpu->env;

    Error *local_err = NULL;



    VAR_3 = VAR_1 ? strtok(VAR_1, ",") : NULL;



    while (VAR_3) {

        char *VAR_4;

        if (VAR_3[0] == '+') {

            add_flagname_to_bitmaps(VAR_3 + 1, plus_features);

        } else if (VAR_3[0] == '-') {

            add_flagname_to_bitmaps(VAR_3 + 1, minus_features);

        } else if ((VAR_4 = strchr(VAR_3, '='))) {

            *VAR_4 = 0; VAR_4++;

            feat2prop(VAR_3);

            if (!strcmp(VAR_3, "xlevel")) {

                char *VAR_7;

                char VAR_8[32];



                numvalue = strtoul(VAR_4, &VAR_7, 0);

                if (!*VAR_4 || *VAR_7) {

                    error_setg(&local_err, "bad numerical value %s", VAR_4);

                    goto out;

                }

                if (numvalue < 0x80000000) {

                    error_report("xlevel value shall always be >= 0x80000000"

                                 ", fixup will be removed in future versions");

                    numvalue += 0x80000000;

                }

                snprintf(VAR_8, sizeof(VAR_8), "%" PRIu32, numvalue);

                object_property_parse(OBJECT(cpu), VAR_8, VAR_3, &local_err);

            } else if (!strcmp(VAR_3, "tsc-freq")) {

                int64_t tsc_freq;

                char *VAR_7;

                char VAR_8[32];



                tsc_freq = strtosz_suffix_unit(VAR_4, &VAR_7,

                                               STRTOSZ_DEFSUFFIX_B, 1000);

                if (tsc_freq < 0 || *VAR_7) {

                    error_setg(&local_err, "bad numerical value %s", VAR_4);

                    goto out;

                }

                snprintf(VAR_8, sizeof(VAR_8), "%" PRId64, tsc_freq);

                object_property_parse(OBJECT(cpu), VAR_8, "tsc-frequency",

                                      &local_err);

            } else if (!strcmp(VAR_3, "hv-spinlocks")) {

                char *VAR_7;

                const int VAR_7 = 0xFFF;

                char VAR_8[32];

                numvalue = strtoul(VAR_4, &VAR_7, 0);

                if (!*VAR_4 || *VAR_7) {

                    error_setg(&local_err, "bad numerical value %s", VAR_4);

                    goto out;

                }

                if (numvalue < VAR_7) {

                    error_report("hv-spinlocks value shall always be >= 0x%x"

                            ", fixup will be removed in future versions",

                            VAR_7);

                    numvalue = VAR_7;

                }

                snprintf(VAR_8, sizeof(VAR_8), "%" PRId32, numvalue);

                object_property_parse(OBJECT(cpu), VAR_8, VAR_3, &local_err);

            } else {

                object_property_parse(OBJECT(cpu), VAR_4, VAR_3, &local_err);

            }

        } else {

            feat2prop(VAR_3);

            object_property_parse(OBJECT(cpu), "on", VAR_3, &local_err);

        }

        if (local_err) {

            error_propagate(VAR_2, local_err);

            goto out;

        }

        VAR_3 = strtok(NULL, ",");

    }

    env->VAR_1[FEAT_1_EDX] |= plus_features[FEAT_1_EDX];

    env->VAR_1[FEAT_1_ECX] |= plus_features[FEAT_1_ECX];

    env->VAR_1[FEAT_8000_0001_EDX] |= plus_features[FEAT_8000_0001_EDX];

    env->VAR_1[FEAT_8000_0001_ECX] |= plus_features[FEAT_8000_0001_ECX];

    env->VAR_1[FEAT_C000_0001_EDX] |= plus_features[FEAT_C000_0001_EDX];

    env->VAR_1[FEAT_KVM] |= plus_features[FEAT_KVM];

    env->VAR_1[FEAT_SVM] |= plus_features[FEAT_SVM];

    env->VAR_1[FEAT_7_0_EBX] |= plus_features[FEAT_7_0_EBX];

    env->VAR_1[FEAT_1_EDX] &= ~minus_features[FEAT_1_EDX];

    env->VAR_1[FEAT_1_ECX] &= ~minus_features[FEAT_1_ECX];

    env->VAR_1[FEAT_8000_0001_EDX] &= ~minus_features[FEAT_8000_0001_EDX];

    env->VAR_1[FEAT_8000_0001_ECX] &= ~minus_features[FEAT_8000_0001_ECX];

    env->VAR_1[FEAT_C000_0001_EDX] &= ~minus_features[FEAT_C000_0001_EDX];

    env->VAR_1[FEAT_KVM] &= ~minus_features[FEAT_KVM];

    env->VAR_1[FEAT_SVM] &= ~minus_features[FEAT_SVM];

    env->VAR_1[FEAT_7_0_EBX] &= ~minus_features[FEAT_7_0_EBX];



out:

    return;

}

static void FUNC_0(CPUState *VAR_0, char *VAR_1,
Error **VAR_2)
{ X86CPU *cpu = X86_CPU(VAR_0); char *VAR_3; FeatureWordArray plus_features = { 0 }; FeatureWordArray minus_features = { 0 }; uint32_t numvalue; CPUX86State *env = &cpu->env; Error *local_err = NULL; VAR_3 = VAR_1 ? strtok(VAR_1, ",") : NULL; while (VAR_3) { char *VAR_4; if (VAR_3[0] == '+') { add_flagname_to_bitmaps(VAR_3 + 1, plus_features); } else if (VAR_3[0] == '-') { add_flagname_to_bitmaps(VAR_3 + 1, minus_features); } else if ((VAR_4 = strchr(VAR_3, '='))) { *VAR_4 = 0; VAR_4++; feat2prop(VAR_3); if (!strcmp(VAR_3, "xlevel")) { char *VAR_7; char VAR_8[32]; numvalue = strtoul(VAR_4, &VAR_7, 0); if (!*VAR_4 || *VAR_7) { error_setg(&local_err, "bad numerical value %s", VAR_4); goto out; } if (numvalue < 0x80000000) { error_report("xlevel value shall always be >= 0x80000000"
", fixup will be removed in future versions"); numvalue += 0x80000000; } snprintf(VAR_8, sizeof(VAR_8), "%" PRIu32, numvalue); object_property_parse(OBJECT(cpu), VAR_8, VAR_3, &local_err); } else if (!strcmp(VAR_3, "tsc-freq")) { int64_t tsc_freq; char *VAR_7; char VAR_8[32]; tsc_freq = strtosz_suffix_unit(VAR_4, &VAR_7,
STRTOSZ_DEFSUFFIX_B, 1000); if (tsc_freq < 0 || *VAR_7) { error_setg(&local_err, "bad numerical value %s", VAR_4); goto out; } snprintf(VAR_8, sizeof(VAR_8), "%" PRId64, tsc_freq); object_property_parse(OBJECT(cpu), VAR_8, "tsc-frequency",
&local_err); } else if (!strcmp(VAR_3, "hv-spinlocks")) { char *VAR_7; const int VAR_7 = 0xFFF; char VAR_8[32]; numvalue = strtoul(VAR_4, &VAR_7, 0); if (!*VAR_4 || *VAR_7) { error_setg(&local_err, "bad numerical value %s", VAR_4); goto out; } if (numvalue < VAR_7) { error_report("hv-spinlocks value shall always be >= 0x%x"
", fixup will be removed in future versions",
VAR_7); numvalue = VAR_7; } snprintf(VAR_8, sizeof(VAR_8), "%" PRId32, numvalue); object_property_parse(OBJECT(cpu), VAR_8, VAR_3, &local_err); } else { object_property_parse(OBJECT(cpu), VAR_4, VAR_3, &local_err); } } else { feat2prop(VAR_3); object_property_parse(OBJECT(cpu), "on", VAR_3, &local_err); } if (local_err) { error_propagate(VAR_2, local_err); goto out; } VAR_3 = strtok(NULL, ","); } env->VAR_1[FEAT_1_EDX] |= plus_features[FEAT_1_EDX]; env->VAR_1[FEAT_1_ECX] |= plus_features[FEAT_1_ECX]; env->VAR_1[FEAT_8000_0001_EDX] |= plus_features[FEAT_8000_0001_EDX]; env->VAR_1[FEAT_8000_0001_ECX] |= plus_features[FEAT_8000_0001_ECX]; env->VAR_1[FEAT_C000_0001_EDX] |= plus_features[FEAT_C000_0001_EDX]; env->VAR_1[FEAT_KVM] |= plus_features[FEAT_KVM]; env->VAR_1[FEAT_SVM] |= plus_features[FEAT_SVM]; env->VAR_1[FEAT_7_0_EBX] |= plus_features[FEAT_7_0_EBX]; env->VAR_1[FEAT_1_EDX] &= ~minus_features[FEAT_1_EDX]; env->VAR_1[FEAT_1_ECX] &= ~minus_features[FEAT_1_ECX]; env->VAR_1[FEAT_8000_0001_EDX] &= ~minus_features[FEAT_8000_0001_EDX]; env->VAR_1[FEAT_8000_0001_ECX] &= ~minus_features[FEAT_8000_0001_ECX]; env->VAR_1[FEAT_C000_0001_EDX] &= ~minus_features[FEAT_C000_0001_EDX]; env->VAR_1[FEAT_KVM] &= ~minus_features[FEAT_KVM]; env->VAR_1[FEAT_SVM] &= ~minus_features[FEAT_SVM]; env->VAR_1[FEAT_7_0_EBX] &= ~minus_features[FEAT_7_0_EBX]; out:
return; }