diff --git a/qemu/hw/i386/pc.c b/qemu/hw/i386/pc.c index 17c50c4f..734a14bd 100644 --- a/qemu/hw/i386/pc.c +++ b/qemu/hw/i386/pc.c @@ -119,41 +119,12 @@ static X86CPU *pc_new_cpu(struct uc_struct *uc, const char *typename, int64_t ap int pc_cpus_init(struct uc_struct *uc, PCMachineState *pcms) { int i; - CPUClass *cc; - ObjectClass *oc; - const char *typename; - gchar **model_pieces; Error *error = NULL; - MachineState *machine = MACHINE(uc, pcms); + MachineState *ms = MACHINE(uc, pcms); - /* init CPUs */ - if (machine->cpu_model == NULL) { -#ifdef TARGET_X86_64 - machine->cpu_model = "qemu64"; -#else - machine->cpu_model = "qemu32"; -#endif - } - - model_pieces = g_strsplit(machine->cpu_model, ",", 2); - if (!model_pieces[0]) { - fprintf(stderr, "Invalid/empty CPU model name"); - return -1; - } - - oc = cpu_class_by_name(uc, TYPE_X86_CPU, model_pieces[0]); - if (oc == NULL) { - fprintf(stderr, "Unable to find CPU definition: %s", model_pieces[0]); - return -1; - } - typename = object_class_get_name(oc); - cc = CPU_CLASS(uc, oc); - cc->parse_features(uc, typename, model_pieces[1], &error_fatal); - g_strfreev(model_pieces); for (i = 0; i < smp_cpus; i++) { - uc->cpu = (CPUState *)pc_new_cpu(uc, typename, x86_cpu_apic_id_from_index(i), &error); + uc->cpu = (CPUState *)pc_new_cpu(uc, ms->cpu_type, x86_cpu_apic_id_from_index(i), &error); if (error) { - //error_report("%s", error_get_pretty(error)); error_free(error); return -1; } @@ -168,6 +139,8 @@ static void pc_machine_initfn(struct uc_struct *uc, Object *obj, void *opaque) static void pc_machine_class_init(struct uc_struct *uc, ObjectClass *oc, void *data) { + MachineClass *mc = MACHINE_CLASS(uc, oc); + mc->default_cpu_type = TARGET_DEFAULT_CPU_TYPE; } static const TypeInfo pc_machine_info = { diff --git a/qemu/target/i386/cpu.c b/qemu/target/i386/cpu.c index 544a3c0d..dc7f125e 100644 --- a/qemu/target/i386/cpu.c +++ b/qemu/target/i386/cpu.c @@ -910,12 +910,6 @@ void host_vendor_fms(char *vendor, int *family, int *model, int *stepping) } } - -/* CPU class name definitions: */ - -#define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU -#define X86_CPU_TYPE_NAME(name) (name X86_CPU_TYPE_SUFFIX) - /* Return type name for a given CPU model name * Caller is responsible for freeing the returned string. */ diff --git a/qemu/target/i386/cpu.h b/qemu/target/i386/cpu.h index 35e439a2..e7a9e2dc 100644 --- a/qemu/target/i386/cpu.h +++ b/qemu/target/i386/cpu.h @@ -1529,6 +1529,12 @@ uint64_t cpu_get_tsc(CPUX86State *env); #define X86_CPU_TYPE_NAME(name) (name X86_CPU_TYPE_SUFFIX) #define CPU_RESOLVING_TYPE TYPE_X86_CPU +#ifdef TARGET_X86_64 +#define TARGET_DEFAULT_CPU_TYPE X86_CPU_TYPE_NAME("qemu64") +#else +#define TARGET_DEFAULT_CPU_TYPE X86_CPU_TYPE_NAME("qemu32") +#endif + #define cpu_signal_handler cpu_x86_signal_handler #endif