Skip to content

Commit

Permalink
target-i386: Emulate X86CPU subclasses for global properties
Browse files Browse the repository at this point in the history
After initializing the object from its x86_def_t and before setting any
additional -cpu arguments, set any global properties for the designated
subclass <name>-{i386,x86_64}-cpu.

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
afaerber committed May 6, 2013
1 parent 868d378 commit ba2bc7a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions target-i386/cpu.c
Expand Up @@ -1751,6 +1751,7 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
CPUX86State *env;
gchar **model_pieces;
char *name, *features;
char *typename;
Error *error = NULL;

model_pieces = g_strsplit(cpu_model, ",", 2);
Expand Down Expand Up @@ -1778,6 +1779,14 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
goto out;
}

/* Emulate per-model subclasses for global properties */
typename = g_strdup_printf("%s-" TYPE_X86_CPU, name);
qdev_prop_set_globals_for_type(DEVICE(cpu), typename, &error);
g_free(typename);
if (error) {
goto out;
}

cpu_x86_parse_featurestr(cpu, features, &error);
if (error) {
goto out;
Expand Down

0 comments on commit ba2bc7a

Please sign in to comment.